From d80e11fbbca5e7fcfece73636550588b0eed00af Mon Sep 17 00:00:00 2001 From: "Khaveesh N (MBP)" Date: Tue, 28 Sep 2021 20:38:55 +0530 Subject: [PATCH] Cleanup --- README.md | 4 +++- autoload/fish.vim | 32 -------------------------------- ftdetect/fish.vim | 2 +- ftplugin/fish.vim | 27 ++++++--------------------- 4 files changed, 10 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index cd47054..0997385 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,9 @@ you can use any plugin manager you like. - Syntax highlighting and filetype detection, of course. - Code formatting with `fish_indent`. +- Fold expressions for automatic folding. - Omni-complete from fish using the `^X^O` command. +- Comment strings & matchit patterns. For everything above to work you need to have fish installed in `$PATH` and some Vim features turned on. First, tell Vim to use the syntax and @@ -30,7 +32,7 @@ The above commands are required only for Vim and not for NeoVim. Vim needs a more POSIX compatible shell than fish for certain functionality to work, such as `:%!`, compressed help pages and many third-party addons. If you use fish as your login shell or launch Vim -from fish, you need to set `shell` to something else in your `~/.vimrc`, +from fish, you need to set `shell` to something else in your `vimrc`, for example: ``` {.vim} diff --git a/autoload/fish.vim b/autoload/fish.vim index 6b8720b..8d85083 100644 --- a/autoload/fish.vim +++ b/autoload/fish.vim @@ -42,35 +42,3 @@ function! fish#Complete(findstart, base) abort return l:results endif endfunction - -function! fish#Help(ref) abort - let l:ref = a:ref - if empty(a:ref) - " let l:ref = &filetype ==# 'man' ? expand('') : expand('') - let l:ref = expand('') - if empty(l:ref) - call s:fish_help_error('no identifier under cursor') - return - endif - endif - let l:output = systemlist('fish -c "man -w ' . shellescape(l:ref) . '"') - if v:shell_error - call s:fish_help_error(printf('command exited with code %d: %s', v:shell_error, join(l:output))) - return - endif - aug ft_man_fish - au FileType man - \ setlocal nobuflisted - \ | setlocal keywordprg=:FishHelp' - \ | nnoremap K :FishHelp - \ | nnoremap :FishHelp - aug END - execute 'Man ' . l:output[0] - silent aug! ft_man_fish -endfunction - -function! s:fish_help_error(message) - echohl ErrorMsg - echon 'FishHelp: ' a:message - echohl NONE -endfunction diff --git a/ftdetect/fish.vim b/ftdetect/fish.vim index 85cedff..4cdbca1 100644 --- a/ftdetect/fish.vim +++ b/ftdetect/fish.vim @@ -1,4 +1,4 @@ -au BufNewFile,BufRead *.fish setfiletype fish +autocmd BufNewFile,BufRead *.fish setfiletype fish " Detect fish scripts by the shebang line. autocmd BufNewFile,BufRead,StdinReadPost * diff --git a/ftplugin/fish.vim b/ftplugin/fish.vim index ea8795a..58a05aa 100644 --- a/ftplugin/fish.vim +++ b/ftplugin/fish.vim @@ -10,43 +10,28 @@ setlocal comments=:# setlocal commentstring=#%s setlocal define=\\v^\\s*function> setlocal foldexpr=fish#Fold() -setlocal formatoptions+=n1 +setlocal formatoptions+=jn1 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') setlocal omnifunc=fish#Complete setlocal formatprg=fish_indent endif -command! -nargs=? FishHelp call fish#Help() -setlocal keywordprg=:FishHelp - let b:match_ignorecase = 0 -if has('patch-7.3.1037') - let s:if = '%(else\s\+)\@15:::' - \, '<>%|)') + \ '<%(begin|function|%(else\s\+)\@15' + \ . ':::', + \ '<>%|)') let b:match_skip = 's:comment\|string\|deref' - let b:undo_ftplugin = " \ setlocal comments< commentstring< define< foldexpr< formatoptions< - \|setlocal include< iskeyword< suffixesadd< - \|setlocal formatexpr< omnifunc< formatprg< path< keywordprg< - \|unlet! b:match_words + \ | setlocal include< iskeyword< suffixesadd< omnifunc< formatprg< + \ | unlet! b:match_words b:match_skip b:match_ignorecase \" let &cpo = s:save_cpo