aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorii14 <59243201+ii14@users.noreply.github.com>2023-03-13 03:29:11 +0100
committerGitHub <noreply@github.com>2023-03-13 10:29:11 +0800
commit2daf0b37dbfe54a4510c1033531dbaefd168c387 (patch)
tree8f0c1f7ea449f6d38817398244852e458bcc79cd /runtime
parent673d2b52fa4335aa083c52e6686f0728e25b8ebd (diff)
downloadrneovim-2daf0b37dbfe54a4510c1033531dbaefd168c387.tar.gz
rneovim-2daf0b37dbfe54a4510c1033531dbaefd168c387.tar.bz2
rneovim-2daf0b37dbfe54a4510c1033531dbaefd168c387.zip
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.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/autocmd.txt1
-rw-r--r--runtime/doc/change.txt2
-rw-r--r--runtime/doc/deprecated.txt21
-rw-r--r--runtime/doc/map.txt5
-rw-r--r--runtime/doc/news.txt3
-rw-r--r--runtime/doc/options.txt97
-rw-r--r--runtime/doc/quickref.txt2
-rw-r--r--runtime/doc/vim_diff.txt1
-rw-r--r--runtime/optwin.vim20
9 files changed, 29 insertions, 123 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt
index e9a4196252..d0713ee18c 100644
--- a/runtime/doc/autocmd.txt
+++ b/runtime/doc/autocmd.txt
@@ -704,7 +704,6 @@ InsertCharPre When a character is typed in Insert mode,
inserted literally.
Cannot change the text. |textlock|
- Not triggered when 'paste' is set.
*InsertEnter*
InsertEnter Just before starting Insert mode. Also for
Replace mode and Virtual Replace mode. The
diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt
index 3706612d52..91358a8cdd 100644
--- a/runtime/doc/change.txt
+++ b/runtime/doc/change.txt
@@ -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
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;
'textwidth' is still useful for formatting with "gq".
diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt
index 5c8d7f044f..fe1d6f1645 100644
--- a/runtime/doc/deprecated.txt
+++ b/runtime/doc/deprecated.txt
@@ -146,6 +146,27 @@ OPTIONS
- 'viewoptions' Flags "unix", "slash" are ignored and always enabled.
- *'viminfo'* Deprecated alias to 'shada' 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-wildmenu* Use |ui-cmdline| with |ui-popupmenu| instead. Enabled
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 3a5223fa3a..c65007d1a4 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -695,8 +695,7 @@ this (see |<>|). Example: >
:map _ls :!ls -l %:S<CR>:echo "the end"<CR>
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'
-option is on.
+type a CTRL-V first.
*map-error*
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.
@@ -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
recursive abbreviations, for no apparent reason}
-Abbreviations are disabled if the 'paste' option is on.
-
*:abbreviate-local* *:abbreviate-<buffer>*
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: >
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 66e8e5ef9f..ee409d542a 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -45,6 +45,9 @@ The following changes may require adaptations in user config or plugins.
- `printheader`
- `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.
• Unsaved changes are now preserved rather than discarded when |channel-stdio|
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 6c5b168402..9fff5228f2 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -676,8 +676,6 @@ A jump table for the options with a short description can be found at |Q_op|.
line.
When 'smartindent' or 'cindent' is on the indent is changed in
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
<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}.
@@ -1266,7 +1264,6 @@ A jump table for the options with a short description can be found at |Q_op|.
See |C-indenting|.
When you don't like the way 'cindent' works, try the 'smartindent'
option or 'indentexpr'.
- This option is not used when 'paste' is set.
*'cinkeys'* *'cink'*
'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
when 'autoindent' is on. To insert a real tab when 'expandtab' is
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' 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")
local to buffer
This is a sequence of letters which describes how automatic
- formatting is to be done. See |fo-table|. When the 'paste' option is
- on, no formatting is done (like 'formatoptions' is empty). Commas can
- be inserted for readability.
+ formatting is to be done. See |fo-table|. Commas can be inserted for
+ readability.
To avoid problems with flags that are added in the future, use the
"+=" 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
'smartindent' indenting. When 'lisp' is set, this option is
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
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).
@@ -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
"=" operator to use this same indentation algorithm rather than
calling an external program if 'equalprg' is empty.
- This option is not used when 'paste' is set.
*'lispoptions'* *'lop'*
'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
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'*
'patchexpr' 'pex' string (default "")
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
backwards" |ins-reverse|. This option can be toggled with the CTRL-_
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' 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.
For an empty line "0-1" is shown.
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
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'.
A Beep is given if there is no match (no matter if the match can be
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
will immediately move the cursor back to where it belongs.
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.
When using the ">>" command, lines starting with '#' are not shifted
right.
- This option is reset when 'paste' is set and restored when 'paste' is
- reset.
*'smarttab'* *'sta'* *'nosmarttab'* *'nosta'*
'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'
option. Also see |ins-expandtab|. When 'expandtab' is not set, the
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' 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.
When 'sts' is zero, this feature is off.
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
spaces is minimized by using <Tab>s.
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
broken after white space to get this width. A zero value disables
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
'formatoptions' and |ins-textwidth|.
When 'formatexpr' is set it will be used to break the line.
diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt
index d17df3cd61..952f0064e6 100644
--- a/runtime/doc/quickref.txt
+++ b/runtime/doc/quickref.txt
@@ -812,8 +812,6 @@ Short explanation of each option: *option-list*
'operatorfunc' 'opfunc' function to be called for |g@| operator
'packpath' 'pp' list of directories used for packages
'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
'patchmode' 'pm' keep the oldest version of a file
'path' 'pa' list of directories searched with "gf" et.al.
diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt
index 21736059c4..9c01e3dbc7 100644
--- a/runtime/doc/vim_diff.txt
+++ b/runtime/doc/vim_diff.txt
@@ -623,6 +623,7 @@ Options:
'highlight' (Names of builtin |highlight-groups| cannot be changed.)
*'hkmap'* *'hk'* use `set keymap=hebrew` instead.
*'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead.
+ *'pastetoggle'* *'pt'*
*'imactivatefunc'* *'imaf'*
*'imactivatekey'* *'imak'*
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 200254321e..0d10ac4758 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -106,11 +106,7 @@ func <SID>Update(lnum, line, local, thiswin)
else
let name = substitute(a:line, '^ \tset \(no\)\=\([a-z]*\).*', '\2', "")
endif
- if name == "pt" && &pt =~ "\x80"
- let val = <SID>PTvalue()
- else
- let val = escape(eval('&' . name), " \t\\\"|")
- endif
+ let val = escape(eval('&' . name), " \t\\\"|")
if a:local
exe a:thiswin . "wincmd w"
endif
@@ -211,14 +207,6 @@ func <SID>Header(text)
let s:lnum = s:lnum + 1
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.
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>AddOption("paste", gettext("paste mode, insert typed text literally"))
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>OptionG("rtp", &rtp)
call <SID>AddOption("packpath", gettext("list of directories used for plugin packages"))