diff options
Diffstat (limited to 'ftplugin')
-rw-r--r-- | ftplugin/fish.vim | 43 | ||||
-rw-r--r-- | ftplugin/git.vim | 45 | ||||
-rw-r--r-- | ftplugin/gitcommit.vim | 68 | ||||
-rw-r--r-- | ftplugin/gitconfig.vim | 19 | ||||
-rw-r--r-- | ftplugin/gitrebase.vim | 49 | ||||
-rw-r--r-- | ftplugin/gitsendemail.vim | 10 | ||||
-rw-r--r-- | ftplugin/julia.vim | 99 |
7 files changed, 99 insertions, 234 deletions
diff --git a/ftplugin/fish.vim b/ftplugin/fish.vim deleted file mode 100644 index c6c1f6d8..00000000 --- a/ftplugin/fish.vim +++ /dev/null @@ -1,43 +0,0 @@ -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 diff --git a/ftplugin/git.vim b/ftplugin/git.vim deleted file mode 100644 index 38b9493b..00000000 --- a/ftplugin/git.vim +++ /dev/null @@ -1,45 +0,0 @@ -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 diff --git a/ftplugin/gitcommit.vim b/ftplugin/gitcommit.vim deleted file mode 100644 index dc6a581a..00000000 --- a/ftplugin/gitcommit.vim +++ /dev/null @@ -1,68 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1 - -" Vim filetype plugin -" Language: git commit file -" 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 - -runtime! ftplugin/git.vim -let b:did_ftplugin = 1 - -setlocal comments=:# commentstring=#\ %s -setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72 -setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q -let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<' - -if exists("g:no_gitcommit_commands") || v:version < 700 - finish -endif - -if !exists("b:git_dir") - let b:git_dir = expand("%:p:h") -endif - -command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) - -let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached" - -function! s:diffcomplete(A,L,P) - let args = "" - if a:P <= match(a:L." -- "," -- ")+3 - let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n" - end - if exists("b:git_dir") && a:A !~ '^-' - let tree = fnamemodify(b:git_dir,':h') - if strpart(getcwd(),0,strlen(tree)) == tree - let args = args."\n".system("git diff --cached --name-only") - endif - endif - return args -endfunction - -function! s:gitdiffcached(bang,gitdir,...) - let tree = fnamemodify(a:gitdir,':h') - let name = tempname() - let git = "git" - if strpart(getcwd(),0,strlen(tree)) != tree - let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"') - endif - if a:0 - let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'")) - else - let extra = "-p --stat=".&columns - endif - call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name)) - exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name) - wincmd P - let b:git_dir = a:gitdir - command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>) - nnoremap <buffer> <silent> q :q<CR> - setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git -endfunction - -endif diff --git a/ftplugin/gitconfig.vim b/ftplugin/gitconfig.vim deleted file mode 100644 index 23282522..00000000 --- a/ftplugin/gitconfig.vim +++ /dev/null @@ -1,19 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1 - -" Vim filetype plugin -" Language: git config file -" Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 - -" Only do this when not done yet for this buffer -if (exists("b:did_ftplugin")) - finish -endif -let b:did_ftplugin = 1 - -setlocal formatoptions-=t formatoptions+=croql -setlocal comments=:#,:; commentstring=;\ %s - -let b:undo_ftplugin = "setl fo< com< cms<" - -endif diff --git a/ftplugin/gitrebase.vim b/ftplugin/gitrebase.vim deleted file mode 100644 index 032aba31..00000000 --- a/ftplugin/gitrebase.vim +++ /dev/null @@ -1,49 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1 - -" Vim filetype plugin -" Language: git rebase --interactive -" Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2010 May 21 - -" Only do this when not done yet for this buffer -if (exists("b:did_ftplugin")) - finish -endif - -runtime! ftplugin/git.vim -let b:did_ftplugin = 1 - -setlocal comments=:# commentstring=#\ %s formatoptions-=t -setlocal nomodeline -if !exists("b:undo_ftplugin") - let b:undo_ftplugin = "" -endif -let b:undo_ftplugin = b:undo_ftplugin."|setl com< cms< fo< ml<" - -function! s:choose(word) - s/^\(\w\+\>\)\=\(\s*\)\ze\x\{4,40\}\>/\=(strlen(submatch(1)) == 1 ? a:word[0] : a:word) . substitute(submatch(2),'^$',' ','')/e -endfunction - -function! s:cycle() - call s:choose(get({'s':'edit','p':'squash','e':'reword','r':'fixup'},getline('.')[0],'pick')) -endfunction - -command! -buffer -bar -range Pick :<line1>,<line2>call s:choose('pick') -command! -buffer -bar -range Squash :<line1>,<line2>call s:choose('squash') -command! -buffer -bar -range Edit :<line1>,<line2>call s:choose('edit') -command! -buffer -bar -range Reword :<line1>,<line2>call s:choose('reword') -command! -buffer -bar -range Fixup :<line1>,<line2>call s:choose('fixup') -command! -buffer -bar -range Drop :<line1>,<line2>call s:choose('drop') -command! -buffer -bar Cycle :call s:cycle() -" The above are more useful when they are mapped; for example: -"nnoremap <buffer> <silent> S :Cycle<CR> - -if exists("g:no_plugin_maps") || exists("g:no_gitrebase_maps") - finish -endif - -nnoremap <buffer> <expr> K col('.') < 7 && expand('<Lt>cword>') =~ '\X' && getline('.') =~ '^\w\+\s\+\x\+\>' ? 'wK' : 'K' - -let b:undo_ftplugin = b:undo_ftplugin . "|nunmap <buffer> K" - -endif diff --git a/ftplugin/gitsendemail.vim b/ftplugin/gitsendemail.vim deleted file mode 100644 index 69e0360e..00000000 --- a/ftplugin/gitsendemail.vim +++ /dev/null @@ -1,10 +0,0 @@ -if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'git') == -1 - -" Vim filetype plugin -" Language: git send-email message -" Maintainer: Tim Pope <vimNOSPAM@tpope.org> -" Last Change: 2009 Dec 24 - -runtime! ftplugin/mail.vim - -endif diff --git a/ftplugin/julia.vim b/ftplugin/julia.vim new file mode 100644 index 00000000..2d1bcb49 --- /dev/null +++ b/ftplugin/julia.vim @@ -0,0 +1,99 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'julia') == -1 + +" Vim filetype plugin file +" Language: Julia +" Maintainer: Carlo Baldassi <carlobaldassi@gmail.com> +" Last Change: 2014 may 29 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo-=C + +setlocal include=^\\s*\\%(reload\\\|include\\)\\> +setlocal suffixesadd=.jl +setlocal comments=:# +setlocal commentstring=#=%s=# +setlocal cinoptions+=#1 +setlocal define=^\\s*macro\\> + +let b:julia_vim_loaded = 1 + +let b:undo_ftplugin = "setlocal include< suffixesadd< comments< commentstring<" + \ . " define< shiftwidth< expandtab< indentexpr< indentkeys< cinoptions< omnifunc<" + \ . " | unlet! b:julia_vim_loaded" + +" MatchIt plugin support +if exists("loaded_matchit") + let b:match_ignorecase = 0 + + " note: begin_keywords must contain all blocks in order + " for nested-structures-skipping to work properly + let b:julia_begin_keywords = '\%(\%(\.\s*\)\@<!\|\%(@\s*.\s*\)\@<=\)\<\%(\%(staged\)\?function\|macro\|begin\|mutable\s\+struct\|\%(mutable\s\+\)\@<!struct\|\%(abstract\|primitive\)\s\+type\|\%(\(abstract\|primitive\)\s\+\)\@<!type\|immutable\|let\|do\|\%(bare\)\?module\|quote\|if\|for\|while\|try\)\>' + let s:macro_regex = '@\%(#\@!\S\)\+\s\+' + let s:nomacro = '\%(' . s:macro_regex . '\)\@<!' + let s:yesmacro = s:nomacro . '\%('. s:macro_regex . '\)\+' + let b:julia_begin_keywordsm = '\%(' . s:yesmacro . b:julia_begin_keywords . '\)\|' + \ . '\%(' . s:nomacro . b:julia_begin_keywords . '\)' + let b:julia_end_keywords = '\<end\>' + + " note: this function relies heavily on the syntax file + function! JuliaGetMatchWords() + let [l,c] = [line('.'),col('.')] + let attr = synIDattr(synID(l, c, 1),"name") + let c1 = c + while attr == 'juliaMacro' + normal! W + if line('.') > l || col('.') == c1 + call cursor(l, c) + return '' + endif + let attr = synIDattr(synID(l, col('.'), 1),"name") + let c1 = col('.') + endwhile + call cursor(l, c) + if attr == 'juliaConditional' + return b:julia_begin_keywordsm . ':\<\%(elseif\|else\)\>:' . b:julia_end_keywords + elseif attr =~ '\<\%(juliaRepeat\|juliaRepKeyword\)\>' + return b:julia_begin_keywordsm . ':\<\%(break\|continue\)\>:' . b:julia_end_keywords + elseif attr == 'juliaBlKeyword' + return b:julia_begin_keywordsm . ':' . b:julia_end_keywords + elseif attr == 'juliaException' + return b:julia_begin_keywordsm . ':\<\%(catch\|finally\)\>:' . b:julia_end_keywords + endif + return '\<\>:\<\>' + endfunction + + let b:match_words = 'JuliaGetMatchWords()' + + " we need to skip everything within comments, strings and + " the 'end' keyword when it is used as a range rather than as + " the end of a block + let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") =~ ' + \ . '"\\<julia\\%(Comprehension\\%(For\\|If\\)\\|RangeEnd\\|SymbolS\\?\\|Comment[LM]\\|\\%([bv]\\|ip\\|MIME\\|Shell\\|Doc\\)\\?String\\|RegEx\\)\\>"' + + let b:undo_ftplugin = b:undo_ftplugin + \ . " | unlet! b:match_words b:match_skip b:match_ignorecase" + \ . " | unlet! b:julia_begin_keywords b:julia_end_keywords" + \ . " | delfunction JuliaGetMatchWords" + \ . " | call julia_blocks#remove_mappings()" + + if get(g:, "julia_blocks", 1) + call julia_blocks#init_mappings() + let b:undo_ftplugin .= " | call julia_blocks#remove_mappings()" + endif + +endif + +if has("gui_win32") + let b:browsefilter = "Julia Source Files (*.jl)\t*.jl\n" + let b:undo_ftplugin = b:undo_ftplugin . " | unlet! b:browsefilter" +endif + +let &cpo = s:save_cpo +unlet s:save_cpo + +endif |