mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-11 04:53:51 -05:00
Improve bash and zsh highlighting
This commit is contained in:
@@ -10,7 +10,7 @@ A collection of language packs for Vim.
|
||||
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
|
||||
|
||||
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->150<!--/Package Count--> packages it consists of.
|
||||
- It **installs and updates 120+ times faster** than the <!--Package Count-->151<!--/Package Count--> packages it consists of.
|
||||
- Solid syntax and indentation support (other features skipped). Only the best language packs.
|
||||
- All unnecessary files are ignored (like enormous documentation from php support).
|
||||
- No support for esoteric languages, only most popular ones (modern too, like `slim`).
|
||||
@@ -160,6 +160,7 @@ If you need full functionality of any plugin, please use it directly with your p
|
||||
- [sbt](https://github.com/derekwyatt/vim-sbt) (syntax)
|
||||
- [scala](https://github.com/derekwyatt/vim-scala) (syntax, indent, compiler, ftplugin, ctags)
|
||||
- [scss](https://github.com/cakebaker/scss-syntax.vim) (syntax, indent, ftplugin)
|
||||
- [sh](https://github.com/arzg/vim-sh) (syntax)
|
||||
- [slim](https://github.com/slim-template/vim-slim) (syntax, indent, ftplugin)
|
||||
- [slime](https://github.com/slime-lang/vim-slime-syntax) (syntax, indent)
|
||||
- [smt2](https://github.com/bohlender/vim-smt2) (syntax, autoload, ftplugin)
|
||||
|
||||
1
build
1
build
@@ -252,6 +252,7 @@ PACKS="
|
||||
sbt:derekwyatt/vim-sbt
|
||||
scala:derekwyatt/vim-scala
|
||||
scss:cakebaker/scss-syntax.vim
|
||||
sh:arzg/vim-sh
|
||||
slim:slim-template/vim-slim
|
||||
slime:slime-lang/vim-slime-syntax
|
||||
smt2:bohlender/vim-smt2
|
||||
|
||||
60
syntax/sh.vim
Normal file
60
syntax/sh.vim
Normal file
@@ -0,0 +1,60 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sh') == -1
|
||||
|
||||
" Shebang
|
||||
syn match shShebang "^#!.*$" containedin=shComment
|
||||
|
||||
" Operators
|
||||
syn match shOperator '||'
|
||||
syn match shOperator '&&'
|
||||
|
||||
" Match semicolons as Delimiter rather than Operator
|
||||
syn match shSemicolon ';' containedin=shOperator,zshOperator
|
||||
|
||||
" Highlight braces, brackets and parens as Delimiters in zsh
|
||||
syn match zshDelim '\v(\(|\))' containedin=zshParentheses
|
||||
syn match zshDelim '\v(\{|\})' containedin=zshBraces
|
||||
syn match zshDelim '\v(\[|\])' containedin=zshParentheses
|
||||
|
||||
" Match command flags in zsh
|
||||
syn match zshFlag "\v<-\w+" containedin=zshBrackets,zshParentheses
|
||||
|
||||
" Special files as Constants
|
||||
syn match Constant "\v/dev/\w+"
|
||||
\ containedin=shFunctionOne,shIf,shCmdParenRegion,shCommandSub
|
||||
|
||||
" Common commands
|
||||
let commands = [ 'arch', 'awk', 'b2sum', 'base32', 'base64', 'basename', 'basenc', 'bash', 'brew', 'cat', 'chcon', 'chgrp', 'chown', 'chroot', 'cksum', 'comm', 'cp', 'csplit', 'curl', 'cut', 'date', 'dd', 'defaults', 'df', 'dir', 'dircolors', 'dirname', 'ed', 'env', 'expand', 'factor', 'fmt', 'fold', 'git', 'grep', 'groups', 'head', 'hexdump', 'hostid', 'hostname', 'hugo', 'id', 'install', 'join', 'killall', 'link', 'ln', 'logname', 'md5sum', 'mkdir', 'mkfifo', 'mknod', 'mktemp', 'nice', 'nl', 'nohup', 'npm', 'nproc', 'numfmt', 'od', 'open', 'paste', 'pathchk', 'pr', 'printenv', 'printf', 'ptx', 'readlink', 'realpath', 'rg', 'runcon', 'scutil', 'sed', 'seq', 'sha1sum', 'sha2', 'shred', 'shuf', 'split', 'stat', 'stdbuf', 'stty', 'sudo', 'sum', 'sync', 'tac', 'tee', 'terminfo', 'timeout', 'tmux', 'top', 'touch', 'tput', 'tr', 'truncate', 'tsort', 'tty', 'uname', 'unexpand', 'uniq', 'unlink', 'uptime', 'users', 'vdir', 'vim', 'wc', 'who', 'whoami', 'yabai', 'yes' ]
|
||||
|
||||
for i in commands
|
||||
execute 'syn match shStatement "\v(\w|-)@<!'
|
||||
\ . i
|
||||
\ . '(\w|-)@!" containedin=shFunctionOne,shIf,shCmdParenRegion,shCommandSub,zshBrackets'
|
||||
endfor
|
||||
|
||||
" Fix default highlighting groups
|
||||
hi def link bashSpecialVariables Identifier
|
||||
hi def link shCmdSubRegion Delimiter
|
||||
hi def link shDerefSimple Identifier
|
||||
hi def link shFor Identifier
|
||||
hi def link shFunctionKey Statement
|
||||
hi def link shQuote StringDelimiter
|
||||
hi def link shRange Delimiter
|
||||
hi def link shSnglCase Delimiter
|
||||
hi def link shStatement Statement
|
||||
hi def link shTestOpr Operator
|
||||
hi def link shVarAssign Operator
|
||||
hi def link zshDeref Identifier
|
||||
hi def link zshFunction Function
|
||||
hi def link zshOperator Operator
|
||||
hi def link zshStringDelimiter StringDelimiter
|
||||
hi def link zshSubst Identifier
|
||||
hi def link zshSubstDelim Delimiter
|
||||
hi def link zshVariableDef Identifier
|
||||
|
||||
" Link custom groups
|
||||
hi def link shSemicolon Delimiter
|
||||
hi def link shShebang PreProc
|
||||
hi def link zshDelim Delimiter
|
||||
hi def link zshFlag Special
|
||||
|
||||
endif
|
||||
60
syntax/zsh.vim
Normal file
60
syntax/zsh.vim
Normal file
@@ -0,0 +1,60 @@
|
||||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sh') == -1
|
||||
|
||||
" Shebang
|
||||
syn match shShebang "^#!.*$" containedin=shComment
|
||||
|
||||
" Operators
|
||||
syn match shOperator '||'
|
||||
syn match shOperator '&&'
|
||||
|
||||
" Match semicolons as Delimiter rather than Operator
|
||||
syn match shSemicolon ';' containedin=shOperator,zshOperator
|
||||
|
||||
" Highlight braces, brackets and parens as Delimiters in zsh
|
||||
syn match zshDelim '\v(\(|\))' containedin=zshParentheses
|
||||
syn match zshDelim '\v(\{|\})' containedin=zshBraces
|
||||
syn match zshDelim '\v(\[|\])' containedin=zshParentheses
|
||||
|
||||
" Match command flags in zsh
|
||||
syn match zshFlag "\v<-\w+" containedin=zshBrackets,zshParentheses
|
||||
|
||||
" Special files as Constants
|
||||
syn match Constant "\v/dev/\w+"
|
||||
\ containedin=shFunctionOne,shIf,shCmdParenRegion,shCommandSub
|
||||
|
||||
" Common commands
|
||||
let commands = [ 'arch', 'awk', 'b2sum', 'base32', 'base64', 'basename', 'basenc', 'bash', 'brew', 'cat', 'chcon', 'chgrp', 'chown', 'chroot', 'cksum', 'comm', 'cp', 'csplit', 'curl', 'cut', 'date', 'dd', 'defaults', 'df', 'dir', 'dircolors', 'dirname', 'ed', 'env', 'expand', 'factor', 'fmt', 'fold', 'git', 'grep', 'groups', 'head', 'hexdump', 'hostid', 'hostname', 'hugo', 'id', 'install', 'join', 'killall', 'link', 'ln', 'logname', 'md5sum', 'mkdir', 'mkfifo', 'mknod', 'mktemp', 'nice', 'nl', 'nohup', 'npm', 'nproc', 'numfmt', 'od', 'open', 'paste', 'pathchk', 'pr', 'printenv', 'printf', 'ptx', 'readlink', 'realpath', 'rg', 'runcon', 'scutil', 'sed', 'seq', 'sha1sum', 'sha2', 'shred', 'shuf', 'split', 'stat', 'stdbuf', 'stty', 'sudo', 'sum', 'sync', 'tac', 'tee', 'terminfo', 'timeout', 'tmux', 'top', 'touch', 'tput', 'tr', 'truncate', 'tsort', 'tty', 'uname', 'unexpand', 'uniq', 'unlink', 'uptime', 'users', 'vdir', 'vim', 'wc', 'who', 'whoami', 'yabai', 'yes' ]
|
||||
|
||||
for i in commands
|
||||
execute 'syn match shStatement "\v(\w|-)@<!'
|
||||
\ . i
|
||||
\ . '(\w|-)@!" containedin=shFunctionOne,shIf,shCmdParenRegion,shCommandSub,zshBrackets'
|
||||
endfor
|
||||
|
||||
" Fix default highlighting groups
|
||||
hi def link bashSpecialVariables Identifier
|
||||
hi def link shCmdSubRegion Delimiter
|
||||
hi def link shDerefSimple Identifier
|
||||
hi def link shFor Identifier
|
||||
hi def link shFunctionKey Statement
|
||||
hi def link shQuote StringDelimiter
|
||||
hi def link shRange Delimiter
|
||||
hi def link shSnglCase Delimiter
|
||||
hi def link shStatement Statement
|
||||
hi def link shTestOpr Operator
|
||||
hi def link shVarAssign Operator
|
||||
hi def link zshDeref Identifier
|
||||
hi def link zshFunction Function
|
||||
hi def link zshOperator Operator
|
||||
hi def link zshStringDelimiter StringDelimiter
|
||||
hi def link zshSubst Identifier
|
||||
hi def link zshSubstDelim Delimiter
|
||||
hi def link zshVariableDef Identifier
|
||||
|
||||
" Link custom groups
|
||||
hi def link shSemicolon Delimiter
|
||||
hi def link shShebang PreProc
|
||||
hi def link zshDelim Delimiter
|
||||
hi def link zshFlag Special
|
||||
|
||||
endif
|
||||
Reference in New Issue
Block a user