diff options
31 files changed, 16277 insertions, 1215 deletions
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index 9f9609434f..b6c4c660b8 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -163,7 +163,7 @@ fun! tar#Browse(tarfile) " call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " - elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' + elseif tarfile =~# '\.\(tgz\)$' || tarfile =~# '\.\(tbz\)$' || tarfile =~# '\.\(txz\)$' || tarfile =~# '\.\(tzs\)$' if has("unix") && executable("file") let filekind= system("file ".shellescape(tarfile,1)) =~ "bzip2" else @@ -174,6 +174,8 @@ fun! tar#Browse(tarfile) exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " elseif filekind =~ "XZ" exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + elseif filekind =~ "Zstandard" + exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " else exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " endif @@ -190,6 +192,8 @@ fun! tar#Browse(tarfile) elseif tarfile =~# '\.\(xz\|txz\)$' " call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + elseif tarfile =~# '\.\(zst\|tzs\)$' + exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " else if tarfile =~ '^\s*-' " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. @@ -302,6 +306,9 @@ fun! tar#Read(fname,mode) elseif fname =~ '\.xz$' && executable("xzcat") let decmp= "|xzcat" let doro = 1 + elseif fname =~ '\.zst$' && executable("zstdcat") + let decmp= "|zstdcat" + let doro = 1 else let decmp="" let doro = 0 @@ -331,6 +338,8 @@ fun! tar#Read(fname,mode) exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif filekind =~ "XZ" exe "sil! r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + elseif filekind =~ "Zstandard" + exe "sil! r! zstd --decompress --stdout -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp else exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp endif @@ -452,6 +461,10 @@ fun! tar#Write(fname) let tarfile = substitute(tarfile,'\.xz','','e') let compress= "xz -- ".shellescape(tarfile,0) " call Decho("compress<".compress.">") + elseif tarfile =~# '\.zst' + call system("zstd --decompress -- ".shellescape(tarfile,0)) + let tarfile = substitute(tarfile,'\.zst','','e') + let compress= "zstd -- ".shellescape(tarfile,0) elseif tarfile =~# '\.lzma' call system("lzma -d -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.lzma','','e') @@ -676,6 +689,28 @@ fun! tar#Extract() else echo "***note*** successfully extracted ".fname endif + + elseif filereadable(tarbase.".tzs") + let extractcmd= substitute(extractcmd,"-","--zstd","") +" call Decho("system(".extractcmd." ".shellescape(tarbase).".tzs ".shellescape(fname).")") + call system(extractcmd." ".shellescape(tarbase).".txz ".shellescape(fname)) + if v:shell_error != 0 + echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!" | echohl NONE +" call Decho("***error*** ".extractcmd." ".tarbase.".tzs ".fname.": failed!") + else + echo "***note*** successfully extracted ".fname + endif + + elseif filereadable(tarbase.".tar.zst") + let extractcmd= substitute(extractcmd,"-","--zstd","") +" call Decho("system(".extractcmd." ".shellescape(tarbase).".tar.zst ".shellescape(fname).")") + call system(extractcmd." ".shellescape(tarbase).".tar.xz ".shellescape(fname)) + if v:shell_error != 0 + echohl Error | echo "***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!" | echohl NONE +" call Decho("***error*** ".extractcmd." ".tarbase.".tar.zst ".fname.": failed!") + else + echo "***note*** successfully extracted ".fname + endif endif " restore option diff --git a/runtime/compiler/zsh.vim b/runtime/compiler/zsh.vim new file mode 100644 index 0000000000..5703c1fc44 --- /dev/null +++ b/runtime/compiler/zsh.vim @@ -0,0 +1,23 @@ +" Vim compiler file +" Compiler: Zsh +" Maintainer: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2020 Sep 6 + +if exists("current_compiler") + finish +endif +let current_compiler = "zsh" + +if exists(":CompilerSet") != 2 " older Vim always used :setlocal + command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo&vim + +CompilerSet makeprg=zsh\ -n\ --\ %:S +CompilerSet errorformat=%f:\ line\ %l:\ %m, + \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index 4eb746260e..19720e1841 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -563,16 +563,15 @@ Local mappings: MAN *ft-man-plugin* *:Man* *man.vim* -Displays a manual page in a nice way. Also see the user manual -|find-manpage|. - -To start using the ":Man" command before any manual page was loaded, source -this script from your startup vimrc file: > +This plugin displays a manual page in a nice way. See |find-manpage| in the +user manual for more information. +To start using the |:Man| command before any manual page has been loaded, +source this script from your startup |vimrc| file: > runtime ftplugin/man.vim Options: -'iskeyword' the '.' character is added to be able to use CTRL-] on the +'iskeyword' The '.' character is added to support the use of CTRL-] on the manual page name. Commands: @@ -582,24 +581,25 @@ Man {number} {name} Global mapping: <Leader>K Displays the manual page for the word under the cursor. -<Plug>ManPreGetPage idem, allows for using a mapping: > - nmap <F1> <Plug>ManPreGetPage<CR> +<Plug>ManPreGetPage + idem, allows for using a mapping: > + nmap <F1> <Plug>ManPreGetPage Local mappings: CTRL-] Jump to the manual page for the word under the cursor. CTRL-T Jump back to the previous manual page. -q Same as ":quit" +q Same as the |:quit| command. To use a vertical split instead of horizontal: > let g:ft_man_open_mode = 'vert' To use a new tab: > let g:ft_man_open_mode = 'tab' -To enable folding use this: > - let g:ft_man_folding_enable = 1 -If you do not like the default folding, use an autocommand to add your desired +To enable |folding|, use this: > + let g:ft_man_folding_enable = 1 +If you do not like the default folding, use an |autocommand| to add your desired folding style instead. For example: > - autocmd FileType man setlocal foldmethod=indent foldenable + autocmd FileType man setlocal foldmethod=indent foldenable If you would like :Man {number} {name} to behave like man {number} {name} by not running man {name} if no page is found, then use this: > @@ -612,7 +612,7 @@ page in a Vim window: > MANPAGER *manpager.vim* -The :Man command allows you to turn Vim into a manpager (that syntax highlights +The |:Man| command allows you to turn Vim into a manpager (that syntax highlights manpages and follows linked manpages on hitting CTRL-]). For bash,zsh,ksh or dash, add to the config file (.bashrc,.zshrc, ...) diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 6b38b8c04a..00d01bc520 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 8.2. Last change: 2020 Aug 15 +*syntax.txt* For Vim version 8.2. Last change: 2020 Nov 22 VIM REFERENCE MANUAL by Bram Moolenaar @@ -5305,6 +5305,12 @@ If you like Question highlighting for C comments, put this in your vimrc file: > Without the "default" in the C syntax file, the highlighting would be overruled when the syntax file is loaded. +To have a link survive `:highlight clear`, which is useful if you have +highlighting for a specific filetype and you want to keep it when selecting +another color scheme, put a command like this in the +"after/syntax/{filetype}.vim" file: > + highlight! default link cComment Question + ============================================================================== 15. Cleaning up *:syn-clear* *E391* diff --git a/runtime/doc/terminal.txt b/runtime/doc/terminal.txt index 1d751c37ba..08815ef8ce 100644 --- a/runtime/doc/terminal.txt +++ b/runtime/doc/terminal.txt @@ -1,4 +1,4 @@ -*terminal.txt* For Vim version 8.2. Last change: 2020 Nov 15 +*terminal.txt* For Vim version 8.2. Last change: 2020 Nov 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -123,12 +123,14 @@ use |:tlmenu| instead of |:tmenu|. *options-in-terminal* After opening the terminal window and setting 'buftype' to "terminal" the -TerminalOpen autocommand event is triggered. This makes it possible to set -options specifically for the window and buffer. Example: > - au TerminalOpen * if &buftype == 'terminal' | setlocal bufhidden=hide | endif -The <abuf> is set to the terminal buffer, but if there is no window (hidden -terminal) then setting options will happen in the wrong buffer, therefore the -check for &buftype in the example. +|TerminalWinOpen| autocommand event is triggered. This makes it possible to set +options specifically for the terminal window and buffer. Example: > + au TerminalWinOpen * setlocal bufhidden=hide + +There is also the |TerminalOpen| event, but this may be triggered for a hidden +terminal, and the current window and buffer may not be for the new terminal. +You need to use <abuf>, which is set to the terminal buffer. Example: > + au TerminalOpen * call setbufvar(+expand('<abuf>'), '&colorcolumn', 123) Mouse events (click and drag) are passed to the terminal. Mouse move events are only passed when Vim itself is receiving them. For a terminal that is @@ -504,7 +506,7 @@ term_dumpdiff({filename}, {filename} [, {options}]) + missing position in first file - missing position in second file > cursor position in first file, not in second - < cursor position in secone file, not in first + < cursor position in second file, not in first Using the "s" key the top and bottom parts are swapped. This makes it easy to spot a difference. diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index b8088d5459..454c0c24b6 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.2. Last change: 2020 Nov 19 +*todo.txt* For Vim version 8.2. Last change: 2020 Nov 28 VIM REFERENCE MANUAL by Bram Moolenaar @@ -38,8 +38,6 @@ browser use: https://github.com/vim/vim/issues/1234 *known-bugs* -------------------- Known bugs and current work ----------------------- -Coverity errors in October and November. - Vim9 - Change - Drop support for #{} early December. Close #7310 -> Does it work to recognize lambda? @@ -47,8 +45,10 @@ Vim9 - Change var int = 5 {x: int, y: int} Vim9 - Making everything work: +- Compile: for [key, value] in items(map): Also support @r, $VAR, etc. - Make map() give an error if the resulting type of the first argument is - wrong. Only works if the type is known? + wrong. Only works if the type is known? Is this slow (need to go over all + items)? - Run the same tests in :def and Vim9 script, like in Test_expr7_not() - need to check type when a declaration specifies a type: #6507 let nr: number = 'asdf' @@ -57,8 +57,6 @@ Vim9 - Making everything work: the script-local function, not a global one. - Make sure that where a callback is expected a function can be used (without quotes). E.g. sort() and map(). Also at the script level. -- assignment to more complex lval: list[1][2][3] = 8 #7309 - Also "list[0] += value". test in Test_assign_dict_unknown_type(). - ":put" with ISN_PUT does not handle range correctly, e.g. ":$-2put". Add command to parse range at runtime? - When defining an :autocmd or :command, how to specify using Vim9 syntax? @@ -77,9 +75,6 @@ Vim9 - Making everything work: - Expand `=expr` in :next, :argedit, :argadd, :argdelete, :drop - Expand `=expr` in :vimgrep, :vimgrepadd, :lvimgrep, :lvimgrepadd - Expand `=expr` in :mkspell -- Test that a function defined inside a :def function is local to that - function, g: functions can be defined and script-local functions cannot be - defined. - Does this work already: can use func as reference: def SomeFunc() ... map(list, SomeFunc) @@ -87,7 +82,6 @@ Vim9 - Making everything work: - make 0 == 'string' fail on the script level, like inside :def. - Check that when using a user function name without prefix, it does not find a global function. Prefixing g: is required. -- Compile: for [key, value] in items(map) - Need the equivalent of get_lval() and set_var_lval() to implement assignment to nested list and dict members. - Assignment to dict doesn't work: @@ -127,8 +121,9 @@ Also: - Test each level of expressions properly, with type checking - Test try/catch and throw better, also nested. Test return inside try/finally jumps to finally and then returns. -- Test: Function declared inside a :def function is local, disappears at the - end of the function. Unless g: is used, just like with variables. +- Test that a function defined inside a :def function is local to that + function, g: functions can be defined and script-local functions cannot be + defined. - implement :type - import type declaration? - Future work: See |vim9-classes| @@ -160,7 +155,6 @@ Popup windows: current window. ? - switch between current window and all popup windows Esc in popup window goes back to previous current window -- Cursor not updated before a redraw, making it jump. (#5943) - Add a termcap entry for changing the cursor when it goes under the popup and back. like t_SI and t_EI (t_SU and t_EU, where "U" means under?) - With terminal in popup, allow for popup_hide() to temporarily hide it.? @@ -278,6 +272,9 @@ Was originally written by Felipe Morales. Remove SPACE_IN_FILENAME ? It is only used for completion. +Making breakat support multibyte characters (Yasuhiro Matsumoto, #6598) +Scroll doesn't work correctly, why? + Add 'termguiattr' option, use "gui=" attributes in the terminal? Would work with 'termguicolors'. #1740 @@ -292,9 +289,6 @@ Add an option to start_timer() to return from the input loop with K_IGNORE. This is useful e.g. when a popup was created that disables mappings, we need to return from vgetc() to make this happen. #7011 -Making breakat support multibyte characters (Yasuhiro Matsumoto, #6598) -Scroll doesn't work correctly, why? - Expanding <mods> should put the tab number from cmdmod.tab before "tab". Any way to convert "$" back by using a special value? (#6901) @@ -323,6 +317,9 @@ autocommands for the buffer lifecycle: BufIsRenamed (after buffer ID gets another name) The buffer list and windows are locked, no changes possible +Add a ModeChanged autocommand that has an argument indicating the old and new +mode, as what's returned from mode(). Also used for switching Terminal mode. + Matchparen doesn't remove highlight after undo. (#7054) Is OK when syntax HL is active. @@ -766,6 +763,7 @@ Make ":interactive !cmd" stop termcap mode, also when used in an autocommand. Add buffer argument to undotree(). (#4001) +Memory leak in test_debugger Using uninitialized value in test_crypt (can't explain why). Memory leak in test_terminal_fail TODO: be able to run all parts of test_alot with valgrind separately @@ -896,9 +894,6 @@ Try out background make plugin: or asyncmake: https://github.com/yegappan/asyncmake -Add a ModeChanged autocommand that has an argument indicating the old and new -mode, as what's returned from mode(). Also used for switching Terminal mode. - Add an option with file patterns, to be used when unloading a buffer: If there is a match, remove entries for the buffer from marks, jumplist, etc. To be used for git temp files. diff --git a/runtime/doc/version8.txt b/runtime/doc/version8.txt index 951a3070f6..f7dc1fc071 100644 --- a/runtime/doc/version8.txt +++ b/runtime/doc/version8.txt @@ -76,7 +76,7 @@ Timers ~ Also asynchronous are timers. They can fire once or repeatedly and invoke a function to do any work. For example: > let tempTimer = timer_start(4000, 'CheckTemp') -This will call the CheckTemp() function four seconds (4000 milli seconds) +This will call the CheckTemp() function four seconds (4000 milliseconds) later. See |timer_start()|. diff --git a/runtime/doc/vim9.txt b/runtime/doc/vim9.txt index 9d42b68d06..085e4453e0 100644 --- a/runtime/doc/vim9.txt +++ b/runtime/doc/vim9.txt @@ -1,4 +1,4 @@ -*vim9.txt* For Vim version 8.2. Last change: 2020 Nov 20 +*vim9.txt* For Vim version 8.2. Last change: 2020 Nov 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -388,6 +388,9 @@ This will assign "start" and print a line: > var result = start :+ print +Note that the colon is not required for the |+cmd| argument: > + edit +6 fname + It is also possible to split a function header over multiple lines, in between arguments: > def MyFunc( @@ -1122,7 +1125,7 @@ are used. That is different, thus it's good to use a different command: `:var`. This is used in many languages. The semantics might be slightly different, but it's easily recognized as a declaration. -Using `:const` for constants is common, but the semantics vary. Some +Using `:const` for constants is common, but the semantics varies. Some languages only make the variable immutable, others also make the value immutable. Since "final" is well known from Java for only making the variable immutable we decided to use that. And then `:const` can be used for making @@ -1182,7 +1185,7 @@ text not starting with a number would be converted to zero, which is considered false. Thus using a string for a condition would often not give an error and be considered false. That is confusing. -In Vim9 type checking is more strict to avoid mistakes. Where a condition is +In Vim9 type checking is stricter to avoid mistakes. Where a condition is used, e.g. with the `:if` command and the `||` operator, only boolean-like values are accepted: true: `true`, `v:true`, `1`, `0 < 9` diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 3073c9a6b2..6d636ab8fe 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2020 Oct 24 +" Last Change: 2020 Nov 22 " Listen very carefully, I will say this only once if exists("did_load_filetypes") diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim index 069c02e59a..cf62d02daa 100644 --- a/runtime/ftplugin/nroff.vim +++ b/runtime/ftplugin/nroff.vim @@ -1,7 +1,9 @@ " Vim filetype plugin " Language: roff(7) -" Maintainer: Chris Spiegel <cspiegel@gmail.com> -" Last Change: 2019 Apr 24 +" Maintainer: Aman Verma +" Homepage: https://github.com/a-vrma/vim-nroff-ftplugin +" Previous Maintainer: Chris Spiegel <cspiegel@gmail.com> +" Last Change: 2020 Nov 21 if exists("b:did_ftplugin") finish @@ -9,3 +11,7 @@ endif let b:did_ftplugin = 1 setlocal commentstring=.\\\"%s +setlocal comments=:.\\\" +setlocal sections+=Sh + +let b:undo_ftplugin = 'setlocal commentstring< comments< sections<' diff --git a/runtime/ftplugin/zsh.vim b/runtime/ftplugin/zsh.vim index 741f31b42c..53ce1417dd 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: 2020-01-10 +" Latest Revision: 2020-09-01 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-zsh @@ -19,20 +19,21 @@ setlocal comments=:# commentstring=#\ %s formatoptions-=t formatoptions+=croql let b:undo_ftplugin = "setl com< cms< fo< " if executable('zsh') - if !has('gui_running') && executable('less') - command! -buffer -nargs=1 RunHelp silent exe '!zsh -ic "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 -ic "autoload -Uz run-help; run-help <args>"' - else - command! -buffer -nargs=1 RunHelp echo system('zsh -ic "autoload -Uz run-help; run-help <args> 2>/dev/null"') - endif + if !has('gui_running') && executable('less') + command! -buffer -nargs=1 RunHelp silent exe '!MANPAGER= zsh -ic "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 -ic "autoload -Uz run-help; run-help <args>"' + else + command! -buffer -nargs=1 RunHelp echo system('zsh -ic "autoload -Uz run-help; run-help <args> 2>/dev/null"') + endif + if !exists('current_compiler') + compiler zsh + endif setlocal keywordprg=:RunHelp - setlocal makeprg=zsh\ -n\ --\ %:S - setlocal errorformat=%f:\ line\ %l:\ %m - let b:undo_ftplugin .= 'keywordprg< errorformat< makeprg<' + let b:undo_ftplugin .= 'keywordprg<' endif -let b:match_words = ',\<if\>:\<elif\>:\<else\>:\<fi\>' +let b:match_words = '\<if\>:\<elif\>:\<else\>:\<fi\>' \ . ',\<case\>:^\s*([^)]*):\<esac\>' \ . ',\<\%(select\|while\|until\|repeat\|for\%(each\)\=\)\>:\<done\>' let b:match_skip = 's:comment\|string\|heredoc\|subst' diff --git a/runtime/gvim.desktop b/runtime/gvim.desktop index 3b9ed3ada6..3132bc861d 100644 --- a/runtime/gvim.desktop +++ b/runtime/gvim.desktop @@ -15,7 +15,7 @@ GenericName[eo]=Tekstoredaktilo GenericName[fr]=Éditeur de texte GenericName[ja]=テキストエディタ GenericName[ru]=Текстовый редактор -GenericName[sr]=Текст Едитор +GenericName[sr]=Едитор текст GenericName[tr]=Metin Düzenleyici GenericName=Text Editor # Translators: This is the comment used in the Vim desktop file @@ -24,7 +24,7 @@ Comment[eo]=Redakti tekstajn dosierojn Comment[fr]=Éditer des fichiers texte Comment[ja]=テキストファイルを編集します Comment[ru]=Редактирование текстовых файлов -Comment[sr]=Уређивање текст фајлова +Comment[sr]=Уређујте текст фајлове Comment[tr]=Metin dosyaları düzenleyin Comment=Edit text files # The translations should come from the po file. Leave them here for now, they will @@ -112,7 +112,6 @@ Icon[de]=gvim Icon[eo]=gvim Icon[fr]=gvim Icon[ru]=gvim -Icon[sr]=gvim Icon=gvim Categories=Utility;TextEditor; StartupNotify=true diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim index 413a3ddb53..da65417939 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -2,8 +2,9 @@ " Maintainer: Christian Brabandt <cb@256bit.org> " Repository: https://github.com/chrisbra/vim-xml-ftplugin " Previous Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Changed: 2019 Dec 02 +" Last Changed: 2020 Nov 4th " Last Change: +" 20200529 - Handle empty closing tags correctly " 20191202 - Handle docbk filetype " 20190726 - Correctly handle non-tagged data " 20190204 - correctly handle wrap tags @@ -45,7 +46,7 @@ if !exists('b:xml_indent_open') endif if !exists('b:xml_indent_close') - let b:xml_indent_close = '.\{-}</' + let b:xml_indent_close = '.\{-}</\|/>.\{-}' " end pre tag, e.g. </address> " let b:xml_indent_close = '.\{-}</\(address\)\@!' endif @@ -81,7 +82,7 @@ endfun " [-- return the sum of indents of a:lnum --] fun! <SID>XmlIndentSum(line, style, add) - if <SID>IsXMLContinuation(a:line) && a:style == 0 + if <SID>IsXMLContinuation(a:line) && a:style == 0 && !<SID>IsXMLEmptyClosingTag(a:line) " no complete tag, add one additional indent level " but only for the current line return a:add + shiftwidth() @@ -131,13 +132,25 @@ fun! XmlIndentGet(lnum, use_syntax_check) endif let syn_name_end = synIDattr(synID(a:lnum, strlen(curline) - 1, 1), 'name') let syn_name_start = synIDattr(synID(a:lnum, match(curline, '\S') + 1, 1), 'name') + let prev_syn_name_end = synIDattr(synID(ptag, strlen(pline) - 1, 1), 'name') + " not needed (yet?) + " let prev_syn_name_start = synIDattr(synID(ptag, match(pline, '\S') + 1, 1), 'name') endif if syn_name_end =~ 'Comment' && syn_name_start =~ 'Comment' return <SID>XmlIndentComment(a:lnum) elseif empty(syn_name_start) && empty(syn_name_end) && a:use_syntax_check " non-xml tag content: use indent from 'autoindent' - return pind + shiftwidth() + if pline =~ b:xml_indent_close + return pind + elseif !empty(prev_syn_name_end) + " only indent by an extra shiftwidth, if the previous line ends + " with an XML like tag + return pind + shiftwidth() + else + " no extra indent, looks like a text continuation line + return pind + endif endif " Get indent from previous tag line @@ -157,15 +170,28 @@ func! <SID>HasNoTagEnd(line) return a:line !~ '>\s*$' endfunc +func! <SID>IsXMLEmptyClosingTag(line) + " Checks whether the line ends with an empty closing tag such as <lb/> + return a:line =~? '<[^>]*/>\s*$' +endfunc + " return indent for a commented line, " the middle part might be indented one additional level func! <SID>XmlIndentComment(lnum) - let ptagopen = search(b:xml_indent_open, 'bnW') + let ptagopen = search('.\{-}<[:A-Z_a-z]\_[^/]\{-}>.\{-}', 'bnW') let ptagclose = search(b:xml_indent_close, 'bnW') if getline(a:lnum) =~ '<!--' " if previous tag was a closing tag, do not add " one additional level of indent if ptagclose > ptagopen && a:lnum > ptagclose + " If the previous tag was closed on the same line as it was + " declared, we should indent with its indent level. + if !<SID>IsXMLContinuation(getline(ptagclose)) + return indent(ptagclose) + else + return indent(ptagclose) - shiftwidth() + endif + elseif ptagclose == ptagopen return indent(ptagclose) else " start of comment, add one indentation level diff --git a/runtime/keymap/korean-dubeolsik_utf-8.vim b/runtime/keymap/korean-dubeolsik_utf-8.vim new file mode 100644 index 0000000000..a6b5f2a24c --- /dev/null +++ b/runtime/keymap/korean-dubeolsik_utf-8.vim @@ -0,0 +1,11237 @@ +" Maintainer: Jang Whemoon <palindrom615@gmail.com> +" Last Change: Nov 24, 2020 +" +" +" +" Unlike Japanese or Chinese, modern Korean texts do not depends on conversion +" to Hanja (Chinese character). Thus, general Korean text totally can be +" covered without help of IME but this keymap. +" +" BUT, simply mapping each letter of Hangul with sequence of alphabet 1 by 1 +" can fail to combine Hangul jamo (conconants and vowels) right. +" For example, sequentially pressing `ㅅㅓㅇㅜㄹㄷㅐㅎㅏㄱㅛ` can not only be +" combined as `서울대학교`, but alse `성ㅜㄹ댛ㅏㄱ교`, which is totally +" nonsense. +" Though combining Hangul is deterministic with law that each letter must be +" one of (consonant + vowel) or (consonant + vowel + consonant), there is no +" way to apply such law without implementing input engine. +" +" Thus, user of this keymap should wait until previous hangul letter is +" completed before typing next one. To reduce such inconvenience, I suggest to +" set `timeoutlen` as their own value. (default value is 1000ms) +scriptencoding utf-8 + +let b:keymap_name = "ko" + +loadkeymap + +" Hangul jamo of 40 letters + +q ㅂ +w ㅈ +e ㄷ +r ㄱ +t ㅅ +y ㅛ +u ㅕ +i ㅑ +o ㅐ +p ㅔ +a ㅁ +s ㄴ +d ㅇ |