From 9e1ee9fb1d747facb6fa97a32dc5e22c7dfcb346 Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Sun, 22 May 2022 21:20:18 -0600 Subject: refactor!: delete insertmode (#18547) Neovim already removed `evim` (or any similar flags). The 'insertmode' option is a weird remnant, so get rid of it. The 'insertmode' option is replaced with a script that closely emulates the option. This script is documented at :help 'insertmode' --- runtime/doc/cmdline.txt | 3 +-- runtime/doc/eval.txt | 2 +- runtime/doc/gui.txt | 3 --- runtime/doc/index.txt | 15 ++++++--------- runtime/doc/insert.txt | 9 ++------- runtime/doc/intro.txt | 10 ++-------- runtime/doc/options.txt | 26 -------------------------- runtime/doc/quickref.txt | 1 - runtime/doc/starting.txt | 1 - runtime/doc/various.txt | 2 -- runtime/doc/vim_diff.txt | 7 +++++++ runtime/optwin.vim | 2 -- 12 files changed, 19 insertions(+), 62 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index 6228c9238f..23a87505ad 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -1065,8 +1065,7 @@ line contains the command as typed so far. The left column will show a character that indicates the type of command-line being edited, see |cmdwin-char|. -Vim will be in Normal mode when the editor is opened, except when 'insertmode' -is set. +Vim will be in Normal mode when the editor is opened. The height of the window is specified with 'cmdwinheight' (or smaller if there is no room). The window is always full width and is positioned just above the diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d1686741b4..71f5ad4536 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1366,7 +1366,7 @@ option *expr-option* *E112* *E113* Examples: > echo "tabstop is " .. &tabstop - if &insertmode + if &expandtab Any option name can be used here. See |options|. When using the local value and there is no buffer-local or window-local value, the global value is used diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt index 812259741f..e296141c39 100644 --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -224,9 +224,6 @@ some modes: Cmdline Op-pending -Appending CTRL-\ CTRL-G is for going back to insert mode when 'insertmode' is -set. |CTRL-\_CTRL-G| - Example: > :amenu File.Next :next^M diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 58d49b5843..ee8a820e53 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -26,7 +26,7 @@ tag char action in Insert mode ~ insert |i_CTRL-A| CTRL-A insert previously inserted text |i_CTRL-C| CTRL-C quit insert mode, without checking for - abbreviation, unless 'insertmode' set. + abbreviation |i_CTRL-D| CTRL-D delete one shiftwidth of indent in the current line |i_CTRL-E| CTRL-E insert the character which is below the cursor @@ -50,7 +50,6 @@ tag char action in Insert mode ~ |i_CTRL-J| CTRL-J same as |i_CTRL-K| CTRL-K {char1} {char2} enter digraph -|i_CTRL-L| CTRL-L when 'insertmode' set: Leave Insert mode |i_| begin new line |i_CTRL-M| CTRL-M same as |i_CTRL-N| CTRL-N find next match for keyword in front of the @@ -86,11 +85,10 @@ tag char action in Insert mode ~ |i_CTRL-W| CTRL-W delete word before the cursor |i_CTRL-X| CTRL-X {mode} enter CTRL-X sub mode, see |i_CTRL-X_index| |i_CTRL-Y| CTRL-Y insert the character which is above the cursor -|i_CTRL-Z| CTRL-Z when 'insertmode' set: suspend Vim -|i_| end insert mode (unless 'insertmode' set) +|i_| end insert mode |i_CTRL-[| CTRL-[ same as |i_CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode -|i_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode' +|i_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode CTRL-\ a - z reserved for extensions CTRL-\ others not used |i_CTRL-]| CTRL-] trigger abbreviation @@ -221,7 +219,7 @@ tag char note action in Normal mode ~ |CTRL-Z| CTRL-Z suspend program (or start new shell) CTRL-[ not used |CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode (no-op) -|CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode' +|CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode (no-op) CTRL-\ a - z reserved for extensions CTRL-\ others not used |CTRL-]| CTRL-] :ta to ident under cursor @@ -892,7 +890,7 @@ here are those that are different. tag command note action in Visual mode ~ ------------------------------------------------------------------------------ |v_CTRL-\_CTRL-N| CTRL-\ CTRL-N stop Visual mode -|v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode' +|v_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode |v_CTRL-A| CTRL-A 2 add N to number in highlighted text |v_CTRL-C| CTRL-C stop Visual mode |v_CTRL-G| CTRL-G toggle between Visual mode and Select mode @@ -1068,8 +1066,7 @@ tag command action in Command-line editing mode ~ |c_| abandon command-line without executing it |c_CTRL-[| CTRL-[ same as |c_CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode, abandon command-line -|c_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to mode specified with 'insertmode', - abandon command-line +|c_CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode, abandon command-line CTRL-\ a - d reserved for extensions |c_CTRL-\_e| CTRL-\ e {expr} replace the command line with the result of {expr} diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 7f6662089d..3c5d246a49 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -32,9 +32,6 @@ If you are working in a special language mode when inserting text, see the 'langmap' option, |'langmap'|, on how to avoid switching this mode on and off all the time. -If you have 'insertmode' set, and a few other keys get another meaning. -See |'insertmode'|. - char action ~ ----------------------------------------------------------------------- *i_CTRL-[* *i_* @@ -335,9 +332,8 @@ that key is interpreted as in Insert mode. The following keys are special. They stop the current insert, do something, and then restart insertion. This means you can do something without getting out of Insert mode. This is very handy if you prefer to use the Insert mode -all the time, just like editors that don't have a separate Normal mode. You -may also want to set the 'insertmode' option. You can use CTRL-O if you want -to map a function key to a command. +all the time, just like editors that don't have a separate Normal mode. You +can use CTRL-O if you want to map a function key to a command. The changes (inserted or deleted characters) before and after these keys can be undone separately. Only the last change can be redone and always behaves @@ -378,7 +374,6 @@ CTRL-G CTRL-J cursor one line down, insert start column *i_CTRL-G_CTRL-J* move window one page right *i_* CTRL-O execute one command, return to Insert mode *i_CTRL-O* CTRL-\ CTRL-O like CTRL-O but don't move the cursor *i_CTRL-\_CTRL-O* -CTRL-L when 'insertmode' is set: go to Normal mode *i_CTRL-L* CTRL-G u break undo sequence, start new change *i_CTRL-G_u* CTRL-G U don't break undo with next left/right cursor *i_CTRL-G_U* movement, if the cursor stays within the diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 4e3dcf850c..0074dc0733 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -424,8 +424,7 @@ Vim has seven BASIC modes: *Normal* *Normal-mode* *command-mode* Normal mode In Normal mode you can enter all the normal editor commands. If you start the editor you are in this - mode (unless you have set the 'insertmode' option, - see below). This is also known as command mode. + mode. This is also known as command mode. Visual mode This is like Normal mode, but the movement commands extend a highlighted area. When a non-movement @@ -551,8 +550,6 @@ Ex :vi -- -- -- -- -- *6 Go from Select mode to Insert mode by typing a printable character. The selection is deleted and the character is inserted. -If the 'insertmode' option is on, editing a file will start in Insert mode. - *CTRL-\_CTRL-N* *i_CTRL-\_CTRL-N* *c_CTRL-\_CTRL-N* *v_CTRL-\_CTRL-N* Additionally the command CTRL-\ CTRL-N or can be used to go to Normal mode from any other mode. This can be used to make sure Vim is in @@ -561,10 +558,7 @@ work in Ex mode. When used after a command that takes an argument, such as |f| or |m|, the timeout set with 'ttimeoutlen' applies. *CTRL-\_CTRL-G* *i_CTRL-\_CTRL-G* *c_CTRL-\_CTRL-G* *v_CTRL-\_CTRL-G* -The command CTRL-\ CTRL-G or can be used to go to Insert mode when -'insertmode' is set. Otherwise it goes to Normal mode. This can be used to -make sure Vim is in the mode indicated by 'insertmode', without knowing in -what mode Vim currently is. +CTRL-\ CTRL-G works the same as |CTRL-\_CTRL-N| for backward compatibility. *gQ* *mode-Ex* *Ex-mode* *Ex* *EX* *E501* gQ Switch to Ex mode. This is like typing ":" commands diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 0c2de7d6ee..9015f0a97e 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -959,7 +959,6 @@ A jump table for the options with a short description can be found at |Q_op|. (mostly used in |Normal-mode| or |Cmdline-mode|). esc hitting in |Normal-mode|. hangul Ignored. - insertmode Pressing in 'insertmode'. lang Calling the beep module for Lua/Mzscheme/TCL. mess No output available for |g<|. showmatch Error occurred for 'showmatch' function. @@ -3412,31 +3411,6 @@ A jump table for the options with a short description can be found at |Q_op|. and there is a letter before it, the completed part is made uppercase. With 'noinfercase' the match is used as-is. - *'insertmode'* *'im'* *'noinsertmode'* *'noim'* -'insertmode' 'im' boolean (default off) - global - Makes Vim work in a way that Insert mode is the default mode. Useful - if you want to use Vim as a modeless editor. - These Insert mode commands will be useful: - - Use the cursor keys to move around. - - Use CTRL-O to execute one Normal mode command |i_CTRL-O|. When - this is a mapping, it is executed as if 'insertmode' was off. - Normal mode remains active until the mapping is finished. - - Use CTRL-L to execute a number of Normal mode commands, then use - to get back to Insert mode. Note that CTRL-L moves the cursor - left, like does when 'insertmode' isn't set. |i_CTRL-L| - - These items change when 'insertmode' is set: - - when starting to edit of a file, Vim goes to Insert mode. - - in Insert mode is a no-op and beeps. - - in Normal mode makes Vim go to Insert mode. - - CTRL-L in Insert mode is a command, it is not inserted. - - CTRL-Z in Insert mode suspends Vim, see |CTRL-Z|. *i_CTRL-Z* - However, when is used inside a mapping, it behaves like - 'insertmode' was not set. This was done to be able to use the same - mappings with 'insertmode' set or not set. - When executing commands with |:normal| 'insertmode' is not used. - *'isfname'* *'isf'* 'isfname' 'isf' string (default for Windows: "@,48-57,/,\,.,-,_,+,,,#,$,%,{,},[,],:,@-@,!,~,=" diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index ff7e2ab400..1716ea025d 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -741,7 +741,6 @@ Short explanation of each option: *option-list* 'indentexpr' 'inde' expression used to obtain the indent of a line 'indentkeys' 'indk' keys that trigger indenting with 'indentexpr' 'infercase' 'inf' adjust case of match for keyword completion -'insertmode' 'im' start the edit of a file in Insert mode 'isfname' 'isf' characters included in file names and pathnames 'isident' 'isi' characters included in identifiers 'iskeyword' 'isk' characters included in keywords diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index f542f33451..8b88fa9363 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -527,7 +527,6 @@ accordingly, proceeding as follows: 16. Execute startup commands If a |-t| flag was given, the tag is jumped to. Commands given with |-c| and |+cmd| are executed. - If the 'insertmode' option is set, Insert mode is entered. The starting flag is reset, has("vim_starting") will now return zero. The |v:vim_did_enter| variable is set to 1. The |VimEnter| autocommands are executed. diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 0a25904104..562faeaa2c 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -208,8 +208,6 @@ g8 Print the hex values of the bytes used in the {commands} cannot start with a space. Put a count of 1 (one) before it, "1 " is one space. - The 'insertmode' option is ignored for {commands}. - This command cannot be followed by another command, since any '|' is considered part of the command. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index c926337b47..85b44e3b51 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -543,6 +543,13 @@ Options: *'imactivatefunc'* *'imaf'* *'imactivatekey'* *'imak'* *'imstatusfunc'* *'imsf'* + *'insertmode'* *'im'* Use the following script to emulate 'insertmode': +> + autocmd VimEnter,CmdlineLeave,WinEnter,WinScrolled,BufEnter * silent! if &modifiable | startinsert | endif + inoremap + inoremap + nnoremap i +< *'macatsui'* 'maxmem' Nvim delegates memory-management to the OS. 'maxmemtot' Nvim delegates memory-management to the OS. diff --git a/runtime/optwin.vim b/runtime/optwin.vim index 493f7b57d0..54f57a260c 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -229,8 +229,6 @@ call append("$", "compatible\tbehave very Vi compatible (not advisable)") call BinOptionG("cp", &cp) call append("$", "cpoptions\tlist of flags to specify Vi compatibility") call OptionG("cpo", &cpo) -call append("$", "insertmode\tuse Insert mode as the default mode") -call BinOptionG("im", &im) call append("$", "paste\tpaste mode, insert typed text literally") call BinOptionG("paste", &paste) call append("$", "pastetoggle\tkey sequence to toggle paste mode") -- cgit