mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
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:
2
Filelist
2
Filelist
@@ -60,6 +60,7 @@ SRC_ALL = \
|
|||||||
src/keymap.h \
|
src/keymap.h \
|
||||||
src/macros.h \
|
src/macros.h \
|
||||||
src/main.c \
|
src/main.c \
|
||||||
|
src/map.c \
|
||||||
src/mark.c \
|
src/mark.c \
|
||||||
src/mbyte.c \
|
src/mbyte.c \
|
||||||
src/memfile.c \
|
src/memfile.c \
|
||||||
@@ -199,6 +200,7 @@ SRC_ALL = \
|
|||||||
src/proto/json.pro \
|
src/proto/json.pro \
|
||||||
src/proto/list.pro \
|
src/proto/list.pro \
|
||||||
src/proto/main.pro \
|
src/proto/main.pro \
|
||||||
|
src/proto/map.pro \
|
||||||
src/proto/mark.pro \
|
src/proto/mark.pro \
|
||||||
src/proto/mbyte.pro \
|
src/proto/mbyte.pro \
|
||||||
src/proto/memfile.pro \
|
src/proto/memfile.pro \
|
||||||
|
@@ -736,6 +736,7 @@ OBJ = \
|
|||||||
$(OUTDIR)/json.o \
|
$(OUTDIR)/json.o \
|
||||||
$(OUTDIR)/list.o \
|
$(OUTDIR)/list.o \
|
||||||
$(OUTDIR)/main.o \
|
$(OUTDIR)/main.o \
|
||||||
|
$(OUTDIR)/map.o \
|
||||||
$(OUTDIR)/mark.o \
|
$(OUTDIR)/mark.o \
|
||||||
$(OUTDIR)/memfile.o \
|
$(OUTDIR)/memfile.o \
|
||||||
$(OUTDIR)/memline.o \
|
$(OUTDIR)/memline.o \
|
||||||
|
@@ -56,6 +56,7 @@ SRC = arabic.c \
|
|||||||
json.c \
|
json.c \
|
||||||
list.c \
|
list.c \
|
||||||
main.c \
|
main.c \
|
||||||
|
map.c \
|
||||||
mark.c \
|
mark.c \
|
||||||
mbyte.c \
|
mbyte.c \
|
||||||
memfile.c \
|
memfile.c \
|
||||||
|
@@ -745,6 +745,7 @@ OBJ = \
|
|||||||
$(OUTDIR)\json.obj \
|
$(OUTDIR)\json.obj \
|
||||||
$(OUTDIR)\list.obj \
|
$(OUTDIR)\list.obj \
|
||||||
$(OUTDIR)\main.obj \
|
$(OUTDIR)\main.obj \
|
||||||
|
$(OUTDIR)\map.obj \
|
||||||
$(OUTDIR)\mark.obj \
|
$(OUTDIR)\mark.obj \
|
||||||
$(OUTDIR)\mbyte.obj \
|
$(OUTDIR)\mbyte.obj \
|
||||||
$(OUTDIR)\memfile.obj \
|
$(OUTDIR)\memfile.obj \
|
||||||
@@ -1556,6 +1557,8 @@ $(OUTDIR)/list.obj: $(OUTDIR) list.c $(INCL)
|
|||||||
|
|
||||||
$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL) $(CUI_INCL)
|
$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL) $(CUI_INCL)
|
||||||
|
|
||||||
|
$(OUTDIR)/map.obj: $(OUTDIR) map.c $(INCL)
|
||||||
|
|
||||||
$(OUTDIR)/mark.obj: $(OUTDIR) mark.c $(INCL)
|
$(OUTDIR)/mark.obj: $(OUTDIR) mark.c $(INCL)
|
||||||
|
|
||||||
$(OUTDIR)/memfile.obj: $(OUTDIR) memfile.c $(INCL)
|
$(OUTDIR)/memfile.obj: $(OUTDIR) memfile.c $(INCL)
|
||||||
@@ -1769,6 +1772,7 @@ proto.h: \
|
|||||||
proto/json.pro \
|
proto/json.pro \
|
||||||
proto/list.pro \
|
proto/list.pro \
|
||||||
proto/main.pro \
|
proto/main.pro \
|
||||||
|
proto/map.pro \
|
||||||
proto/mark.pro \
|
proto/mark.pro \
|
||||||
proto/memfile.pro \
|
proto/memfile.pro \
|
||||||
proto/memline.pro \
|
proto/memline.pro \
|
||||||
|
@@ -312,8 +312,8 @@ SRC = arabic.c autocmd.c beval.c blob.c blowfish.c buffer.c change.c charset.c \
|
|||||||
evalfunc.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c \
|
evalfunc.c ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c \
|
||||||
if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \
|
if_cscope.c if_xcmdsrv.c fileio.c findfile.c fold.c getchar.c \
|
||||||
hardcopy.c hashtab.c highlight.c indent.c insexpand.c json.c list.c \
|
hardcopy.c hashtab.c highlight.c indent.c insexpand.c json.c list.c \
|
||||||
main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \
|
main.c map.c mark.c menu.c mbyte.c memfile.c memline.c message.c \
|
||||||
misc2.c move.c normal.c ops.c option.c popupmnu.c popupwin.c \
|
misc1.c misc2.c move.c normal.c ops.c option.c popupmnu.c popupwin.c \
|
||||||
profiler.c quickfix.c regexp.c search.c session.c sha256.c sign.c \
|
profiler.c quickfix.c regexp.c search.c session.c sha256.c sign.c \
|
||||||
spell.c spellfile.c syntax.c tag.c term.c termlib.c testing.c \
|
spell.c spellfile.c syntax.c tag.c term.c termlib.c testing.c \
|
||||||
textprop.c ui.c undo.c usercmd.c userfunc.c version.c viminfo.c \
|
textprop.c ui.c undo.c usercmd.c userfunc.c version.c viminfo.c \
|
||||||
@@ -327,8 +327,8 @@ OBJ = arabic.obj autocmd.obj beval.obj blob.obj blowfish.obj buffer.obj change.
|
|||||||
ex_docmd.obj ex_eval.obj ex_getln.obj if_cscope.obj if_xcmdsrv.obj \
|
ex_docmd.obj ex_eval.obj ex_getln.obj if_cscope.obj if_xcmdsrv.obj \
|
||||||
fileio.obj findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \
|
fileio.obj findfile.obj fold.obj getchar.obj hardcopy.obj hashtab.obj \
|
||||||
highlight.obj indent.obj insexpand.obj json.obj list.obj main.obj \
|
highlight.obj indent.obj insexpand.obj json.obj list.obj main.obj \
|
||||||
mark.obj menu.obj memfile.obj memline.obj message.obj misc1.obj \
|
map.obj mark.obj menu.obj memfile.obj memline.obj message.obj \
|
||||||
misc2.obj move.obj mbyte.obj normal.obj ops.obj option.obj \
|
misc1.obj misc2.obj move.obj mbyte.obj normal.obj ops.obj option.obj \
|
||||||
popupmnu.obj popupwin.obj profiler.obj quickfix.obj regexp.obj \
|
popupmnu.obj popupwin.obj profiler.obj quickfix.obj regexp.obj \
|
||||||
search.obj session.obj sha256.obj sign.obj spell.obj spellfile.obj \
|
search.obj session.obj sha256.obj sign.obj spell.obj spellfile.obj \
|
||||||
syntax.obj tag.obj term.obj termlib.obj testing.obj textprop.obj \
|
syntax.obj tag.obj term.obj termlib.obj testing.obj textprop.obj \
|
||||||
@@ -630,6 +630,9 @@ main.obj : main.c vim.h [.auto]config.h feature.h os_unix.h \
|
|||||||
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
|
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
|
||||||
[.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h \
|
[.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h \
|
||||||
arabic.c
|
arabic.c
|
||||||
|
map.obj : map.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||||
|
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
|
||||||
|
[.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h \
|
||||||
mark.obj : mark.c vim.h [.auto]config.h feature.h os_unix.h \
|
mark.obj : mark.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||||
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
|
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
|
||||||
[.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h \
|
[.proto]gui_beval.pro option.h ex_cmds.h proto.h globals.h \
|
||||||
|
10
src/Makefile
10
src/Makefile
@@ -1612,6 +1612,7 @@ BASIC_SRC = \
|
|||||||
json.c \
|
json.c \
|
||||||
list.c \
|
list.c \
|
||||||
main.c \
|
main.c \
|
||||||
|
map.c \
|
||||||
mark.c \
|
mark.c \
|
||||||
memfile.c \
|
memfile.c \
|
||||||
memline.c \
|
memline.c \
|
||||||
@@ -1735,6 +1736,7 @@ OBJ_COMMON = \
|
|||||||
objects/indent.o \
|
objects/indent.o \
|
||||||
objects/insexpand.o \
|
objects/insexpand.o \
|
||||||
objects/list.o \
|
objects/list.o \
|
||||||
|
objects/map.o \
|
||||||
objects/mark.o \
|
objects/mark.o \
|
||||||
objects/memline.o \
|
objects/memline.o \
|
||||||
objects/menu.o \
|
objects/menu.o \
|
||||||
@@ -1879,6 +1881,7 @@ PRO_AUTO = \
|
|||||||
json.pro \
|
json.pro \
|
||||||
list.pro \
|
list.pro \
|
||||||
main.pro \
|
main.pro \
|
||||||
|
map.pro \
|
||||||
mark.pro \
|
mark.pro \
|
||||||
mbyte.pro \
|
mbyte.pro \
|
||||||
memfile.pro \
|
memfile.pro \
|
||||||
@@ -3169,6 +3172,9 @@ objects/list.o: list.c
|
|||||||
objects/main.o: main.c
|
objects/main.o: main.c
|
||||||
$(CCC) -o $@ main.c
|
$(CCC) -o $@ main.c
|
||||||
|
|
||||||
|
objects/map.o: map.c
|
||||||
|
$(CCC) -o $@ map.c
|
||||||
|
|
||||||
objects/mark.o: mark.c
|
objects/mark.o: mark.c
|
||||||
$(CCC) -o $@ mark.c
|
$(CCC) -o $@ mark.c
|
||||||
|
|
||||||
@@ -3604,6 +3610,10 @@ objects/main.o: main.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
|||||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
proto.h globals.h
|
proto.h globals.h
|
||||||
|
objects/map.o: map.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||||
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
|
proto.h globals.h
|
||||||
objects/mark.o: mark.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
objects/mark.o: mark.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
|
@@ -38,6 +38,7 @@ highlight.c | syntax highlighting
|
|||||||
indent.c | C and Lisp indentation
|
indent.c | C and Lisp indentation
|
||||||
insexpand.c | Insert mode completion
|
insexpand.c | Insert mode completion
|
||||||
mark.c | marks
|
mark.c | marks
|
||||||
|
map.c | mapping and abbreviations
|
||||||
mbyte.c | multi-byte character handling
|
mbyte.c | multi-byte character handling
|
||||||
memfile.c | storing lines for buffers in a swapfile
|
memfile.c | storing lines for buffers in a swapfile
|
||||||
memline.c | storing lines for buffers in memory
|
memline.c | storing lines for buffers in memory
|
||||||
|
@@ -951,10 +951,8 @@ free_buffer_stuff(
|
|||||||
#ifdef FEAT_NETBEANS_INTG
|
#ifdef FEAT_NETBEANS_INTG
|
||||||
netbeans_file_killed(buf);
|
netbeans_file_killed(buf);
|
||||||
#endif
|
#endif
|
||||||
#ifdef FEAT_LOCALMAP
|
|
||||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
|
map_clear_int(buf, MAP_ALL_MODES, TRUE, FALSE); /* clear local mappings */
|
||||||
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
|
map_clear_int(buf, MAP_ALL_MODES, TRUE, TRUE); /* clear local abbrevs */
|
||||||
#endif
|
|
||||||
VIM_CLEAR(buf->b_start_fenc);
|
VIM_CLEAR(buf->b_start_fenc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -6189,9 +6189,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
"lispindent",
|
"lispindent",
|
||||||
#endif
|
#endif
|
||||||
"listcmds",
|
"listcmds",
|
||||||
#ifdef FEAT_LOCALMAP
|
|
||||||
"localmap",
|
"localmap",
|
||||||
#endif
|
|
||||||
#ifdef FEAT_LUA
|
#ifdef FEAT_LUA
|
||||||
# ifndef DYNAMIC_LUA
|
# ifndef DYNAMIC_LUA
|
||||||
"lua",
|
"lua",
|
||||||
@@ -7396,84 +7394,6 @@ f_localtime(typval_T *argvars UNUSED, typval_T *rettv)
|
|||||||
rettv->vval.v_number = (varnumber_T)time(NULL);
|
rettv->vval.v_number = (varnumber_T)time(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
|
||||||
{
|
|
||||||
char_u *keys;
|
|
||||||
char_u *which;
|
|
||||||
char_u buf[NUMBUFLEN];
|
|
||||||
char_u *keys_buf = NULL;
|
|
||||||
char_u *rhs;
|
|
||||||
int mode;
|
|
||||||
int abbr = FALSE;
|
|
||||||
int get_dict = FALSE;
|
|
||||||
mapblock_T *mp;
|
|
||||||
int buffer_local;
|
|
||||||
|
|
||||||
/* return empty string for failure */
|
|
||||||
rettv->v_type = VAR_STRING;
|
|
||||||
rettv->vval.v_string = NULL;
|
|
||||||
|
|
||||||
keys = tv_get_string(&argvars[0]);
|
|
||||||
if (*keys == NUL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (argvars[1].v_type != VAR_UNKNOWN)
|
|
||||||
{
|
|
||||||
which = tv_get_string_buf_chk(&argvars[1], buf);
|
|
||||||
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
||||||
{
|
|
||||||
abbr = (int)tv_get_number(&argvars[2]);
|
|
||||||
if (argvars[3].v_type != VAR_UNKNOWN)
|
|
||||||
get_dict = (int)tv_get_number(&argvars[3]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
which = (char_u *)"";
|
|
||||||
if (which == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
mode = get_map_mode(&which, 0);
|
|
||||||
|
|
||||||
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
|
|
||||||
rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
|
|
||||||
vim_free(keys_buf);
|
|
||||||
|
|
||||||
if (!get_dict)
|
|
||||||
{
|
|
||||||
/* Return a string. */
|
|
||||||
if (rhs != NULL)
|
|
||||||
{
|
|
||||||
if (*rhs == NUL)
|
|
||||||
rettv->vval.v_string = vim_strsave((char_u *)"<Nop>");
|
|
||||||
else
|
|
||||||
rettv->vval.v_string = str2special_save(rhs, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
|
|
||||||
{
|
|
||||||
/* Return a dictionary. */
|
|
||||||
char_u *lhs = str2special_save(mp->m_keys, TRUE);
|
|
||||||
char_u *mapmode = map_mode_to_chars(mp->m_mode);
|
|
||||||
dict_T *dict = rettv->vval.v_dict;
|
|
||||||
|
|
||||||
dict_add_string(dict, "lhs", lhs);
|
|
||||||
dict_add_string(dict, "rhs", mp->m_orig_str);
|
|
||||||
dict_add_number(dict, "noremap", mp->m_noremap ? 1L : 0L);
|
|
||||||
dict_add_number(dict, "expr", mp->m_expr ? 1L : 0L);
|
|
||||||
dict_add_number(dict, "silent", mp->m_silent ? 1L : 0L);
|
|
||||||
dict_add_number(dict, "sid", (long)mp->m_script_ctx.sc_sid);
|
|
||||||
dict_add_number(dict, "lnum", (long)mp->m_script_ctx.sc_lnum);
|
|
||||||
dict_add_number(dict, "buffer", (long)buffer_local);
|
|
||||||
dict_add_number(dict, "nowait", mp->m_nowait ? 1L : 0L);
|
|
||||||
dict_add_string(dict, "mode", mapmode);
|
|
||||||
|
|
||||||
vim_free(lhs);
|
|
||||||
vim_free(mapmode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef FEAT_FLOAT
|
#ifdef FEAT_FLOAT
|
||||||
/*
|
/*
|
||||||
* "log()" function
|
* "log()" function
|
||||||
|
@@ -29,11 +29,6 @@ static void free_cmdmod(void);
|
|||||||
static void append_command(char_u *cmd);
|
static void append_command(char_u *cmd);
|
||||||
static char_u *find_command(exarg_T *eap, int *full);
|
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
|
#ifndef FEAT_MENU
|
||||||
# define ex_emenu ex_ni
|
# define ex_emenu ex_ni
|
||||||
# define ex_menu 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_pwd(exarg_T *eap);
|
||||||
static void ex_equal(exarg_T *eap);
|
static void ex_equal(exarg_T *eap);
|
||||||
static void ex_sleep(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_winsize(exarg_T *eap);
|
||||||
static void ex_wincmd(exarg_T *eap);
|
static void ex_wincmd(exarg_T *eap);
|
||||||
#if defined(FEAT_GUI) || defined(UNIX) || defined(VMS) || defined(MSWIN)
|
#if defined(FEAT_GUI) || defined(UNIX) || defined(VMS) || defined(MSWIN)
|
||||||
@@ -5347,61 +5341,6 @@ getargopt(exarg_T *eap)
|
|||||||
return OK;
|
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
|
static void
|
||||||
ex_autocmd(exarg_T *eap)
|
ex_autocmd(exarg_T *eap)
|
||||||
{
|
{
|
||||||
@@ -7782,25 +7721,6 @@ do_sleep(long msec)
|
|||||||
(void)vpeekc();
|
(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).
|
* ":winsize" command (obsolete).
|
||||||
*/
|
*/
|
||||||
|
@@ -166,10 +166,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* +localmap Mappings and abbreviations local to a buffer.
|
* +localmap Mappings and abbreviations local to a buffer.
|
||||||
|
* Now always included.
|
||||||
*/
|
*/
|
||||||
#ifdef FEAT_NORMAL
|
|
||||||
# define FEAT_LOCALMAP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* +insert_expand CTRL-N/CTRL-P/CTRL-X in insert mode. Takes about
|
* +insert_expand CTRL-N/CTRL-P/CTRL-X in insert mode. Takes about
|
||||||
|
2250
src/getchar.c
2250
src/getchar.c
File diff suppressed because it is too large
Load Diff
@@ -98,6 +98,7 @@ extern int _stricoll(char *a, char *b);
|
|||||||
# include "list.pro"
|
# include "list.pro"
|
||||||
# include "blob.pro"
|
# include "blob.pro"
|
||||||
# include "main.pro"
|
# include "main.pro"
|
||||||
|
# include "map.pro"
|
||||||
# include "mark.pro"
|
# include "mark.pro"
|
||||||
# include "memfile.pro"
|
# include "memfile.pro"
|
||||||
# include "memline.pro"
|
# include "memline.pro"
|
||||||
|
@@ -23,6 +23,7 @@ void stuffnumReadbuff(long n);
|
|||||||
int start_redo(long count, int old_redo);
|
int start_redo(long count, int old_redo);
|
||||||
int start_redo_ins(void);
|
int start_redo_ins(void);
|
||||||
void stop_redo_ins(void);
|
void stop_redo_ins(void);
|
||||||
|
int noremap_keys(void);
|
||||||
int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent);
|
int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent);
|
||||||
void ins_char_typebuf(int c);
|
void ins_char_typebuf(int c);
|
||||||
int typebuf_changed(int tb_change_cnt);
|
int typebuf_changed(int tb_change_cnt);
|
||||||
@@ -49,22 +50,4 @@ int char_avail(void);
|
|||||||
void vungetc(int c);
|
void vungetc(int c);
|
||||||
int fix_input_buffer(char_u *buf, int len);
|
int fix_input_buffer(char_u *buf, int len);
|
||||||
int input_available(void);
|
int input_available(void);
|
||||||
int do_map(int maptype, char_u *arg, int mode, int abbrev);
|
|
||||||
int get_map_mode(char_u **cmdp, int forceit);
|
|
||||||
void map_clear(char_u *cmdp, char_u *arg, int forceit, int abbr);
|
|
||||||
void map_clear_int(buf_T *buf, int mode, int local, int abbr);
|
|
||||||
char_u *map_mode_to_chars(int mode);
|
|
||||||
int map_to_exists(char_u *str, char_u *modechars, int abbr);
|
|
||||||
int map_to_exists_mode(char_u *rhs, int mode, int abbr);
|
|
||||||
char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx);
|
|
||||||
int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file);
|
|
||||||
int check_abbr(int c, char_u *ptr, int col, int mincol);
|
|
||||||
char_u *vim_strsave_escape_csi(char_u *p);
|
|
||||||
void vim_unescape_csi(char_u *p);
|
|
||||||
int makemap(FILE *fd, buf_T *buf);
|
|
||||||
int put_escstr(FILE *fd, char_u *strstart, int what);
|
|
||||||
void check_map_keycodes(void);
|
|
||||||
char_u *check_map(char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr);
|
|
||||||
void init_mappings(void);
|
|
||||||
void add_map(char_u *map, int mode);
|
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
27
src/proto/map.pro
Normal file
27
src/proto/map.pro
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/* map.c */
|
||||||
|
mapblock_T *get_maphash_list(int state, int c);
|
||||||
|
mapblock_T *get_buf_maphash_list(int state, int c);
|
||||||
|
int is_maphash_valid(void);
|
||||||
|
int do_map(int maptype, char_u *arg, int mode, int abbrev);
|
||||||
|
void map_clear_int(buf_T *buf, int mode, int local, int abbr);
|
||||||
|
int map_to_exists(char_u *str, char_u *modechars, int abbr);
|
||||||
|
int map_to_exists_mode(char_u *rhs, int mode, int abbr);
|
||||||
|
char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx);
|
||||||
|
int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file);
|
||||||
|
int check_abbr(int c, char_u *ptr, int col, int mincol);
|
||||||
|
char_u *eval_map_expr(char_u *str, int c);
|
||||||
|
char_u *vim_strsave_escape_csi(char_u *p);
|
||||||
|
void vim_unescape_csi(char_u *p);
|
||||||
|
int makemap(FILE *fd, buf_T *buf);
|
||||||
|
int put_escstr(FILE *fd, char_u *strstart, int what);
|
||||||
|
void check_map_keycodes(void);
|
||||||
|
char_u *check_map(char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr);
|
||||||
|
void get_maparg(typval_T *argvars, typval_T *rettv, int exact);
|
||||||
|
void init_mappings(void);
|
||||||
|
void add_map(char_u *map, int mode);
|
||||||
|
void ex_abbreviate(exarg_T *eap);
|
||||||
|
void ex_map(exarg_T *eap);
|
||||||
|
void ex_unmap(exarg_T *eap);
|
||||||
|
void ex_mapclear(exarg_T *eap);
|
||||||
|
void ex_abclear(exarg_T *eap);
|
||||||
|
/* vim: set ft=c : */
|
@@ -2293,13 +2293,12 @@ struct file_buffer
|
|||||||
*/
|
*/
|
||||||
char_u b_chartab[32];
|
char_u b_chartab[32];
|
||||||
|
|
||||||
#ifdef FEAT_LOCALMAP
|
|
||||||
// Table used for mappings local to a buffer.
|
// Table used for mappings local to a buffer.
|
||||||
mapblock_T *(b_maphash[256]);
|
mapblock_T *(b_maphash[256]);
|
||||||
|
|
||||||
// First abbreviation local to a buffer.
|
// First abbreviation local to a buffer.
|
||||||
mapblock_T *b_first_abbr;
|
mapblock_T *b_first_abbr;
|
||||||
#endif
|
|
||||||
// User commands local to the buffer.
|
// User commands local to the buffer.
|
||||||
garray_T b_ucmds;
|
garray_T b_ucmds;
|
||||||
// start and end of an operator, also used for '[ and ']
|
// start and end of an operator, also used for '[ and ']
|
||||||
|
@@ -354,11 +354,7 @@ static char *(features[]) =
|
|||||||
"-lispindent",
|
"-lispindent",
|
||||||
#endif
|
#endif
|
||||||
"+listcmds",
|
"+listcmds",
|
||||||
#ifdef FEAT_LOCALMAP
|
|
||||||
"+localmap",
|
"+localmap",
|
||||||
#else
|
|
||||||
"-localmap",
|
|
||||||
#endif
|
|
||||||
#ifdef FEAT_LUA
|
#ifdef FEAT_LUA
|
||||||
# ifdef DYNAMIC_LUA
|
# ifdef DYNAMIC_LUA
|
||||||
"+lua/dyn",
|
"+lua/dyn",
|
||||||
@@ -777,6 +773,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1785,
|
||||||
/**/
|
/**/
|
||||||
1784,
|
1784,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user