├── LICENSE ├── README.md └── syntax ├── sh.vim └── zsh.vim /LICENSE: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2019, Aramis Razzaghipour 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vim-sh 2 | 3 | Super small plugin to improve Vim’s highlighting of shell scripts. 4 | 5 | #### Screenshots 6 | 7 | | Before | After | 8 | | -- | -- | 9 | | ![Before vim-sh](https://raw.githubusercontent.com/arzg/resources/master/vim-sh-before.png) |![After vim-sh](https://raw.githubusercontent.com/arzg/resources/master/vim-sh-after.png) | 10 | -------------------------------------------------------------------------------- /syntax/sh.vim: -------------------------------------------------------------------------------- 1 | " Shebang 2 | syn match shShebang "^#!.*$" containedin=shComment 3 | 4 | " Operators 5 | syn match shOperator '||' 6 | syn match shOperator '&&' 7 | 8 | " Match semicolons as Delimiter rather than Operator 9 | syn match shSemicolon ';' containedin=shOperator,zshOperator 10 | 11 | " Highlight braces, brackets and parens as Delimiters in zsh 12 | syn match zshDelim '\v(\(|\))' containedin=zshParentheses 13 | syn match zshDelim '\v(\{|\})' containedin=zshBraces 14 | syn match zshDelim '\v(\[|\])' containedin=zshParentheses 15 | 16 | " Match command flags in zsh 17 | syn match zshFlag "\v<-\w+" containedin=zshBrackets,zshParentheses 18 | 19 | " Special files as Constants 20 | syn match Constant "\v/dev/\w+" 21 | \ containedin=shFunctionOne,shIf,shCmdParenRegion,shCommandSub 22 | 23 | " Common commands 24 | 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' ] 25 | 26 | for i in commands 27 | execute 'syn match shStatement "\v(\w|-)@