From 13841a56b4b4916a2f18e66f97cb6f5e55d40e53 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Fri, 12 Aug 2016 12:00:36 +0200 Subject: Incsubsitution feature Originally implemented by * Clement0 * DesbyP * aym7 * Adrey06 * Robinhola in #4811. Major reworkings and bug fixes by * bfredl Most tests suggested by ZyX-l, suggestions for improvements by oni-link. --- runtime/doc/options.txt | 11 +++++++++++ runtime/doc/syntax.txt | 2 ++ runtime/syntax/vim.vim | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 5a5999e64c..0db1053d5e 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3946,6 +3946,7 @@ A jump table for the options with a short description can be found at |Q_op|. global Strings to use in 'list' mode and for the |:list| command. It is a comma separated list of string settings. + *lcs-eol* eol:c Character to show at the end of each line. When omitted, there is no extra character at the end of the @@ -3991,6 +3992,16 @@ A jump table for the options with a short description can be found at |Q_op|. "precedes". "SpecialKey" for "nbsp", "space", "tab" and "trail". |hl-NonText| |hl-SpecialKey| + *'incsubstitute'* *'ics'* +'incsubstitute' 'ics' string (default "") + global + + If set to "split" or "nosplit", substitutions (|:s|) are updated live + while the user types the command. If set to "split", a split window + is open which displays the lines where the search matches. The + replacement text in the split is hightlighted using + |hl-IncSubstitute|. Note: Only '/' is supported as a delimiter. + *'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'* 'loadplugins' 'lpl' boolean (default on) global diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 308fa90ab3..4bad9d7ff7 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4855,6 +4855,8 @@ IncSearch 'incsearch' highlighting; also used for the text replaced with *hl-LineNr* LineNr Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. + *hl-IncSubstitute* +IncSubstitute The replacement text when using the |incsubstitute| functionality *hl-CursorLineNr* CursorLineNr Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 32e871ea79..dc5649f2b1 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -58,7 +58,7 @@ syn case ignore syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu +syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch IncSubstitute LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu syn match vimHLGroup contained "Conceal" syn keyword vimOnlyHLGroup contained VisualNOS syn keyword nvimHLGroup contained EndOfBuffer TermCursor TermCursorNC QuickFixLine -- cgit From c04ffe866d276d6a6bd9e9c6a8b0dbb71504db7c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 31 Oct 2016 03:50:19 +0100 Subject: 'inccommand': rework MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Eliminate/isolate static/global variables - Remove special-case parameter from buflist_new() - Remove special-case ECMD_RESERVED_BUFNR - To determine when u_undo_and_forget() should be done, check b_changedtick instead of a heuristic. - use mb_string2cells() instead of strlen() to measure the :sub patterns - call ml_close() before buf_clear_file(). Avoids leaks caught by ASan. Original patch by: Robin Elrharbi-Fleury (Robinhola) Audrey Rayé (Adrey06) Philémon Hullot (DesbyP) Aymeric Collange (aym7) Clément Guyomard (Clement0) --- runtime/doc/intro.txt | 2 +- runtime/doc/options.txt | 18 ++++++++---------- runtime/doc/syntax.txt | 4 ++-- runtime/doc/vim_diff.txt | 35 ++++++++++++++++++++--------------- runtime/syntax/vim.vim | 9 ++------- 5 files changed, 33 insertions(+), 35 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index cbe017e051..786097dd74 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -450,7 +450,7 @@ notation meaning equivalent decimal value(s) ~ - keypad 0 to 9 *keypad-0* *keypad-9* shift-key *shift* * control-key *control* *ctrl* * alt-key or meta-key *meta* *alt* * alt-key or meta-key *META* *meta* *alt* * same as * command-key or "super" key * key with "xx" entry in termcap diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 0db1053d5e..f41983cf07 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3526,6 +3526,14 @@ A jump table for the options with a short description can be found at |Q_op|. CTRL-R CTRL-W can be used to add the word at the end of the current match, excluding the characters that were already typed. + *'incsubstitute'* *'ics'* +'incsubstitute' 'ics' string (default "") + global + + If "split" or "nosplit" then |:substitute| updates the buffer + as-you-type. If "split", also show partial off-screen results in + a window. Replacement text is hightlighted with |hl-IncSubstitute|. + *'indentexpr'* *'inde'* 'indentexpr' 'inde' string (default "") local to buffer @@ -3992,16 +4000,6 @@ A jump table for the options with a short description can be found at |Q_op|. "precedes". "SpecialKey" for "nbsp", "space", "tab" and "trail". |hl-NonText| |hl-SpecialKey| - *'incsubstitute'* *'ics'* -'incsubstitute' 'ics' string (default "") - global - - If set to "split" or "nosplit", substitutions (|:s|) are updated live - while the user types the command. If set to "split", a split window - is open which displays the lines where the search matches. The - replacement text in the split is hightlighted using - |hl-IncSubstitute|. Note: Only '/' is supported as a delimiter. - *'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'* 'loadplugins' 'lpl' boolean (default on) global diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 4bad9d7ff7..a942c5de03 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4852,11 +4852,11 @@ SignColumn column where |signs| are displayed *hl-IncSearch* IncSearch 'incsearch' highlighting; also used for the text replaced with ":s///c" + *hl-IncSubstitute* +IncSubstitute 'incsubstitute' replacement text *hl-LineNr* LineNr Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. - *hl-IncSubstitute* -IncSubstitute The replacement text when using the |incsubstitute| functionality *hl-CursorLineNr* CursorLineNr Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index f1adffc30e..9b862275cc 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -64,7 +64,7 @@ these differences. 3. New Features *nvim-features* -MAJOR FEATURES ~ +MAJOR COMPONENTS ~ Embedded terminal emulator |terminal-emulator| RPC API |RPC| @@ -85,25 +85,29 @@ avoids features that cannot be provided on all platforms--instead that is delegated to external plugins/extensions. -OTHER FEATURES ~ +ARCHITECTURE ~ -|bracketed-paste-mode| is built-in and enabled by default. +External plugins run in separate processes. |remote-plugin| This improves +stability and allows those plugins to perform tasks without blocking the +editor. Even "legacy" Python and Ruby plugins which use the old Vim interfaces +(|if_py| and |if_ruby|) run out-of-process. + + +FEATURES ~ -Meta (alt) chords are recognized (even in the terminal). - , , ... - , , , ... - , , ... - , , , , , , ... +|bracketed-paste-mode| is built-in and enabled by default. - Note: Meta chords are case-sensitive ( is distinguished from ). +|META| (ALT) chords are recognized, even in the terminal. Any |, , , , , , +, , , , , , , ... +META chords are case-sensitive: and are two different keycodes. Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants (even in the terminal). Specifically, the following are known to work: - , - , - , + , , , , , Options: + 'incsubstitute' shows results while typing a |:substitute| command 'statusline' supports unlimited alignment sections 'tabline' %@Func@foo%X can call any function on mouse-click @@ -125,14 +129,14 @@ Functions: Events: |TabNew| |TabNewEntered| - |TabClosed| - |TermOpen| |TermClose| + |TermOpen| |TextYankPost| Highlight groups: - |hl-EndOfBuffer| + |hl-Substitute| |hl-QuickFixLine| + |hl-Substitute| |hl-TermCursor| |hl-TermCursorNC| @@ -298,6 +302,7 @@ Other commands: :mode (no longer accepts an argument) :open :shell + :smile :tearoff Other compile-time features: diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index dc5649f2b1..ae01c0f3ee 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,9 +1,4 @@ " Vim syntax file -" Language: Vim 7.4 script -" Maintainer: Charles E. Campbell -" Last Change: March 29, 2016 -" Version: 7.4-45 -" Automatically generated keyword lists: {{{1 " ############################################################################# " ############################################################################# @@ -58,10 +53,10 @@ syn case ignore syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch IncSubstitute LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu +syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual WarningMsg WildMenu syn match vimHLGroup contained "Conceal" syn keyword vimOnlyHLGroup contained VisualNOS -syn keyword nvimHLGroup contained EndOfBuffer TermCursor TermCursorNC QuickFixLine +syn keyword nvimHLGroup contained EndOfBuffer IncSubstitute TermCursor TermCursorNC QuickFixLine "}}}2 syn case match " Special Vim Highlighting (not automatic) {{{1 -- cgit From d0689eb0b2473de479396b77fb685954d65d994c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 6 Nov 2016 23:58:53 +0100 Subject: 'inccommand': disable 'cursorline', 'spell' in preview --- runtime/doc/vim_diff.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 9b862275cc..80db8eefb0 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -134,7 +134,6 @@ Events: |TextYankPost| Highlight groups: - |hl-Substitute| |hl-QuickFixLine| |hl-Substitute| |hl-TermCursor| -- cgit From 6a3f8d48d0c96330511565aef5e10ad965e986b4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 7 Nov 2016 00:59:32 +0100 Subject: 'inccommand': rename 'incsubstitute' 'inccommand' allows us to expand the feature to other commands, such as: :cdo :cfdo :global Also rename "IncSubstitute" highlight group to "Substitute". --- runtime/doc/options.txt | 17 +++++++++-------- runtime/doc/syntax.txt | 5 +++-- runtime/doc/vim_diff.txt | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f41983cf07..79e5ff090f 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3466,6 +3466,15 @@ A jump table for the options with a short description can be found at |Q_op|. The value is set to 1 when it is not -1 and setting the 'keymap' option to a valid keymap name. + *'inccommand'* *'icm'* +'inccommand' 'icm' string (default "") + global + + "nosplit" : Shows the effects of a command incrementally, as you type. + "split" : Also shows partial off-screen results in a preview window. + + Currently only works for |:substitute|. |hl-Substitute| + *'include'* *'inc'* 'include' 'inc' string (default "^\s*#\s*include") global or local to buffer |global-local| @@ -3526,14 +3535,6 @@ A jump table for the options with a short description can be found at |Q_op|. CTRL-R CTRL-W can be used to add the word at the end of the current match, excluding the characters that were already typed. - *'incsubstitute'* *'ics'* -'incsubstitute' 'ics' string (default "") - global - - If "split" or "nosplit" then |:substitute| updates the buffer - as-you-type. If "split", also show partial off-screen results in - a window. Replacement text is hightlighted with |hl-IncSubstitute|. - *'indentexpr'* *'inde'* 'indentexpr' 'inde' string (default "") local to buffer diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index a942c5de03..a9762a7121 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -4852,8 +4852,9 @@ SignColumn column where |signs| are displayed *hl-IncSearch* IncSearch 'incsearch' highlighting; also used for the text replaced with ":s///c" - *hl-IncSubstitute* -IncSubstitute 'incsubstitute' replacement text + *hl-Substitute* +Substitute |:substitute| replacement text highlighting + *hl-LineNr* LineNr Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set. diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 80db8eefb0..79381183a0 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -107,7 +107,7 @@ Some `CTRL-SHIFT-...` key chords are distinguished from `CTRL-...` variants , , , , , Options: - 'incsubstitute' shows results while typing a |:substitute| command + 'inccommand' shows results while typing a |:substitute| command 'statusline' supports unlimited alignment sections 'tabline' %@Func@foo%X can call any function on mouse-click -- cgit