📄 zsh.vim
字号:
" Vim syntax file" Language: Z shell (zsh)" Maintainer: Felix von Leitner <leitner@math.fu-berlin.de>" Heavily based on sh.vim by Lennart Schultz" Last Change: 2001 May 09" For version 5.x: Clear all syntax items" For version 6.x: Quit when a syntax file was already loadedif version < 600 syntax clearelseif exists("b:current_syntax") finishendifsyn region zshSinglequote start=+'+ skip=+\\'+ end=+'+" A bunch of useful zsh keywords" syn keyword zshFunction functionsyn keyword zshStatement bg break cd chdir continue echo eval execsyn keyword zshStatement exit export fg getopts hash jobs killsyn keyword zshStatement pwd read readonly return set zshift functionsyn keyword zshStatement stop suspend test times trap type ulimitsyn keyword zshStatement umask unset wait setopt compctl sourcesyn keyword zshStatement whence disown shift which unhash unaliassyn keyword zshStatement alias functions unfunction getln disablesyn keyword zshStatement vared getopt enable unsetopt autoloadsyn keyword zshStatement bindkey pushln command limit unlimit fcsyn keyword zshStatement print builtin noglob sched r timesyn keyword zshStatement typeset declare local integersyn keyword zshConditional if else esac case then elif fi insyn keyword zshRepeat while for do done" Following is worth to notice: command substitution, file redirection and functions (so these features turns red)syn match zshFunctionName "\h\w*\s*()"syn region zshCommandSub start=+`+ skip=+\\`+ end=+`+" contains=ALLBUT,zshFunctionsyn match zshRedir "\d\=\(<\|<<\|>\|>>\)\(|\|&\d\)\="syn keyword zshTodo contained TODOsyn keyword zshShellVariables USER LOGNAME HOME PATH CDPATH SHELLsyn keyword zshShellVariables LC_TYPE LC_MESSAGE MAIL MAILCHECKsyn keyword zshShellVariables PS1 PS2 IFS EGID EUID ERRNO GID UIDsyn keyword zshShellVariables HOST LINENO MACHTYPE OLDPWD OPTARGsyn keyword zshShellVariables OPTIND OSTYPE PPID PWD RANDOM SECONDSsyn keyword zshShellVariables SHLVL TTY signals TTYIDLE USERNAMEsyn keyword zshShellVariables VENDOR ZSH_NAME ZSH_VERSION ARGV0syn keyword zshShellVariables BAUD COLUMNS cdpath DIRSTACKSIZEsyn keyword zshShellVariables FCEDIT fignore fpath histchars HISTCHARSsyn keyword zshShellVariables HISTFILE HISTSIZE KEYTIMEOUT LANGsyn keyword zshShellVariables LC_ALL LC_COLLATE LC_CTYPE LC_MESSAGESsyn keyword zshShellVariables LC_TIME LINES LISTMAX LOGCHECK mailpathsyn keyword zshShellVariables MAILPATH MANPATH manpath module_pathsyn keyword zshShellVariables MODULE_PATH NULLCMD path POSTEDITsyn keyword zshShellVariables PS3 PS4 PROMPT PROMPT2 PROMPT3 PROMPT4syn keyword zshShellVariables psvar PSVAR prompt READNULLCMDsyn keyword zshShellVariables REPORTTIME RPROMPT RPS1 SAVEHISTsyn keyword zshShellVariables SPROMPT STTY TIMEFMT TMOUT TMPPREFIXsyn keyword zshShellVariables watch WATCH WATCHFMT WORDCHARS ZDOTDIRsyn match zshSpecialShellVar "\$[-#@*$?!0-9]"syn keyword zshSetVariables ignoreeof noclobbersyn region zshDerefOpr start="\${" end="}" contains=zshShellVariablessyn match zshDerefIdentifier "\$[a-zA-Z_][a-zA-Z0-9_]*\>"syn match zshOperator "[][}{&;|)(]"" String and Character contstants" Highlight special characters (those which have a backslash) differentlysyn match zshSpecial contained "\\\d\d\d\|\\[abcfnrtv\\]"syn match zshNumber "-\=\<\d\+\>"syn match zshComment "#.*$" contains=zshNumber,zshTodosyn match zshTestOpr "-\<[oeaznlg][tfqet]\=\>\|!\==\|-\<[b-gkLprsStuwjxOG]\>""syn region zshTest start="\[" skip="\\$" end="\]" contains=zshString,zshTestOpr,zshDerefIdentifier,zshDerefOprsyn region zshString start=+"+ skip=+\\"+ end=+"+ contains=zshSpecial,zshOperator,zshDerefIdentifier,zshDerefOpr,zshSpecialShellVar,zshSinglequote,zshCommandSub" Define the default highlighting." For version 5.7 and earlier: only when not done already" For version 5.8 and later: only when an item doesn't have highlighting yetif version >= 508 || !exists("did_zsh_syntax_inits") if version < 508 let did_zsh_syntax_inits = 1 command -nargs=+ HiLink hi link <args> else command -nargs=+ HiLink hi def link <args> endif HiLink zshSinglequote zshString HiLink zshConditional zshStatement HiLink zshRepeat zshStatement HiLink zshFunctionName zshFunction HiLink zshCommandSub zshOperator HiLink zshRedir zshOperator HiLink zshSetVariables zshShellVariables HiLink zshSpecialShellVar zshShellVariables HiLink zshTestOpr zshOperator HiLink zshDerefOpr zshSpecial HiLink zshDerefIdentifier zshShellVariables HiLink zshOperator Operator HiLink zshStatement Statement HiLink zshNumber Number HiLink zshString String HiLink zshComment Comment HiLink zshSpecial Special HiLink zshTodo Todo HiLink zshShellVariables Special" hi zshOperator term=underline ctermfg=6 guifg=Purple gui=bold" hi zshShellVariables term=underline ctermfg=2 guifg=SeaGreen gui=bold" hi zshFunction term=bold ctermbg=1 guifg=Red delcommand HiLinkendiflet b:current_syntax = "zsh"" vim: ts=8
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -