Permalink
Browse files

Merge #5561 'inccommand'

Initial work by:
  Robin Elrharbi-Fleury (Robinhola)
  Audrey Rayé (Adrey06)
  Philémon Hullot (DesbyP)
  Aymeric Collange (aym7)
  Clément Guyomard (Clement0)

Major revisions by:
  KillTheMule
  Björn Linse <bjorn.linse@gmail.com>
  Justin M. Keyes <justinkz@gmail.com>
  • Loading branch information...
justinmk committed Nov 9, 2016
2 parents bd33f11 + aa0e09d commit 0213e99aaf6eba303fd459183dd14a4a11cc5b07
@@ -450,7 +450,7 @@ notation meaning equivalent decimal value(s) ~
<k0> - <k9> keypad 0 to 9 *keypad-0* *keypad-9*
<S-...> shift-key *shift* *<S-*
<C-...> control-key *control* *ctrl* *<C-*
<M-...> alt-key or meta-key *meta* *alt* *<M-*
<M-...> alt-key or meta-key *META* *meta* *alt* *<M-*
<A-...> same as <M-...> *<A-*
<D-...> command-key or "super" key *<D-*
<t_xx> key with "xx" entry in termcap
@@ -3416,6 +3416,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|
@@ -3896,6 +3905,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
@@ -4852,6 +4852,9 @@ SignColumn column where |signs| are displayed
*hl-IncSearch*
IncSearch 'incsearch' highlighting; also used for the text replaced with
":s///c"
*hl-Substitute*
Substitute |:substitute| replacement text highlighting
*hl-LineNr*
LineNr Line number for ":number" and ":#" commands, and when 'number'
or 'relativenumber' option is set.
@@ -63,7 +63,7 @@ these differences.
3. New Features *nvim-features*
MAJOR FEATURES ~
MAJOR COMPONENTS ~
Embedded terminal emulator |terminal-emulator|
RPC API |RPC|
@@ -84,25 +84,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).
<M-1>, <M-2>, ...
<M-BS>, <M-Del>, <M-Ins>, ...
<M-/>, <M-\>, ...
<M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
|bracketed-paste-mode| is built-in and enabled by default.
Note: Meta chords are case-sensitive (<M-a> is distinguished from <M-A>).
|META| (ALT) chords are recognized, even in the terminal. Any |<M-| mapping
will work. Some examples: <M-1>, <M-2>, <M-BS>, <M-Del>, <M-Ins>, <M-/>,
<M-\>, <M-Space>, <M-Enter>, <M-=>, <M-->, <M-?>, <M-$>, ...
META chords are case-sensitive: <M-a> and <M-A> 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:
<C-Tab>, <C-S-Tab>
<C-BS>, <C-S-BS>
<C-Enter>, <C-S-Enter>
<C-Tab>, <C-S-Tab>, <C-BS>, <C-S-BS>, <C-Enter>, <C-S-Enter>
Options:
'inccommand' shows results while typing a |:substitute| command
'statusline' supports unlimited alignment sections
'tabline' %@Func@foo%X can call any function on mouse-click
@@ -123,12 +127,13 @@ Functions:
Events:
|TabNewEntered|
|TermOpen|
|TermClose|
|TermOpen|
|TextYankPost|
Highlight groups:
|hl-QuickFixLine|
|hl-Substitute|
|hl-TermCursor|
|hl-TermCursorNC|
@@ -295,6 +300,7 @@ Other commands:
:mode (no longer accepts an argument)
:open
:shell
:smile
:tearoff
Other compile-time features:
@@ -1,9 +1,4 @@
" Vim syntax file
" Language: Vim 7.4 script
" Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
" Last Change: March 29, 2016
" Version: 7.4-45
" Automatically generated keyword lists: {{{1
" #############################################################################
" #############################################################################
@@ -61,7 +56,7 @@ syn keyword vimGroup contained Comment Constant String Character Number Boolean
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

This comment has been minimized.

@balta2ar

balta2ar Nov 9, 2016

@justinmk I'm not sure, but maybe this should be Substitute? That's what I would think after this commit: 6a3f8d4

This comment has been minimized.

@justinmk

justinmk Nov 9, 2016

Member

Yes, thanks.

"}}}2
syn case match
" Special Vim Highlighting (not automatic) {{{1
@@ -268,6 +268,9 @@ open_buffer (
bool buf_valid(buf_T *buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
if (buf == NULL) {
return false;
}
FOR_ALL_BUFFERS(bp) {
if (bp == buf) {
return true;
@@ -479,6 +482,18 @@ void buf_clear_file(buf_T *buf)
buf->b_ml.ml_flags = ML_EMPTY; /* empty buffer */
}
/// Clears the current buffer contents.
void buf_clear(void)
{
linenr_T line_count = curbuf->b_ml.ml_line_count;
while (!(curbuf->b_ml.ml_flags & ML_EMPTY)) {
ml_delete((linenr_T)1, false);
}
deleted_lines_mark(1, line_count); // prepare for display
ml_close(curbuf, true); // free memline_T
buf_clear_file(curbuf);
}
/// buf_freeall() - free all things allocated for a buffer that are related to
/// the file. Careful: get here with "curwin" NULL when exiting.
///
@@ -671,14 +686,15 @@ void handle_swap_exists(buf_T *old_curbuf)
* aborting() returns FALSE when closing a buffer. */
enter_cleanup(&cs);
/* User selected Quit at ATTENTION prompt. Go back to previous
* buffer. If that buffer is gone or the same as the current one,
* open a new, empty buffer. */
swap_exists_action = SEA_NONE; /* don't want it again */
swap_exists_did_quit = TRUE;
close_buffer(curwin, curbuf, DOBUF_UNLOAD, FALSE);
if (!buf_valid(old_curbuf) || old_curbuf == curbuf)
// User selected Quit at ATTENTION prompt. Go back to previous
// buffer. If that buffer is gone or the same as the current one,
// open a new, empty buffer.
swap_exists_action = SEA_NONE; // don't want it again
swap_exists_did_quit = true;
close_buffer(curwin, curbuf, DOBUF_UNLOAD, false);
if (!buf_valid(old_curbuf) || old_curbuf == curbuf) {
old_curbuf = buflist_new(NULL, NULL, 1L, BLN_CURBUF | BLN_LISTED);
}
if (old_curbuf != NULL) {
enter_buffer(old_curbuf);
if (old_tw != curbuf->b_p_tw)
@@ -1319,28 +1335,29 @@ void do_autochdir(void)
}
}
/*
* functions for dealing with the buffer list
*/
//
// functions for dealing with the buffer list
//
/*
* Add a file name to the buffer list. Return a pointer to the buffer.
* If the same file name already exists return a pointer to that buffer.
* If it does not exist, or if fname == NULL, a new entry is created.
* If (flags & BLN_CURBUF) is TRUE, may use current buffer.
* If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list.
* If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer.
* This is the ONLY way to create a new buffer.
*/
static int top_file_num = 1; /* highest file number */
buf_T *
buflist_new (
char_u *ffname, /* full path of fname or relative */
char_u *sfname, /* short fname or NULL */
linenr_T lnum, /* preferred cursor line */
int flags /* BLN_ defines */
)
static int top_file_num = 1; ///< highest file number
/// Add a file name to the buffer list.
/// If the same file name already exists return a pointer to that buffer.
/// If it does not exist, or if fname == NULL, a new entry is created.
/// If (flags & BLN_CURBUF) is TRUE, may use current buffer.
/// If (flags & BLN_LISTED) is TRUE, add new buffer to buffer list.
/// If (flags & BLN_DUMMY) is TRUE, don't count it as a real buffer.
/// If (flags & BLN_NEW) is TRUE, don't use an existing buffer.
/// This is the ONLY way to create a new buffer.
///
/// @param ffname full path of fname or relative
/// @param sfname short fname or NULL
/// @param lnum preferred cursor line
/// @param flags BLN_ defines
/// @param bufnr
///
/// @return pointer to the buffer
buf_T * buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags)
{
buf_T *buf;
@@ -2374,10 +2391,11 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
{
buf_T *buf;
/* Create a buffer. 'buflisted' is not set if it's a new buffer */
// Create a buffer. 'buflisted' is not set if it's a new buffer
buf = buflist_new(ffname, sfname, lnum, 0);
if (buf != NULL && !cmdmod.keepalt)
if (buf != NULL && !cmdmod.keepalt) {
curwin->w_alt_fnum = buf->b_fnum;
}
return buf;
}
@@ -2412,8 +2430,9 @@ int buflist_add(char_u *fname, int flags)
buf_T *buf;
buf = buflist_new(fname, NULL, (linenr_T)0, flags);
if (buf != NULL)
if (buf != NULL) {
return buf->b_fnum;
}
return 0;
}
@@ -5253,3 +5272,15 @@ wipe_buffer (
unblock_autocmds();
}
}
/// Creates or switches to a special-purpose buffer.
///
/// @param bufnr Buffer to switch to, or 0 to create a new buffer.
void buf_open_special(handle_T bufnr, char *bufname, char *buftype)
{
(void)do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
(void)setfname(curbuf, (char_u *)bufname, NULL, true);
set_option_value((char_u *)"bt", 0L, (char_u *)buftype, OPT_LOCAL);
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
RESET_BINDING(curwin);
}
Oops, something went wrong.

1 comment on commit 0213e99

@dmerejkowsky

This comment has been minimized.

Contributor

dmerejkowsky commented on 0213e99 Nov 9, 2016

For the curious, here's what it looks like:
https://asciinema.org/a/92207

Please sign in to comment.