diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-10-16 15:23:36 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-10-16 15:23:36 +0100 |
commit | 2286304cdbba53ceb52b3ba2ba4a521b0a2f8d0f (patch) | |
tree | 05a0b3be618b14dc1dd6e9ee6d6389c4923dfa50 /runtime/ftplugin | |
parent | 28b6a3bef6d25d36c049bb731ced496155f7f9c0 (diff) | |
download | vim-git-2286304cdbba53ceb52b3ba2ba4a521b0a2f8d0f.tar.gz |
Update runtime files
Diffstat (limited to 'runtime/ftplugin')
-rw-r--r-- | runtime/ftplugin/context.vim | 67 | ||||
-rw-r--r-- | runtime/ftplugin/csh.vim | 49 | ||||
-rw-r--r-- | runtime/ftplugin/tcsh.vim | 21 | ||||
-rw-r--r-- | runtime/ftplugin/tmux.vim | 3 | ||||
-rw-r--r-- | runtime/ftplugin/toml.vim | 23 |
5 files changed, 101 insertions, 62 deletions
diff --git a/runtime/ftplugin/context.vim b/runtime/ftplugin/context.vim index 10f1ae164..37f7240d7 100644 --- a/runtime/ftplugin/context.vim +++ b/runtime/ftplugin/context.vim @@ -2,7 +2,7 @@ " Language: ConTeXt typesetting engine " Maintainer: Nicola Vitacolonna <nvitacolonna@gmail.com> " Former Maintainers: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2016 Oct 30 +" Latest Revision: 2021 Oct 15 if exists("b:did_ftplugin") finish @@ -17,7 +17,6 @@ if !exists('current_compiler') endif let b:undo_ftplugin = "setl com< cms< def< inc< sua< fo< ofu<" - \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" setlocal comments=b:%D,b:%C,b:%M,:% commentstring=%\ %s formatoptions+=tjcroql2 if get(b:, 'context_metapost', get(g:, 'context_metapost', 1)) @@ -35,11 +34,12 @@ let &l:include = '^\s*\\\%(input\|component\|product\|project\|environment\)' setlocal suffixesadd=.tex -if exists("loaded_matchit") +if exists("loaded_matchit") && !exists("b:match_words") let b:match_ignorecase = 0 let b:match_skip = 'r:\\\@<!\%(\\\\\)*%' let b:match_words = '(:),\[:],{:},\\(:\\),\\\[:\\],' . \ '\\start\(\a\+\):\\stop\1' + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words b:match_skip" endif let s:context_regex = { @@ -57,19 +57,28 @@ function! s:move_around(count, what, flags, visual) call map(range(2, a:count), 'search(s:context_regex[a:what], a:flags)') endfunction -" Move around macros. -nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> -vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> -nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> -vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> -nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> -vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> -nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> -vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> -nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> -vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> -nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> -vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> +if !exists("no_plugin_maps") && !exists("no_context_maps") + " Move around macros. + nnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:false) <CR> + vnoremap <silent><buffer> [[ :<C-U>call <SID>move_around(v:count1, "beginsection", "bW", v:true) <CR> + nnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:false) <CR> + vnoremap <silent><buffer> ]] :<C-U>call <SID>move_around(v:count1, "beginsection", "W", v:true) <CR> + nnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:false) <CR> + vnoremap <silent><buffer> [] :<C-U>call <SID>move_around(v:count1, "endsection", "bW", v:true) <CR> + nnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:false) <CR> + vnoremap <silent><buffer> ][ :<C-U>call <SID>move_around(v:count1, "endsection", "W", v:true) <CR> + nnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:false) <CR> + vnoremap <silent><buffer> [{ :<C-U>call <SID>move_around(v:count1, "beginblock", "bW", v:true) <CR> + nnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:false) <CR> + vnoremap <silent><buffer> ]} :<C-U>call <SID>move_around(v:count1, "endblock", "W", v:true) <CR> + + let b:undo_ftplugin .= " | sil! exe 'nunmap <buffer> [[' | sil! exe 'vunmap <buffer> [['" . + \ " | sil! exe 'nunmap <buffer> ]]' | sil! exe 'vunmap <buffer> ]]'" . + \ " | sil! exe 'nunmap <buffer> []' | sil! exe 'vunmap <buffer> []'" . + \ " | sil! exe 'nunmap <buffer> ][' | sil! exe 'vunmap <buffer> ]['" . + \ " | sil! exe 'nunmap <buffer> [{' | sil! exe 'vunmap <buffer> [{'" . + \ " | sil! exe 'nunmap <buffer> ]}' | sil! exe 'vunmap <buffer> ]}'" +end " Other useful mappings if get(g:, 'context_mappings', 1) @@ -81,16 +90,22 @@ if get(g:, 'context_mappings', 1) call cursor(search(s:tp_regex, 'W') - 1, 1) endf - " Reflow paragraphs with commands like gqtp ("gq TeX paragraph") - onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr> - " Select TeX paragraph - vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr> - - " $...$ text object - onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr> - onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr> - vnoremap <buffer> i$ T$ot$ - vnoremap <buffer> a$ F$of$ + if !exists("no_plugin_maps") && !exists("no_context_maps") + " Reflow paragraphs with commands like gqtp ("gq TeX paragraph") + onoremap <silent><buffer> tp :<c-u>call <sid>tp()<cr> + " Select TeX paragraph + vnoremap <silent><buffer> tp <esc>:<c-u>call <sid>tp()<cr> + + " $...$ text object + onoremap <silent><buffer> i$ :<c-u>normal! T$vt$<cr> + onoremap <silent><buffer> a$ :<c-u>normal! F$vf$<cr> + vnoremap <buffer> i$ T$ot$ + vnoremap <buffer> a$ F$of$ + + let b:undo_ftplugin .= " | sil! exe 'ounmap <buffer> tp' | sil! exe 'vunmap <buffer> tp'" . + \ " | sil! exe 'ounmap <buffer> i$' | sil! exe 'vunmap <buffer> i$'" . + \ " | sil! exe 'ounmap <buffer> a$' | sil! exe 'vunmap <buffer> a$'" + endif endif " Commands for asynchronous typesetting diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim index 4ae09f91b..929823219 100644 --- a/runtime/ftplugin/csh.vim +++ b/runtime/ftplugin/csh.vim @@ -1,21 +1,23 @@ " Vim filetype plugin file -" Language: csh -" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> -" Last Changed: 20 Jan 2009 -" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin +" Language: csh +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> +" Contributor: Johannes Zellner <johannes@zellner.org> +" Last Change: 2021 Oct 15 if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 -" Make sure the continuation lines below do not cause problems in -" compatibility mode. let s:save_cpo = &cpo set cpo-=C +setlocal comments=:# setlocal commentstring=#%s setlocal formatoptions-=t setlocal formatoptions+=crql +let b:undo_ftplugin = "setlocal com< cms< fo<" + " Csh: thanks to Johannes Zellner " - Both foreach and end must appear alone on separate lines. " - The words else and endif must appear at the beginning of input lines; @@ -23,26 +25,27 @@ setlocal formatoptions+=crql " - Each case label and the default label must appear at the start of a " line. " - while and end must appear alone on their input lines. -if exists("loaded_matchit") - let b:match_words = - \ '^\s*\<if\>.*(.*).*\<then\>:'. - \ '^\s*\<else\>\s\+\<if\>.*(.*).*\<then\>:^\s*\<else\>:'. - \ '^\s*\<endif\>,'. - \ '\%(^\s*\<foreach\>\s\+\S\+\|^s*\<while\>\).*(.*):'. - \ '\<break\>:\<continue\>:^\s*\<end\>,'. - \ '^\s*\<switch\>.*(.*):^\s*\<case\>\s\+:^\s*\<default\>:^\s*\<endsw\>' +if exists("loaded_matchit") && !exists("b:match_words") + let s:line_start = '\%(^\s*\)\@<=' + let b:match_words = + \ s:line_start .. 'if\s*(.*)\s*then\>:' .. + \ s:line_start .. 'else\s\+if\s*(.*)\s*then\>:' .. s:line_start .. 'else\>:' .. + \ s:line_start .. 'endif\>,' .. + \ s:line_start .. '\%(\<foreach\s\+\h\w*\|while\)\s*(:' .. + \ '\<break\>:\<continue\>:' .. + \ s:line_start .. 'end\>,' .. + \ s:line_start .. 'switch\s*(:' .. + \ s:line_start .. 'case\s\+:' .. s:line_start .. 'default\>:\<breaksw\>:' .. + \ s:line_start .. 'endsw\>' + unlet s:line_start + let b:undo_ftplugin ..= " | unlet b:match_words" endif -" Change the :browse e filter to primarily show csh-related files. -if has("gui_win32") - let b:browsefilter="csh Scripts (*.csh)\t*.csh\n" . - \ "All Files (*.*)\t*.*\n" +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter="csh Scripts (*.csh)\t*.csh\n" .. + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin ..= " | unlet b:browsefilter" endif -" Undo the stuff we changed. -let b:undo_ftplugin = "setlocal commentstring< formatoptions<" . - \ " | unlet! b:match_words b:browsefilter" - -" Restore the saved compatibility options. let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/ftplugin/tcsh.vim b/runtime/ftplugin/tcsh.vim index 7e2d95993..33f1aabf6 100644 --- a/runtime/ftplugin/tcsh.vim +++ b/runtime/ftplugin/tcsh.vim @@ -1,19 +1,17 @@ " Vim filetype plugin file -" Language: tcsh -" Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> -" Last Changed: 20 Jan 2009 -" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin +" Language: tcsh +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> +" Last Change: 2021 Oct 15 if exists("b:did_ftplugin") | finish | endif -" Make sure the continuation lines below do not cause problems in -" compatibility mode. let s:save_cpo = &cpo set cpo-=C " Define some defaults in case the included ftplugins don't set them. let s:undo_ftplugin = "" -let s:browsefilter = "csh Files (*.csh)\t*.csh\n" . +let s:browsefilter = "csh Files (*.csh)\t*.csh\n" .. \ "All Files (*.*)\t*.*\n" runtime! ftplugin/csh.vim ftplugin/csh_*.vim ftplugin/csh/*.vim @@ -27,14 +25,11 @@ if exists("b:browsefilter") let s:browsefilter = b:browsefilter endif -" Change the :browse e filter to primarily show tcsh-related files. -if has("gui_win32") - let b:browsefilter="tcsh Scripts (*.tcsh)\t*.tcsh\n" . s:browsefilter +if (has("gui_win32") || has("gui_gtk")) + let b:browsefilter="tcsh Scripts (*.tcsh)\t*.tcsh\n" .. s:browsefilter endif -" Undo the stuff we changed. -let b:undo_ftplugin = "unlet! b:browsefilter | " . s:undo_ftplugin +let b:undo_ftplugin = "unlet! b:browsefilter | " .. s:undo_ftplugin -" Restore the saved compatibility options. let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/ftplugin/tmux.vim b/runtime/ftplugin/tmux.vim index ed9154924..5c3461fef 100644 --- a/runtime/ftplugin/tmux.vim +++ b/runtime/ftplugin/tmux.vim @@ -9,4 +9,7 @@ if exists("b:did_ftplugin") endif let b:did_ftplugin = 1 +let b:undo_ftplugin = "setlocal comments< commentstring<" + +setlocal comments=:# setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/toml.vim b/runtime/ftplugin/toml.vim new file mode 100644 index 000000000..1ef09a16e --- /dev/null +++ b/runtime/ftplugin/toml.vim @@ -0,0 +1,23 @@ +" Vim filetype plugin +" Language: TOML +" Homepage: https://github.com/cespare/vim-toml +" Maintainer: Aman Verma +" Author: Kevin Ballard <kevin@sb.org> +" Last Change: Sep 21, 2021 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim +let b:undo_ftplugin = 'setlocal commentstring< comments<' + +setlocal commentstring=#\ %s +setlocal comments=:# + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim: et sw=2 sts=2 |