1
0
forked from aniani/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 #4740)  Graduate the +localmap feature.
This commit is contained in:
Bram Moolenaar
2019-08-01 14:28:24 +02:00
parent 3f9bdeb2a5
commit b66bab381c
18 changed files with 2343 additions and 2427 deletions

View File

@@ -29,11 +29,6 @@ static void free_cmdmod(void);
static void append_command(char_u *cmd);
static char_u *find_command(exarg_T *eap, int *full);
static void ex_abbreviate(exarg_T *eap);
static void ex_map(exarg_T *eap);
static void ex_unmap(exarg_T *eap);
static void ex_mapclear(exarg_T *eap);
static void ex_abclear(exarg_T *eap);
#ifndef FEAT_MENU
# define ex_emenu ex_ni
# define ex_menu ex_ni
@@ -231,7 +226,6 @@ static void ex_read(exarg_T *eap);
static void ex_pwd(exarg_T *eap);
static void ex_equal(exarg_T *eap);
static void ex_sleep(exarg_T *eap);
static void do_exmap(exarg_T *eap, int isabbrev);
static void ex_winsize(exarg_T *eap);
static void ex_wincmd(exarg_T *eap);
#if defined(FEAT_GUI) || defined(UNIX) || defined(VMS) || defined(MSWIN)
@@ -5347,61 +5341,6 @@ getargopt(exarg_T *eap)
return OK;
}
/*
* ":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(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(eap->cmd, eap->arg, eap->forceit, FALSE);
}
/*
* ":abclear" and friends.
*/
static void
ex_abclear(exarg_T *eap)
{
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
}
static void
ex_autocmd(exarg_T *eap)
{
@@ -7782,25 +7721,6 @@ do_sleep(long msec)
(void)vpeekc();
}
static void
do_exmap(exarg_T *eap, int isabbrev)
{
int mode;
char_u *cmdp;
cmdp = eap->cmd;
mode = get_map_mode(&cmdp, eap->forceit || isabbrev);
switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'),
eap->arg, mode, isabbrev))
{
case 1: emsg(_(e_invarg));
break;
case 2: emsg((isabbrev ? _(e_noabbr) : _(e_nomap)));
break;
}
}
/*
* ":winsize" command (obsolete).
*/