diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-10-28 22:39:03 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-10-28 22:48:12 +0800 |
commit | a7912b190d135c73821b93aab3e1c500f1533e71 (patch) | |
tree | 174118a7e968e817a7725900aa275367bf2dd867 | |
parent | d9dce2d955b0359d1555bfa86aa641f26ad6e8bc (diff) | |
download | rneovim-a7912b190d135c73821b93aab3e1c500f1533e71.tar.gz rneovim-a7912b190d135c73821b93aab3e1c500f1533e71.tar.bz2 rneovim-a7912b190d135c73821b93aab3e1c500f1533e71.zip |
vim-patch:8.2.1639: options window cannot be translated
Problem: Options window cannot be translated.
Solution: Get the translation for "local to" texts once and use them in many
places. Fix that 'whichwrap' is not a local option. (issue vim/vim#6800)
https://github.com/vim/vim/commit/64075b0ab18449132ed01a07874fe1d1f3f356d4
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | runtime/optwin.vim | 178 |
1 files changed, 88 insertions, 90 deletions
diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 16af8fce17..c85c7f7a10 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -69,14 +69,15 @@ fun! <SID>Space() endif endfun -let s:local_to_window = '(local to window)' -let s:local_to_buffer = '(local to buffer)' +let s:local_to_window = gettext('(local to window)') +let s:local_to_buffer = gettext('(local to buffer)') let s:global_or_local = '(global or local to buffer)' " find the window in which the option applies " returns 0 for global option, 1 for local option, -1 for error fun! <SID>Find(lnum) - if getline(a:lnum - 1) =~ "(local to" + let line = getline(a:lnum - 1) + if line =~ s:local_to_window || line =~ s:local_to_buffer let local = 1 let thiswin = winnr() wincmd p @@ -247,8 +248,7 @@ call <SID>OptionG("hf", &hf) call <SID>Header("moving around, searching and patterns") call append("$", "whichwrap\tlist of flags specifying which commands wrap to another line") -call append("$", "\t(local to window)") -call <SID>OptionL("ww") +call <SID>OptionG("ww") call append("$", "startofline\tmany jump commands move the cursor to the first non-blank") call append("$", "\tcharacter of a line") call <SID>BinOptionG("sol", &sol) @@ -288,10 +288,10 @@ call append("$", "\t(global or local to buffer)") call <SID>OptionG("def", &def) if has("find_in_path") call append("$", "include\tpattern for an include-file line") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("inc") call append("$", "includeexpr\texpression used to transform an include line to a file name") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("inex") endif @@ -316,28 +316,28 @@ call append("$", "showfulltag\twhen completing tags in Insert mode show more inf call <SID>BinOptionG("sft", &sft) if has("eval") call append("$", "tagfunc\ta function to be used to perform tag searches") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("tfu") endif call <SID>Header("displaying text") call append("$", "scroll\tnumber of lines to scroll for CTRL-U and CTRL-D") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>OptionL("scr") call append("$", "scrolloff\tnumber of screen lines to show around the cursor") call append("$", " \tset so=" . &so) call append("$", "wrap\tlong lines wrap") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("wrap") call append("$", "linebreak\twrap long lines at a character in 'breakat'") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("lbr") call append("$", "breakindent\tpreserve indentation in wrapped text") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("bri") call append("$", "breakindentopt\tadjust breakindent behaviour") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>OptionL("briopt") call append("$", "breakat\twhich characters might cause a line break") call <SID>OptionG("brk", &brk) @@ -370,27 +370,27 @@ call append("$", "writedelay\tdelay in msec for each char written to the display call append("$", "\t(for debugging)") call append("$", " \tset wd=" . &wd) call append("$", "list\tshow <Tab> as ^I and end-of-line as $") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("list") call append("$", "listchars\tlist of strings used for list mode") call <SID>OptionG("lcs", &lcs) call append("$", "number\tshow the line number for each line") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("nu") call append("$", "relativenumber\tshow the relative line number for each line") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("rnu") if has("linebreak") call append("$", "numberwidth\tnumber of columns to use for the line number") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("nuw") endif if has("conceal") call append("$", "conceallevel\tcontrols whether concealable text is hidden") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("cole") call append("$", "concealcursor\tmodes in which text in the cursor line can be concealed") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("cocu") endif @@ -399,14 +399,14 @@ call <SID>Header("syntax, highlighting and spelling") call append("$", "background\t\"dark\" or \"light\"; the background color brightness") call <SID>OptionG("bg", &bg) call append("$", "filetype\ttype of file; triggers the FileType event when set") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("ft") if has("syntax") call append("$", "syntax\tname of syntax highlighting used") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("syn") call append("$", "synmaxcol\tmaximum column to look for syntax items") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("smc") endif call append("$", "highlight\twhich highlighting to use for various occasions") @@ -419,31 +419,31 @@ if has("termguicolors") endif if has("syntax") call append("$", "cursorcolumn\thighlight the screen column of the cursor") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("cuc") call append("$", "cursorline\thighlight the screen line of the cursor") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("cul") call append("$", "cursorlineopt\tspecifies which area 'cursorline' highlights") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("culopt") call append("$", "colorcolumn\tcolumns to highlight") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("cc") call append("$", "spell\thighlight spelling mistakes") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("spell") call append("$", "spelllang\tlist of accepted languages") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("spl") call append("$", "spellfile\tfile that \"zg\" adds good words to") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("spf") call append("$", "spellcapcheck\tpattern to locate the end of a sentence") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("spc") call append("$", "spelloptions\tflags to change how spell checking works") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("spo") call append("$", "spellsuggest\tmethods used to suggest corrections") call <SID>OptionG("sps", &sps) @@ -468,10 +468,10 @@ call append("$", " \tset wh=" . &wh) call append("$", "winminheight\tminimal number of lines used for any window") call append("$", " \tset wmh=" . &wmh) call append("$", "winfixheight\tkeep the height of the window") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("wfh") call append("$", "winfixwidth\tkeep the width of the window") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("wfw") call append("$", "winwidth\tminimal number of columns used for the current window") call append("$", " \tset wiw=" . &wiw) @@ -485,7 +485,7 @@ if has("quickfix") call append("$", "previewheight\tdefault height for the preview window") call append("$", " \tset pvh=" . &pvh) call append("$", "previewwindow\tidentifies the preview window") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("pvw") endif call append("$", "hidden\tdon't unload a buffer when no longer shown in a window") @@ -500,19 +500,19 @@ call <SID>BinOptionG("spk", &spk) call append("$", "splitright\ta new window is put right of the current one") call <SID>BinOptionG("spr", &spr) call append("$", "scrollbind\tthis window scrolls together with other bound windows") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("scb") call append("$", "scrollopt\t\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'") call <SID>OptionG("sbo", &sbo) call append("$", "cursorbind\tthis window's cursor moves together with other bound windows") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("crb") if has("terminal") call append("$", "termsize\tsize of a terminal window") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("tms") call append("$", "termkey\tkey that precedes Vim commands in a terminal window") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("tk") endif @@ -743,36 +743,34 @@ call <SID>OptionL("wm") call append("$", "backspace\tspecifies what <BS>, CTRL-W, etc. can do in Insert mode") call append("$", " \tset bs=" . &bs) call append("$", "comments\tdefinition of what comment lines look like") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("com") call append("$", "formatoptions\tlist of flags that tell how automatic formatting works") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("fo") call append("$", "formatlistpat\tpattern to recognize a numbered list") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("flp") if has("eval") call append("$", "formatexpr\texpression used for \"gq\" to format lines") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("fex") endif if has("insert_expand") call append("$", "complete\tspecifies how Insert mode completion works for CTRL-N and CTRL-P") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("cpt") call append("$", "completeopt\twhether to use a popup menu for Insert mode completion") call <SID>OptionG("cot", &cot) call append("$", "pumheight\tmaximum height of the popup menu") call <SID>OptionG("ph", &ph) - if exists("&pw") - call append("$", "pumwidth\tminimum width of the popup menu") - call <SID>OptionG("pw", &pw) - endif + call append("$", "pumwidth\tminimum width of the popup menu") + call <SID>OptionG("pw", &pw) call append("$", "completefunc\tuser defined function for Insert mode completion") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("cfu") call append("$", "omnifunc\tfunction for filetype-specific Insert mode completion") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("ofu") call append("$", "dictionary\tlist of dictionary files for keyword completion") call append("$", "\t(global or local to buffer)") @@ -782,7 +780,7 @@ if has("insert_expand") call <SID>OptionG("tsr", &tsr) endif call append("$", "infercase\tadjust case of a keyword completion match") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("inf") if has("digraphs") call append("$", "digraph\tenable entering digraphs with c1 <BS> c2") @@ -808,69 +806,69 @@ call <SID>OptionL("nf") call <SID>Header("tabs and indenting") call append("$", "tabstop\tnumber of spaces a <Tab> in the text stands for") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("ts") call append("$", "shiftwidth\tnumber of spaces used for each step of (auto)indent") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("sw") if has("vartabs") call append("$", "vartabstop\tlist of number of spaces a tab counts for") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("vts") call append("$", "varsofttabstop\tlist of number of spaces a soft tabsstop counts for") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("vsts") endif call append("$", "smarttab\ta <Tab> in an indent inserts 'shiftwidth' spaces") call <SID>BinOptionG("sta", &sta) call append("$", "softtabstop\tif non-zero, number of spaces to insert for a <Tab>") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("sts") call append("$", "shiftround\tround to 'shiftwidth' for \"<<\" and \">>\"") call <SID>BinOptionG("sr", &sr) call append("$", "expandtab\texpand <Tab> to spaces in Insert mode") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("et") call append("$", "autoindent\tautomatically set the indent of a new line") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("ai") if has("smartindent") call append("$", "smartindent\tdo clever autoindenting") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("si") endif if has("cindent") call append("$", "cindent\tenable specific indenting for C code") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("cin") call append("$", "cinoptions\toptions for C-indenting") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("cino") call append("$", "cinkeys\tkeys that trigger C-indenting in Insert mode") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("cink") call append("$", "cinwords\tlist of words that cause more C-indent") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("cinw") call append("$", "cinscopedecls\tlist of scope declaration names used by cino-g") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("cinsd") call append("$", "indentexpr\texpression used to obtain the indent of a line") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("inde") call append("$", "indentkeys\tkeys that trigger indenting with 'indentexpr' in Insert mode") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("indk") endif call append("$", "copyindent\tcopy whitespace for indenting from previous line") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("ci") call append("$", "preserveindent\tpreserve kind of whitespace when changing indent") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("pi") if has("lispindent") call append("$", "lisp\tenable lisp mode") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("lisp") call append("$", "lispwords\twords that change how lisp indenting works") call <SID>OptionL("lw") @@ -890,17 +888,17 @@ if has("folding") call append("$", "foldlevelstart\tvalue for 'foldlevel' when starting to edit a file") call append("$", " \tset fdls=" . &fdls) call append("$", "foldcolumn\twidth of the column used to indicate folds") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("fdc") call append("$", "foldtext\texpression used to display the text of a closed fold") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("fdt") call append("$", "foldclose\tset to \"all\" to close a fold when the cursor leaves it") call <SID>OptionG("fcl", &fcl) call append("$", "foldopen\tspecifies for which commands a fold will be opened") call <SID>OptionG("fdo", &fdo) call append("$", "foldminlines\tminimum number of screen lines for a fold to be closed") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("fml") call append("$", "commentstring\ttemplate for comments; used to put the marker in") call <SID>OptionL("cms") @@ -925,7 +923,7 @@ endif if has("diff") call <SID>Header("diff mode") call append("$", "diff\tuse diff mode for the current window") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("diff") call append("$", "diffopt\toptions for using diff mode") call <SID>OptionG("dip", &dip) @@ -952,30 +950,30 @@ call append("$", " \tset ttm=" . &ttm) call <SID>Header("reading and writing files") call append("$", "modeline\tenable using settings from modelines when reading a file") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("ml") call append("$", "modelineexpr\tallow setting expression options from a modeline") call <SID>BinOptionG("mle", &mle) call append("$", "modelines\tnumber of lines to check for modelines") call append("$", " \tset mls=" . &mls) call append("$", "binary\tbinary file editing") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("bin") call append("$", "endofline\tlast line in the file has an end-of-line") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("eol") call append("$", "fixendofline\tfixes missing end-of-line at end of text file") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("fixeol") call append("$", "bomb\tprepend a Byte Order Mark to the file") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("bomb") call append("$", "fileformat\tend-of-line format: \"dos\", \"unix\" or \"mac\"") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("ff") call append("$", "fileformats\tlist of file formats to look for when editing a file") call <SID>OptionG("ffs", &ffs) -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call append("$", "write\twriting files is allowed") call <SID>BinOptionG("write", &write) call append("$", "writebackup\twrite a backup file before overwriting a file") @@ -1010,7 +1008,7 @@ call <SID>Header("the swap file") call append("$", "directory\tlist of directories for the swap file") call <SID>OptionG("dir", &dir) call append("$", "swapfile\tuse a swap file for this buffer") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("swf") call append("$", "updatecount\tnumber of characters typed to cause a swap file update") call append("$", " \tset uc=" . &uc) @@ -1035,7 +1033,7 @@ call append("$", "suffixes\tlist of file name extensions that have a lower prior call <SID>OptionG("su", &su) if has("file_in_path") call append("$", "suffixesadd\tlist of file name extensions added when searching for a file") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("sua") endif if has("wildignore") @@ -1122,21 +1120,21 @@ call <SID>OptionG("isf", &isf) call append("$", "isident\tspecifies the characters in an identifier") call <SID>OptionG("isi", &isi) call append("$", "iskeyword\tspecifies the characters in a keyword") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("isk") call append("$", "isprint\tspecifies printable characters") call <SID>OptionG("isp", &isp) if has("textobjects") call append("$", "quoteescape\tspecifies escape characters in a string") - call append("$", "\t(local to buffer)") + call append("$", "\t" .. s:local_to_buffer) call <SID>OptionL("qe") endif if has("rightleft") call append("$", "rightleft\tdisplay the buffer right-to-left") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("rl") call append("$", "rightleftcmd\twhen to edit the command-line right-to-left") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>OptionL("rlc") call append("$", "revins\tinsert characters backwards") call <SID>BinOptionG("ri", &ri) @@ -1151,7 +1149,7 @@ if has("rightleft") endif if has("arabic") call append("$", "arabic\tprepare for editing Arabic text") - call append("$", "\t(local to window)") + call append("$", "\t" .. s:local_to_window) call <SID>BinOptionL("arab") call append("$", "arabicshape\tperform shaping of Arabic characters") call <SID>BinOptionG("arshape", &arshape) @@ -1173,10 +1171,10 @@ if has("xim") call <SID>BinOptionG("imd", &imd) endif call append("$", "iminsert\tin Insert mode: 1: use :lmap; 2: use IM; 0: neither") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>OptionL("imi") call append("$", "imsearch\tentering a search pattern: 1: use :lmap; 2: use IM; 0: neither") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>OptionL("ims") if has("xim") call append("$", "imcmdline\twhen set always use IM when starting to edit a command line") @@ -1254,12 +1252,12 @@ if has("quickfix") call <SID>OptionL("bt") endif call append("$", "buflisted\twhether the buffer shows up in the buffer list") -call append("$", "\t(local to buffer)") +call append("$", "\t" .. s:local_to_buffer) call <SID>BinOptionL("bl") call append("$", "debug\tset to \"msg\" to see all error messages") call append("$", " \tset debug=" . &debug) call append("$", "signcolumn\twhether to show the signcolumn") -call append("$", "\t(local to window)") +call append("$", "\t" .. s:local_to_window) call <SID>OptionL("scl") set cpo&vim |