mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 03:08:27 +00:00
refactor: move some mapping-related code to a separate file (#19061)
This marks the following Vim patches as ported: vim-patch:8.1.1785: map functionality mixed with character input Problem: Map functionality mixed with character input. Solution: Move the map functionality to a separate file. (Yegappan Lakshmanan, closes vim/vim#4740) Graduate the +localmap feature.b66bab381c
vim-patch:8.2.3643: header for source file is outdated Problem: Header for source file is outdated. Solution: Make the header more accurate. (closes vim/vim#9186)a3f83feb63
Also cherry-pick a change for <unique> mappings from patch 8.2.0807. Rename map_clear_mode() to do_mapclear().
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
#include "nvim/keycodes.h"
|
||||
#include "nvim/lua/executor.h"
|
||||
#include "nvim/main.h"
|
||||
#include "nvim/mapping.h"
|
||||
#include "nvim/mark.h"
|
||||
#include "nvim/match.h"
|
||||
#include "nvim/mbyte.h"
|
||||
@@ -5256,45 +5257,6 @@ theend:
|
||||
return tab_number;
|
||||
}
|
||||
|
||||
/// ":abbreviate" and friends.
|
||||
static void ex_abbreviate(exarg_T *eap)
|
||||
{
|
||||
do_exmap(eap, TRUE); // almost the same as mapping
|
||||
}
|
||||
|
||||
/// ":map" and friends.
|
||||
static void ex_map(exarg_T *eap)
|
||||
{
|
||||
/*
|
||||
* If we are sourcing .exrc or .vimrc in current directory we
|
||||
* print the mappings for security reasons.
|
||||
*/
|
||||
if (secure) {
|
||||
secure = 2;
|
||||
msg_outtrans((char_u *)eap->cmd);
|
||||
msg_putchar('\n');
|
||||
}
|
||||
do_exmap(eap, FALSE);
|
||||
}
|
||||
|
||||
/// ":unmap" and friends.
|
||||
static void ex_unmap(exarg_T *eap)
|
||||
{
|
||||
do_exmap(eap, FALSE);
|
||||
}
|
||||
|
||||
/// ":mapclear" and friends.
|
||||
static void ex_mapclear(exarg_T *eap)
|
||||
{
|
||||
map_clear_mode((char_u *)eap->cmd, (char_u *)eap->arg, eap->forceit, false);
|
||||
}
|
||||
|
||||
/// ":abclear" and friends.
|
||||
static void ex_abclear(exarg_T *eap)
|
||||
{
|
||||
map_clear_mode((char_u *)eap->cmd, (char_u *)eap->arg, true, true);
|
||||
}
|
||||
|
||||
static void ex_autocmd(exarg_T *eap)
|
||||
{
|
||||
// Disallow autocommands from .exrc and .vimrc in current
|
||||
@@ -8381,23 +8343,6 @@ void do_sleep(long msec)
|
||||
}
|
||||
}
|
||||
|
||||
static void do_exmap(exarg_T *eap, int isabbrev)
|
||||
{
|
||||
int mode;
|
||||
char *cmdp = eap->cmd;
|
||||
mode = get_map_mode(&cmdp, eap->forceit || isabbrev);
|
||||
|
||||
switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'),
|
||||
(char_u *)eap->arg, mode, isabbrev)) {
|
||||
case 1:
|
||||
emsg(_(e_invarg));
|
||||
break;
|
||||
case 2:
|
||||
emsg(isabbrev ? _(e_noabbr) : _(e_nomap));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// ":winsize" command (obsolete).
|
||||
static void ex_winsize(exarg_T *eap)
|
||||
{
|
||||
|
Reference in New Issue
Block a user