Skip to content

Commit 4aa2534

Browse files
committed
v0.3.4 updates: new filetypes, folder exact matching, readme updates and fixes
1 parent 283c4f2 commit 4aa2534

24 files changed

+71
-28
lines changed

plugin/webdevicons.vim

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,37 +23,63 @@ endif
2323
" config
2424

2525
let g:WebDevIconsUnicodeDecorateFileNodes = 1
26+
" whether to show default folder glyphs on directories:
2627
let g:WebDevIconsUnicodeDecorateFolderNodes = 0
27-
let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = ''
28-
let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = ''
29-
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = { 'styl': '', 'scss': '', 'htm': '', 'html': '', 'css': '', 'less': '', 'md': '', 'json': '', 'js': '', 'rb': '', 'php': '', 'py': '', 'coffee': '','mustache': '', 'hbs': '', 'conf': '', 'ini': '', 'yml': '', 'jpg': '', 'jpeg': '', 'bmp': '', 'png': '', 'gif': '', 'ai': '', 'twig': '', 'cpp': ''}
28+
" whether to try to match folder notes with any exact file node matches
29+
" default is to match but requires WebDevIconsUnicodeDecorateFolderNodes set
30+
" to 1:
31+
if !exists('g:WebDevIconsUnicodeDecorateFolderNodesExactMatches')
32+
let g:WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1
33+
endif
34+
35+
if !exists('g:WebDevIconsUnicodeGlyphDoubleWidth')
36+
let g:WebDevIconsUnicodeGlyphDoubleWidth = 1
37+
endif
38+
39+
if !exists('g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol')
40+
let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = ''
41+
endif
42+
43+
if !exists('g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol')
44+
let g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol = ''
45+
endif
46+
47+
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = { 'styl': '', 'scss': '', 'htm': '', 'html': '', 'css': '', 'less': '', 'md': '', 'json': '', 'js': '', 'rb': '', 'php': '', 'py': '', 'pyc': '', 'pyo': '', 'pyd': '', 'coffee': '','mustache': '', 'hbs': '', 'conf': '', 'ini': '', 'yml': '', 'jpg': '', 'jpeg': '', 'bmp': '', 'png': '', 'gif': '', 'ai': '', 'twig': '', 'cpp': '', 'c++': '', 'cxx': '', 'cc': '', 'cp': '', 'c': '', 'hs': '', 'lhs': '', 'lua': '', 'java': '', 'sh': '', 'diff': '', 'db': '', 'clj': '', 'scala': '', 'go': '', 'dart': '', 'xul': '', 'sln': '', 'suo': '' }
3048

3149
" do not remove: exact-match-case-sensitive-*
32-
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = { 'exact-match-case-sensitive-1.txt': 'X1', 'exact-match-case-sensitive-2': 'X2', 'gruntfile.coffee': '', 'gruntfile.js': '', 'gruntfile.ls': '', 'gulpfile.coffee': '', 'gulpfile.js': '', 'gulpfile.ls': '' }
50+
let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = { 'exact-match-case-sensitive-1.txt': 'X1', 'exact-match-case-sensitive-2': 'X2', 'gruntfile.coffee': '', 'gruntfile.js': '', 'gruntfile.ls': '', 'gulpfile.coffee': '', 'gulpfile.js': '', 'gulpfile.ls': '', 'dropbox': '' }
3351

3452

35-
" a:1 (bufferName)
53+
" a:1 (bufferName), a:2 (isDirectory)
3654
function! WebDevIconsGetFileTypeSymbol(...)
3755

3856
if a:0 == 0
3957
let fileNodeExtension = expand("%:e")
4058
let fileNode = expand("%:t")
59+
let isDirectory = 0
4160
else
4261
let fileNodeExtension = fnamemodify(a:1, ':e')
4362
let fileNode = fnamemodify(a:1, ':t')
44-
end
63+
if a:0 == 2
64+
let isDirectory = a:2
65+
else
66+
let isDirectory = 0
67+
endif
68+
endif
4569

4670
let fileNodeExtension = tolower(fileNodeExtension)
4771
let fileNode = tolower(fileNode)
4872

4973
if has_key(g:WebDevIconsUnicodeDecorateFileNodesExactSymbols, fileNode)
5074
let symbol = g:WebDevIconsUnicodeDecorateFileNodesExactSymbols[fileNode]
51-
5275
elseif has_key(g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols, fileNodeExtension)
5376
let symbol = g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols[fileNodeExtension]
54-
5577
else
56-
let symbol = g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol
78+
if isDirectory == 1
79+
let symbol = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol
80+
else
81+
let symbol = g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol
82+
endif
5783
endif
5884

5985
return symbol
@@ -85,11 +111,20 @@ endif
85111

86112
function! NERDTreeWebDevIconsRefreshListener(event)
87113
let path = a:event.subject
114+
let padding = ' '
115+
116+
if g:WebDevIconsUnicodeGlyphDoubleWidth == 0
117+
let padding = ''
118+
endif
88119

89120
if !path.isDirectory
90-
let flag = WebDevIconsGetFileTypeSymbol(path.str()) . ' '
121+
let flag = WebDevIconsGetFileTypeSymbol(path.str()) . padding
91122
elseif path.isDirectory && g:WebDevIconsUnicodeDecorateFolderNodes == 1
92-
let flag = g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol . ' '
123+
if g:WebDevIconsUnicodeDecorateFolderNodesExactMatches == 1
124+
let flag = WebDevIconsGetFileTypeSymbol(path.str(), path.isDirectory) . padding
125+
else
126+
let flag = g:WebDevIconsUnicodeDecorateFolderNodesDefaultSymbol
127+
endif
93128
else
94129
let flag = ''
95130
endif

readme.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
vim-webdevicons v0.3.3
2-
=================
1+
vim-webdevicons v0.3.4
2+
=======================
33
[![GitHub version](https://badge.fury.io/gh/ryanoasis%2Fvim-webdevicons.svg)](http://badge.fury.io/gh/ryanoasis%2Fvim-webdevicons)
4-
=================
4+
=======================
55

66
Adds filetype glyphs (icons) to other vim plugins such as nerdtree and
77
vim-airline.
88

9-
![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.1.5/overall-screenshot.png)
9+
![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.3.4/overall-screenshot.png)
1010

11-
- [vim-webdevicons v0.3.3](#)
11+
- [vim-webdevicons v0.3.4](#)
1212
- [Usage](#usage)
1313
- [Font Configuration](#font-configuration)
1414
- [Font Installation](#font-installation)
@@ -69,25 +69,25 @@ You can find more fonts under my repository [nerd-filetype-glyphs-fonts-patcher]
6969

7070
## Screenshots
7171

72-
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.1.5/vim.png)
72+
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.3.4/vim.png)
7373

7474
* NERDTree:
7575

76-
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.1.5/nerdtree.png)
76+
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.3.4/nerdtree.png)
7777

7878
* vim-airline
7979
* statusline
80-
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.1.5/airline-statusline.png)
80+
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.3.4/airline-statusline.png)
8181
* tabline
82-
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.1.5/airline-tabline.png)
82+
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.3.4/airline-tabline.png)
8383

8484
* Different patched fonts example:
8585

86-
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.1.5/different-fonts-sample.png)
86+
![image](https://raw.githubusercontent.com/wiki/ryanoasis/vim-webdevicons/screenshots/v0.3.4/different-fonts-sample.png)
8787

8888
* Glyph set test file
8989

90-
![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.1.5/glyph-set-test.png)
90+
![image](https://github.com/ryanoasis/vim-webdevicons/wiki/screenshots/v0.3.4/glyph-set-test.png)
9191

9292
## Features
9393
* show developer file type glyphs from a font in various vim plugins, currently supports:
@@ -98,9 +98,9 @@ You can find more fonts under my repository [nerd-filetype-glyphs-fonts-patcher]
9898
* ability to override predefined dictionary variable
9999
* if you are unhappy with the default glyph used you can choose your own
100100
* supports a range of file type extensions by default:
101-
* ```styl, scss, htm, html, css, less, md, json, js, rb, php, py , coffee ,mustache, hbs, conf, ini, yml, jpg, jpeg, bmp, png, gif, ai, twig, cpp```
101+
* ```styl, scss, htm, html, css, less, md, json, js, rb, php, py, pyc, pyd, pyo, coffee, mustache, hbs, conf, ini, yml, jpg, jpeg, bmp, png, gif, ai, twig, cpp, c++, cc, cp, cxx, cpp, c, hs, lhs, lua, sh, diff, clj, dart, db, go, scala, sln, suo, xul```
102102
* supports full filename matches, by default:
103-
* ```gruntfile.coffee, gruntfile.js, gruntfile.ls, gulpfile.coffee, gulpfile.js, gulpfile.ls```
103+
* ```gruntfile.coffee, gruntfile.js, gruntfile.ls, gulpfile.coffee, gulpfile.js, gulpfile.ls, dropbox```
104104
* font patcher ([nerd-filetype-glyphs-fonts-patcher](https://github.com/ryanoasis/nerd-filetype-glyphs-fonts-patcher))
105105
* requires: python2, python-fontforge package
106106
* example usage
@@ -129,31 +129,39 @@ You can find more fonts under my repository [nerd-filetype-glyphs-fonts-patcher]
129129

130130
> let g:webdevicons_enable_airline_statusline = 1
131131
132-
* turn on/off file node glpyh decorations (not particularly useful)
132+
* turn on/off file node glyph decorations (not particularly useful)
133133

134134
> let g:WebDevIconsUnicodeDecorateFileNodes = 1
135135
136+
* whether or not font is using double-width glyphs (default 1, set to 0 for single character width glyphs)
137+
138+
> let g:WebDevIconsUnicodeGlyphDoubleWidth = 1
139+
136140
### character mappings
137141

138142
* change the default character when no match found
139143

140144
> let g:WebDevIconsUnicodeDecorateFileNodesDefaultSymbol = 'x'
141145
142-
* enable folder/directory glpyh flag (disabled by default)
146+
* enable folder/directory glyph flag (disabled by default with 0)
143147

144148
> let g:WebDevIconsUnicodeDecorateFolderNodes = 1
145149
150+
* enable custom folder/directory glyph exact matching (enabled by default when g:WebDevIconsUnicodeDecorateFolderNodes is set to 1)
151+
152+
> let WebDevIconsUnicodeDecorateFolderNodesExactMatches = 1
153+
146154
* change the default folder/directory glyph/icon
147155

148156
> let g:WebDevIconsUnicodeDecorateFolderNodeDefaultSymbol = 'mycoolFolderGlyph'
149157
150158
* change the default dictionary mappings for file extension matches
151159

152-
> let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = { 'js': 'mycoolJSfontglyph' }
160+
> let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = 'mycoolJSfontglyph'
153161
154162
* change the default dictionary mappings for exact file node matches
155163

156-
> let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols = { 'MyReallyCoolFile.okay': 'myreallycoolglyph' }
164+
> let g:WebDevIconsUnicodeDecorateFileNodesExactSymbols['MyReallyCoolFile.okay'] = 'myreallycoolglyph'
157165
158166
* add or override individual additional filetypes
159167

tests/test.c

Whitespace-only changes.

tests/test.c++

Whitespace-only changes.

tests/test.cc

Whitespace-only changes.

tests/test.clj

Whitespace-only changes.

tests/test.cp

Whitespace-only changes.

tests/test.cxx

Whitespace-only changes.

tests/test.dart

Whitespace-only changes.

tests/test.db

Whitespace-only changes.

0 commit comments

Comments
 (0)