mirror of
https://github.com/neovim/neovim.git
synced 2025-09-17 08:48:16 +00:00
feat(options)!: deprecate paste, remove pastetoggle (#22647)
we cannot remove 'paste'. It is very common in plugins and configs. 'pastetoggle' can and should be removed though, it's a total waste of everyone's time because it generates bug reports and doesn't work well, and is useless because bracketed-paste works better.
This commit is contained in:
@@ -704,7 +704,6 @@ InsertCharPre When a character is typed in Insert mode,
|
|||||||
inserted literally.
|
inserted literally.
|
||||||
|
|
||||||
Cannot change the text. |textlock|
|
Cannot change the text. |textlock|
|
||||||
Not triggered when 'paste' is set.
|
|
||||||
*InsertEnter*
|
*InsertEnter*
|
||||||
InsertEnter Just before starting Insert mode. Also for
|
InsertEnter Just before starting Insert mode. Also for
|
||||||
Replace mode and Virtual Replace mode. The
|
Replace mode and Virtual Replace mode. The
|
||||||
|
@@ -1725,8 +1725,6 @@ Note that when 'textwidth' is 0, Vim does no automatic formatting anyway (but
|
|||||||
does insert comment leaders according to the 'comments' option). An exception
|
does insert comment leaders according to the 'comments' option). An exception
|
||||||
is when the 'a' flag is present. |auto-format|
|
is when the 'a' flag is present. |auto-format|
|
||||||
|
|
||||||
Note that when 'paste' is on, Vim does no formatting at all.
|
|
||||||
|
|
||||||
Note that 'textwidth' can be non-zero even if Vim never performs auto-wrapping;
|
Note that 'textwidth' can be non-zero even if Vim never performs auto-wrapping;
|
||||||
'textwidth' is still useful for formatting with "gq".
|
'textwidth' is still useful for formatting with "gq".
|
||||||
|
|
||||||
|
@@ -146,6 +146,27 @@ OPTIONS
|
|||||||
- 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
|
- 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
|
||||||
- *'viminfo'* Deprecated alias to 'shada' option.
|
- *'viminfo'* Deprecated alias to 'shada' option.
|
||||||
- *'viminfofile'* Deprecated alias to 'shadafile' option.
|
- *'viminfofile'* Deprecated alias to 'shadafile' option.
|
||||||
|
- *'paste'* *'nopaste'* This option is obsolete; |paste| is handled automatically.
|
||||||
|
Enables "paste mode":
|
||||||
|
- mappings in Insert mode and Command-line mode are
|
||||||
|
disabled
|
||||||
|
- abbreviations are disabled
|
||||||
|
- 'autoindent' is reset
|
||||||
|
- 'expandtab' is reset
|
||||||
|
- 'formatoptions' is used like it is empty
|
||||||
|
- 'revins' is reset
|
||||||
|
- 'ruler' is reset
|
||||||
|
- 'showmatch' is reset
|
||||||
|
- 'smartindent' is reset
|
||||||
|
- 'smarttab' is reset
|
||||||
|
- 'softtabstop' is set to 0
|
||||||
|
- 'textwidth' is set to 0
|
||||||
|
- 'wrapmargin' is set to 0
|
||||||
|
These options keep their value, but their effect is
|
||||||
|
disabled:
|
||||||
|
- 'cindent'
|
||||||
|
- 'indentexpr'
|
||||||
|
- 'lisp'
|
||||||
|
|
||||||
UI EXTENSIONS
|
UI EXTENSIONS
|
||||||
- *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled
|
- *ui-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled
|
||||||
|
@@ -695,8 +695,7 @@ this (see |<>|). Example: >
|
|||||||
:map _ls :!ls -l %:S<CR>:echo "the end"<CR>
|
:map _ls :!ls -l %:S<CR>:echo "the end"<CR>
|
||||||
|
|
||||||
To avoid mapping of the characters you type in insert or Command-line mode,
|
To avoid mapping of the characters you type in insert or Command-line mode,
|
||||||
type a CTRL-V first. The mapping in Insert mode is disabled if the 'paste'
|
type a CTRL-V first.
|
||||||
option is on.
|
|
||||||
*map-error*
|
*map-error*
|
||||||
Note that when an error is encountered (that causes an error message or might
|
Note that when an error is encountered (that causes an error message or might
|
||||||
cause a beep) the rest of the mapping is not executed. This is Vi-compatible.
|
cause a beep) the rest of the mapping is not executed. This is Vi-compatible.
|
||||||
@@ -1070,8 +1069,6 @@ Abbreviations are never recursive. You can use ":ab f f-o-o" without any
|
|||||||
problem. But abbreviations can be mapped. {some versions of Vi support
|
problem. But abbreviations can be mapped. {some versions of Vi support
|
||||||
recursive abbreviations, for no apparent reason}
|
recursive abbreviations, for no apparent reason}
|
||||||
|
|
||||||
Abbreviations are disabled if the 'paste' option is on.
|
|
||||||
|
|
||||||
*:abbreviate-local* *:abbreviate-<buffer>*
|
*:abbreviate-local* *:abbreviate-<buffer>*
|
||||||
Just like mappings, abbreviations can be local to a buffer. This is mostly
|
Just like mappings, abbreviations can be local to a buffer. This is mostly
|
||||||
used in a |filetype-plugin| file. Example for a C plugin file: >
|
used in a |filetype-plugin| file. Example for a C plugin file: >
|
||||||
|
@@ -45,6 +45,9 @@ The following changes may require adaptations in user config or plugins.
|
|||||||
- `printheader`
|
- `printheader`
|
||||||
- `printmbcharset`
|
- `printmbcharset`
|
||||||
|
|
||||||
|
• 'paste' option is now deprecated and 'pastetoggle' is removed. |paste| works
|
||||||
|
automatically in GUI and terminal (TUI) Nvim. Just Paste It.™
|
||||||
|
|
||||||
• libiconv and intl are now required build dependencies.
|
• libiconv and intl are now required build dependencies.
|
||||||
|
|
||||||
• Unsaved changes are now preserved rather than discarded when |channel-stdio|
|
• Unsaved changes are now preserved rather than discarded when |channel-stdio|
|
||||||
|
@@ -676,8 +676,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
line.
|
line.
|
||||||
When 'smartindent' or 'cindent' is on the indent is changed in
|
When 'smartindent' or 'cindent' is on the indent is changed in
|
||||||
a different way.
|
a different way.
|
||||||
The 'autoindent' option is reset when the 'paste' option is set and
|
|
||||||
restored when 'paste' is reset.
|
|
||||||
{small difference from Vi: After the indent is deleted when typing
|
{small difference from Vi: After the indent is deleted when typing
|
||||||
<Esc> or <CR>, the cursor position when moving up or down is after the
|
<Esc> or <CR>, the cursor position when moving up or down is after the
|
||||||
deleted indent; Vi puts the cursor somewhere in the deleted indent}.
|
deleted indent; Vi puts the cursor somewhere in the deleted indent}.
|
||||||
@@ -1266,7 +1264,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
See |C-indenting|.
|
See |C-indenting|.
|
||||||
When you don't like the way 'cindent' works, try the 'smartindent'
|
When you don't like the way 'cindent' works, try the 'smartindent'
|
||||||
option or 'indentexpr'.
|
option or 'indentexpr'.
|
||||||
This option is not used when 'paste' is set.
|
|
||||||
|
|
||||||
*'cinkeys'* *'cink'*
|
*'cinkeys'* *'cink'*
|
||||||
'cinkeys' 'cink' string (default "0{,0},0),0],:,0#,!^F,o,O,e")
|
'cinkeys' 'cink' string (default "0{,0},0),0],:,0#,!^F,o,O,e")
|
||||||
@@ -2246,8 +2243,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
<Tab>. Spaces are used in indents with the '>' and '<' commands and
|
<Tab>. Spaces are used in indents with the '>' and '<' commands and
|
||||||
when 'autoindent' is on. To insert a real tab when 'expandtab' is
|
when 'autoindent' is on. To insert a real tab when 'expandtab' is
|
||||||
on, use CTRL-V<Tab>. See also |:retab| and |ins-expandtab|.
|
on, use CTRL-V<Tab>. See also |:retab| and |ins-expandtab|.
|
||||||
This option is reset when the 'paste' option is set and restored when
|
|
||||||
the 'paste' option is reset.
|
|
||||||
|
|
||||||
*'exrc'* *'ex'* *'noexrc'* *'noex'*
|
*'exrc'* *'ex'* *'noexrc'* *'noex'*
|
||||||
'exrc' 'ex' boolean (default off)
|
'exrc' 'ex' boolean (default off)
|
||||||
@@ -2749,9 +2744,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
'formatoptions' 'fo' string (default: "tcqj")
|
'formatoptions' 'fo' string (default: "tcqj")
|
||||||
local to buffer
|
local to buffer
|
||||||
This is a sequence of letters which describes how automatic
|
This is a sequence of letters which describes how automatic
|
||||||
formatting is to be done. See |fo-table|. When the 'paste' option is
|
formatting is to be done. See |fo-table|. Commas can be inserted for
|
||||||
on, no formatting is done (like 'formatoptions' is empty). Commas can
|
readability.
|
||||||
be inserted for readability.
|
|
||||||
To avoid problems with flags that are added in the future, use the
|
To avoid problems with flags that are added in the future, use the
|
||||||
"+=" and "-=" feature of ":set" |add-option-flags|.
|
"+=" and "-=" feature of ":set" |add-option-flags|.
|
||||||
|
|
||||||
@@ -3392,7 +3386,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
When this option is not empty, it overrules the 'cindent' and
|
When this option is not empty, it overrules the 'cindent' and
|
||||||
'smartindent' indenting. When 'lisp' is set, this option is
|
'smartindent' indenting. When 'lisp' is set, this option is
|
||||||
is only used when 'lispoptions' contains "expr:1".
|
is only used when 'lispoptions' contains "expr:1".
|
||||||
When 'paste' is set this option is not used for indenting.
|
|
||||||
The expression is evaluated with |v:lnum| set to the line number for
|
The expression is evaluated with |v:lnum| set to the line number for
|
||||||
which the indent is to be computed. The cursor is also in this line
|
which the indent is to be computed. The cursor is also in this line
|
||||||
when the expression is evaluated (but it may be moved around).
|
when the expression is evaluated (but it may be moved around).
|
||||||
@@ -3761,7 +3754,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
The '-' character is included in keyword characters. Redefines the
|
The '-' character is included in keyword characters. Redefines the
|
||||||
"=" operator to use this same indentation algorithm rather than
|
"=" operator to use this same indentation algorithm rather than
|
||||||
calling an external program if 'equalprg' is empty.
|
calling an external program if 'equalprg' is empty.
|
||||||
This option is not used when 'paste' is set.
|
|
||||||
|
|
||||||
*'lispoptions'* *'lop'*
|
*'lispoptions'* *'lop'*
|
||||||
'lispoptions' 'lop' string (default "")
|
'lispoptions' 'lop' string (default "")
|
||||||
@@ -4474,77 +4466,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
Specifies the nroff macros that separate paragraphs. These are pairs
|
Specifies the nroff macros that separate paragraphs. These are pairs
|
||||||
of two letters (see |object-motions|).
|
of two letters (see |object-motions|).
|
||||||
|
|
||||||
*'paste'* *'nopaste'*
|
|
||||||
'paste' boolean (default off)
|
|
||||||
global
|
|
||||||
This option is obsolete; |bracketed-paste-mode| is built-in.
|
|
||||||
|
|
||||||
Put Vim in Paste mode. This is useful if you want to cut or copy
|
|
||||||
some text from one window and paste it in Vim. This will avoid
|
|
||||||
unexpected effects.
|
|
||||||
Setting this option is useful when using Vim in a terminal, where Vim
|
|
||||||
cannot distinguish between typed text and pasted text. In the GUI, Vim
|
|
||||||
knows about pasting and will mostly do the right thing without 'paste'
|
|
||||||
being set. The same is true for a terminal where Vim handles the
|
|
||||||
mouse clicks itself.
|
|
||||||
This option is reset when starting the GUI. Thus if you set it in
|
|
||||||
your vimrc it will work in a terminal, but not in the GUI. Setting
|
|
||||||
'paste' in the GUI has side effects: e.g., the Paste toolbar button
|
|
||||||
will no longer work in Insert mode, because it uses a mapping.
|
|
||||||
When the 'paste' option is switched on (also when it was already on):
|
|
||||||
- mapping in Insert mode and Command-line mode is disabled
|
|
||||||
- abbreviations are disabled
|
|
||||||
- 'autoindent' is reset
|
|
||||||
- 'expandtab' is reset
|
|
||||||
- 'hkmap' is reset
|
|
||||||
- 'revins' is reset
|
|
||||||
- 'ruler' is reset
|
|
||||||
- 'showmatch' is reset
|
|
||||||
- 'smarttab' is reset
|
|
||||||
- 'softtabstop' is set to 0
|
|
||||||
- 'textwidth' is set to 0
|
|
||||||
- 'wrapmargin' is set to 0
|
|
||||||
- 'varsofttabstop' is made empty
|
|
||||||
These options keep their value, but their effect is disabled:
|
|
||||||
- 'cindent'
|
|
||||||
- 'formatoptions' is used like it is empty
|
|
||||||
- 'indentexpr'
|
|
||||||
- 'lisp'
|
|
||||||
- 'smartindent'
|
|
||||||
NOTE: When you start editing another file while the 'paste' option is
|
|
||||||
on, settings from the modelines or autocommands may change the
|
|
||||||
settings again, causing trouble when pasting text. You might want to
|
|
||||||
set the 'paste' option again.
|
|
||||||
When the 'paste' option is reset the mentioned options are restored to
|
|
||||||
the value before the moment 'paste' was switched from off to on.
|
|
||||||
Resetting 'paste' before ever setting it does not have any effect.
|
|
||||||
Since mapping doesn't work while 'paste' is active, you need to use
|
|
||||||
the 'pastetoggle' option to toggle the 'paste' option with some key.
|
|
||||||
|
|
||||||
*'pastetoggle'* *'pt'*
|
|
||||||
'pastetoggle' 'pt' string (default "")
|
|
||||||
global
|
|
||||||
When non-empty, specifies the key sequence that toggles the 'paste'
|
|
||||||
option. This is like specifying a mapping: >
|
|
||||||
:map {keys} :set invpaste<CR>
|
|
||||||
< Where {keys} is the value of 'pastetoggle'.
|
|
||||||
The difference is that it will work even when 'paste' is set.
|
|
||||||
'pastetoggle' works in Insert mode and Normal mode, but not in
|
|
||||||
Command-line mode.
|
|
||||||
Mappings are checked first, thus overrule 'pastetoggle'. However,
|
|
||||||
when 'paste' is on mappings are ignored in Insert mode, thus you can do
|
|
||||||
this: >
|
|
||||||
:map <F10> :set paste<CR>
|
|
||||||
:map <F11> :set nopaste<CR>
|
|
||||||
:imap <F10> <C-O>:set paste<CR>
|
|
||||||
:imap <F11> <nop>
|
|
||||||
:set pastetoggle=<F11>
|
|
||||||
< This will make <F10> start paste mode and <F11> stop paste mode.
|
|
||||||
Note that typing <F10> in paste mode inserts "<F10>", since in paste
|
|
||||||
mode everything is inserted literally, except the 'pastetoggle' key
|
|
||||||
sequence.
|
|
||||||
When the value has several bytes 'ttimeoutlen' applies.
|
|
||||||
|
|
||||||
*'pex'* *'patchexpr'*
|
*'pex'* *'patchexpr'*
|
||||||
'patchexpr' 'pex' string (default "")
|
'patchexpr' 'pex' string (default "")
|
||||||
global
|
global
|
||||||
@@ -4827,8 +4748,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
Inserting characters in Insert mode will work backwards. See "typing
|
Inserting characters in Insert mode will work backwards. See "typing
|
||||||
backwards" |ins-reverse|. This option can be toggled with the CTRL-_
|
backwards" |ins-reverse|. This option can be toggled with the CTRL-_
|
||||||
command in Insert mode, when 'allowrevins' is set.
|
command in Insert mode, when 'allowrevins' is set.
|
||||||
This option is reset when 'paste' is set and restored when 'paste' is
|
|
||||||
reset.
|
|
||||||
|
|
||||||
*'rightleft'* *'rl'* *'norightleft'* *'norl'*
|
*'rightleft'* *'rl'* *'norightleft'* *'norl'*
|
||||||
'rightleft' 'rl' boolean (default off)
|
'rightleft' 'rl' boolean (default off)
|
||||||
@@ -4877,8 +4796,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
separated with a dash.
|
separated with a dash.
|
||||||
For an empty line "0-1" is shown.
|
For an empty line "0-1" is shown.
|
||||||
For an empty buffer the line number will also be zero: "0,0-1".
|
For an empty buffer the line number will also be zero: "0,0-1".
|
||||||
This option is reset when 'paste' is set and restored when 'paste' is
|
|
||||||
reset.
|
|
||||||
If you don't want to see the ruler all the time but want to know where
|
If you don't want to see the ruler all the time but want to know where
|
||||||
you are, use "g CTRL-G" |g_CTRL-G|.
|
you are, use "g CTRL-G" |g_CTRL-G|.
|
||||||
|
|
||||||
@@ -5610,8 +5527,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
show the match can be set with 'matchtime'.
|
show the match can be set with 'matchtime'.
|
||||||
A Beep is given if there is no match (no matter if the match can be
|
A Beep is given if there is no match (no matter if the match can be
|
||||||
seen or not).
|
seen or not).
|
||||||
This option is reset when 'paste' is set and restored when 'paste' is
|
|
||||||
reset.
|
|
||||||
When the 'm' flag is not included in 'cpoptions', typing a character
|
When the 'm' flag is not included in 'cpoptions', typing a character
|
||||||
will immediately move the cursor back to where it belongs.
|
will immediately move the cursor back to where it belongs.
|
||||||
See the "sm" field in 'guicursor' for setting the cursor shape and
|
See the "sm" field in 'guicursor' for setting the cursor shape and
|
||||||
@@ -5733,8 +5648,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H.
|
mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H.
|
||||||
When using the ">>" command, lines starting with '#' are not shifted
|
When using the ">>" command, lines starting with '#' are not shifted
|
||||||
right.
|
right.
|
||||||
This option is reset when 'paste' is set and restored when 'paste' is
|
|
||||||
reset.
|
|
||||||
|
|
||||||
*'smarttab'* *'sta'* *'nosmarttab'* *'nosta'*
|
*'smarttab'* *'sta'* *'nosmarttab'* *'nosta'*
|
||||||
'smarttab' 'sta' boolean (default on)
|
'smarttab' 'sta' boolean (default on)
|
||||||
@@ -5749,8 +5662,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
What gets inserted (a <Tab> or spaces) depends on the 'expandtab'
|
What gets inserted (a <Tab> or spaces) depends on the 'expandtab'
|
||||||
option. Also see |ins-expandtab|. When 'expandtab' is not set, the
|
option. Also see |ins-expandtab|. When 'expandtab' is not set, the
|
||||||
number of spaces is minimized by using <Tab>s.
|
number of spaces is minimized by using <Tab>s.
|
||||||
This option is reset when 'paste' is set and restored when 'paste' is
|
|
||||||
reset.
|
|
||||||
|
|
||||||
*'softtabstop'* *'sts'*
|
*'softtabstop'* *'sts'*
|
||||||
'softtabstop' 'sts' number (default 0)
|
'softtabstop' 'sts' number (default 0)
|
||||||
@@ -5763,8 +5674,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
commands like "x" still work on the actual characters.
|
commands like "x" still work on the actual characters.
|
||||||
When 'sts' is zero, this feature is off.
|
When 'sts' is zero, this feature is off.
|
||||||
When 'sts' is negative, the value of 'shiftwidth' is used.
|
When 'sts' is negative, the value of 'shiftwidth' is used.
|
||||||
'softtabstop' is set to 0 when the 'paste' option is set and restored
|
|
||||||
when 'paste' is reset.
|
|
||||||
See also |ins-expandtab|. When 'expandtab' is not set, the number of
|
See also |ins-expandtab|. When 'expandtab' is not set, the number of
|
||||||
spaces is minimized by using <Tab>s.
|
spaces is minimized by using <Tab>s.
|
||||||
The 'L' flag in 'cpoptions' changes how tabs are used when 'list' is
|
The 'L' flag in 'cpoptions' changes how tabs are used when 'list' is
|
||||||
@@ -6579,8 +6488,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
Maximum width of text that is being inserted. A longer line will be
|
Maximum width of text that is being inserted. A longer line will be
|
||||||
broken after white space to get this width. A zero value disables
|
broken after white space to get this width. A zero value disables
|
||||||
this.
|
this.
|
||||||
'textwidth' is set to 0 when the 'paste' option is set and restored
|
|
||||||
when 'paste' is reset.
|
|
||||||
When 'textwidth' is zero, 'wrapmargin' may be used. See also
|
When 'textwidth' is zero, 'wrapmargin' may be used. See also
|
||||||
'formatoptions' and |ins-textwidth|.
|
'formatoptions' and |ins-textwidth|.
|
||||||
When 'formatexpr' is set it will be used to break the line.
|
When 'formatexpr' is set it will be used to break the line.
|
||||||
|
@@ -812,8 +812,6 @@ Short explanation of each option: *option-list*
|
|||||||
'operatorfunc' 'opfunc' function to be called for |g@| operator
|
'operatorfunc' 'opfunc' function to be called for |g@| operator
|
||||||
'packpath' 'pp' list of directories used for packages
|
'packpath' 'pp' list of directories used for packages
|
||||||
'paragraphs' 'para' nroff macros that separate paragraphs
|
'paragraphs' 'para' nroff macros that separate paragraphs
|
||||||
'paste' allow pasting text
|
|
||||||
'pastetoggle' 'pt' key code that causes 'paste' to toggle
|
|
||||||
'patchexpr' 'pex' expression used to patch a file
|
'patchexpr' 'pex' expression used to patch a file
|
||||||
'patchmode' 'pm' keep the oldest version of a file
|
'patchmode' 'pm' keep the oldest version of a file
|
||||||
'path' 'pa' list of directories searched with "gf" et.al.
|
'path' 'pa' list of directories searched with "gf" et.al.
|
||||||
|
@@ -623,6 +623,7 @@ Options:
|
|||||||
'highlight' (Names of builtin |highlight-groups| cannot be changed.)
|
'highlight' (Names of builtin |highlight-groups| cannot be changed.)
|
||||||
*'hkmap'* *'hk'* use `set keymap=hebrew` instead.
|
*'hkmap'* *'hk'* use `set keymap=hebrew` instead.
|
||||||
*'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead.
|
*'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead.
|
||||||
|
*'pastetoggle'* *'pt'*
|
||||||
|
|
||||||
*'imactivatefunc'* *'imaf'*
|
*'imactivatefunc'* *'imaf'*
|
||||||
*'imactivatekey'* *'imak'*
|
*'imactivatekey'* *'imak'*
|
||||||
|
@@ -106,11 +106,7 @@ func <SID>Update(lnum, line, local, thiswin)
|
|||||||
else
|
else
|
||||||
let name = substitute(a:line, '^ \tset \(no\)\=\([a-z]*\).*', '\2', "")
|
let name = substitute(a:line, '^ \tset \(no\)\=\([a-z]*\).*', '\2', "")
|
||||||
endif
|
endif
|
||||||
if name == "pt" && &pt =~ "\x80"
|
|
||||||
let val = <SID>PTvalue()
|
|
||||||
else
|
|
||||||
let val = escape(eval('&' . name), " \t\\\"|")
|
let val = escape(eval('&' . name), " \t\\\"|")
|
||||||
endif
|
|
||||||
if a:local
|
if a:local
|
||||||
exe a:thiswin . "wincmd w"
|
exe a:thiswin . "wincmd w"
|
||||||
endif
|
endif
|
||||||
@@ -211,14 +207,6 @@ func <SID>Header(text)
|
|||||||
let s:lnum = s:lnum + 1
|
let s:lnum = s:lnum + 1
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Get the value of 'pastetoggle'. It could be a special key.
|
|
||||||
func <SID>PTvalue()
|
|
||||||
redir @a
|
|
||||||
silent set pt
|
|
||||||
redir END
|
|
||||||
return substitute(@a, '[^=]*=\(.*\)', '\1', "")
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Restore the previous value of 'cpoptions' here, it's used below.
|
" Restore the previous value of 'cpoptions' here, it's used below.
|
||||||
let &cpo = s:cpo_save
|
let &cpo = s:cpo_save
|
||||||
|
|
||||||
@@ -232,12 +220,6 @@ call <SID>AddOption("cpoptions", gettext("list of flags to specify Vi compatibil
|
|||||||
call <SID>OptionG("cpo", &cpo)
|
call <SID>OptionG("cpo", &cpo)
|
||||||
call <SID>AddOption("paste", gettext("paste mode, insert typed text literally"))
|
call <SID>AddOption("paste", gettext("paste mode, insert typed text literally"))
|
||||||
call <SID>BinOptionG("paste", &paste)
|
call <SID>BinOptionG("paste", &paste)
|
||||||
call <SID>AddOption("pastetoggle", gettext("key sequence to toggle paste mode"))
|
|
||||||
if &pt =~ "\x80"
|
|
||||||
call append("$", " \tset pt=" . <SID>PTvalue())
|
|
||||||
else
|
|
||||||
call <SID>OptionG("pt", &pt)
|
|
||||||
endif
|
|
||||||
call <SID>AddOption("runtimepath", gettext("list of directories used for runtime files and plugins"))
|
call <SID>AddOption("runtimepath", gettext("list of directories used for runtime files and plugins"))
|
||||||
call <SID>OptionG("rtp", &rtp)
|
call <SID>OptionG("rtp", &rtp)
|
||||||
call <SID>AddOption("packpath", gettext("list of directories used for plugin packages"))
|
call <SID>AddOption("packpath", gettext("list of directories used for plugin packages"))
|
||||||
|
@@ -2073,39 +2073,6 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for match with 'pastetoggle'
|
|
||||||
if (*p_pt != NUL && mp == NULL && (State & (MODE_INSERT | MODE_NORMAL))) {
|
|
||||||
bool match = typebuf_match_len((uint8_t *)p_pt, &mlen);
|
|
||||||
if (match) {
|
|
||||||
// write chars to script file(s)
|
|
||||||
if (mlen > typebuf.tb_maplen) {
|
|
||||||
gotchars(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_maplen,
|
|
||||||
(size_t)(mlen - typebuf.tb_maplen));
|
|
||||||
}
|
|
||||||
|
|
||||||
del_typebuf(mlen, 0); // remove the chars
|
|
||||||
set_option_value_give_err("paste", !p_paste, NULL, 0);
|
|
||||||
if (!(State & MODE_INSERT)) {
|
|
||||||
msg_col = 0;
|
|
||||||
msg_row = Rows - 1;
|
|
||||||
msg_clr_eos(); // clear ruler
|
|
||||||
}
|
|
||||||
status_redraw_all();
|
|
||||||
redraw_statuslines();
|
|
||||||
showmode();
|
|
||||||
setcursor();
|
|
||||||
*keylenp = keylen;
|
|
||||||
return map_result_retry;
|
|
||||||
}
|
|
||||||
// Need more chars for partly match.
|
|
||||||
if (mlen == typebuf.tb_len) {
|
|
||||||
keylen = KEYLEN_PART_KEY;
|
|
||||||
} else if (max_mlen < mlen) {
|
|
||||||
// no match, may have to check for termcode at next character
|
|
||||||
max_mlen = mlen + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP) {
|
if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP) {
|
||||||
// When no matching mapping found or found a non-matching mapping that
|
// When no matching mapping found or found a non-matching mapping that
|
||||||
// matches at least what the matching mapping matched:
|
// matches at least what the matching mapping matched:
|
||||||
@@ -2116,13 +2083,6 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|
|||||||
|| (typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER && typebuf.tb_len < 4))) {
|
|| (typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER && typebuf.tb_len < 4))) {
|
||||||
// Incomplete modifier sequence: cannot decide whether to simplify yet.
|
// Incomplete modifier sequence: cannot decide whether to simplify yet.
|
||||||
keylen = KEYLEN_PART_KEY;
|
keylen = KEYLEN_PART_KEY;
|
||||||
} else if (keylen == KEYLEN_PART_KEY && !*timedout) {
|
|
||||||
// If 'pastetoggle' matched partially, don't simplify.
|
|
||||||
// When the last characters were not typed, don't wait for a typed character to
|
|
||||||
// complete 'pastetoggle'.
|
|
||||||
if (typebuf.tb_len == typebuf.tb_maplen) {
|
|
||||||
keylen = 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// Try to include the modifier into the key.
|
// Try to include the modifier into the key.
|
||||||
keylen = check_simplify_modifier(max_mlen + 1);
|
keylen = check_simplify_modifier(max_mlen + 1);
|
||||||
@@ -2923,18 +2883,6 @@ int fix_input_buffer(uint8_t *buf, int len)
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool typebuf_match_len(const uint8_t *str, int *mlen)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < typebuf.tb_len && str[i]; i++) {
|
|
||||||
if (str[i] != typebuf.tb_buf[typebuf.tb_off + i]) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*mlen = i;
|
|
||||||
return str[i] == NUL; // matched the whole string
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Get command argument for <Cmd> key
|
/// Get command argument for <Cmd> key
|
||||||
char *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
|
char *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
|
||||||
{
|
{
|
||||||
|
@@ -2918,12 +2918,8 @@ getoption_T get_option_value(const char *name, long *numval, char **stringval, u
|
|||||||
return gov_hidden_string;
|
return gov_hidden_string;
|
||||||
}
|
}
|
||||||
if (stringval != NULL) {
|
if (stringval != NULL) {
|
||||||
if ((char **)varp == &p_pt) { // 'pastetoggle'
|
|
||||||
*stringval = str2special_save(*(char **)(varp), false, false);
|
|
||||||
} else {
|
|
||||||
*stringval = xstrdup(*(char **)(varp));
|
*stringval = xstrdup(*(char **)(varp));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return gov_string;
|
return gov_string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3532,17 +3528,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char **valuep, uint64_
|
|||||||
char_u *part = NULL;
|
char_u *part = NULL;
|
||||||
|
|
||||||
if (*valuep != NULL) {
|
if (*valuep != NULL) {
|
||||||
// Output 'pastetoggle' as key names. For other
|
if ((flags & P_EXPAND) != 0) {
|
||||||
// options some characters have to be escaped with
|
|
||||||
// CTRL-V or backslash
|
|
||||||
if (valuep == &p_pt) {
|
|
||||||
char_u *s = (char_u *)(*valuep);
|
|
||||||
while (*s != NUL) {
|
|
||||||
if (put_escstr(fd, (char *)str2special((const char **)&s, false, false), 2) == FAIL) {
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ((flags & P_EXPAND) != 0) {
|
|
||||||
size_t size = (size_t)strlen(*valuep) + 1;
|
size_t size = (size_t)strlen(*valuep) + 1;
|
||||||
|
|
||||||
// replace home directory in the whole option value into "buf"
|
// replace home directory in the whole option value into "buf"
|
||||||
@@ -4990,9 +4976,6 @@ static void option_value2string(vimoption_T *opp, int scope)
|
|||||||
NameBuff[0] = NUL;
|
NameBuff[0] = NUL;
|
||||||
} else if (opp->flags & P_EXPAND) {
|
} else if (opp->flags & P_EXPAND) {
|
||||||
home_replace(NULL, varp, NameBuff, MAXPATHL, false);
|
home_replace(NULL, varp, NameBuff, MAXPATHL, false);
|
||||||
// Translate 'pastetoggle' into special key names.
|
|
||||||
} else if ((char **)opp->var == &p_pt) {
|
|
||||||
str2specialbuf((const char *)p_pt, NameBuff, MAXPATHL);
|
|
||||||
} else {
|
} else {
|
||||||
xstrlcpy(NameBuff, varp, MAXPATHL);
|
xstrlcpy(NameBuff, varp, MAXPATHL);
|
||||||
}
|
}
|
||||||
|
@@ -613,7 +613,6 @@ EXTERN char *p_nf; ///< 'nrformats'
|
|||||||
EXTERN char *p_opfunc; // 'operatorfunc'
|
EXTERN char *p_opfunc; // 'operatorfunc'
|
||||||
EXTERN char *p_para; // 'paragraphs'
|
EXTERN char *p_para; // 'paragraphs'
|
||||||
EXTERN int p_paste; // 'paste'
|
EXTERN int p_paste; // 'paste'
|
||||||
EXTERN char *p_pt; // 'pastetoggle'
|
|
||||||
EXTERN char *p_pex; // 'patchexpr'
|
EXTERN char *p_pex; // 'patchexpr'
|
||||||
EXTERN char *p_pm; // 'patchmode'
|
EXTERN char *p_pm; // 'patchmode'
|
||||||
EXTERN char *p_path; // 'path'
|
EXTERN char *p_path; // 'path'
|
||||||
|
@@ -1685,9 +1685,8 @@ return {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
full_name='pastetoggle', abbreviation='pt',
|
full_name='pastetoggle', abbreviation='pt',
|
||||||
short_desc=N_("key code that causes 'paste' to toggle"),
|
short_desc=N_("No description"),
|
||||||
type='string', scope={'global'},
|
type='string', scope={'global'},
|
||||||
varname='p_pt',
|
|
||||||
defaults={if_true=""}
|
defaults={if_true=""}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@@ -1306,22 +1306,6 @@ static void did_set_foldcolumn(char **varp, char **errmsg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void did_set_pastetoggle(void)
|
|
||||||
{
|
|
||||||
// 'pastetoggle': translate key codes like in a mapping
|
|
||||||
if (*p_pt) {
|
|
||||||
char *p = NULL;
|
|
||||||
(void)replace_termcodes(p_pt,
|
|
||||||
strlen(p_pt),
|
|
||||||
&p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
|
|
||||||
CPO_TO_CPO_FLAGS);
|
|
||||||
if (p != NULL) {
|
|
||||||
free_string_option(p_pt);
|
|
||||||
p_pt = p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void did_set_backspace(char **errmsg)
|
static void did_set_backspace(char **errmsg)
|
||||||
{
|
{
|
||||||
if (ascii_isdigit(*p_bs)) {
|
if (ascii_isdigit(*p_bs)) {
|
||||||
@@ -1778,8 +1762,6 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
|
|||||||
did_set_opt_strings(*varp, p_sloc_values, false, &errmsg);
|
did_set_opt_strings(*varp, p_sloc_values, false, &errmsg);
|
||||||
} else if (gvarp == &win->w_allbuf_opt.wo_fdc) { // 'foldcolumn'
|
} else if (gvarp == &win->w_allbuf_opt.wo_fdc) { // 'foldcolumn'
|
||||||
did_set_foldcolumn(varp, &errmsg);
|
did_set_foldcolumn(varp, &errmsg);
|
||||||
} else if (varp == &p_pt) { // 'pastetoggle'
|
|
||||||
did_set_pastetoggle();
|
|
||||||
} else if (varp == &p_bs) { // 'backspace'
|
} else if (varp == &p_bs) { // 'backspace'
|
||||||
did_set_backspace(&errmsg);
|
did_set_backspace(&errmsg);
|
||||||
} else if (varp == &p_bo) {
|
} else if (varp == &p_bo) {
|
||||||
|
@@ -1,90 +0,0 @@
|
|||||||
local helpers = require('test.functional.helpers')(after_each)
|
|
||||||
|
|
||||||
local clear = helpers.clear
|
|
||||||
local feed = helpers.feed
|
|
||||||
local command = helpers.command
|
|
||||||
local eq = helpers.eq
|
|
||||||
local expect = helpers.expect
|
|
||||||
local eval = helpers.eval
|
|
||||||
local insert = helpers.insert
|
|
||||||
local meths = helpers.meths
|
|
||||||
local sleep = helpers.sleep
|
|
||||||
|
|
||||||
describe("'pastetoggle' option", function()
|
|
||||||
before_each(clear)
|
|
||||||
it("toggles 'paste'", function()
|
|
||||||
command('set pastetoggle=a')
|
|
||||||
eq(0, eval('&paste'))
|
|
||||||
feed('a')
|
|
||||||
-- Need another key so that the vgetorpeek() function returns.
|
|
||||||
feed('j')
|
|
||||||
eq(1, eval('&paste'))
|
|
||||||
end)
|
|
||||||
describe("multiple key 'pastetoggle'", function()
|
|
||||||
before_each(function()
|
|
||||||
eq(0, eval('&paste'))
|
|
||||||
command('set timeoutlen=1 ttimeoutlen=10000')
|
|
||||||
end)
|
|
||||||
it('is waited for when chars are typed', function()
|
|
||||||
local pastetoggle = 'lllll'
|
|
||||||
command('set pastetoggle=' .. pastetoggle)
|
|
||||||
feed(pastetoggle:sub(0, 2))
|
|
||||||
-- sleep() for long enough that vgetorpeek() is gotten into, but short
|
|
||||||
-- enough that ttimeoutlen is not reached.
|
|
||||||
sleep(200)
|
|
||||||
feed(pastetoggle:sub(3, -1))
|
|
||||||
-- Need another key so that the vgetorpeek() function returns.
|
|
||||||
feed('j')
|
|
||||||
eq(1, eval('&paste'))
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('is not waited for when there are no typed chars after mapped chars', function()
|
|
||||||
command('set pastetoggle=abc')
|
|
||||||
command('imap d a')
|
|
||||||
meths.feedkeys('id', 't', true)
|
|
||||||
-- sleep() for long enough that vgetorpeek() is gotten into, but short
|
|
||||||
-- enough that ttimeoutlen is not reached.
|
|
||||||
sleep(200)
|
|
||||||
feed('bc')
|
|
||||||
-- Need another key so that the vgetorpeek() function returns.
|
|
||||||
feed('j')
|
|
||||||
-- 'ttimeoutlen' should NOT apply
|
|
||||||
eq(0, eval('&paste'))
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('is waited for when there are typed chars after mapped chars', function()
|
|
||||||
command('set pastetoggle=abc')
|
|
||||||
command('imap d a')
|
|
||||||
meths.feedkeys('idb', 't', true)
|
|
||||||
-- sleep() for long enough that vgetorpeek() is gotten into, but short
|
|
||||||
-- enough that ttimeoutlen is not reached.
|
|
||||||
sleep(200)
|
|
||||||
feed('c')
|
|
||||||
-- Need another key so that the vgetorpeek() function returns.
|
|
||||||
feed('j')
|
|
||||||
-- 'ttimeoutlen' should apply
|
|
||||||
eq(1, eval('&paste'))
|
|
||||||
end)
|
|
||||||
|
|
||||||
it('is waited for when there are typed chars after noremapped chars', function()
|
|
||||||
command('set pastetoggle=abc')
|
|
||||||
command('inoremap d a')
|
|
||||||
meths.feedkeys('idb', 't', true)
|
|
||||||
-- sleep() for long enough that vgetorpeek() is gotten into, but short
|
|
||||||
-- enough that ttimeoutlen is not reached.
|
|
||||||
sleep(200)
|
|
||||||
feed('c')
|
|
||||||
-- Need another key so that the vgetorpeek() function returns.
|
|
||||||
feed('j')
|
|
||||||
-- 'ttimeoutlen' should apply
|
|
||||||
eq(1, eval('&paste'))
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
it('does not interfere with character-find', function()
|
|
||||||
insert('foo,bar')
|
|
||||||
feed('0')
|
|
||||||
command('set pastetoggle=,sp')
|
|
||||||
feed('dt,')
|
|
||||||
expect(',bar')
|
|
||||||
end)
|
|
||||||
end)
|
|
@@ -943,15 +943,16 @@ func Test_mkvimrc()
|
|||||||
|
|
||||||
" the 'pastetoggle', 'wildchar' and 'wildcharm' option values should be
|
" the 'pastetoggle', 'wildchar' and 'wildcharm' option values should be
|
||||||
" stored as key names in the vimrc file
|
" stored as key names in the vimrc file
|
||||||
set pastetoggle=<F5>
|
" set pastetoggle=<F5>
|
||||||
set wildchar=<F6>
|
set wildchar=<F6>
|
||||||
set wildcharm=<F7>
|
set wildcharm=<F7>
|
||||||
call assert_fails('mkvimrc Xtestvimrc')
|
call assert_fails('mkvimrc Xtestvimrc')
|
||||||
mkvimrc! Xtestvimrc
|
mkvimrc! Xtestvimrc
|
||||||
call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set pastetoggle=<F5>'))
|
" call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set pastetoggle=<F5>'))
|
||||||
call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildchar=<F6>'))
|
call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildchar=<F6>'))
|
||||||
call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildcharm=<F7>'))
|
call assert_notequal(-1, index(readfile('Xtestvimrc'), 'set wildcharm=<F7>'))
|
||||||
set pastetoggle& wildchar& wildcharm&
|
" set pastetoggle& wildchar& wildcharm&
|
||||||
|
set wildchar& wildcharm&
|
||||||
|
|
||||||
call delete('Xtestvimrc')
|
call delete('Xtestvimrc')
|
||||||
endfunc
|
endfunc
|
||||||
|
@@ -49,6 +49,7 @@ endfunc
|
|||||||
|
|
||||||
" Test for getting the value of 'pastetoggle'
|
" Test for getting the value of 'pastetoggle'
|
||||||
func Test_pastetoggle()
|
func Test_pastetoggle()
|
||||||
|
throw "Skipped: 'pastetoggle' is removed from Nvim"
|
||||||
" character with K_SPECIAL byte
|
" character with K_SPECIAL byte
|
||||||
let &pastetoggle = '…'
|
let &pastetoggle = '…'
|
||||||
call assert_equal('…', &pastetoggle)
|
call assert_equal('…', &pastetoggle)
|
||||||
|
@@ -1,21 +1,4 @@
|
|||||||
|
|
||||||
" Test for 'pastetoggle'
|
|
||||||
func Test_pastetoggle()
|
|
||||||
new
|
|
||||||
set pastetoggle=<F4>
|
|
||||||
set nopaste
|
|
||||||
call feedkeys("iHello\<F4>", 'xt')
|
|
||||||
call assert_true(&paste)
|
|
||||||
call feedkeys("i\<F4>", 'xt')
|
|
||||||
call assert_false(&paste)
|
|
||||||
call assert_equal('Hello', getline(1))
|
|
||||||
" command-line completion for 'pastetoggle' value
|
|
||||||
call feedkeys(":set pastetoggle=\<Tab>\<C-B>\"\<CR>", 'xt')
|
|
||||||
call assert_equal('"set pastetoggle=<F4>', @:)
|
|
||||||
set pastetoggle&
|
|
||||||
bwipe!
|
|
||||||
endfunc
|
|
||||||
|
|
||||||
" Test for restoring option values when 'paste' is disabled
|
" Test for restoring option values when 'paste' is disabled
|
||||||
func Test_paste_opt_restore()
|
func Test_paste_opt_restore()
|
||||||
set autoindent expandtab ruler showmatch
|
set autoindent expandtab ruler showmatch
|
||||||
|
Reference in New Issue
Block a user