mirror of
https://github.com/neovim/neovim
synced 2025-07-20 21:32:16 +00:00
feat(defaults): map CTRL-L to search highlights, update diffs #15385
This commit is contained in:
@ -14,6 +14,10 @@ Various commands *various*
|
|||||||
*CTRL-L*
|
*CTRL-L*
|
||||||
CTRL-L Clears and redraws the screen. The redraw may happen
|
CTRL-L Clears and redraws the screen. The redraw may happen
|
||||||
later, after processing typeahead.
|
later, after processing typeahead.
|
||||||
|
*CTRL-L-default*
|
||||||
|
By default, also clears search highlighting
|
||||||
|
|:nohlsearch| and updates diffs |:diffupdate|.
|
||||||
|
|default-mappings|
|
||||||
|
|
||||||
*:mod* *:mode*
|
*:mod* *:mode*
|
||||||
:mod[e] Clears and redraws the screen.
|
:mod[e] Clears and redraws the screen.
|
||||||
|
@ -74,7 +74,9 @@ the differences.
|
|||||||
|
|
||||||
|
|
||||||
Default Mappings: *default-mappings*
|
Default Mappings: *default-mappings*
|
||||||
|
|
||||||
nnoremap Y y$
|
nnoremap Y y$
|
||||||
|
nnoremap <C-L> <Cmd>nohlsearch<Bar>diffupdate<CR><C-L>
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
3. New Features *nvim-features*
|
3. New Features *nvim-features*
|
||||||
|
@ -6259,8 +6259,8 @@ static int open_cmdwin(void)
|
|||||||
const int histtype = hist_char2type(cmdwin_type);
|
const int histtype = hist_char2type(cmdwin_type);
|
||||||
if (histtype == HIST_CMD || histtype == HIST_DEBUG) {
|
if (histtype == HIST_CMD || histtype == HIST_DEBUG) {
|
||||||
if (p_wc == TAB) {
|
if (p_wc == TAB) {
|
||||||
add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", INSERT);
|
add_map((char_u *)"<buffer> <Tab> <C-X><C-V>", INSERT, false);
|
||||||
add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", NORMAL);
|
add_map((char_u *)"<buffer> <Tab> a<C-X><C-V>", NORMAL, false);
|
||||||
}
|
}
|
||||||
set_option_value("ft", 0L, "vim", OPT_LOCAL);
|
set_option_value("ft", 0L, "vim", OPT_LOCAL);
|
||||||
}
|
}
|
||||||
|
@ -4357,18 +4357,23 @@ check_map (
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/// Add a mapping. Unlike @ref do_map this copies the {map} argument, so
|
||||||
* Add a mapping "map" for mode "mode".
|
/// static or read-only strings can be used.
|
||||||
* Need to put string in allocated memory, because do_map() will modify it.
|
///
|
||||||
*/
|
/// @param map C-string containing the arguments of the map/abbrev command,
|
||||||
void add_map(char_u *map, int mode)
|
/// i.e. everything except the initial `:[X][nore]map`.
|
||||||
|
/// @param mode Bitflags representing the mode in which to set the mapping.
|
||||||
|
/// See @ref get_map_mode.
|
||||||
|
/// @param nore If true, make a non-recursive mapping.
|
||||||
|
void add_map(char_u *map, int mode, bool nore)
|
||||||
{
|
{
|
||||||
char_u *s;
|
char_u *s;
|
||||||
char_u *cpo_save = p_cpo;
|
char_u *cpo_save = p_cpo;
|
||||||
|
|
||||||
p_cpo = (char_u *)""; // Allow <> notation
|
p_cpo = (char_u *)""; // Allow <> notation
|
||||||
|
// Need to put string in allocated memory, because do_map() will modify it.
|
||||||
s = vim_strsave(map);
|
s = vim_strsave(map);
|
||||||
(void)do_map(0, s, mode, FALSE);
|
(void)do_map(nore ? 2 : 0, s, mode, false);
|
||||||
xfree(s);
|
xfree(s);
|
||||||
p_cpo = cpo_save;
|
p_cpo = cpo_save;
|
||||||
}
|
}
|
||||||
|
@ -399,7 +399,8 @@ void init_normal_cmds(void)
|
|||||||
|
|
||||||
void init_default_mappings(void)
|
void init_default_mappings(void)
|
||||||
{
|
{
|
||||||
add_map((char_u *)"Y y$", NORMAL);
|
add_map((char_u *)"Y y$", NORMAL, true);
|
||||||
|
add_map((char_u *)"<C-L> <Cmd>nohlsearch<Bar>diffupdate<CR><C-L>", NORMAL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -21,7 +21,10 @@ set undodir^=.
|
|||||||
set wildoptions=
|
set wildoptions=
|
||||||
set startofline
|
set startofline
|
||||||
set sessionoptions+=options
|
set sessionoptions+=options
|
||||||
|
|
||||||
|
" Unmap Nvim default mappings.
|
||||||
unmap Y
|
unmap Y
|
||||||
|
unmap <C-L>
|
||||||
|
|
||||||
" Prevent Nvim log from writing to stderr.
|
" Prevent Nvim log from writing to stderr.
|
||||||
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
|
let $NVIM_LOG_FILE = exists($NVIM_LOG_FILE) ? $NVIM_LOG_FILE : 'Xnvim.log'
|
||||||
|
@ -42,7 +42,10 @@ module.nvim_set = (
|
|||||||
module.nvim_argv = {
|
module.nvim_argv = {
|
||||||
module.nvim_prog, '-u', 'NONE', '-i', 'NONE',
|
module.nvim_prog, '-u', 'NONE', '-i', 'NONE',
|
||||||
'--cmd', module.nvim_set,
|
'--cmd', module.nvim_set,
|
||||||
'--cmd', 'unmap Y', '--embed'}
|
'--cmd', 'unmap Y',
|
||||||
|
'--cmd', 'unmap <C-L>',
|
||||||
|
'--embed'}
|
||||||
|
|
||||||
-- Directory containing nvim.
|
-- Directory containing nvim.
|
||||||
module.nvim_dir = module.nvim_prog:gsub("[/\\][^/\\]+$", "")
|
module.nvim_dir = module.nvim_prog:gsub("[/\\][^/\\]+$", "")
|
||||||
if module.nvim_dir == module.nvim_prog then
|
if module.nvim_dir == module.nvim_prog then
|
||||||
|
Reference in New Issue
Block a user