-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
2,292 additions
and
3,432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1 | ||
|
||
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 | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1 | ||
|
||
if exists('current_compiler') | ||
finish | ||
endif | ||
let current_compiler = 'fish' | ||
|
||
CompilerSet makeprg=fish\ --no-execute\ % | ||
execute 'CompilerSet errorformat='.escape(fish#errorformat(), ' ') | ||
|
||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'fish') == -1 | ||
|
||
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 iskeyword=@,48-57,-,_,.,/ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1 | ||
|
||
" Vim filetype plugin | ||
" Language: generic git output | ||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org> | ||
" Last Change: 2013 May 30 | ||
|
||
" Only do this when not done yet for this buffer | ||
if (exists("b:did_ftplugin")) | ||
finish | ||
endif | ||
let b:did_ftplugin = 1 | ||
|
||
if !exists('b:git_dir') | ||
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]' | ||
" Stay out of the way | ||
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees' | ||
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>') | ||
elseif expand('%:p') =~# '\.git\>' | ||
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>') | ||
elseif $GIT_DIR != '' | ||
let b:git_dir = $GIT_DIR | ||
endif | ||
if (has('win32') || has('win64')) && exists('b:git_dir') | ||
let b:git_dir = substitute(b:git_dir,'\\','/','g') | ||
endif | ||
endif | ||
|
||
if exists('*shellescape') && exists('b:git_dir') && b:git_dir != '' | ||
if b:git_dir =~# '/\.git$' " Not a bare repository | ||
let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path | ||
endif | ||
let &l:path = escape(b:git_dir,'\, ').','.&l:path | ||
let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show' | ||
else | ||
setlocal keywordprg=git\ show | ||
endif | ||
if has('gui_running') | ||
let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','') | ||
endif | ||
|
||
setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','') | ||
let b:undo_ftplugin = "setl keywordprg< path< includeexpr<" | ||
|
||
endif |
Oops, something went wrong.