mirror of
https://github.com/khaveesh/vim-fish-syntax.git
synced 2026-09-10 07:16:31 -04:00
Added everything
This commit is contained in:
parent
64ae38c966
commit
ea01d4e9ba
6
ftdetect/fish.vim
Normal file
6
ftdetect/fish.vim
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
au BufNewFile,BufRead *.fish set ft=fish
|
||||
|
||||
autocmd BufNewFile,BufRead,StdinReadPost *
|
||||
\ if getline(1) =~ '^#!.*\Wfish\s*$' |
|
||||
\ set ft=fish |
|
||||
\ endif
|
||||
40
ftplugin/fish.vim
Normal file
40
ftplugin/fish.vim
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
setlocal comments=:#
|
||||
setlocal commentstring=#%s
|
||||
setlocal define=\\v^\\s*function>
|
||||
setlocal foldexpr=fish#Fold()
|
||||
setlocal formatoptions+=ron1
|
||||
setlocal formatoptions-=t
|
||||
setlocal include=\\v^\\s*\\.>
|
||||
setlocal suffixesadd^=.fish
|
||||
|
||||
" Use the 'j' format option when available.
|
||||
if v:version ># 703 || v:version ==# 703 && has('patch541')
|
||||
setlocal formatoptions+=j
|
||||
endif
|
||||
|
||||
if executable('fish_indent')
|
||||
setlocal formatexpr=fish#Format()
|
||||
endif
|
||||
|
||||
if executable('fish')
|
||||
setlocal omnifunc=fish#Complete
|
||||
for s:path in split(system("fish -c 'echo $fish_function_path'"))
|
||||
execute 'setlocal path+='.s:path
|
||||
endfor
|
||||
else
|
||||
setlocal omnifunc=syntaxcomplete#Complete
|
||||
endif
|
||||
|
||||
" Use the 'man' wrapper function in fish to include fish's man pages.
|
||||
" Have to use a script for this; 'fish -c man' would make the the man page an
|
||||
" argument to fish instead of man.
|
||||
execute 'setlocal keywordprg=fish\ '.fnameescape(expand('<sfile>:p:h:h').'/bin/man.fish')
|
||||
|
||||
let b:match_words =
|
||||
\ escape('<%(begin|function|if|switch|while|for)>:<end>', '<>%|)')
|
||||
|
||||
let b:endwise_addition = 'end'
|
||||
let b:endwise_words = 'begin,function,if,switch,while,for'
|
||||
let b:endwise_syngroups = 'fishKeyword,fishConditional,fishRepeat'
|
||||
|
||||
endif
|
||||
39
syntax/fish.vim
Normal file
39
syntax/fish.vim
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
if exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax case match
|
||||
|
||||
syntax keyword fishKeyword begin function end
|
||||
syntax keyword fishConditional if else switch
|
||||
syntax keyword fishRepeat while for in
|
||||
syntax keyword fishLabel case
|
||||
|
||||
syntax match fishComment /#.*/
|
||||
syntax match fishSpecial /\\$/
|
||||
syntax match fishIdentifier /\$[[:alnum:]_]\+/
|
||||
syntax region fishString start=/'/ skip=/\\'/ end=/'/
|
||||
syntax region fishString start=/"/ skip=/\\"/ end=/"/ contains=fishIdentifier
|
||||
syntax match fishCharacter /\v\\[abefnrtv *?~%#(){}\[\]<>&;"']|\\[xX][0-9a-f]{1,2}|\\o[0-7]{1,2}|\\u[0-9a-f]{1,4}|\\U[0-9a-f]{1,8}|\\c[a-z]/
|
||||
syntax match fishStatement /\v;\s*\zs\k+>/
|
||||
syntax match fishCommandSub /\v\(\s*\zs\k+>/
|
||||
|
||||
syntax region fishLineContinuation matchgroup=fishStatement
|
||||
\ start='\v^\s*\zs\k+>' skip='\\$' end='$'
|
||||
\ contains=fishSpecial,fishIdentifier,fishString,fishCharacter,fishStatement,fishCommandSub,fishComment
|
||||
|
||||
highlight default link fishKeyword Keyword
|
||||
highlight default link fishConditional Conditional
|
||||
highlight default link fishRepeat Repeat
|
||||
highlight default link fishLabel Label
|
||||
highlight default link fishComment Comment
|
||||
highlight default link fishSpecial Special
|
||||
highlight default link fishIdentifier Identifier
|
||||
highlight default link fishString String
|
||||
highlight default link fishCharacter Character
|
||||
highlight default link fishStatement Statement
|
||||
highlight default link fishCommandSub fishStatement
|
||||
|
||||
let b:current_syntax = 'fish'
|
||||
|
||||
endif
|
||||
Loading…
Reference in a new issue