Skip to content

Commit 5740b73

Browse files
fix: add missing filetypes (#531)
* chore: add script to Makefile to check for missing filetypes * fix: add missing filetypes * fix: move avif extension to proper table * docs: improve instructions and apply style * fixup! chore: add script to Makefile to check for missing filetypes * fixup! chore: add script to Makefile to check for missing filetypes * ci: add check for missing filetypes * fixup! ci: add check for missing filetypes * fixup! chore: add script to Makefile to check for missing filetypes --------- Co-authored-by: Alexander Courtis <alex@courtis.org>
1 parent d42e686 commit 5740b73

File tree

9 files changed

+149
-132
lines changed

9 files changed

+149
-132
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,16 @@ jobs:
5252
- name: make colors-check
5353
run: make colors-check
5454

55+
filetypes:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- uses: actions/checkout@v3
59+
60+
- uses: rhysd/action-setup-vim@v1
61+
with:
62+
neovim: true
63+
64+
- name: make filetypes
65+
env:
66+
VIMRUNTIME: /home/runner/nvim-stable/share/nvim/runtime
67+
run: make filetypes

CONTRIBUTING.md

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,24 @@ Thank you for your contribution!
44

55
## Order
66

7-
Please ensure `icons_by_filename`, `icons_by_file_extension` and `filetypes` are ordered alphabetically, to prevent merge conflicts.
7+
Please ensure `icons_by_filename`, `icons_by_file_extension`, `icons_by_operating_system`, `icons_by_desktop_environment`,
8+
`icons_by_window_manager` and `filetypes` are ordered alphabetically, to prevent merge conflicts.
89

910
## Prerequisites
1011

11-
Code is formatted using stylua and linted using luacheck.
12+
Code is formatted using *stylua* and linted using *luacheck*.
1213

1314
You can install these with:
15+
1416
```sh
1517
cargo install stylua
1618
luarocks install luacheck
1719
```
1820

19-
or via your OS package manager e.g. Arch linux:
21+
or via your OS package manager e.g. *Arch Linux*:
22+
2023
```sh
21-
pacman -S stylua
22-
pacman -S luacheck
24+
pacman -S stylua luacheck
2325
```
2426

2527
## Building
@@ -31,13 +33,16 @@ make
3133
```
3234

3335
This will:
36+
3437
1. `git clone --depth 1 https://github.com/lifepillar/vim-colortemplate.git vim-colortemplate` if necessary
35-
1. Generate cterm colors
36-
2. Generate light color variants
37-
3. Check style
38-
4. Lint
38+
2. Generate cterm colors
39+
3. Generate light color variants
40+
4. Check style
41+
5. Lint
42+
6. Find missing filetypes
3943

4044
You can automatically fix any style issues via:
45+
4146
```sh
4247
make style-fix
4348
```
@@ -46,15 +51,20 @@ make style-fix
4651

4752
Add or update icons in `lua/nvim-web-devicons/icons-default.lua`
4853

49-
There are two tables where icons can be added:
50-
1. icons_by_filename
51-
2. icons_by_file_extension
54+
There are five tables where icons can be added:
55+
56+
1. `icons_by_filename`
57+
2. `icons_by_file_extension`
58+
3. `icons_by_operating_system`
59+
4. `icons_by_desktop_environment`
60+
5. `icons_by_window_manager`
61+
62+
Add the icon to table **1.** if the icon is for a file that is always named that way, for example `.gitconfig`.
63+
Add the icon to table **2.** if the icon is for all files with an extension, for example `vim`.
64+
Add the icon to table **3.**, **4.**, **5.** if the icon is from an OS, DE or WM.
5265

53-
Add the icon in table 1. if the icon is for a file that is always named that
54-
way, for example `.gitconfig`. Add to table 2. if the icon is for all files
55-
with an extension.
66+
Each icon must have the following structure (this is an example):
5667

57-
Each icon must have the following (this is an example):
5868
```lua
5969
[".gitconfig"] = {
6070
icon = "",
@@ -63,15 +73,16 @@ Each icon must have the following (this is an example):
6373
name = "GitConfig",
6474
},
6575
```
66-
___Key/value pairs must appear in the same exact order!___
76+
77+
***Key/value pairs must appear in the same exact order!***
6778

6879
- `color` must contain a color in the html notation
6980
- `cterm_color` must be below `color`, and it must contain a number (any number)
7081
- the correct value for `cterm_color` will be generated by the script
7182
- `name` must only contain alphanumeric characters (don't use `/`, `-`, `_`)
7283

73-
Ensure your current working directory is the repo root.
74-
Run `make`. This will:
84+
Ensure your current working directory is the repo root. Run `make`. This will:
85+
7586
- Update `cterm_color` based on `color`
7687
- Generate `lua/nvim-web-devicons/icons-light.lua`
7788

@@ -81,44 +92,47 @@ Please commit both `lua/nvim-web-devicons/icons-default.lua` and `lua/nvim-web-d
8192

8293
Run `:NvimWebDeviconsHiTest` to view the icons and their highlighting.
8394

84-
Start neovim with `TERM=xterm-256color nvim ...` to test cterm.
95+
Start *Neovim* with `TERM=xterm-256color nvim ...` to test cterm.
8596

8697
Check with `&background` `dark` and `light`
8798

8899
## Documentation
89100

90101
When modifying or adding API, please update [Usage](README.md#Usage)
91102

92-
# Pull Request
103+
## Pull Request
93104

94105
Please reference any issues in the description e.g. "resolves #1234", which will be closed upon merge.
95106

96-
Please check "allow edits by maintainers" to allow nvim-web-devicons maintainers to make small changes such as documentation tweaks.
107+
Please check "allow edits by maintainers" to allow *nvim-web-devicons* maintainers to make small changes
108+
such as documentation tweaks.
97109

98110
## Subject
99111

100112
The merge commit message will be the subject of the PR.
101113

102-
A [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) subject will be validated by the Semantic Pull Request Subject CI job. Reference the issue to be used in the release notes e.g.
114+
A [Conventional Commits] subject will be validated by the Semantic Pull Request Subject CI job.
115+
Reference the issue to be used in the release notes e.g.
103116

104-
```
117+
```txt
105118
feat: add gradle icons
106119
fix: update rust icon
107120
feat(#192): :NvimWebDeviconsHiTest
108121
```
109122

110123
Available types:
111-
* feat: A new feature
112-
* fix: A bug fix
113-
* docs: Documentation only changes
114-
* style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
115-
* refactor: A code change that neither fixes a bug nor adds a feature
116-
* perf: A code change that improves performance
117-
* test: Adding missing tests or correcting existing tests
118-
* build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
119-
* ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
120-
* chore: Other changes that don't modify src or test files
121-
* revert: Reverts a previous commit
124+
125+
- feat: A new feature
126+
- fix: A bug fix
127+
- docs: Documentation only changes
128+
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
129+
- refactor: A code change that neither fixes a bug nor adds a feature
130+
- perf: A code change that improves performance
131+
- test: Adding missing tests or correcting existing tests
132+
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
133+
- ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
134+
- chore: Other changes that don't modify src or test files
135+
- revert: Reverts a previous commit
122136

123137
If in doubt, look at previous commits.
124138

@@ -130,7 +144,9 @@ It is useful to see the actual glyphs in the pull request. That can be done by s
130144

131145
Using firefox:
132146

133-
* Settings -> General
134-
* Fonts -> Advanced
135-
* Change Monospace to "Hack Nerd Font Mono" or similar
136-
* Uncheck "Allow pages to choose their own fonts, instead of your selections above"
147+
- Settings -> General
148+
- Fonts -> Advanced
149+
- Change Monospace to "Hack Nerd Font Mono" or similar
150+
- Uncheck "Allow pages to choose their own fonts, instead of your selections above"
151+
152+
[Conventional Commits]: <https://www.conventionalcommits.org/en/v1.0.0>

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VIM_COLORTEMPLATE_VERSION = 2.2.3
22

3-
all: colors style-check lint
3+
all: colors style-check lint filetypes
44

55
colors: vim-colortemplate
66
nvim \
@@ -26,7 +26,10 @@ style-fix:
2626
lint:
2727
luacheck lua scripts
2828

29+
filetypes:
30+
./scripts/filetypes.sh
31+
2932
clean:
3033
rm -rf vim-colortemplate
3134

32-
.PHONY: all colors style-check style-fix lint
35+
.PHONY: all colors style-check style-fix lint filetypes

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# Notice
2-
Nerd fonts moved some symbols with version 3.0. Version 2.3 is meant for transition, supporting both version 2 and version 3 icons.
3-
4-
Nvim-web-devicons requires version 2.3 or above to work properly. If you are unable to update please use your plugin manager to pin version of nvim-web-dev icons to `nerd-v2-compat` tag.
5-
61
# Nvim-web-devicons
72

8-
Provides [Nerd Font](https://www.nerdfonts.com/) <sup>[1]</sup> icons (glyphs) for use by neovim plugins:
3+
Provides [Nerd Font](https://www.nerdfonts.com/) [^1] icons (glyphs) for use by *Neovim* plugins:
4+
95
- Icons by:
106
- Extension
117
- Full name
@@ -15,7 +11,13 @@ Provides [Nerd Font](https://www.nerdfonts.com/) <sup>[1]</sup> icons (glyphs) f
1511

1612
A `lua` fork of [vim-devicons](https://github.com/ryanoasis/vim-devicons).
1713

18-
<sup>[1]</sup> Not limited to Nerd Font icons: unicode and other fonts may be used.
14+
> [!IMPORTANT]
15+
> Nerd fonts moved some symbols with version 3.0. Version 2.3 is meant for transition,
16+
> supporting both version 2 and version 3 icons.
17+
> Nvim-web-devicons requires version 2.3 or above to work properly. If you are unable to update
18+
> please use your plugin manager to pin version of nvim-web-dev icons to `nerd-v2-compat` tag.
19+
20+
[^1]: Not limited to Nerd Font icons: unicode and other fonts may be used.
1921

2022
## Requirements
2123

@@ -30,10 +32,16 @@ Plug 'nvim-tree/nvim-web-devicons'
3032

3133
or with [packer.nvim](https://github.com/wbthomason/packer.nvim)
3234

33-
```
35+
```lua
3436
use 'nvim-tree/nvim-web-devicons'
3537
```
3638

39+
or with [lazy.nvim](https://github.com/folke/lazy.nvim)
40+
41+
```lua
42+
{ "nvim-tree/nvim-web-devicons", opts = {} },
43+
```
44+
3745
[![LuaRocks](https://img.shields.io/luarocks/v/nvim-tree/nvim-web-devicons?logo=lua&color=purple)](https://luarocks.org/modules/nvim-tree/nvim-web-devicons)
3846

3947
## Usage
@@ -48,6 +56,7 @@ Light or dark color variants of the icons depend on `&background`.
4856
The variant can also be set manually in `setup` with the `variant` option.
4957

5058
The variant is updated:
59+
5160
- on `OptionSet` event for `background`, or
5261
- after explicitly calling `require("nvim-web-devicons").refresh()`.
5362

@@ -68,7 +77,7 @@ if the color scheme changes
6877

6978
```lua
7079
require'nvim-web-devicons'.setup {
71-
-- your personnal icons can go here (to override)
80+
-- your personal icons can go here (to override)
7281
-- you can specify color or cterm_color instead of specifying both of them
7382
-- DevIcon will be appended to `name`
7483
override = {
@@ -126,7 +135,7 @@ require'nvim-web-devicons'.setup {
126135

127136
### Get Icon
128137

129-
Get the icon for a given file by passing in the `name`, the `extension` and an _optional_ options `table`.
138+
Get the icon for a given file by passing in the `name`, the `extension` and an *optional* options `table`.
130139
The name is passed in to check for an exact match e.g. `.bashrc` if there is no exact name match the extension
131140
is used. Calls `.setup()` if it hasn't already ran.
132141

@@ -146,6 +155,7 @@ require'nvim-web-devicons'.get_icon(filename, extension, { default = true })
146155
```
147156

148157
You can check if the setup function was already called with:
158+
149159
```lua
150160
require'nvim-web-devicons'.has_loaded()
151161
```
@@ -156,6 +166,7 @@ require'nvim-web-devicons'.has_loaded()
156166
`get_icon_cterm_color` returns cterm color instead of gui color
157167
`get_icon` returns icon and highlight name.
158168
If you want to get color code, you can use this function.
169+
159170
```lua
160171
local icon, color = require'nvim-web-devicons'.get_icon_color("init.lua", "lua")
161172
assert(icon == "")
@@ -220,7 +231,8 @@ or set the icon to use for a filetype with:
220231
require("nvim-web-devicons").set_icon_by_filetype { cpp = "c", pandoc = "md", }
221232
```
222233

223-
These functions are the same as their counterparts without the `_by_filetype` suffix, but they take a filetype instead of a name/extension.
234+
These functions are the same as their counterparts without the `_by_filetype` suffix,
235+
but they take a filetype instead of a name/extension.
224236

225237
You can also use `get_icon_name_by_filetype(filetype)` to get the icon name associated with the filetype.
226238

lua/nvim-web-devicons.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ end
105105
local filetypes = {
106106
["apl"] = "apl",
107107
["asm"] = "asm",
108+
["astro"] = "astro",
108109
["avif"] = "avif",
109110
["bash"] = "bash",
110111
["bib"] = "bib",
@@ -154,6 +155,7 @@ local filetypes = {
154155
["eex"] = "eex",
155156
["ejs"] = "ejs",
156157
["elixir"] = "ex",
158+
["elf"] = "elf",
157159
["elm"] = "elm",
158160
["epuppet"] = "epp",
159161
["erlang"] = "erl",
@@ -215,11 +217,13 @@ local filetypes = {
215217
["lock"] = "lock",
216218
["lprolog"] = "sig",
217219
["lua"] = "lua",
220+
["luau"] = "luau",
218221
["make"] = "makefile",
219222
["markdown"] = "markdown",
220223
["material"] = "material",
221224
["mdx"] = "mdx",
222225
["mint"] = "mint",
226+
["mojo"] = "mojo",
223227
["motoko"] = "mo",
224228
["mustache"] = "mustache",
225229
["nim"] = "nim",
@@ -254,6 +258,7 @@ local filetypes = {
254258
["pyd"] = "pyd",
255259
["pyo"] = "pyo",
256260
["python"] = "py",
261+
["qml"] = "qml",
257262
["query"] = "query",
258263
["r"] = "r",
259264
["res"] = "rescript",
@@ -278,6 +283,7 @@ local filetypes = {
278283
["sqlite3"] = "sqlite3",
279284
["srt"] = "srt",
280285
["ssa"] = "ssa",
286+
["stp"] = "stp",
281287
["styl"] = "styl",
282288
["sublime"] = "sublime",
283289
["suo"] = "suo",
@@ -287,9 +293,11 @@ local filetypes = {
287293
["systemverilog"] = "sv",
288294
["tads"] = "t",
289295
["tcl"] = "tcl",
296+
["tf"] = "tf",
290297
["templ"] = "templ",
291298
["terminal"] = "terminal",
292299
["tex"] = "tex",
300+
["tmux"] = "tmux",
293301
["toml"] = "toml",
294302
["tres"] = "tres",
295303
["tscn"] = "tscn",

lua/nvim-web-devicons/icons-default.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,6 @@ local icons_by_filename = {
335335
cterm_color = "135",
336336
name = "AUTHORS",
337337
},
338-
["avif"] = {
339-
icon = "",
340-
color = "#a074c4",
341-
cterm_color = "140",
342-
name = "Avif",
343-
},
344338
["brewfile"] = {
345339
icon = "",
346340
color = "#701516",
@@ -1214,6 +1208,12 @@ local icons_by_file_extension = {
12141208
cterm_color = "197",
12151209
name = "Astro",
12161210
},
1211+
["avif"] = {
1212+
icon = "",
1213+
color = "#a074c4",
1214+
cterm_color = "140",
1215+
name = "Avif",
1216+
},
12171217
["awk"] = {
12181218
icon = "",
12191219
color = "#4d5a5e",

0 commit comments

Comments
 (0)