Overview
Comment: | Partially import github.com/dag/vim-fish |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a1f4539621ede3656e4c0e3b811ebd09 |
User & Date: | js 2020-02-20 21:29:06 |
Context
2020-02-20
| ||
21:30 | vimrc: Add autocmd for fish check-in: 5bf7d8036d user: js tags: trunk | |
21:29 | Partially import github.com/dag/vim-fish check-in: a1f4539621 user: js tags: trunk | |
21:16 | fish: Add run command to run a command in the bg check-in: 92789c0ee5 user: js tags: trunk | |
Changes
Added vim/autoload/fish.vim.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | function! fish#Indent() let l:shiftwidth = shiftwidth() let l:prevlnum = prevnonblank(v:lnum - 1) if l:prevlnum ==# 0 return 0 endif let l:indent = 0 let l:prevline = getline(l:prevlnum) if l:prevline =~# '\v^\s*switch>' let l:indent = l:shiftwidth * 2 elseif l:prevline =~# '\v^\s*%(begin|if|else|while|for|function|case)>' let l:indent = l:shiftwidth endif let l:line = getline(v:lnum) if l:line =~# '\v^\s*end>' return indent(v:lnum) - (l:indent ==# 0 ? l:shiftwidth : l:indent) elseif l:line =~# '\v^\s*%(case|else)>' return indent(v:lnum) - l:shiftwidth endif return indent(l:prevlnum) + l:indent endfunction function! fish#Format() if mode() =~# '\v^%(i|R)$' return 1 else let l:command = v:lnum.','.(v:lnum+v:count-1).'!fish_indent' echo l:command execute l:command endif endfunction function! fish#Fold() let l:line = getline(v:lnum) if l:line =~# '\v^\s*%(begin|if|while|for|function|switch)>' return 'a1' elseif l:line =~# '\v^\s*end>' return 's1' else return '=' end endfunction function! fish#Complete(findstart, base) if a:findstart return getline('.') =~# '\v^\s*$' ? -1 : 0 else if empty(a:base) return [] endif let l:results = [] let l:completions = \ system('fish -c "complete -C'.shellescape(a:base).'"') let l:cmd = substitute(a:base, '\v\S+$', '', '') for l:line in split(l:completions, '\n') let l:tokens = split(l:line, '\t') call add(l:results, {'word': l:cmd.l:tokens[0], \'abbr': l:tokens[0], \'menu': get(l:tokens, 1, '')}) endfor return l:results endif endfunction function! fish#errorformat() return '%Afish: %m,%-G%*\\ ^,%-Z%f (line %l):%s' endfunction |
Added vim/ftdetect/fish.vim.
> > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | autocmd BufRead,BufNewFile *.fish setfiletype fish " Detect fish scripts by the shebang line. autocmd BufRead * \ if getline(1) =~# '\v^#!%(\f*/|/usr/bin/env\s*<)fish>' | \ setlocal filetype=fish | \ endif " Move cursor to first empty line when using funced. autocmd BufRead fish_funced_*_*.fish call search('^$') " Fish histories are YAML documents. autocmd BufRead,BufNewFile ~/.config/fish/fish_{read_,}history setfiletype yaml " Universal variable storages should not be hand edited. autocmd BufRead,BufNewFile ~/.config/fish/fishd.* setlocal readonly " Mimic `funced` when manually creating functions. autocmd BufNewFile ~/.config/fish/functions/*.fish \ call append(0, ['function '.expand('%:t:r'), \'', \'end']) | \ 2 |
Added vim/indent/fish.vim.
> > | 1 2 | setlocal indentexpr=fish#Indent() setlocal indentkeys+==end,=else,=case |
Added vim/syntax/fish.vim.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 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' |