summaryrefslogtreecommitdiff
path: root/src/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/map.c b/src/map.c
index b2f9dcf51..c7de5a15a 100644
--- a/src/map.c
+++ b/src/map.c
@@ -2389,10 +2389,10 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact)
}
/*
- * "getmappings()" function
+ * "maplist()" function
*/
void
-f_getmappings(typval_T *argvars UNUSED, typval_T *rettv)
+f_maplist(typval_T *argvars UNUSED, typval_T *rettv)
{
dict_T *d;
mapblock_T *mp;
@@ -2402,6 +2402,12 @@ f_getmappings(typval_T *argvars UNUSED, typval_T *rettv)
int hash;
char_u *lhs;
const int flags = REPTERM_FROM_PART | REPTERM_DO_LT;
+ int abbr = FALSE;
+
+ if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+ return;
+ if (argvars[0].v_type != VAR_UNKNOWN)
+ abbr = tv_get_bool(&argvars[0]);
if (rettv_list_alloc(rettv) != OK)
return;
@@ -2413,7 +2419,16 @@ f_getmappings(typval_T *argvars UNUSED, typval_T *rettv)
{
for (hash = 0; hash < 256; ++hash)
{
- if (buffer_local)
+ if (abbr)
+ {
+ if (hash > 0) // there is only one abbr list
+ break;
+ if (buffer_local)
+ mp = curbuf->b_first_abbr;
+ else
+ mp = first_abbr;
+ }
+ else if (buffer_local)
mp = curbuf->b_maphash[hash];
else
mp = maphash[hash];