From 8eff0ca6d50bf2ef0897a08f5fdbc0abed7c1266 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 Dec 2021 06:56:33 +0800 Subject: vim-patch:8.2.2468: not easy to get the full command name from a shortened one Problem: Not easy to get the full command name from a shortened one. Solution: Add fullcommand(). (Martin Tournoij, closes vim/vim#7777) https://github.com/vim/vim/commit/038e09ee7645731de0296d255aabb17603276443 --- runtime/doc/eval.txt | 20 ++++++++++++++++++-- runtime/doc/usr_41.txt | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index aef303195d..9a2b9f5069 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -2410,10 +2410,11 @@ foldlevel({lnum}) Number fold level at {lnum} foldtext() String line displayed for closed fold foldtextresult({lnum}) String text for closed fold at {lnum} foreground() Number bring the Vim window to the foreground +fullcommand({name}) String get full command from {name} funcref({name} [, {arglist}] [, {dict}]) - Funcref reference to function {name} + Funcref reference to function {name} function({name} [, {arglist}] [, {dict}]) - Funcref named reference to function {name} + Funcref named reference to function {name} garbagecollect([{atexit}]) none free memory, breaking cyclic references get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def} get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def} @@ -4550,6 +4551,21 @@ foreground() Move the Vim window to the foreground. Useful when sent from |remote_foreground()| instead. {only in the Win32 GUI and console version} +fullcommand({name}) *fullcommand()* + Get the full command name from a short abbreviated command + name; see |20.2| for details on command abbreviations. + + {name} may start with a `:` and can include a [range], these + are skipped and not returned. + Returns an empty string if a command doesn't exist or if it's + ambiguous (for user-defined functions). + + For example `fullcommand('s')`, `fullcommand('sub')`, + `fullcommand(':%substitute')` all return "substitute". + + Can also be used as a |method|: > + GetName()->fullcommand() +< *funcref()* funcref({name} [, {arglist}] [, {dict}]) Just like |function()|, but the returned Funcref will lookup diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 6a9284dac9..7e611a47f3 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -852,6 +852,7 @@ Command line: *command-line-functions* getcmdtype() return the current command-line type getcmdwintype() return the current command-line window type getcompletion() list of command-line completion matches + fullcommand() get full command name Quickfix and location lists: *quickfix-functions* getqflist() list of quickfix errors -- cgit From 7fa8411d8b219b37ffd56aa081ba7bf305858ce1 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 Dec 2021 07:47:18 +0800 Subject: vim-patch:partial:6aa57295cfbe Update runtime files https://github.com/vim/vim/commit/6aa57295cfbe8f21c15f0671e45fd53cf990d404 --- runtime/doc/eval.txt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 9a2b9f5069..2cbf06b3c0 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4163,11 +4163,12 @@ expand({string} [, {nosuf} [, {list}]]) *expand()* Can also be used as a |method|: > Getpattern()->expand() -expandcmd({expr}) *expandcmd()* - Expand special items in {expr} like what is done for an Ex - command such as `:edit`. This expands special keywords, like - with |expand()|, and environment variables, anywhere in - {expr}. "~user" and "~/path" are only expanded at the start. +expandcmd({string}) *expandcmd()* + Expand special items in String {string} like what is done for + an Ex command such as `:edit`. This expands special keywords, + like with |expand()|, and environment variables, anywhere in + {string}. "~user" and "~/path" are only expanded at the + start. Returns the expanded string. Example: > :echo expandcmd('make %<.o') @@ -4555,8 +4556,8 @@ fullcommand({name}) *fullcommand()* Get the full command name from a short abbreviated command name; see |20.2| for details on command abbreviations. - {name} may start with a `:` and can include a [range], these - are skipped and not returned. + The string argument {name} may start with a `:` and can + include a [range], these are skipped and not returned. Returns an empty string if a command doesn't exist or if it's ambiguous (for user-defined functions). -- cgit From ccc4d83507cd31c7724a958b3099c169ef3b411f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 25 Dec 2021 08:35:27 +0800 Subject: vim-patch:partial:6c391a74fe90 Update runtime files https://github.com/vim/vim/commit/6c391a74fe90190796ca0b0c010112948a6e75d7 --- runtime/doc/eval.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 2cbf06b3c0..15e9d6c811 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -4559,7 +4559,7 @@ fullcommand({name}) *fullcommand()* The string argument {name} may start with a `:` and can include a [range], these are skipped and not returned. Returns an empty string if a command doesn't exist or if it's - ambiguous (for user-defined functions). + ambiguous (for user-defined commands). For example `fullcommand('s')`, `fullcommand('sub')`, `fullcommand(':%substitute')` all return "substitute". -- cgit