diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
commit | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch) | |
tree | d8c1843a95da5ea0bb4acc09f7e37843d9995c86 /runtime/ftplugin | |
parent | 142d9041391780ac15b89886a54015fdc5c73995 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-userreg.tar.gz rneovim-userreg.tar.bz2 rneovim-userreg.zip |
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'runtime/ftplugin')
97 files changed, 1142 insertions, 359 deletions
diff --git a/runtime/ftplugin/aap.vim b/runtime/ftplugin/aap.vim index b5065e5157..df839c99ae 100644 --- a/runtime/ftplugin/aap.vim +++ b/runtime/ftplugin/aap.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Aap recipe -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2021 Nov 14 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/abap.vim b/runtime/ftplugin/abap.vim index 956b002ecd..61db8093fb 100644 --- a/runtime/ftplugin/abap.vim +++ b/runtime/ftplugin/abap.vim @@ -3,6 +3,7 @@ " Author: Steven Oliver <oliver.steven@gmail.com> " Copyright: Copyright (c) 2013 Steven Oliver " License: You may redistribute this under the same terms as Vim itself +" Last Change: 2023 Aug 28 by Vim Project (undo_ftplugin) " -------------------------------------------------------------------------- " Only do this when not done yet for this buffer @@ -17,10 +18,13 @@ set cpo&vim setlocal softtabstop=2 shiftwidth=2 setlocal suffixesadd=.abap +let b:undo_ftplugin = "setl sts< sua< sw<" + " Windows allows you to filter the open file dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "ABAP Source Files (*.abap)\t*.abap\n" . \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/art.vim b/runtime/ftplugin/art.vim index c501a992d8..41b02a94e5 100644 --- a/runtime/ftplugin/art.vim +++ b/runtime/ftplugin/art.vim @@ -3,6 +3,7 @@ " Maintainer: Dorai Sitaram <ds26@gte.com> " URL: http://www.ccs.neu.edu/~dorai/vimplugins/vimplugins.html " Last Change: Apr 2, 2003 +" 2023 Aug 28 by Vim Project (undo_ftplugin) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -13,3 +14,5 @@ run ftplugin/lisp.vim setl lw-=if setl lw+=def-art-fun,deffacts,defglobal,defrule,defschema,for,schema,while + +let b:undo_ftplugin ..= " | setl lw<" diff --git a/runtime/ftplugin/asm.vim b/runtime/ftplugin/asm.vim index 0914bf634a..f6a92d57d7 100644 --- a/runtime/ftplugin/asm.vim +++ b/runtime/ftplugin/asm.vim @@ -1,11 +1,13 @@ " Vim filetype plugin file " Language: asm " Maintainer: Colin Caine <cmcaine at the common googlemail domain> -" Last Changed: 23 May 2020 +" Last Change: 23 May 2020 +" 2023 Aug 28 by Vim Project (undo_ftplugin) if exists("b:did_ftplugin") | finish | endif +let b:did_ftplugin = 1 setl comments=:;,s1:/*,mb:*,ex:*/,:// setl commentstring=;%s -let b:did_ftplugin = 1 +let b:undo_ftplugin = "setl commentstring< comments<" diff --git a/runtime/ftplugin/awk.vim b/runtime/ftplugin/awk.vim index 1bca3ad3cf..40fe304cf4 100644 --- a/runtime/ftplugin/awk.vim +++ b/runtime/ftplugin/awk.vim @@ -37,11 +37,14 @@ if exists("g:awk_is_gawk") let b:undo_ftplugin .= " | setl fp<" endif - let path = system("gawk 'BEGIN { printf ENVIRON[\"AWKPATH\"] }'") - let path = substitute(path, '^\.\=:\|:\.\=$\|:\.\=:', ',,', 'g') " POSIX cwd - let path = substitute(path, ':', ',', 'g') + " Disabled by default for security reasons. + if dist#vim#IsSafeExecutable('awk', 'gawk') + let path = system("gawk 'BEGIN { printf ENVIRON[\"AWKPATH\"] }'") + let path = substitute(path, '^\.\=:\|:\.\=$\|:\.\=:', ',,', 'g') " POSIX cwd + let path = substitute(path, ':', ',', 'g') - let &l:path = path + let &l:path = path + endif let b:undo_ftplugin .= " | setl inc< path<" endif diff --git a/runtime/ftplugin/bash.vim b/runtime/ftplugin/bash.vim index 7bd9787b6c..7be1eca2a9 100644 --- a/runtime/ftplugin/bash.vim +++ b/runtime/ftplugin/bash.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: bash -" Maintainer: Bram Moolenaar -" Last Changed: 2019 Jan 12 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Changed: 2023 Aug 13 " " This is not a real filetype plugin. It allows for someone to set 'filetype' " to "bash" in the modeline, and gets the effect of filetype "sh" with diff --git a/runtime/ftplugin/btm.vim b/runtime/ftplugin/btm.vim index d3dc5b75f5..1c2c68599d 100644 --- a/runtime/ftplugin/btm.vim +++ b/runtime/ftplugin/btm.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: BTM -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2004 Jul 06 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/bzl.vim b/runtime/ftplugin/bzl.vim index 8ab876e9d6..716b3890b1 100644 --- a/runtime/ftplugin/bzl.vim +++ b/runtime/ftplugin/bzl.vim @@ -2,6 +2,7 @@ " Language: Bazel (http://bazel.io) " Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) " Last Change: 2021 Jan 19 +" 2023 Aug 28 by Vim Project (undo_ftplugin) "" " @section Introduction, intro @@ -41,6 +42,9 @@ let &l:tabstop = s:save_tabstop setlocal formatoptions-=t +" Initially defined in the python ftplugin sourced above +let b:undo_ftplugin .= " | setlocal fo<" + " Make gf work with imports in BUILD files. setlocal includeexpr=substitute(v:fname,'//','','') @@ -48,6 +52,7 @@ setlocal includeexpr=substitute(v:fname,'//','','') if get(g:, 'ft_bzl_fold', 0) setlocal foldmethod=syntax setlocal foldtext=BzlFoldText() + let b:undo_ftplugin .= " | setlocal fdm< fdt<" endif if exists('*BzlFoldText') diff --git a/runtime/ftplugin/c.lua b/runtime/ftplugin/c.lua new file mode 100644 index 0000000000..0ddbf09470 --- /dev/null +++ b/runtime/ftplugin/c.lua @@ -0,0 +1,14 @@ +-- These are the default option values in Vim, but not in Nvim, so must be set explicitly. +vim.bo.commentstring = '/*%s*/' +vim.bo.define = '^\\s*#\\s*define' +vim.bo.include = '^\\s*#\\s*include' + +if vim.fn.isdirectory('/usr/include') == 1 then + vim.cmd([[ + setlocal path^=/usr/include + setlocal path-=. + setlocal path^=. + ]]) +end + +vim.b.undo_ftplugin = vim.b.undo_ftplugin .. '|setl path<' diff --git a/runtime/ftplugin/c.vim b/runtime/ftplugin/c.vim index cfaf26f66c..83fb9ead68 100644 --- a/runtime/ftplugin/c.vim +++ b/runtime/ftplugin/c.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: C -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2022 Apr 08 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/calender.lua b/runtime/ftplugin/calender.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/calender.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim index e9df63f8c9..ab73949be5 100644 --- a/runtime/ftplugin/changelog.vim +++ b/runtime/ftplugin/changelog.vim @@ -55,13 +55,19 @@ if &filetype == 'changelog' elseif $EMAIL_ADDRESS != "" return $EMAIL_ADDRESS endif + let s:default_login = 'unknown' - let login = s:login() + " Disabled by default for security reasons. + if dist#vim#IsSafeExecutable('changelog', 'whoami') + let login = s:login() + else + let login = s:default_login + endif return printf('%s <%s@%s>', s:name(login), login, s:hostname()) endfunction function! s:login() - return s:trimmed_system_with_default('whoami', 'unknown') + return s:trimmed_system_with_default('whoami', s:default_login) endfunction function! s:trimmed_system_with_default(command, default) @@ -71,7 +77,7 @@ if &filetype == 'changelog' function! s:system_with_default(command, default) let output = system(a:command) if v:shell_error - return default + return a:default endif return output endfunction diff --git a/runtime/ftplugin/checkhealth.vim b/runtime/ftplugin/checkhealth.vim index 62a1970b4a..4b530e6f7c 100644 --- a/runtime/ftplugin/checkhealth.vim +++ b/runtime/ftplugin/checkhealth.vim @@ -9,6 +9,9 @@ endif runtime! ftplugin/help.vim setlocal wrap breakindent linebreak +setlocal foldexpr=getline(v:lnum-1)=~'^=\\{78}$'?'>1':(getline(v:lnum)=~'^=\\{78}'?0:'=') +setlocal foldmethod=expr +setlocal foldtext=v:lua.require('vim.health').foldtext() let &l:iskeyword='!-~,^*,^|,^",192-255' if exists("b:undo_ftplugin") diff --git a/runtime/ftplugin/corn.vim b/runtime/ftplugin/corn.vim new file mode 100644 index 0000000000..2259442229 --- /dev/null +++ b/runtime/ftplugin/corn.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin +" Language: Corn +" Original Author: Jake Stanger (mail@jstanger.dev) +" License: MIT +" Last Change: 2023 May 28 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setlocal formatoptions-=t + +" Set comment (formatting) related options. +setlocal commentstring=//\ %s comments=:// + +" Let Vim know how to disable the plug-in. +let b:undo_ftplugin = 'setlocal commentstring< comments< formatoptions<' diff --git a/runtime/ftplugin/cpp.vim b/runtime/ftplugin/cpp.vim index 58c4e4b24a..cb425aa8e7 100644 --- a/runtime/ftplugin/cpp.vim +++ b/runtime/ftplugin/cpp.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: C++ -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2020 Jul 26 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/cs.lua b/runtime/ftplugin/cs.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/cs.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim index ca5da5a8b9..2feec57bb2 100644 --- a/runtime/ftplugin/csh.vim +++ b/runtime/ftplugin/csh.vim @@ -3,9 +3,11 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Dan Sharp " Contributor: Johannes Zellner <johannes@zellner.org> -" Last Change: 2021 Oct 15 +" Last Change: 2023 Oct 09 -if exists("b:did_ftplugin") | finish | endif +if exists("b:did_ftplugin") + finish +endif let b:did_ftplugin = 1 let s:save_cpo = &cpo @@ -18,7 +20,7 @@ setlocal formatoptions+=crql let b:undo_ftplugin = "setlocal com< cms< fo<" -" Csh: thanks to Johannes Zellner +" 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; " the if must appear alone on its input line or after an else. @@ -38,13 +40,14 @@ if exists("loaded_matchit") && !exists("b:match_words") \ 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" + let b:undo_ftplugin ..= " | unlet! b:match_words" endif 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" + let b:browsefilter = "csh Scripts (*.csh)\t*.csh\n" .. + \ "All Files (*.*)\t*.*\n" + let b:csh_set_browsefilter = 1 + let b:undo_ftplugin ..= " | unlet! b:browsefilter b:csh_set_browsefilter" endif let &cpo = s:save_cpo diff --git a/runtime/ftplugin/css.lua b/runtime/ftplugin/css.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/css.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/d.lua b/runtime/ftplugin/d.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/d.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/debchangelog.vim b/runtime/ftplugin/debchangelog.vim index cf8dd17c44..aa657a9b97 100644 --- a/runtime/ftplugin/debchangelog.vim +++ b/runtime/ftplugin/debchangelog.vim @@ -3,9 +3,9 @@ " Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org> " Former Maintainers: Michael Piefel <piefel@informatik.hu-berlin.de> " Stefano Zacchiroli <zack@debian.org> -" Last Change: 2022 Jul 25 +" Last Change: 2023 Aug 18 " License: Vim License -" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debchangelog.vim +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debchangelog.vim " Bug completion requires apt-listbugs installed for Debian packages or " python-launchpadlib installed for Ubuntu packages @@ -35,14 +35,14 @@ if exists('g:did_changelog_ftplugin') finish endif +" Don't load another plugin (this is global) +let g:did_changelog_ftplugin = 1 + " Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise " <CR> would not be recognized. See ":help 'cpoptions'". let s:cpo_save = &cpo set cpo&vim -" Don't load another plugin (this is global) -let g:did_changelog_ftplugin = 1 - " {{{1 GUI menu " Helper functions returning various data. @@ -122,7 +122,7 @@ function NewVersion() normal! 1G0 call search(')') normal! h - " ':normal' doens't support key annotation (<c-a>) directly. + " ':normal' doesn't support key annotation (<c-a>) directly. " Vim's manual recommends using ':exe' to use key annotation indirectly (backslash-escaping needed though). exe "normal! \<c-a>" call setline(1, substitute(getline(1), '-\$\$', '-', '')) diff --git a/runtime/ftplugin/debcontrol.vim b/runtime/ftplugin/debcontrol.vim index 3a6e39a682..bb710e597c 100644 --- a/runtime/ftplugin/debcontrol.vim +++ b/runtime/ftplugin/debcontrol.vim @@ -2,8 +2,8 @@ " Language: Debian control files " Maintainer: Debian Vim Maintainers " Former Maintainer: Pierre Habouzit <madcoder@debian.org> -" Last Change: 2018-01-28 -" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/debcontrol.vim +" Last Change: 2023 Jan 16 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debcontrol.vim " Do these settings once per buffer if exists('b:did_ftplugin') diff --git a/runtime/ftplugin/debsources.vim b/runtime/ftplugin/debsources.vim new file mode 100644 index 0000000000..cbb4fafd22 --- /dev/null +++ b/runtime/ftplugin/debsources.vim @@ -0,0 +1,16 @@ +" Language: Debian sources.list +" Maintainer: Debian Vim Maintainers <team+vim@tracker.debian.org> +" Last Change: 2023 Aug 30 +" License: Vim License +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/debsources.vim + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin=1 + +setlocal comments=:# +setlocal commentstring=#%s +setlocal formatoptions-=t + +let b:undo_ftplugin = 'setlocal comments< commentstring< formatoptions<' diff --git a/runtime/ftplugin/diff.vim b/runtime/ftplugin/diff.vim index bf37d464c0..f2a0820be9 100644 --- a/runtime/ftplugin/diff.vim +++ b/runtime/ftplugin/diff.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Diff -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2021 Nov 14 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim index 0c5cde2503..f02f26b1fd 100644 --- a/runtime/ftplugin/dosbatch.vim +++ b/runtime/ftplugin/dosbatch.vim @@ -1,7 +1,10 @@ " Vim filetype plugin file -" Language: MS-DOS .bat files -" Maintainer: Mike Williams <mrw@eandem.co.uk> -" Last Change: 7th May 2020 +" Language: MS-DOS/Windows .bat files +" Maintainer: Mike Williams <mrmrdubya@gmail.com> +" Last Change: 12th February 2023 +" +" Options Flags: +" dosbatch_colons_comment - any value to treat :: as comment line " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -15,8 +18,13 @@ let s:cpo_save = &cpo set cpo&vim " BAT comment formatting -setlocal comments=b:rem,b:@rem,b:REM,b:@REM,::: -setlocal commentstring=::\ %s +setlocal comments=b:rem,b:@rem,b:REM,b:@REM +if exists("dosbatch_colons_comment") + setlocal comments+=::: + setlocal commentstring=::\ %s +else + setlocal commentstring=REM\ %s +endif setlocal formatoptions-=t formatoptions+=rol " Lookup DOS keywords using Windows command help. diff --git a/runtime/ftplugin/dune.vim b/runtime/ftplugin/dune.vim index 86c99c097f..6e20a8fabb 100644 --- a/runtime/ftplugin/dune.vim +++ b/runtime/ftplugin/dune.vim @@ -3,8 +3,9 @@ " Anton Kochkov <anton.kochkov@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: -" 2018 Nov 3 - Added commentstring (Markus Mottl) -" 2017 Sep 6 - Initial version (Etienne Millon) +" 2023 Aug 28 - Added undo_ftplugin (Vim Project) +" 2018 Nov 03 - Added commentstring (Markus Mottl) +" 2017 Sep 06 - Initial version (Etienne Millon) if exists("b:did_ftplugin") finish @@ -18,3 +19,5 @@ setl commentstring=;\ %s setl comments=:; setl iskeyword+=#,?,.,/ + +let b:undo_ftplugin = "setl lisp< cms< com< isk<" diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index e67b00b278..893fa58d32 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -3,7 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2020 Jun 28 +" Last Change: 2022 May 15 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -86,8 +86,12 @@ runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim let b:did_ftplugin = 1 " Combine the new set of values with those previously included. -if exists("b:undo_ftplugin") - let s:undo_ftplugin = b:undo_ftplugin . " | " . s:undo_ftplugin +if !exists('b:undo_ftplugin') + " No-op + let b:undo_ftplugin = 'exe' +endif +if !empty(s:undo_ftplugin) + let b:undo_ftplugin .= '|' . s:undo_ftplugin endif if exists ("b:browsefilter") let s:browsefilter = substitute(b:browsefilter,'\cAll Files (\*\.\*)\t\*\.\*\n','','') . s:browsefilter @@ -119,7 +123,7 @@ endif setlocal commentstring=<%#%s%> let b:undo_ftplugin = "setl cms< " . - \ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin + \ " | unlet! b:browsefilter b:match_words | " . b:undo_ftplugin let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/ftplugin/fennel.vim b/runtime/ftplugin/fennel.vim index 2e502699c5..93cf366726 100644 --- a/runtime/ftplugin/fennel.vim +++ b/runtime/ftplugin/fennel.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Fennel " Maintainer: Gregory Anders <greg[NOSPAM]@gpanders.com> -" Last Update: 2022 Apr 20 +" Last Update: 2023 Jun 9 if exists('b:did_ftplugin') finish @@ -13,6 +13,6 @@ setlocal comments=:;;,:; setlocal formatoptions-=t setlocal suffixesadd=.fnl setlocal lisp -setlocal lispwords=accumulate,collect,do,doto,each,eval-compiler,fn,for,icollect,lambda,let,macro,macros,match,match-try,when,while,with-open +setlocal lispwords=accumulate,case,case-try,collect,do,doto,each,eval-compiler,faccumulate,fcollect,fn,for,icollect,lambda,let,macro,macros,match,match-try,when,while,with-open let b:undo_ftplugin = 'setlocal commentstring< comments< formatoptions< suffixesadd< lisp< lispwords<' diff --git a/runtime/ftplugin/fish.vim b/runtime/ftplugin/fish.vim new file mode 100644 index 0000000000..f06ad3a0bf --- /dev/null +++ b/runtime/ftplugin/fish.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin file +" Language: fish +" Maintainer: Nicholas Boyle (github.com/nickeb96) +" Repository: https://github.com/nickeb96/fish.vim +" Last Change: February 1, 2023 +" 2023 Aug 28 by Vim Project (undo_ftplugin) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal iskeyword=@,48-57,_,192-255,-,. +setlocal comments=:# +setlocal commentstring=#%s +setlocal formatoptions+=crjq + +let b:undo_ftplugin = "setl cms< com< fo< isk<" diff --git a/runtime/ftplugin/forth.vim b/runtime/ftplugin/forth.vim new file mode 100644 index 0000000000..d28c8484e1 --- /dev/null +++ b/runtime/ftplugin/forth.vim @@ -0,0 +1,72 @@ +" Vim filetype plugin +" Language: Forth +" Maintainer: Johan Kotlinski <kotlinski@gmail.com> +" Last Change: 2023 Sep 15 +" URL: https://github.com/jkotlinski/forth.vim + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal commentstring=\\\ %s +setlocal comments=s:(,mb:\ ,e:),b:\\ +setlocal iskeyword=33-126,128-255 + +let s:include_patterns =<< trim EOL + + \<\%(INCLUDE\|REQUIRE\)\>\s\+\zs\k\+\ze + \<S"\s\+\zs[^"]*\ze"\s\+\%(INCLUDED\|REQUIRED\)\> +EOL +let &l:include = $'\c{ s:include_patterns[1:]->join('\|') }' + +let s:define_patterns =<< trim EOL + : + [2F]\=CONSTANT + [2F]\=VALUE + [2F]\=VARIABLE + BEGIN-STRUCTURE + BUFFER: + CODE + CREATE + MARKER + SYNONYM +EOL +let &l:define = $'\c\<\%({ s:define_patterns->join('\|') }\)' + +" assume consistent intra-project file extensions +let &l:suffixesadd = "." .. expand("%:e") + +let b:undo_ftplugin = "setl cms< com< def< inc< isk< sua<" + +if exists("loaded_matchit") && !exists("b:match_words") + let s:matchit_patterns =<< trim EOL + + \<\:\%(NONAME\)\=\>:\<EXIT\>:\<;\> + \<IF\>:\<ELSE\>:\<THEN\> + \<\[IF]\>:\<\[ELSE]\>:\<\[THEN]\> + \<?\=DO\>:\<LEAVE\>:\<+\=LOOP\> + \<CASE\>:\<ENDCASE\> + \<OF\>:\<ENDOF\> + \<BEGIN\>:\<WHILE\>:\<\%(AGAIN\|REPEAT\|UNTIL\)\> + \<CODE\>:\<END-CODE\> + \<BEGIN-STRUCTURE\>:\<END-STRUCTURE\> + EOL + let b:match_ignorecase = 1 + let b:match_words = s:matchit_patterns[1:]->join(',') + let b:undo_ftplugin ..= "| unlet! b:match_ignorecase b:match_words" + unlet s:matchit_patterns +endif + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Forth Source Files (*.f *.fs *.ft *.fth *.4th)\t*.f;*.fs;*.ft;*.fth;*.4th\n" .. + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin ..= " | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save +unlet s:define_patterns s:include_patterns diff --git a/runtime/ftplugin/gpg.vim b/runtime/ftplugin/gpg.vim index 3f890e58f6..7fb4f47ed8 100644 --- a/runtime/ftplugin/gpg.vim +++ b/runtime/ftplugin/gpg.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: gpg(1) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -15,5 +15,22 @@ let b:undo_ftplugin = "setl com< cms< fo<" setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 GpgKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+--' . <q-args> . '\b'' --hilite-search" man ' . 'gpg' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 GpgKeywordPrg + \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+--' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'gpg' + endif + if exists(':GpgKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:GpgKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer GpgKeywordPrg' + endif +endif + let &cpo = s:cpo_save unlet s:cpo_save + diff --git a/runtime/ftplugin/hare.vim b/runtime/ftplugin/hare.vim index bb10daf38c..0200ba5913 100644 --- a/runtime/ftplugin/hare.vim +++ b/runtime/ftplugin/hare.vim @@ -2,26 +2,34 @@ " Language: Hare " Maintainer: Amelia Clarke <me@rsaihe.dev> " Previous Maintainer: Drew DeVault <sir@cmpwn.com> -" Last Updated: 2022-09-21 +" Last Updated: 2022-09-28 +" 2023 Aug 28 by Vim Project (undo_ftplugin) -" Only do this when not done yet for this buffer if exists('b:did_ftplugin') finish endif - -" Don't load another plugin for this buffer let b:did_ftplugin = 1 -setlocal noexpandtab -setlocal tabstop=8 -setlocal shiftwidth=0 -setlocal softtabstop=0 -setlocal textwidth=80 +" Formatting settings. +setlocal formatoptions-=t formatoptions+=croql/ + +" Miscellaneous. +setlocal comments=:// setlocal commentstring=//\ %s +setlocal suffixesadd=.ha -" Set 'formatoptions' to break comment lines but not other lines, -" and insert the comment leader when hitting <CR> or using "o". -setlocal fo-=t fo+=croql +let b:undo_ftplugin = "setl cms< com< fo< sua<" + +" Hare recommended style. +if get(g:, "hare_recommended_style", 1) + setlocal noexpandtab + setlocal shiftwidth=8 + setlocal softtabstop=0 + setlocal tabstop=8 + setlocal textwidth=80 + let b:undo_ftplugin ..= " | setl et< sts< sw< ts< tw<" +endif compiler hare -" vim: tabstop=2 shiftwidth=2 expandtab + +" vim: et sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/haskell.vim b/runtime/ftplugin/haskell.vim index 84f4d0563b..2a864bf916 100644 --- a/runtime/ftplugin/haskell.vim +++ b/runtime/ftplugin/haskell.vim @@ -17,6 +17,7 @@ let b:undo_ftplugin = "setl com< cms< fo<" setlocal comments=s1fl:{-,mb:-,ex:-},:-- commentstring=--\ %s setlocal formatoptions-=t formatoptions+=croql setlocal omnifunc=haskellcomplete#Complete +setlocal iskeyword+=' let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/heex.vim b/runtime/ftplugin/heex.vim index 5274d59fbf..becc071c37 100644 --- a/runtime/ftplugin/heex.vim +++ b/runtime/ftplugin/heex.vim @@ -14,3 +14,14 @@ setlocal comments=:<%!-- setlocal commentstring=<%!--\ %s\ --%> let b:undo_ftplugin = 'set sw< sts< et< com< cms<' + +" HTML: thanks to Johannes Zellner and Benji Fisher. +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 1 + let b:match_words = '<%\{-}!--:--%\{-}>,' .. + \ '<:>,' .. + \ '<\@<=[ou]l\>[^>]*\%(>\|$\):<\@<=li\>:<\@<=/[ou]l>,' .. + \ '<\@<=dl\>[^>]*\%(>\|$\):<\@<=d[td]\>:<\@<=/dl>,' .. + \ '<\@<=\([^/!][^ \t>]*\)[^>]*\%(>\|$\):<\@<=/\1>' + let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words" +endif diff --git a/runtime/ftplugin/help.lua b/runtime/ftplugin/help.lua new file mode 100644 index 0000000000..4cc3386167 --- /dev/null +++ b/runtime/ftplugin/help.lua @@ -0,0 +1,3 @@ +if vim.endswith(vim.fs.normalize(vim.api.nvim_buf_get_name(0)), '/doc/syntax.txt') then + require('vim.vimhelp').highlight_groups() +end diff --git a/runtime/ftplugin/indent.lua b/runtime/ftplugin/indent.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/indent.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/ishd.vim b/runtime/ftplugin/ishd.vim index 33ef1510b5..b160349033 100644 --- a/runtime/ftplugin/ishd.vim +++ b/runtime/ftplugin/ishd.vim @@ -1,32 +1,37 @@ " Vim filetype plugin file -" Language: InstallShield (ft=ishd) -" Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Sat, 24 May 2003 11:55:36 CEST +" Language: InstallShield (ft=ishd) +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Previous Maintainer: Johannes Zellner <johannes@zellner.org> +" Last Change: 2023 Aug 28 if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 -setlocal foldmethod=syntax - " Using line continuation here. let s:cpo_save = &cpo set cpo-=C +setlocal foldmethod=syntax + +let b:undo_ftplugin = "setl fdm<" + " matchit support if exists("loaded_matchit") - let b:match_ignorecase=0 - let b:match_words= + let b:match_ignorecase = 0 + let b:match_words = \ '\%(^\s*\)\@<=\<function\>\s\+[^()]\+\s*(:\%(^\s*\)\@<=\<begin\>\s*$:\%(^\s*\)\@<=\<return\>:\%(^\s*\)\@<=\<end\>\s*;\s*$,' . \ '\%(^\s*\)\@<=\<repeat\>\s*$:\%(^\s*\)\@<=\<until\>\s\+.\{-}\s*;\s*$,' . \ '\%(^\s*\)\@<=\<switch\>\s*(.\{-}):\%(^\s*\)\@<=\<\%(case\|default\)\>:\%(^\s*\)\@<=\<endswitch\>\s*;\s*$,' . \ '\%(^\s*\)\@<=\<while\>\s*(.\{-}):\%(^\s*\)\@<=\<endwhile\>\s*;\s*$,' . \ '\%(^\s*\)\@<=\<for\>.\{-}\<\%(to\|downto\)\>:\%(^\s*\)\@<=\<endfor\>\s*;\s*$,' . \ '\%(^\s*\)\@<=\<if\>\s*(.\{-})\s*then:\%(^\s*\)\@<=\<else\s*if\>\s*([^)]*)\s*then:\%(^\s*\)\@<=\<else\>:\%(^\s*\)\@<=\<endif\>\s*;\s*$' + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" endif -if has("gui_win32") && !exists("b:browsefilter") +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "InstallShield Files (*.rul)\t*.rul\n" . - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/json5.vim b/runtime/ftplugin/json5.vim new file mode 100644 index 0000000000..2560857a33 --- /dev/null +++ b/runtime/ftplugin/json5.vim @@ -0,0 +1,28 @@ +" Vim filetype plugin file +" Language: JSON5 +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2023 Oct 19 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s +setlocal formatoptions-=t formatoptions+=croql + +let b:undo_ftplugin = "setl fo< com< cms<" + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "JSON5 Files (*.json5)\t*.json5\n" .. + \ "JSON Files (*.json)\t*.json\n" .. + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin ..= " | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/kotlin.vim b/runtime/ftplugin/kotlin.vim new file mode 100644 index 0000000000..b21de603ea --- /dev/null +++ b/runtime/ftplugin/kotlin.vim @@ -0,0 +1,33 @@ +" Vim filetype plugin file +" Language: Kotlin +" Maintainer: Alexander Udalov +" URL: https://github.com/udalov/kotlin-vim +" Last Change: 7 November 2021 +" 2023 Sep 17 by Vim Project (browsefilter) + +if exists('b:did_ftplugin') | finish | endif +let b:did_ftplugin = 1 + +let s:save_cpo = &cpo +set cpo&vim + +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//\ %s + +setlocal formatoptions-=t formatoptions+=croqnl +silent! setlocal formatoptions+=j + +setlocal includeexpr=substitute(v:fname,'\\.','/','g') +setlocal suffixesadd=.kt + +let b:undo_ftplugin = "setlocal comments< commentstring< ". + \ "formatoptions< includeexpr< suffixesadd<" + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "Kotlin Source Files (*.kt, *kts)\t*.kt;*.kts\n" . + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin .= " | unlet! b:browsefilter" +endif + +let &cpo = s:save_cpo +unlet s:save_cpo diff --git a/runtime/ftplugin/livebook.vim b/runtime/ftplugin/livebook.vim new file mode 100644 index 0000000000..c97d210412 --- /dev/null +++ b/runtime/ftplugin/livebook.vim @@ -0,0 +1,9 @@ +" Placeholder livebook filetype plugin file. +" This simply uses the markdown filetype plugin. + +" Only load this plugin when no other was loaded. +if exists("b:did_ftplugin") + finish +endif + +runtime! ftplugin/markdown.vim ftplugin/markdown_*.vim ftplugin/markdown/*.vim diff --git a/runtime/ftplugin/logcheck.vim b/runtime/ftplugin/logcheck.vim index 9d664b2d09..9c1be1108e 100644 --- a/runtime/ftplugin/logcheck.vim +++ b/runtime/ftplugin/logcheck.vim @@ -1,9 +1,9 @@ " Vim filetype plugin file " Language: Logcheck " Maintainer: Debian Vim Maintainers -" Last Change: 2018 Dec 27 +" Last Change: 2023 Jan 16 " License: Vim License -" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/logcheck.vim +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/main/ftplugin/logcheck.vim if exists('b:did_ftplugin') finish diff --git a/runtime/ftplugin/lprolog.vim b/runtime/ftplugin/lprolog.vim index a8a3c612c1..1075a9c813 100644 --- a/runtime/ftplugin/lprolog.vim +++ b/runtime/ftplugin/lprolog.vim @@ -2,7 +2,8 @@ " Language: LambdaProlog (Teyjus) " Maintainer: Markus Mottl <markus.mottl@gmail.com> " URL: http://www.ocaml.info/vim/ftplugin/lprolog.vim -" Last Change: 2006 Feb 05 +" Last Change: 2023 Aug 28 - added undo_ftplugin (Vim Project) +" 2006 Feb 05 " 2001 Sep 16 - fixed 'no_mail_maps'-bug (MM) " 2001 Sep 02 - initial release (MM) @@ -15,11 +16,13 @@ endif let b:did_ftplugin = 1 " Error format -setlocal efm=%+A./%f:%l.%c:\ %m formatprg=fmt\ -w75\ -p\\% +setlocal efm=%+A./%f:%l.%c:\ %m " Formatting of comments setlocal formatprg=fmt\ -w75\ -p\\% +let b:undo_ftplugin = "setlocal efm< fp<" + " Add mappings, unless the user didn't want this. if !exists("no_plugin_maps") && !exists("no_lprolog_maps") " Uncommenting @@ -28,6 +31,11 @@ if !exists("no_plugin_maps") && !exists("no_lprolog_maps") vmap <buffer> <LocalLeader>c <Plug>BUncomOn nmap <buffer> <LocalLeader>C <Plug>LUncomOff vmap <buffer> <LocalLeader>C <Plug>BUncomOff + let b:undo_ftplugin ..= + \ " | silent! execute 'nunmap <buffer> <LocalLeader>c'" .. + \ " | silent! execute 'vunmap <buffer> <LocalLeader>c'" .. + \ " | silent! execute 'nunmap <buffer> <LocalLeader>C'" .. + \ " | silent! execute 'vunmap <buffer> <LocalLeader>C'" endif nnoremap <buffer> <Plug>LUncomOn mz0i/* <ESC>$A */<ESC>`z diff --git a/runtime/ftplugin/lua.lua b/runtime/ftplugin/lua.lua deleted file mode 100644 index 415cf28f9a..0000000000 --- a/runtime/ftplugin/lua.lua +++ /dev/null @@ -1,3 +0,0 @@ -if vim.g.ts_highlight_lua then - vim.treesitter.start() -end diff --git a/runtime/ftplugin/lua.vim b/runtime/ftplugin/lua.vim index 88b1fc9d44..3529e1e3fd 100644 --- a/runtime/ftplugin/lua.vim +++ b/runtime/ftplugin/lua.vim @@ -4,7 +4,8 @@ " Previous Maintainer: Max Ischenko <mfi@ukr.net> " Contributor: Dorai Sitaram <ds26@gte.com> " C.D. MacEachern <craig.daniel.maceachern@gmail.com> -" Last Change: 2022 Nov 19 +" Tyler Miller <tmillr@proton.me> +" Last Change: 2023 Mar 24 if exists("b:did_ftplugin") finish @@ -14,7 +15,7 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -setlocal comments=:-- +setlocal comments=:---,:-- setlocal commentstring=--\ %s setlocal formatoptions-=t formatoptions+=croql diff --git a/runtime/ftplugin/luau.vim b/runtime/ftplugin/luau.vim new file mode 100644 index 0000000000..458d0b05a9 --- /dev/null +++ b/runtime/ftplugin/luau.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: Luau +" Maintainer: None yet +" Last Change: 2023 Apr 30 + +if exists("b:did_ftplugin") + finish +endif + +" Luau is a superset of Lua +runtime! ftplugin/lua.vim + + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/lynx.vim b/runtime/ftplugin/lynx.vim index b76c69f0ae..bf8410d6a0 100644 --- a/runtime/ftplugin/lynx.vim +++ b/runtime/ftplugin/lynx.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Lynx Web Browser Configuration " Maintainer: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2022 Sep 09 +" Last Change: 2023 Nov 09 if exists("b:did_ftplugin") finish @@ -18,7 +18,7 @@ setlocal formatoptions-=t formatoptions+=croql let b:undo_ftplugin = "setl cms< com< fo<" if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Lynx Configuration Files (lynx.cfg .lynxrc)\tlynx.cfg;.lynxrc\n" .. + let b:browsefilter = "Lynx Configuration Files (lynx.cfg, .lynxrc)\tlynx.cfg;.lynxrc\n" .. \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/mail.vim b/runtime/ftplugin/mail.vim index f12022305f..3cef84f528 100644 --- a/runtime/ftplugin/mail.vim +++ b/runtime/ftplugin/mail.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Mail -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2021 Oct 23 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/make.vim b/runtime/ftplugin/make.vim index 168bc38eb3..7227bb3739 100644 --- a/runtime/ftplugin/make.vim +++ b/runtime/ftplugin/make.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Make -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2020 Oct 16 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/modconf.vim b/runtime/ftplugin/modconf.vim index c8e76b538b..22d18a9aad 100644 --- a/runtime/ftplugin/modconf.vim +++ b/runtime/ftplugin/modconf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: modules.conf(5) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -16,5 +16,21 @@ let b:undo_ftplugin = "setl com< cms< inc< fo<" setlocal comments=:# commentstring=#\ %s include=^\\s*include setlocal formatoptions-=t formatoptions+=croql +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 ModconfKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'modprobe.d' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 ModconfKeywordPrg + \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'modprobe.d' + endif + if exists(':ModconfKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:ModconfKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ModconfKeywordPrg' + endif +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/muttrc.vim b/runtime/ftplugin/muttrc.vim index c8ad0f2ec5..c9f6df31d0 100644 --- a/runtime/ftplugin/muttrc.vim +++ b/runtime/ftplugin/muttrc.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: mutt RC File " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-04-19 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -18,5 +18,21 @@ setlocal formatoptions-=t formatoptions+=croql let &l:include = '^\s*source\>' +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 MuttrcKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . 'muttrc' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 MuttrcKeywordPrg + \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'muttrc' + endif + if exists(':MuttrcKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:MuttrcKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer MuttrcKeywordPrg' + endif +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/netrc.vim b/runtime/ftplugin/netrc.vim index 02ee327295..5f40bec96e 100644 --- a/runtime/ftplugin/netrc.vim +++ b/runtime/ftplugin/netrc.vim @@ -2,6 +2,7 @@ " Language: netrc(5) configuration file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Revision: 2008-07-09 +" Last Change: 2023 Feb 27 by Keith Smiley if exists("b:did_ftplugin") finish @@ -13,7 +14,7 @@ set cpo&vim let b:undo_ftplugin = "setl com< cms< fo<" -setlocal comments= commentstring= formatoptions-=tcroq formatoptions+=l +setlocal comments=b:# commentstring=#\ %s formatoptions-=tcroq formatoptions+=l let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/nginx.vim b/runtime/ftplugin/nginx.vim index e808db1277..525d0fdccf 100644 --- a/runtime/ftplugin/nginx.vim +++ b/runtime/ftplugin/nginx.vim @@ -2,5 +2,8 @@ " Language: nginx.conf " Maintainer: Chris Aumann <me@chr4.org> " Last Change: Apr 15, 2017 +" 2023 Aug 28 by Vim Project (undo_ftplugin) setlocal commentstring=#\ %s + +let b:undo_ftplugin = "setlocal commentstring<" diff --git a/runtime/ftplugin/nix.vim b/runtime/ftplugin/nix.vim new file mode 100644 index 0000000000..d417cc7805 --- /dev/null +++ b/runtime/ftplugin/nix.vim @@ -0,0 +1,17 @@ +" Vim filetype plugin +" Language: nix +" Maintainer: Keith Smiley <keithbsmiley@gmail.com> +" Last Change: 2023 Jul 22 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl commentstring< comments<" + +setlocal comments=:# +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/objc.vim b/runtime/ftplugin/objc.vim index e41beb5dad..d129b33c1c 100644 --- a/runtime/ftplugin/objc.vim +++ b/runtime/ftplugin/objc.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Objective C -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2003 Jan 15 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/objdump.vim b/runtime/ftplugin/objdump.vim new file mode 100644 index 0000000000..7517a342a3 --- /dev/null +++ b/runtime/ftplugin/objdump.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: Objdump +" Maintainer: Colin Kennedy <colinvfx@gmail.com> +" Last Change: 2023 October 25 + +if exists("b:did_ftplugin") + finish +endif + +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setlocal cms<" + +setlocal commentstring=#\ %s diff --git a/runtime/ftplugin/pbtxt.vim b/runtime/ftplugin/pbtxt.vim index e3c1bf7650..56c2553ca8 100644 --- a/runtime/ftplugin/pbtxt.vim +++ b/runtime/ftplugin/pbtxt.vim @@ -2,20 +2,16 @@ " Language: Protobuf Text Format " Maintainer: Lakshay Garg <lakshayg@outlook.in> " Last Change: 2020 Nov 17 +" 2023 Aug 28 by Vim Project (undo_ftplugin) " Homepage: https://github.com/lakshayg/vim-pbtxt if exists("b:did_ftplugin") finish endif - let b:did_ftplugin = 1 -let s:cpo_save = &cpo -set cpo&vim - setlocal commentstring=#\ %s -let &cpo = s:cpo_save -unlet s:cpo_save +let b:undo_ftplugin = "setlocal commentstring<" " vim: nowrap sw=2 sts=2 ts=8 noet diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim index d0bdbc0cfb..c63bd3f9c7 100644 --- a/runtime/ftplugin/perl.vim +++ b/runtime/ftplugin/perl.vim @@ -5,6 +5,8 @@ " Bugs/requests: https://github.com/vim-perl/vim-perl/issues " License: Vim License (see :help license) " Last Change: 2021 Nov 10 +" 2023 Sep 07 by Vim Project (safety check: don't execute perl +" from current directory) if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 @@ -54,7 +56,8 @@ endif " Set this once, globally. if !exists("perlpath") - if executable("perl") + " safety check: don't execute perl binary by default + if dist#vim#IsSafeExecutable('perl', 'perl') try if &shellxquote != '"' let perlpath = system('perl -e "print join(q/,/,@INC)"') diff --git a/runtime/ftplugin/pod.vim b/runtime/ftplugin/pod.vim index 2a905ab354..61a4aa094a 100644 --- a/runtime/ftplugin/pod.vim +++ b/runtime/ftplugin/pod.vim @@ -5,11 +5,12 @@ " Homepage: https://github.com/vim-perl/vim-perl " Bugs/requests: https://github.com/vim-perl/vim-perl/issues " License: Vim License (see :help license) -" Last Change: 2021 Oct 19 +" Last Change: 2023 Jul 05 if exists("b:did_ftplugin") - finish + finish endif +let b:did_ftplugin = 1 let s:save_cpo = &cpo set cpo-=C @@ -37,12 +38,12 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:undo_ftplugin .= " | unlet! b:browsefilter" endif -function! s:jumpToSection(backwards) - let flags = a:backwards ? 'bsWz' : 'sWz' - if has('syntax_items') +function s:jumpToSection(direction) + let flags = a:direction == "backward" ? "bsWz" : "sWz" + if has("syntax_items") let skip = "synIDattr(synID(line('.'), col('.'), 1), 'name') !~# '\\<podCommand\\>'" else - let skip = '' + let skip = "" endif for i in range(v:count1) call search('^=\a', flags, 0, 0, skip) @@ -50,19 +51,17 @@ function! s:jumpToSection(backwards) endfunction if !exists("no_plugin_maps") && !exists("no_pod_maps") - nnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR> - vnoremap <silent> <buffer> ]] <Cmd>call <SID>jumpToSection()<CR> - nnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR> - vnoremap <silent> <buffer> ][ <Cmd>call <SID>jumpToSection()<CR> - nnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR> - vnoremap <silent> <buffer> [[ <Cmd>call <SID>jumpToSection(1)<CR> - nnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR> - vnoremap <silent> <buffer> [] <Cmd>call <SID>jumpToSection(1)<CR> - let b:undo_ftplugin .= - \ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" . - \ " | silent! exe 'nunmap <buffer> ][' | silent! exe 'vunmap <buffer> ]['" . - \ " | silent! exe 'nunmap <buffer> ]]' | silent! exe 'vunmap <buffer> ]]'" . - \ " | silent! exe 'nunmap <buffer> []' | silent! exe 'vunmap <buffer> []'" + for s:mode in ["n", "o", "x"] + for s:lhs in ["]]", "]["] + execute s:mode . "noremap <silent> <buffer> " . s:lhs . " <Cmd>call <SID>jumpToSection('forward')<CR>" + let b:undo_ftplugin .= " | silent! execute '" . s:mode . "unmap <buffer> " . s:lhs . "'" + endfor + for s:lhs in ["[[", "[]"] + execute s:mode . "noremap <silent> <buffer> " . s:lhs . " <Cmd>call <SID>jumpToSection('backward')<CR>" + let b:undo_ftplugin .= " | silent! execute '" . s:mode . "unmap <buffer> " . s:lhs . "'" + endfor + endfor + unlet s:mode s:lhs endif let &cpo = s:save_cpo diff --git a/runtime/ftplugin/pymanifest.vim b/runtime/ftplugin/pymanifest.vim new file mode 100644 index 0000000000..a77e956ae5 --- /dev/null +++ b/runtime/ftplugin/pymanifest.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin +" Language: PyPA manifest +" Maintainer: ObserverOfTime <chronobserver@disroot.org> +" Last Change: 2023 Aug 08 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setl comments=:# commentstring=#\ %s + +let b:undo_ftplugin = 'setl com< cms<' diff --git a/runtime/ftplugin/qml.vim b/runtime/ftplugin/qml.vim new file mode 100644 index 0000000000..fd5ddbb4bc --- /dev/null +++ b/runtime/ftplugin/qml.vim @@ -0,0 +1,31 @@ +" Vim filetype plugin file +" Language: QML +" Maintainer: Chase Knowlden <haroldknowlden@gmail.com> +" Last Change: 2023 Aug 16 + +if exists( 'b:did_ftplugin' ) + finish +endif +let b:did_ftplugin = 1 + +let s:cpoptions_save = &cpoptions +set cpoptions&vim + +" command for undo +let b:undo_ftplugin = "setlocal formatoptions< comments< commentstring<" + +if (has("gui_win32") || has("gui_gtk")) && !exists( 'b:browsefilter' ) + let b:browsefilter = + \ 'QML Files (*.qml,*.qbs)\t*.qml;*.qbs\n' . + \ 'All Files\t*\n' +endif + +" Set 'comments' to format dashed lists in comments. +setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=//%s + +setlocal formatoptions-=t +setlocal formatoptions+=croql + +let &cpoptions = s:cpoptions_save +unlet s:cpoptions_save diff --git a/runtime/ftplugin/quarto.vim b/runtime/ftplugin/quarto.vim new file mode 100644 index 0000000000..a76bcc2c7e --- /dev/null +++ b/runtime/ftplugin/quarto.vim @@ -0,0 +1 @@ +runtime ftplugin/rmd.vim diff --git a/runtime/ftplugin/query.lua b/runtime/ftplugin/query.lua index 3b99d67247..964c221ad4 100644 --- a/runtime/ftplugin/query.lua +++ b/runtime/ftplugin/query.lua @@ -1,6 +1,35 @@ -- Neovim filetype plugin file -- Language: Tree-sitter query --- Last Change: 2022 Mar 29 +-- Last Change: 2023 Aug 23 + +if vim.b.did_ftplugin == 1 then + return +end + +-- Do not set vim.b.did_ftplugin = 1 to allow loading of ftplugin/lisp.vim + +-- use treesitter over syntax +vim.treesitter.start() + +-- set omnifunc +vim.bo.omnifunc = 'v:lua.vim.treesitter.query.omnifunc' + +vim.opt_local.iskeyword:append('.') + +-- query linter +local buf = vim.api.nvim_get_current_buf() +local query_lint_on = vim.g.query_lint_on or { 'BufEnter', 'BufWrite' } + +if not vim.b.disable_query_linter and #query_lint_on > 0 then + vim.api.nvim_create_autocmd(query_lint_on, { + group = vim.api.nvim_create_augroup('querylint', { clear = false }), + buffer = buf, + callback = function() + vim.treesitter.query.lint(buf) + end, + desc = 'Query linter', + }) +end -- it's a lisp! vim.cmd([[ runtime! ftplugin/lisp.vim ]]) diff --git a/runtime/ftplugin/r.vim b/runtime/ftplugin/r.vim index a78afa2e7e..28966368cb 100644 --- a/runtime/ftplugin/r.vim +++ b/runtime/ftplugin/r.vim @@ -2,7 +2,7 @@ " Language: R " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 15, 2020 11:37AM +" Last Change: Sun Apr 24, 2022 09:14AM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -22,7 +22,7 @@ setlocal comments=:#',:###,:##,:# if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") let b:browsefilter = "R Source Files (*.R)\t*.R\n" . - \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst)\t*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + \ "Files that include R (*.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/readline.vim b/runtime/ftplugin/readline.vim index eba7122347..181d8ac661 100644 --- a/runtime/ftplugin/readline.vim +++ b/runtime/ftplugin/readline.vim @@ -25,11 +25,27 @@ if exists("loaded_matchit") && !exists("b:match_words") endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Readline Intialization Files (inputrc .inputrc)\tinputrc;*.inputrc\n" .. + let b:browsefilter = "Readline Initialization Files (inputrc .inputrc)\tinputrc;*.inputrc\n" .. \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 ReadlineKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '\b'' --hilite-search" man ' . '3 readline' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 ReadlineKeywordPrg + \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . '3 readline' + endif + if exists(':ReadlineKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:ReadlineKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer ReadlineKeywordPrg' + endif +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/rhelp.vim b/runtime/ftplugin/rhelp.vim index d0b546d62d..2fde4875c6 100644 --- a/runtime/ftplugin/rhelp.vim +++ b/runtime/ftplugin/rhelp.vim @@ -2,7 +2,7 @@ " Language: R help file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 15, 2020 12:01PM +" Last Change: Sun Apr 24, 2022 09:12AM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -18,7 +18,7 @@ set cpo&vim setlocal iskeyword=@,48-57,_,. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rmd.vim b/runtime/ftplugin/rmd.vim index 2ee72ffc6c..a407c236dd 100644 --- a/runtime/ftplugin/rmd.vim +++ b/runtime/ftplugin/rmd.vim @@ -2,7 +2,7 @@ " Language: R Markdown file " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 15, 2020 12:03PM +" Last Change: Mon May 29, 2023 06:31AM " Original work by Alex Zvoleff (adjusted from R help for rmd by Michel Kuhlmann) " Only do this when not yet done for this buffer @@ -23,7 +23,7 @@ setlocal iskeyword=@,48-57,_,. let s:cpo_save = &cpo set cpo&vim -function! FormatRmd() +function FormatRmd() if search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW") setlocal comments=:#',:###,:##,:# else @@ -32,13 +32,30 @@ function! FormatRmd() return 1 endfunction -" If you do not want 'comments' dynamically defined, put in your vimrc: -" let g:rmd_dynamic_comments = 0 +let s:last_line = 0 +function SetRmdCommentStr() + if line('.') == s:last_line + return + endif + let s:last_line = line('.') + + if (search("^[ \t]*```[ ]*{r", "bncW") > search("^[ \t]*```$", "bncW")) || ((search('^---$', 'Wn') || search('^\.\.\.$', 'Wn')) && search('^---$', 'bnW')) + set commentstring=#\ %s + else + set commentstring=<!--\ %s\ --> + endif +endfunction + +" If you do not want both 'comments' and 'commentstring' dynamically defined, +" put in your vimrc: let g:rmd_dynamic_comments = 0 if !exists("g:rmd_dynamic_comments") || (exists("g:rmd_dynamic_comments") && g:rmd_dynamic_comments == 1) setlocal formatexpr=FormatRmd() + augroup RmdCStr + autocmd! + autocmd CursorMoved <buffer> call SetRmdCommentStr() + augroup END endif - " Enables pandoc if it is installed unlet! b:did_ftplugin runtime ftplugin/pandoc.vim @@ -47,7 +64,7 @@ runtime ftplugin/pandoc.vim let b:did_ftplugin = 1 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rnoweb.vim b/runtime/ftplugin/rnoweb.vim index dc5f1b5e06..26c1ab4e3f 100644 --- a/runtime/ftplugin/rnoweb.vim +++ b/runtime/ftplugin/rnoweb.vim @@ -2,7 +2,7 @@ " Language: Rnoweb " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 15, 2020 12:02PM +" Last Change: Mon Feb 27, 2023 07:16PM " Only do this when not yet done for this buffer if exists("b:did_ftplugin") @@ -25,14 +25,31 @@ setlocal suffixesadd=.bib,.tex setlocal comments=b:%,b:#,b:##,b:###,b:#' if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" . \ "All Files (*.*)\t*.*\n" endif +function SetRnwCommentStr() + if (search("^\s*<<.*>>=", "bncW") > search("^@", "bncW")) + set commentstring=#\ %s + else + set commentstring=%\ %s + endif +endfunction + +" If you do not want both 'comments' and 'commentstring' dynamically defined, +" put in your vimrc: let g:rnw_dynamic_comments = 0 +if !exists("g:rnw_dynamic_comments") || (exists("g:rnw_dynamic_comments") && g:rnw_dynamic_comments == 1) + augroup RnwCStr + autocmd! + autocmd CursorMoved <buffer> call SetRnwCommentStr() + augroup END +endif + if exists('b:undo_ftplugin') - let b:undo_ftplugin .= " | setl isk< sua< com< | unlet! b:browsefilter" + let b:undo_ftplugin .= " | setl isk< sua< com< cms< | unlet! b:browsefilter" else - let b:undo_ftplugin = "setl isk< sua< com< | unlet! b:browsefilter" + let b:undo_ftplugin = "setl isk< sua< com< cms< | unlet! b:browsefilter" endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/rrst.vim b/runtime/ftplugin/rrst.vim index a56fd6478e..d9df5e587f 100644 --- a/runtime/ftplugin/rrst.vim +++ b/runtime/ftplugin/rrst.vim @@ -2,7 +2,7 @@ " Language: reStructuredText documentation format with R code " Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com> " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 15, 2020 12:02PM +" Last Change: Mon Feb 27, 2023 07:16PM " Original work by Alex Zvoleff " Only do this when not yet done for this buffer @@ -22,7 +22,7 @@ setlocal formatoptions+=tcqln setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^\\s*[-*+]\\s\\+ setlocal iskeyword=@,48-57,_,. -function! FormatRrst() +function FormatRrst() if search('^\.\. {r', "bncW") > search('^\.\. \.\.$', "bncW") setlocal comments=:#',:###,:##,:# else @@ -38,7 +38,7 @@ if !exists("g:rrst_dynamic_comments") || (exists("g:rrst_dynamic_comments") && g endif if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst\n" . + let b:browsefilter = "R Source Files (*.R *.Rnw *.Rd *.Rmd *.Rrst *.qmd)\t*.R;*.Rnw;*.Rd;*.Rmd;*.Rrst;*.qmd\n" . \ "All Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/rst.vim b/runtime/ftplugin/rst.vim index ff7a402d10..c88e8f2580 100644 --- a/runtime/ftplugin/rst.vim +++ b/runtime/ftplugin/rst.vim @@ -28,7 +28,7 @@ setlocal formatoptions+=tcroql " directives (..) and ordered lists (1.), although it can cause problems for " many other cases. " -" More sophisticated indentation rules should be revisted in the future. +" More sophisticated indentation rules should be revisited in the future. if exists("g:rst_style") && g:rst_style != 0 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index 8c1f47731c..b61c1765d9 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -3,7 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Last Change: 2022 Mar 21 +" Last Change: 2023 Sep 1st if (exists("b:did_ftplugin")) finish @@ -61,6 +61,10 @@ if !exists('g:ruby_version_paths') endif function! s:query_path(root) abort + " Disabled by default for security reasons. + if !get(g:, 'ruby_exec', get(g:, 'plugin_exec', 0)) + return [] + endif let code = "print $:.join %q{,}" if &shell =~# 'sh' && empty(&shellxquote) let prefix = 'env PATH='.shellescape($PATH).' ' @@ -77,7 +81,14 @@ function! s:query_path(root) abort let cwd = fnameescape(getcwd()) try exe cd fnameescape(a:root) - let path = split(system(path_check),',') + let s:tmp_cwd = getcwd() + if (fnamemodify(exepath('ruby'), ':p:h') ==# cwd + \ && (index(split($PATH,has("win32")? ';' : ':'), s:tmp_cwd) == -1 || s:tmp_cwd == '.')) + let path = [] + else + let path = split(system(path_check),',') + endif + unlet! s:tmp_cwd exe cd cwd return path finally diff --git a/runtime/ftplugin/rust.vim b/runtime/ftplugin/rust.vim index 7efca5985b..7f1a86ea95 100644 --- a/runtime/ftplugin/rust.vim +++ b/runtime/ftplugin/rust.vim @@ -1,20 +1,26 @@ " Language: Rust " Description: Vim ftplugin for Rust " Maintainer: Chris Morgan <me@chrismorgan.info> -" Maintainer: Kevin Ballard <kevin@sb.org> -" Last Change: June 08, 2016 -" For bugs, patches and license go to https://github.com/rust-lang/rust.vim +" Last Change: 2023-09-11 +" For bugs, patches and license go to https://github.com/rust-lang/rust.vim if exists("b:did_ftplugin") - finish + finish endif let b:did_ftplugin = 1 +" vint: -ProhibitAbbreviationOption let s:save_cpo = &cpo set cpo&vim - -augroup rust.vim -autocmd! +" vint: +ProhibitAbbreviationOption + +if get(b:, 'current_compiler', '') ==# '' + if strlen(findfile('Cargo.toml', '.;')) > 0 + compiler cargo + else + compiler rustc + endif +endif " Variables {{{1 @@ -22,13 +28,13 @@ autocmd! " comments, so we'll use that as our default, but make it easy to switch. " This does not affect indentation at all (I tested it with and without " leader), merely whether a leader is inserted by default or not. -if exists("g:rust_bang_comment_leader") && g:rust_bang_comment_leader != 0 - " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, - " but without it, */ gets indented one space even if there were no - " leaders. I'm fairly sure that's a Vim bug. - setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// +if get(g:, 'rust_bang_comment_leader', 0) + " Why is the `,s0:/*,mb:\ ,ex:*/` there, you ask? I don't understand why, + " but without it, */ gets indented one space even if there were no + " leaders. I'm fairly sure that's a Vim bug. + setlocal comments=s1:/*,mb:*,ex:*/,s0:/*,mb:\ ,ex:*/,:///,://!,:// else - setlocal comments=s0:/*!,m:\ ,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// + setlocal comments=s0:/*!,ex:*/,s1:/*,mb:*,ex:*/,:///,://!,:// endif setlocal commentstring=//%s setlocal formatoptions-=t formatoptions+=croqnl @@ -39,13 +45,14 @@ silent! setlocal formatoptions+=j " otherwise it's better than nothing. setlocal smartindent nocindent -if !exists("g:rust_recommended_style") || g:rust_recommended_style != 0 - setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab - setlocal textwidth=99 +if get(g:, 'rust_recommended_style', 1) + let b:rust_set_style = 1 + setlocal shiftwidth=4 softtabstop=4 expandtab + setlocal textwidth=99 endif -" This includeexpr isn't perfect, but it's a good start -setlocal includeexpr=substitute(v:fname,'::','/','g') +setlocal include=\\v^\\s*(pub\\s+)?use\\s+\\zs(\\f\|:)+ +setlocal includeexpr=rust#IncludeExpr(v:fname) setlocal suffixesadd=.rs @@ -54,51 +61,36 @@ if exists("g:ftplugin_rust_source_path") endif if exists("g:loaded_delimitMate") - if exists("b:delimitMate_excluded_regions") - let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions - endif - - let s:delimitMate_extra_excluded_regions = ',rustLifetimeCandidate,rustGenericLifetimeCandidate' - - " For this buffer, when delimitMate issues the `User delimitMate_map` - " event in the autocommand system, add the above-defined extra excluded - " regions to delimitMate's state, if they have not already been added. - autocmd User <buffer> - \ if expand('<afile>') ==# 'delimitMate_map' && match( - \ delimitMate#Get("excluded_regions"), - \ s:delimitMate_extra_excluded_regions) == -1 - \| let b:delimitMate_excluded_regions = - \ delimitMate#Get("excluded_regions") - \ . s:delimitMate_extra_excluded_regions - \|endif - - " For this buffer, when delimitMate issues the `User delimitMate_unmap` - " event in the autocommand system, delete the above-defined extra excluded - " regions from delimitMate's state (the deletion being idempotent and - " having no effect if the extra excluded regions are not present in the - " targeted part of delimitMate's state). - autocmd User <buffer> - \ if expand('<afile>') ==# 'delimitMate_unmap' - \| let b:delimitMate_excluded_regions = substitute( - \ delimitMate#Get("excluded_regions"), - \ '\C\V' . s:delimitMate_extra_excluded_regions, - \ '', 'g') - \|endif + if exists("b:delimitMate_excluded_regions") + let b:rust_original_delimitMate_excluded_regions = b:delimitMate_excluded_regions + endif + + augroup rust.vim.DelimitMate + autocmd! + + autocmd User delimitMate_map :call rust#delimitmate#onMap() + autocmd User delimitMate_unmap :call rust#delimitmate#onUnmap() + augroup END +endif + +" Integration with auto-pairs (https://github.com/jiangmiao/auto-pairs) +if exists("g:AutoPairsLoaded") && !get(g:, 'rust_keep_autopairs_default', 0) + let b:AutoPairs = {'(':')', '[':']', '{':'}','"':'"', '`':'`'} endif -if has("folding") && exists('g:rust_fold') && g:rust_fold != 0 - let b:rust_set_foldmethod=1 - setlocal foldmethod=syntax - if g:rust_fold == 2 - setlocal foldlevel< - else - setlocal foldlevel=99 - endif +if has("folding") && get(g:, 'rust_fold', 0) + let b:rust_set_foldmethod=1 + setlocal foldmethod=syntax + if g:rust_fold == 2 + setlocal foldlevel< + else + setlocal foldlevel=99 + endif endif -if has('conceal') && exists('g:rust_conceal') && g:rust_conceal != 0 - let b:rust_set_conceallevel=1 - setlocal conceallevel=2 +if has('conceal') && get(g:, 'rust_conceal', 0) + let b:rust_set_conceallevel=1 + setlocal conceallevel=2 endif " Motion Commands {{{1 @@ -126,72 +118,122 @@ command! -nargs=* -buffer RustEmitIr call rust#Emit("llvm-ir", <q-args>) command! -nargs=* -buffer RustEmitAsm call rust#Emit("asm", <q-args>) " See |:RustPlay| for docs -command! -range=% RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) +command! -range=% -buffer RustPlay :call rust#Play(<count>, <line1>, <line2>, <f-args>) " See |:RustFmt| for docs -command! -buffer RustFmt call rustfmt#Format() +command! -bar -buffer RustFmt call rustfmt#Format() " See |:RustFmtRange| for docs command! -range -buffer RustFmtRange call rustfmt#FormatRange(<line1>, <line2>) -" Mappings {{{1 +" See |:RustInfo| for docs +command! -bar -buffer RustInfo call rust#debugging#Info() + +" See |:RustInfoToClipboard| for docs +command! -bar -buffer RustInfoToClipboard call rust#debugging#InfoToClipboard() + +" See |:RustInfoToFile| for docs +command! -bar -nargs=1 -buffer RustInfoToFile call rust#debugging#InfoToFile(<f-args>) -" Bind ⌘R in MacVim to :RustRun -nnoremap <silent> <buffer> <D-r> :RustRun<CR> -" Bind ⌘⇧R in MacVim to :RustRun! pre-filled with the last args -nnoremap <buffer> <D-R> :RustRun! <C-r>=join(b:rust_last_rustc_args)<CR><C-\>erust#AppendCmdLine(' -- ' . join(b:rust_last_args))<CR> +" See |:RustTest| for docs +command! -buffer -nargs=* -count -bang RustTest call rust#Test(<q-mods>, <count>, <bang>0, <q-args>) if !exists("b:rust_last_rustc_args") || !exists("b:rust_last_args") - let b:rust_last_rustc_args = [] - let b:rust_last_args = [] + let b:rust_last_rustc_args = [] + let b:rust_last_args = [] endif " Cleanup {{{1 let b:undo_ftplugin = " - \ setlocal formatoptions< comments< commentstring< includeexpr< suffixesadd< - \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< - \|if exists('b:rust_original_delimitMate_excluded_regions') - \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions - \|unlet b:rust_original_delimitMate_excluded_regions - \|else - \|unlet! b:delimitMate_excluded_regions - \|endif - \|if exists('b:rust_set_foldmethod') - \|setlocal foldmethod< foldlevel< - \|unlet b:rust_set_foldmethod - \|endif - \|if exists('b:rust_set_conceallevel') - \|setlocal conceallevel< - \|unlet b:rust_set_conceallevel - \|endif - \|unlet! b:rust_last_rustc_args b:rust_last_args - \|delcommand RustRun - \|delcommand RustExpand - \|delcommand RustEmitIr - \|delcommand RustEmitAsm - \|delcommand RustPlay - \|nunmap <buffer> <D-r> - \|nunmap <buffer> <D-R> - \|nunmap <buffer> [[ - \|nunmap <buffer> ]] - \|xunmap <buffer> [[ - \|xunmap <buffer> ]] - \|ounmap <buffer> [[ - \|ounmap <buffer> ]] - \|set matchpairs-=<:> - \" + \ setlocal formatoptions< comments< commentstring< include< includeexpr< suffixesadd< + \|if exists('b:rust_set_style') + \|setlocal tabstop< shiftwidth< softtabstop< expandtab< textwidth< + \|endif + \|if exists('b:rust_original_delimitMate_excluded_regions') + \|let b:delimitMate_excluded_regions = b:rust_original_delimitMate_excluded_regions + \|unlet b:rust_original_delimitMate_excluded_regions + \|else + \|unlet! b:delimitMate_excluded_regions + \|endif + \|if exists('b:rust_set_foldmethod') + \|setlocal foldmethod< foldlevel< + \|unlet b:rust_set_foldmethod + \|endif + \|if exists('b:rust_set_conceallevel') + \|setlocal conceallevel< + \|unlet b:rust_set_conceallevel + \|endif + \|unlet! b:rust_last_rustc_args b:rust_last_args + \|delcommand -buffer RustRun + \|delcommand -buffer RustExpand + \|delcommand -buffer RustEmitIr + \|delcommand -buffer RustEmitAsm + \|delcommand -buffer RustPlay + \|delcommand -buffer RustFmt + \|delcommand -buffer RustFmtRange + \|delcommand -buffer RustInfo + \|delcommand -buffer RustInfoToClipboard + \|delcommand -buffer RustInfoToFile + \|delcommand -buffer RustTest + \|nunmap <buffer> [[ + \|nunmap <buffer> ]] + \|xunmap <buffer> [[ + \|xunmap <buffer> ]] + \|ounmap <buffer> [[ + \|ounmap <buffer> ]] + \|setlocal matchpairs-=<:> + \|unlet b:match_skip + \" " }}}1 " Code formatting on save -if get(g:, "rustfmt_autosave", 0) - autocmd BufWritePre *.rs silent! call rustfmt#Format() -endif - +augroup rust.vim.PreWrite + autocmd! + autocmd BufWritePre *.rs silent! call rustfmt#PreWrite() augroup END +setlocal matchpairs+=<:> +" For matchit.vim (rustArrow stops `Fn() -> X` messing things up) +let b:match_skip = 's:comment\|string\|rustCharacter\|rustArrow' + +command! -buffer -nargs=+ Cargo call cargo#cmd(<q-args>) +command! -buffer -nargs=* Cbuild call cargo#build(<q-args>) +command! -buffer -nargs=* Ccheck call cargo#check(<q-args>) +command! -buffer -nargs=* Cclean call cargo#clean(<q-args>) +command! -buffer -nargs=* Cdoc call cargo#doc(<q-args>) +command! -buffer -nargs=+ Cnew call cargo#new(<q-args>) +command! -buffer -nargs=* Cinit call cargo#init(<q-args>) +command! -buffer -nargs=* Crun call cargo#run(<q-args>) +command! -buffer -nargs=* Ctest call cargo#test(<q-args>) +command! -buffer -nargs=* Cbench call cargo#bench(<q-args>) +command! -buffer -nargs=* Cupdate call cargo#update(<q-args>) +command! -buffer -nargs=* Csearch call cargo#search(<q-args>) +command! -buffer -nargs=* Cpublish call cargo#publish(<q-args>) +command! -buffer -nargs=* Cinstall call cargo#install(<q-args>) +command! -buffer -nargs=* Cruntarget call cargo#runtarget(<q-args>) + +let b:undo_ftplugin .= ' + \|delcommand -buffer Cargo + \|delcommand -buffer Cbuild + \|delcommand -buffer Ccheck + \|delcommand -buffer Cclean + \|delcommand -buffer Cdoc + \|delcommand -buffer Cnew + \|delcommand -buffer Cinit + \|delcommand -buffer Crun + \|delcommand -buffer Ctest + \|delcommand -buffer Cbench + \|delcommand -buffer Cupdate + \|delcommand -buffer Csearch + \|delcommand -buffer Cpublish + \|delcommand -buffer Cinstall + \|delcommand -buffer Cruntarget' + +" vint: -ProhibitAbbreviationOption let &cpo = s:save_cpo unlet s:save_cpo +" vint: +ProhibitAbbreviationOption -" vim: set noet sw=8 ts=8: +" vim: set et sw=4 sts=4 ts=8: diff --git a/runtime/ftplugin/scala.vim b/runtime/ftplugin/scala.vim index b484df99f3..769499cfc1 100644 --- a/runtime/ftplugin/scala.vim +++ b/runtime/ftplugin/scala.vim @@ -4,6 +4,7 @@ " URL: https://github.com/derekwyatt/vim-scala " License: Same as Vim " Last Change: 11 August 2021 +" 2023 Aug 28 by Vim Project (undo_ftplugin) " ---------------------------------------------------------------------------- if exists('b:did_ftplugin') || &cp @@ -32,4 +33,6 @@ setlocal includeexpr=substitute(v:fname,'\\.','/','g') setlocal path+=src/main/scala,src/test/scala setlocal suffixesadd=.scala +let b:undo_ftplugin = "setlocal cms< com< et< fo< inc< inex< pa< sts< sua< sw<" + " vim:set sw=2 sts=2 ts=8 et: diff --git a/runtime/ftplugin/sed.vim b/runtime/ftplugin/sed.vim new file mode 100644 index 0000000000..0073872877 --- /dev/null +++ b/runtime/ftplugin/sed.vim @@ -0,0 +1,29 @@ +" Vim filetype plugin file +" Language: sed +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2020 Apr 1 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +setlocal comments=:# +setlocal commentstring=#\ %s +setlocal formatoptions-=t formatoptions+=croql + +let b:undo_ftplugin = "setl com< cms< fo<" + +if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") + let b:browsefilter = "sed Script Files (*.sed)\t*.sed\n" .. + \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin ..= " | unlet! b:browsefilter" +endif + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/sexplib.vim b/runtime/ftplugin/sexplib.vim index 27e1b28370..b0767ef559 100644 --- a/runtime/ftplugin/sexplib.vim +++ b/runtime/ftplugin/sexplib.vim @@ -3,6 +3,7 @@ " Maintainer: Markus Mottl <markus.mottl@gmail.com> " URL: https://github.com/ocaml/vim-ocaml " Last Change: +" 2023 Aug 28 - Added undo_ftplugin (Vim Project) " 2017 Apr 12 - First version (MM) if exists("b:did_ftplugin") @@ -13,3 +14,5 @@ let b:did_ftplugin=1 " Comment string setl commentstring=;\ %s setl comments=:; + +let b:undo_ftplugin = "setl cms< com<" diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim index b6fdb8f3e2..c1a6bc5ade 100644 --- a/runtime/ftplugin/sh.vim +++ b/runtime/ftplugin/sh.vim @@ -2,15 +2,15 @@ " Language: sh " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Dan Sharp -" Last Change: 2022 Sep 07 +" Contributor: Enno Nagel <ennonagel+vim@gmail.com> +" Eisuke Kawashima +" Last Change: 2023 Sep 28 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 @@ -32,16 +32,26 @@ if exists("loaded_matchit") && !exists("b:match_words") let b:undo_ftplugin ..= " | unlet! b:match_ignorecase b:match_words" endif -" Change the :browse e filter to primarily show shell-related files. if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" .. - \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" .. - \ "Bash Shell Scripts (*.bash)\t*.bash\n" .. - \ "All Files (*.*)\t*.*\n" + let b:browsefilter = "Bourne Shell Scripts (*.sh)\t*.sh\n" .. + \ "Korn Shell Scripts (*.ksh)\t*.ksh\n" .. + \ "Bash Shell Scripts (*.bash)\t*.bash\n" .. + \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif -" Restore the saved compatibility options. +if get(b:, "is_bash", 0) + if !has("gui_running") && executable("less") + command! -buffer -nargs=1 ShKeywordPrg silent exe '!bash -c "{ help "<args>" 2>/dev/null || man "<args>"; } | LESS= less"' | redraw! + elseif has("terminal") + command! -buffer -nargs=1 ShKeywordPrg silent exe ':term bash -c "help "<args>" 2>/dev/null || man "<args>""' + else + command! -buffer -nargs=1 ShKeywordPrg echo system('bash -c "help <args>" 2>/dev/null || man "<args>"') + endif + setlocal keywordprg=:ShKeywordPrg + let b:undo_ftplugin ..= " | setl kp< | sil! delc -buffer ShKeywordPrg" +endif + let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/ftplugin/solidity.vim b/runtime/ftplugin/solidity.vim new file mode 100644 index 0000000000..abe9f2ff26 --- /dev/null +++ b/runtime/ftplugin/solidity.vim @@ -0,0 +1,15 @@ +" Vim filetype plugin file +" Language: Solidity +" Maintainer: Cothi (jiungdev@gmail.com) +" Original Author: tomlion (https://github.com/tomlion/vim-solidity) +" Last Change: 2022 Sep 27 +" 2023 Aug 22 Vim Project (did_ftplugin, undo_ftplugin) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=//\ %s + +let b:undo_ftplugin = "setlocal commentstring<" diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index 1c02a98c7c..7a29d39f8e 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -140,7 +140,7 @@ if !exists("*SQL_SetType") \ ) " Remove duplicates, since sqlanywhere.vim can exist in the - " sytax, indent and ftplugin directory, yet we only want + " syntax, indent and ftplugin directory, yet we only want " to display the option once let index = match(sqls, '.\{-}\ze\n') while index > -1 @@ -204,7 +204,7 @@ if !exists("*SQL_SetType") endif let b:sql_type_override = new_sql_type - " Remove any cached SQL since a new sytax will have different + " Remove any cached SQL since a new syntax will have different " items and groups if !exists('g:loaded_sql_completion') || g:loaded_sql_completion >= 100 call sqlcomplete#ResetCacheSyntax() diff --git a/runtime/ftplugin/sshconfig.vim b/runtime/ftplugin/sshconfig.vim index d933ce0527..4a054da52f 100644 --- a/runtime/ftplugin/sshconfig.vim +++ b/runtime/ftplugin/sshconfig.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file -" Language: OpenSSH client configuration file -" Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Language: OpenSSH client configuration file +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -11,9 +11,24 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim -let b:undo_ftplugin = "setl com< cms< fo<" - setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql +let b:undo_ftplugin = 'setlocal com< cms< fo<' + +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 SshconfigKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s+' . <q-args> . '$'' --hilite-search" man ' . 'ssh_config' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 SshconfigKeywordPrg + \ silent exe 'term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s+' . <q-args> . '$', '\') . ''' --hilite-search" man ' . 'ssh_config' + endif + if exists(':SshconfigKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:SshconfigKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SshconfigKeywordPrg' + endif +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/sudoers.vim b/runtime/ftplugin/sudoers.vim index 38dbf559ee..81ce7906a9 100644 --- a/runtime/ftplugin/sudoers.vim +++ b/runtime/ftplugin/sudoers.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: sudoers(5) configuration files " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -15,5 +15,21 @@ let b:undo_ftplugin = "setl com< cms< fo<" setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 SudoersKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''\b' . <q-args> . '\b'' --hilite-search" man ' . 'sudoers' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 SudoersKeywordPrg + \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('\b' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'sudoers' + endif + if exists(':SudoersKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:SudoersKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SudoersKeywordPrg' + endif +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/swig.vim b/runtime/ftplugin/swig.vim new file mode 100644 index 0000000000..506c929a43 --- /dev/null +++ b/runtime/ftplugin/swig.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin file +" Language: SWIG +" Maintainer: Julien Marrec <julien.marrec 'at' gmail com> +" Last Change: 2023 November 23 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setlocal iskeyword<" +setlocal iskeyword+=% diff --git a/runtime/ftplugin/systemd.vim b/runtime/ftplugin/systemd.vim index 4c5c9a1dc1..8bcacdd381 100644 --- a/runtime/ftplugin/systemd.vim +++ b/runtime/ftplugin/systemd.vim @@ -1,41 +1,37 @@ " Vim filetype plugin file " Language: systemd.unit(5) " Keyword Lookup Support: Enno Nagel <enno.nagel+vim@gmail.com> +" Latest Revision: 2023-10-07 if !exists('b:did_ftplugin') " Looks a lot like dosini files. runtime! ftplugin/dosini.vim endif -if !has('unix') - finish -endif - -if !has('gui_running') - command! -buffer -nargs=1 Sman silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw! -elseif has('terminal') - command! -buffer -nargs=1 Sman silent exe 'term ' . KeywordLookup_systemd(<q-args>) -else - finish -endif - -if !exists('*KeywordLookup_systemd') - function KeywordLookup_systemd(keyword) abort - let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$') - if len(matches) > 1 - let section = matches[1] - return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 SystemdKeywordPrg silent exe '!' . KeywordLookup_systemd(<q-args>) | redraw! + elseif has('terminal') + command -buffer -nargs=1 SystemdKeywordPrg silent exe 'term ' . KeywordLookup_systemd(<q-args>) + endif + if exists(':SystemdKeywordPrg') == 2 + if !exists('*KeywordLookup_systemd') + function KeywordLookup_systemd(keyword) abort + let matches = matchlist(getline(search('\v^\s*\[\s*.+\s*\]\s*$', 'nbWz')), '\v^\s*\[\s*(\k+).*\]\s*$') + if len(matches) > 1 + let section = matches[1] + return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd.' . section + else + return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' + endif + endfunction + endif + setlocal iskeyword+=- + setlocal keywordprg=:SystemdKeywordPrg + if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) + let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' else - return 'LESS= MANPAGER="less --pattern=''(^|,)\s+' . a:keyword . '=$'' --hilite-search" man ' . 'systemd' + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer SystemdKeywordPrg' endif - endfunction -endif - -setlocal iskeyword+=- -setlocal keywordprg=:Sman - -if !exists('b:undo_ftplugin') || empty(b:undo_ftplugin) - let b:undo_ftplugin = 'setlocal keywordprg< iskeyword<' -else - let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword<' + endif endif diff --git a/runtime/ftplugin/tcsh.vim b/runtime/ftplugin/tcsh.vim index 85d3873b33..b2467b43a2 100644 --- a/runtime/ftplugin/tcsh.vim +++ b/runtime/ftplugin/tcsh.vim @@ -2,9 +2,11 @@ " Language: tcsh " Maintainer: Doug Kearns <dougkearns@gmail.com> " Previous Maintainer: Dan Sharp -" Last Change: 2021 Oct 15 +" Last Change: 2023 Oct 09 -if exists("b:did_ftplugin") | finish | endif +if exists("b:did_ftplugin") + finish +endif let s:save_cpo = &cpo set cpo-=C @@ -12,24 +14,26 @@ 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" .. - \ "All Files (*.*)\t*.*\n" + \ "All Files (*.*)\t*.*\n" runtime! ftplugin/csh.vim ftplugin/csh_*.vim ftplugin/csh/*.vim let b:did_ftplugin = 1 " Override our defaults if these were set by an included ftplugin. if exists("b:undo_ftplugin") - let s:undo_ftplugin = b:undo_ftplugin + let s:undo_ftplugin = b:undo_ftplugin endif if exists("b:browsefilter") - let s:browsefilter = b:browsefilter + let s:browsefilter = b:browsefilter endif -if (has("gui_win32") || has("gui_gtk")) - let b:browsefilter="tcsh Scripts (*.tcsh)\t*.tcsh\n" .. s:browsefilter +if (has("gui_win32") || has("gui_gtk")) && + \ (!exists("b:browsefilter") || exists("b:csh_set_browsefilter")) + let b:browsefilter = "tcsh Scripts (*.tcsh)\t*.tcsh\n" .. s:browsefilter + let s:undo_ftplugin = "unlet! b:browsefilter | " .. s:undo_ftplugin endif -let b:undo_ftplugin = "unlet! b:browsefilter | " .. s:undo_ftplugin +let b:undo_ftplugin = s:undo_ftplugin let &cpo = s:save_cpo unlet s:save_cpo diff --git a/runtime/ftplugin/tidy.vim b/runtime/ftplugin/tidy.vim index 470548d83a..b81b66db4a 100644 --- a/runtime/ftplugin/tidy.vim +++ b/runtime/ftplugin/tidy.vim @@ -1,5 +1,5 @@ " Vim filetype plugin file -" Language: HMTL Tidy Configuration +" Language: HTML Tidy Configuration " Maintainer: Doug Kearns <dougkearns@gmail.com> " Last Change: 2020 Sep 4 diff --git a/runtime/ftplugin/toml.vim b/runtime/ftplugin/toml.vim index 1ef09a16e3..6bd79b1c0a 100644 --- a/runtime/ftplugin/toml.vim +++ b/runtime/ftplugin/toml.vim @@ -2,7 +2,7 @@ " Language: TOML " Homepage: https://github.com/cespare/vim-toml " Maintainer: Aman Verma -" Author: Kevin Ballard <kevin@sb.org> +" Author: Lily Ballard <lily@ballards.net> " Last Change: Sep 21, 2021 if exists('b:did_ftplugin') diff --git a/runtime/ftplugin/udevrules.vim b/runtime/ftplugin/udevrules.vim index 6404f6c85e..ec365f04c2 100644 --- a/runtime/ftplugin/udevrules.vim +++ b/runtime/ftplugin/udevrules.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: udev(8) rules file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2023-10-07 if exists("b:did_ftplugin") finish @@ -15,5 +15,21 @@ let b:undo_ftplugin = "setl com< cms< fo<" setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql +if has('unix') && executable('less') + if !has('gui_running') + command -buffer -nargs=1 UdevrulesKeywordPrg + \ silent exe '!' . 'LESS= MANPAGER="less --pattern=''^\s{,8}' . <q-args> . '\b'' --hilite-search" man ' . 'udev' | + \ redraw! + elseif has('terminal') + command -buffer -nargs=1 UdevrulesKeywordPrg + \ silent exe ':term ' . 'env LESS= MANPAGER="less --pattern=''' . escape('^\s{,8}' . <q-args> . '\b', '\') . ''' --hilite-search" man ' . 'udev' + endif + if exists(':UdevrulesKeywordPrg') == 2 + setlocal iskeyword+=- + setlocal keywordprg=:UdevrulesKeywordPrg + let b:undo_ftplugin .= '| setlocal keywordprg< iskeyword< | sil! delc -buffer UdevrulesKeywordPrg' + endif +endif + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/unison.vim b/runtime/ftplugin/unison.vim new file mode 100644 index 0000000000..76dbaef6aa --- /dev/null +++ b/runtime/ftplugin/unison.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: unison +" Maintainer: Anton Parkhomenko <anton@chuwy.me> +" Latest Revision: 2023-08-07 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setl cms< isk<" + +setlocal commentstring=--\ %s +setlocal iskeyword+=!,' diff --git a/runtime/ftplugin/urlshortcut.vim b/runtime/ftplugin/urlshortcut.vim new file mode 100644 index 0000000000..ebe08ac1d8 --- /dev/null +++ b/runtime/ftplugin/urlshortcut.vim @@ -0,0 +1,20 @@ +" Vim filetype plugin file +" Language: MS Windows URL shortcut file +" Maintainer: ObserverOfTime <chronobserver@disroot.org> +" Latest Revision: 2023-06-04 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpoptions +set cpoptions&vim + +let b:undo_ftplugin = "setl com< cms< fo<" + +setlocal comments=:; commentstring=;\ %s +setlocal formatoptions-=t formatoptions+=croql + +let &cpoptions = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/usd.vim b/runtime/ftplugin/usd.vim new file mode 100644 index 0000000000..cd5013f960 --- /dev/null +++ b/runtime/ftplugin/usd.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: Pixar Animation's Universal Scene Description format +" Maintainer: Colin Kennedy <colinvfx@gmail.com> +" Last Change: 2023 May 9 +" 2023 Aug 28 by Vim Project (undo_ftplugin) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=#\ %s + +let b:undo_ftplugin = "setlocal commentstring<" diff --git a/runtime/ftplugin/vhdl.vim b/runtime/ftplugin/vhdl.vim index 0249b542be..ff56166ebe 100644 --- a/runtime/ftplugin/vhdl.vim +++ b/runtime/ftplugin/vhdl.vim @@ -3,6 +3,7 @@ " Maintainer: R.Shankar <shankar.pec?gmail.com> " Modified By: Gerald Lai <laigera+vim?gmail.com> " Last Change: 2011 Dec 11 +" 2023 Aug 28 by Vim Project (undo_ftplugin, commentstring) " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -22,13 +23,20 @@ set cpo&vim " Set 'comments' to format dashed lists in comments. "setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// +setlocal commentstring=--\ %s + " Format comments to be up to 78 characters long "setlocal tw=75 +" let b:undo_ftplugin = "setl cms< com< fo< tw<" + +let b:undo_ftplugin = "setl cms< " + " Win32 can filter files in the browse dialog "if has("gui_win32") && !exists("b:browsefilter") " let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . " \ "All Files (*.*)\t*.*\n" +" let b:undo_ftplugin .= " | unlet! b:browsefilter" "endif " Let the matchit plugin know what items can be matched. @@ -52,37 +60,49 @@ if ! exists("b:match_words") && exists("loaded_matchit") \ s:notend.'\<package\>:\<end\s\+package\>,'. \ s:notend.'\<procedure\>:\<end\s\+procedure\>,'. \ s:notend.'\<configuration\>:\<end\s\+configuration\>' + let b:undo_ftplugin .= " | unlet! b:match_ignorecase b:match_words" endif -" count repeat -function! <SID>CountWrapper(cmd) - let i = v:count1 - if a:cmd[0] == ":" - while i > 0 - execute a:cmd - let i = i - 1 - endwhile - else - execute "normal! gv\<Esc>" - execute "normal ".i.a:cmd - let curcol = col(".") - let curline = line(".") - normal! gv - call cursor(curline, curcol) - endif -endfunction +if !exists("no_plugin_maps") && !exists("no_vhdl_maps") + " count repeat + function! <SID>CountWrapper(cmd) + let i = v:count1 + if a:cmd[0] == ":" + while i > 0 + execute a:cmd + let i = i - 1 + endwhile + else + execute "normal! gv\<Esc>" + execute "normal ".i.a:cmd + let curcol = col(".") + let curline = line(".") + normal! gv + call cursor(curline, curcol) + endif + endfunction -" explore motion -" keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units" -let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)' -noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> -noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> -noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> -noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> -vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR> -vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR> -vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR> -vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR> + " explore motion + " keywords: "architecture", "block", "configuration", "component", "entity", "function", "package", "procedure", "process", "record", "units" + let b:vhdl_explore = '\%(architecture\|block\|configuration\|component\|entity\|function\|package\|procedure\|process\|record\|units\)' + noremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> + noremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\%(\\<end\\s\\+\\)\\@<!\\<".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> + noremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%^","bW")')<CR> + noremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper(':cal search("\\%(--.*\\)\\@<!\\<end\\s\\+".b:vhdl_explore."\\>\\c\\<Bar>\\%$","W")')<CR> + vnoremap <buffer><silent>[[ :<C-u>cal <SID>CountWrapper('[[')<CR> + vnoremap <buffer><silent>]] :<C-u>cal <SID>CountWrapper(']]')<CR> + vnoremap <buffer><silent>[] :<C-u>cal <SID>CountWrapper('[]')<CR> + vnoremap <buffer><silent>][ :<C-u>cal <SID>CountWrapper('][')<CR> + let b:undo_ftplugin .= + \ " | silent! execute 'nunmap <buffer> [['" . + \ " | silent! execute 'nunmap <buffer> ]]'" . + \ " | silent! execute 'nunmap <buffer> []'" . + \ " | silent! execute 'nunmap <buffer> ]['" . + \ " | silent! execute 'vunmap <buffer> [['" . + \ " | silent! execute 'vunmap <buffer> ]]'" . + \ " | silent! execute 'vunmap <buffer> []'" . + \ " | silent! execute 'vunmap <buffer> ]['" +endif let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim index b64bb55d68..06369e8a82 100644 --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -1,7 +1,8 @@ " Vim filetype plugin " Language: Vim -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2022 Nov 27 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -83,8 +84,8 @@ if !exists("no_plugin_maps") && !exists("no_vim_maps") vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR> " Move around comments - nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> - vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR> + nnoremap <silent><buffer> ]" :call search('\%(^\s*".*\n\)\@<!\%(^\s*"\)', "W")<CR> + vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\@<!\%(^\s*"\)', "W")<CR> nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR> endif @@ -98,18 +99,23 @@ if exists("loaded_matchit") " func name " require a parenthesis following, then there can be an "endfunc". let b:match_words = - \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' . - \ '\<\(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\(w\%[hile]\|fo\%[r]\)\>,' . - \ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' . - \ '{:},' . - \ '\<try\>:\%(\%(^\||\)\s*\)\@<=\<cat\%[ch]\>:\%(\%(^\||\)\s*\)\@<=\<fina\%[lly]\>:\%(\%(^\||\)\s*\)\@<=\<endt\%[ry]\>,' . - \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' + \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .. + \ '\<\%(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\%(w\%[hile]\|fo\%[r]\)\>,' .. + \ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' .. + \ '{:},' .. + \ '\<try\>:\%(\%(^\||\)\s*\)\@<=\<cat\%[ch]\>:\%(\%(^\||\)\s*\)\@<=\<fina\%[lly]\>:\%(\%(^\||\)\s*\)\@<=\<endt\%[ry]\>,' .. + \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' .. + \ '\<class\>:\<endclass\>,' .. + \ '\<inte\%[rface]\>:\<endinterface\>,' .. + \ '\<enu\%[m]\>:\<endenum\>,' + " Ignore syntax region commands and settings, any 'en*' would clobber " if-endif. " - set spl=de,en " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ … - let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name") - \ =~? "comment\\|string\\|vimLetHereDoc\\|vimSynReg\\|vimSet"' + " Also ignore here-doc and dictionary keys (vimVar). + let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name") + \ =~? "comment\\|string\\|vimSynReg\\|vimSet\\|vimLetHereDoc\\|vimVar"' endif let &cpo = s:cpo_save diff --git a/runtime/ftplugin/wast.vim b/runtime/ftplugin/wat.vim index 0d9e98d37a..35d2d6a322 100644 --- a/runtime/ftplugin/wast.vim +++ b/runtime/ftplugin/wat.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: WebAssembly " Maintainer: rhysd <lin90162@yahoo.co.jp> -" Last Change: Jul 29, 2018 +" Last Change: Nov 14, 2023 " For bugs, patches and license go to https://github.com/rhysd/vim-wasm if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/wget.vim b/runtime/ftplugin/wget.vim index 7a10221824..db3b62191e 100644 --- a/runtime/ftplugin/wget.vim +++ b/runtime/ftplugin/wget.vim @@ -1,5 +1,5 @@ " Vim filetype plugin file -" Language: Wget configuration file (/etc/wgetrc ~/.wgetrc) +" Language: Wget configuration file (/etc/wgetrc ~/.wgetrc) " Maintainer: Doug Kearns <dougkearns@gmail.com> " Last Change: 2022 Apr 28 @@ -18,7 +18,7 @@ setlocal formatoptions-=t formatoptions+=croql let b:undo_ftplugin = "setl fo< com< cms<" if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Wget Configuration File (wgetrc, .wgetrc)\twgetrc;.wgetrc\n" . + let b:browsefilter = "Wget Configuration File (wgetrc, .wgetrc)\twgetrc;.wgetrc\n" .. \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/wget2.vim b/runtime/ftplugin/wget2.vim index a6845f6df5..8cfcd514e5 100644 --- a/runtime/ftplugin/wget2.vim +++ b/runtime/ftplugin/wget2.vim @@ -1,5 +1,5 @@ " Vim filetype plugin file -" Language: Wget2 configuration file (/etc/wget2rc ~/.wget2rc) +" Language: Wget2 configuration file (/etc/wget2rc ~/.wget2rc) " Maintainer: Doug Kearns <dougkearns@gmail.com> " Last Change: 2022 Apr 28 @@ -18,7 +18,7 @@ setlocal formatoptions-=t formatoptions+=croql let b:undo_ftplugin = "setl fo< com< cms<" if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") - let b:browsefilter = "Wget2 Configuration File (wget2rc, .wget2rc)\twget2rc;.wget2rc\n" . + let b:browsefilter = "Wget2 Configuration File (wget2rc, .wget2rc)\twget2rc;.wget2rc\n" .. \ "All Files (*.*)\t*.*\n" let b:undo_ftplugin ..= " | unlet! b:browsefilter" endif diff --git a/runtime/ftplugin/xcompose.vim b/runtime/ftplugin/xcompose.vim new file mode 100644 index 0000000000..7345c27a2e --- /dev/null +++ b/runtime/ftplugin/xcompose.vim @@ -0,0 +1,13 @@ +" Vim filetype plugin file +" Language: XCompose +" Maintainer: ObserverOfTime <chronobserver@disroot.org +" Last Change: 2023 Nov 09 + +if exists('b:did_ftplugin') + finish +endif +let b:did_ftplugin = 1 + +setl comments=:# commentstring=#\ %s + +let b:undo_ftplugin = 'setl com< cms<' diff --git a/runtime/ftplugin/xdefaults.lua b/runtime/ftplugin/xdefaults.lua new file mode 100644 index 0000000000..b4e68148f5 --- /dev/null +++ b/runtime/ftplugin/xdefaults.lua @@ -0,0 +1 @@ +vim.bo.commentstring = '/*%s*/' diff --git a/runtime/ftplugin/zig.vim b/runtime/ftplugin/zig.vim index e740a52849..28b8cd5a67 100644 --- a/runtime/ftplugin/zig.vim +++ b/runtime/ftplugin/zig.vim @@ -17,7 +17,7 @@ compiler zig_build " Match Zig builtin fns setlocal iskeyword+=@-@ -" Recomended code style, no tabs and 4-space indentation +" Recommended code style, no tabs and 4-space indentation setlocal expandtab setlocal tabstop=8 setlocal softtabstop=4 @@ -28,7 +28,7 @@ setlocal formatoptions-=t formatoptions+=croql setlocal suffixesadd=.zig,.zir if has('comments') - setlocal comments=:///,://!,://,:\\\\ + setlocal comments=:///,://!,:// setlocal commentstring=//\ %s endif @@ -39,7 +39,9 @@ endif let &l:define='\v(<fn>|<const>|<var>|^\s*\#\s*define)' -if !exists('g:zig_std_dir') && exists('*json_decode') && executable('zig') +" Safety check: don't execute zig from current directory +if !exists('g:zig_std_dir') && exists('*json_decode') && + \ executable('zig') && dist#vim#IsSafeExecutable('zig', 'zig') silent let s:env = system('zig env') if v:shell_error == 0 let g:zig_std_dir = json_decode(s:env)['std_dir'] @@ -48,7 +50,7 @@ if !exists('g:zig_std_dir') && exists('*json_decode') && executable('zig') endif if exists('g:zig_std_dir') - let &l:path = &l:path . ',' . g:zig_std_dir + let &l:path = g:zig_std_dir . ',' . &l:path endif let b:undo_ftplugin = diff --git a/runtime/ftplugin/zimbu.vim b/runtime/ftplugin/zimbu.vim index cbe2f55572..94d6be758d 100644 --- a/runtime/ftplugin/zimbu.vim +++ b/runtime/ftplugin/zimbu.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: Zimbu -" Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2022 Sep 07 +" Maintainer: The Vim Project <https://github.com/vim/vim> +" Last Change: 2023 Aug 10 +" Former Maintainer: Bram Moolenaar <Bram@vim.org> " Only do this when not done yet for this buffer if exists("b:did_ftplugin") diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim index 0ca8077305..40986fccbe 100644 --- a/runtime/ftplugin/zsh.vim +++ b/runtime/ftplugin/zsh.vim @@ -2,7 +2,7 @@ " Language: Zsh shell script " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2021-04-03 +" Latest Revision: 2023-10-07 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-zsh @@ -20,17 +20,17 @@ let b:undo_ftplugin = "setl com< cms< fo< " if executable('zsh') && &shell !~# '/\%(nologin\|false\)$' if !has('gui_running') && executable('less') - command! -buffer -nargs=1 RunHelp silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw! + command! -buffer -nargs=1 ZshKeywordPrg silent exe '!MANPAGER= zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null | LESS= less"' | redraw! elseif has('terminal') - command! -buffer -nargs=1 RunHelp silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"' + command! -buffer -nargs=1 ZshKeywordPrg silent exe ':term zsh -c "autoload -Uz run-help; run-help <args>"' else - command! -buffer -nargs=1 RunHelp echo system('zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') + command! -buffer -nargs=1 ZshKeywordPrg echo system('zsh -c "autoload -Uz run-help; run-help <args> 2>/dev/null"') endif if !exists('current_compiler') compiler zsh endif - setlocal keywordprg=:RunHelp - let b:undo_ftplugin .= 'keywordprg<' + setlocal keywordprg=:ZshKeywordPrg + let b:undo_ftplugin .= 'keywordprg< | sil! delc -buffer ZshKeywordPrg' endif let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>' |