We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged


From what I can tell without seeing its implementation, Plugin#Keymap#Register expects a string referring to a globally accessible function, which limits your options. A closure with a single name won't quite work because its contents would keep changing. One option is to create a dynamically-named function for each value of outer key. function! s:...


I though it wasn't possible, but I was wrong. See :h :func-closure You need to patch two things: add closure at the end of the inner of the function declaration respect the usual naming conventions For instance function! s:my_function(dict_arg) let darg = copy(a:dict_arg) func! s:my_inner_func(cond) closure return darg[a:cond] endfunc ...


If you're open for a plugin solution, my ExtractMatches plugin has (among others) a :YankUniqueMatches command. :YankUniqueMatches /\w\+/ Result (can be pasted (and :sorted) into a :new buffer with :put): isPhysicallySettledFxFwd NO Y isPhysicallySettledFxSwap N isPhysicallySettledCommodity YES


What you are seeing here, is essentially the same problem, as why many people struggle with using variables on the command line with the ex commands. See e.g. this question, there are a lot similar ones. Basically, Vims ex commandline commands expect their arguments to be literal, they cannot contain expressions (like variables or strings). Those commands ...

Top 50 recent answers are included