├── .github └── workflows │ └── lint.yml ├── LICENSE ├── README.md ├── after └── syntax │ └── zsh.vim └── images ├── neovim-default.png └── neovim-gruvbox-flat.png /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | pull_request: 5 | branches: [main, master] 6 | push: 7 | branches: [main, master] 8 | tags: ["v*.*.*"] 9 | workflow_dispatch: 10 | 11 | jobs: 12 | commit: 13 | uses: zdharma-continuum/.github/.github/workflows/commit-job.yml@main 14 | lint: 15 | uses: zdharma-continuum/.github/.github/workflows/lint-job.yml@main 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Zplugin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zinit-vim-syntax 2 | 3 | A Vim syntax definition for Zinit commands in any file of type `zsh`. 4 | 5 | ## Installation 6 | 7 | Load as a Vim plugin. E.g. when using vim-plug, add to `~/.vimrc`: 8 | 9 | ```vim 10 | Plug 'zdharma-continuum/zinit-vim-syntax' 11 | ``` 12 | 13 | and then issue the `:PlugInstall` command. 14 | 15 | ### Manual Installation 16 | 17 | To install the syntax copy the file `syntax/after/zsh.vim` under the path `~/.vim/syntax/after`. 18 | 19 | ## Examples 20 | 21 | The default theme: 22 | 23 | ![neovim-default](./images/neovim-default.png) 24 | 25 | The theme: `eddyekofo94/gruvbox-flat.nvim`: 26 | 27 | ![neovim-gruvbox-flat](./images/neovim-gruvbox-flat.png) 28 | 29 | ## TODO 30 | 31 | 1. Highlight user and plugin with different colors. 32 | 1. Fix bugs. 33 | 1. Other? 34 | -------------------------------------------------------------------------------- /after/syntax/zsh.vim: -------------------------------------------------------------------------------- 1 | " Copyright (c) 2019 Sebastian Gniazdowski 2 | " Copyright (c) 2021 Joakim Gottzén 3 | " 4 | " Syntax highlighting for Zinit commands in any file of type `zsh'. 5 | " It adds definitions for the Zinit syntax to the ones from the 6 | " existing zsh.vim definitions-file. 7 | 8 | " Main Zinit command. 9 | " Should be the only TOP rule for the whole syntax. 10 | syn match ZinitCommand '\(^\|\s\)zinit\s'ms=e-5,me=e-1 skipwhite 11 | \ nextgroup=ZinitCommand,ZinitIceCommand,ZinitPluginCommand,ZinitSnippetCommand,ZinitForCommand,ZinitContinue,ZinitIceWithParam,ZinitIce 12 | 13 | syn match ZinitCommand '\s\%(help\|man\)\>'ms=s+1 skipwhite contained 14 | syn match ZinitCommand '\s\%(unload\)\>'ms=s+1 skipwhite contained " load,light and snippet are handled elsewhere 15 | syn match ZinitCommand '\s\%(clist\|completions\|cdisable\|cenable\|creinstall\|cuninstall\)\>'ms=s+1 skipwhite contained 16 | syn match ZinitCommand '\s\%(csearch\|compinit\|cclear\|cdlist\|cdreplay\|cdclear\)\>'ms=s+1 skipwhite contained 17 | syn match ZinitCommand '\s\%(dtrace\|dstart\|dstop\|dunload\|dreport\|dclear\)\>'ms=s+1 skipwhite contained 18 | syn match ZinitCommand '\s\%(times\|zstatus\|report\|loaded\|list\|ls\|status\|recently\|bindkeys\)\>'ms=s+1 skipwhite contained 19 | syn match ZinitCommand '\s\%(compile\|uncompile\|compiled\)\>'ms=s+1 skipwhite contained 20 | syn match ZinitCommand '\s\%(self-update\|update\|delete\|cd\|edit\|glance\|stress\|changes\|create\)\>'ms=s+1 skipwhite contained 21 | syn match ZinitCommand '\s\%(srv\|recall\|env-whitelist\|module\|add-fpath\|fpath\|run\)\>'ms=s+1 skipwhite contained 22 | 23 | syn match ZinitIceCommand '\sice\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitIce,ZinitIceWithParam 24 | 25 | syn match ZinitPluginCommand '\s\%(light\|load\)\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitPlugin,ZinitContinue 26 | 27 | syn match ZinitSnippetCommand '\s\%(snippet\)\s'ms=s+1,me=e-1 skipwhite contained nextgroup=ZinitSnippet,ZinitContinue 28 | 29 | syn match ZinitForCommand '\sfor\s'ms=s+1,me=e-1 skipwhite contained 30 | \ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue 31 | 32 | syn cluster ZinitLine contains=ZinitIce,ZinitIceWithParam,ZinitPlugin,ZinitSnippet,ZinitForCommand 33 | 34 | syn match ZinitContinue '\s\\\s*$'ms=s+1,me=s+2 skipwhite contained skipnl 35 | \ nextgroup=@ZinitLine 36 | 37 | " user/plugin or @user/plugin 38 | syn match ZinitPlugin '\s@\?\<[a-zA-Z0-9][a-zA-Z0-9_\-]*\/[a-zA-Z0-9_\-\.]\+\>'ms=s+1 skipwhite contained 39 | \ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue 40 | 41 | " shorthands 42 | syn match ZinitSnippet '\s\%(OMZ[LPT]\?\|PZT[M]\?\)::[a-zA-Z0-9_\-\.\/]\+\>'ms=s+1 skipwhite contained 43 | \ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue 44 | " url 45 | syn match ZinitSnippet '\s\%(http[s]\?\|ftp\):\/\/[[:alnum:]%\/_#.-]*\>'ms=s+1 skipwhite contained 46 | \ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue 47 | " "$VAR" local path 48 | syn match ZinitSnippet +\s"\$\<[a-zA-Z0-9_]\+[^"]*"+ms=s+1 skipwhite contained 49 | \ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue 50 | " "${VAR}" local path 51 | syn match ZinitSnippet +\s"\${\<[a-zA-Z0-9_]\+}[^"]*"+ms=s+1 skipwhite contained 52 | \ nextgroup=ZinitPlugin,ZinitSnippet,ZinitContinue 53 | 54 | " ices which takes a param enclosed in " 55 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(proto\|from\|ver\|bpick\|depth\|cloneopts\|pullopts\)"+ skip=+\\"+ end=+"+ skipwhite contained 56 | \ nextgroup=@ZinitLine,ZinitContinue 57 | \ contains=ZinitIceDoubleQuoteParam 58 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(pick\|src\|multisrc\)"+ skip=+\\"+ end=+"+ skipwhite contained 59 | \ nextgroup=@ZinitLine,ZinitContinue 60 | \ contains=ZinitIceDoubleQuoteParam 61 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wait\|load\|unload\|if\|has\|subscribe\|on-update-of\|trigger-load\)"+ skip=+\\"+ end=+"+ skipwhite contained 62 | \ nextgroup=@ZinitLine,ZinitContinue 63 | \ contains=ZinitIceDoubleQuoteParam 64 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(mv\|cp\|atclone\|atpull\|atinit\|atload\|atdelete\|make\)"+ skip=+\\"+ end=+"+ skipwhite contained 65 | \ nextgroup=@ZinitLine,ZinitContinue 66 | \ contains=ZinitIceDoubleQuoteParam 67 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(as\|id-as\|compile\|nocompile\|service\|bindmap\|wrap-track\)"+ skip=+\\"+ end=+"+ skipwhite contained 68 | \ nextgroup=@ZinitLine,ZinitContinue 69 | \ contains=ZinitIceDoubleQuoteParam 70 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(extract\|subst\|autoload\)"+ skip=+\\"+ end=+"+ skipwhite contained 71 | \ nextgroup=@ZinitLine,ZinitContinue 72 | \ contains=ZinitIceDoubleQuoteParam 73 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wrap\|ps-on-unload\|ps-on-update\)"+ skip=+\\"+ end=+"+ skipwhite contained 74 | 75 | " zinit packages 76 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(param\)"+ skip=+\\"+ end=+"+ skipwhite contained 77 | \ nextgroup=@ZinitLine,ZinitContinue 78 | \ contains=ZinitIceDoubleQuoteParam 79 | 80 | " added by the existing annexes 81 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(lman\|eval\)"+ skip=+\\"+ end=+"+ skipwhite contained 82 | \ nextgroup=@ZinitLine,ZinitContinue 83 | \ contains=ZinitIceDoubleQuoteParam 84 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(fbin\|lbin\|sbin\|gem\|node\|pip\|fmod\|fsrc\|ferc\)"+ skip=+\\"+ end=+"+ skipwhite contained 85 | \ nextgroup=@ZinitLine,ZinitContinue 86 | \ contains=ZinitIceDoubleQuoteParam 87 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(dl\|patch\|submods\|cargo\|dlink\|dlink0\)"+ skip=+\\"+ end=+"+ skipwhite contained 88 | \ nextgroup=@ZinitLine,ZinitContinue 89 | \ contains=ZinitIceDoubleQuoteParam 90 | 91 | syn match ZinitIceDoubleQuoteParam +[^"]*+ contained 92 | 93 | " ices that takes a param enclosed in ' 94 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(proto\|from\|ver\|bpick\|depth\|cloneopts\|pullopts\)'+ skip=+\\'+ end=+'+ skipwhite contained 95 | \ nextgroup=@ZinitLine,ZinitContinue 96 | \ contains=ZinitIceSingleQuoteParam 97 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(pick\|src\|multisrc\)'+ skip=+\\'+ end=+'+ skipwhite contained 98 | \ nextgroup=@ZinitLine,ZinitContinue 99 | \ contains=ZinitIceSingleQuoteParam 100 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wait\|load\|unload\|if\|has\|subscribe\|on-update-of\|trigger-load\)'+ skip=+\\'+ end=+'+ skipwhite contained 101 | \ nextgroup=@ZinitLine,ZinitContinue 102 | \ contains=ZinitIceSingleQuoteParam 103 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(mv\|cp\|atclone\|atpull\|atinit\|atload\|atdelete\|make\)'+ skip=+\\'+ end=+'+ skipwhite contained 104 | \ nextgroup=@ZinitLine,ZinitContinue 105 | \ contains=ZinitIceSingleQuoteParam 106 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(as\|id-as\|compile\|nocompile\|service\|bindmap\|wrap-track\)'+ skip=+\\'+ end=+'+ skipwhite contained 107 | \ nextgroup=@ZinitLine,ZinitContinue 108 | \ contains=ZinitIceSingleQuoteParam 109 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(extract\|subst\|autoload\)'+ skip=+\\'+ end=+'+ skipwhite contained 110 | \ nextgroup=@ZinitLine,ZinitContinue 111 | \ contains=ZinitIceSingleQuoteParam 112 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(wrap\|ps-on-unload\|ps-on-update\)'+ skip=+\\'+ end=+'+ skipwhite contained 113 | 114 | " zinit packages 115 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(param\)'+ skip=+\\'+ end=+'+ skipwhite contained 116 | \ nextgroup=@ZinitLine,ZinitContinue 117 | \ contains=ZinitIceSingleQuoteParam 118 | 119 | " added by the existing annexes 120 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(lman\|eval\)'+ skip=+\\'+ end=+'+ skipwhite contained 121 | \ nextgroup=@ZinitLine,ZinitContinue 122 | \ contains=ZinitIceSingleQuoteParam 123 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(fbin\|lbin\|sbin\|gem\|node\|pip\|fmod\|fsrc\|ferc\)'+ skip=+\\'+ end=+'+ skipwhite contained 124 | \ nextgroup=@ZinitLine,ZinitContinue 125 | \ contains=ZinitIceSingleQuoteParam 126 | syn region ZinitIceWithParam matchgroup=ZinitIce start=+\s\%(dl\|patch\|submods\|cargo\|dlink\|dlink0\)'+ skip=+\\'+ end=+'+ skipwhite contained 127 | \ nextgroup=@ZinitLine,ZinitContinue 128 | \ contains=ZinitIceSingleQuoteParam 129 | 130 | syn match ZinitIceSingleQuoteParam +[^']*+ contained 131 | 132 | " ices that doens't take a param 133 | syn match ZinitIce '\s\%(teleid\|svn\)\>'ms=s+1 skipwhite contained 134 | \ nextgroup=@ZinitLine,ZinitContinue 135 | syn match ZinitIce '\s\%(wait\|cloneonly\)\>'ms=s+1 skipwhite contained 136 | \ nextgroup=@ZinitLine,ZinitContinue 137 | syn match ZinitIce '\s\%(silent\|lucid\|notify\)\>'ms=s+1 skipwhite contained 138 | \ nextgroup=@ZinitLine,ZinitContinue 139 | syn match ZinitIce '\s\%(blockf\|nocompletions\)\>'ms=s+1 skipwhite contained 140 | \ nextgroup=@ZinitLine,ZinitContinue 141 | syn match ZinitIce '\s\%(run-atpull\|nocd\|make\|countdown\|reset\)\>'ms=s+1 skipwhite contained 142 | \ nextgroup=@ZinitLine,ZinitContinue 143 | syn match ZinitIce '\s!\?\%(sh\|bash\|ksh\|csh\)\>'ms=s+1 skipwhite contained 144 | \ nextgroup=@ZinitLine,ZinitContinue 145 | syn match ZinitIce '\s\%(id-as\|nocompile\|reset-prompt\|trackbinds\|aliases\|light-mode\)\>'ms=s+1 skipwhite contained 146 | \ nextgroup=@ZinitLine,ZinitContinue 147 | syn match ZinitIce '\s\%(is-snippet\)\>'ms=s+1 skipwhite contained 148 | \ nextgroup=@ZinitLine,ZinitContinue 149 | syn match ZinitIce '\s\%(extract\)\>'ms=s+1 skipwhite contained 150 | \ nextgroup=@ZinitLine,ZinitContinue 151 | syn match ZinitIce '\s\%(lman\|eval\)'ms=s+1 skipwhite contained 152 | \ nextgroup=@ZinitLine,ZinitContinue 153 | 154 | " ices that doens't take a param, from zinit packages 155 | syn match ZinitIce '\s\%(pack\|git\|null\)\>'ms=s+1 skipwhite contained 156 | \ nextgroup=@ZinitLine,ZinitContinue 157 | 158 | " ices that doens't take a param, added by the existing annexes 159 | syn match ZinitIce '\s\%(notest\|rustup\|default-ice\|skip\|debug\)\>'ms=s+1 skipwhite contained 160 | \ nextgroup=@ZinitLine,ZinitContinue 161 | 162 | " additional Zsh and zinit functions 163 | syn match ZshAndZinitFunctions '\<\%(compdef\|compinit\|zpcdreplay\|zpcdclear\|zpcompinit\|zpcompdef\)\>' 164 | 165 | " highlights 166 | hi def link ZinitCommand Statement 167 | hi def link ZinitCommand Title 168 | hi def link ZinitIceCommand Title 169 | hi def link ZinitPluginCommand Title 170 | hi def link ZinitSnippetCommand Title 171 | hi def link ZinitForCommand zshRepeat 172 | hi def link ZinitContinue Normal 173 | hi def link ZinitPlugin Macro 174 | hi def link ZinitSnippet Macro 175 | hi def link ZinitIce Type 176 | hi def link ZinitIceDoubleQuoteParam Special 177 | hi def link ZinitIceSingleQuoteParam Special 178 | hi def link ZshAndZinitFunctions Keyword 179 | 180 | -------------------------------------------------------------------------------- /images/neovim-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zdharma-continuum/zinit-vim-syntax/6f3e6b55182b92141688331c101bc07616ab0d2b/images/neovim-default.png -------------------------------------------------------------------------------- /images/neovim-gruvbox-flat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zdharma-continuum/zinit-vim-syntax/6f3e6b55182b92141688331c101bc07616ab0d2b/images/neovim-gruvbox-flat.png --------------------------------------------------------------------------------