Skip to main content

Questions tagged [user-commands]

Questions about :command and how the user can define custom commands.

6 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
1 vote
0 answers
202 views

How to get both the start and end (row, col) of the visual-selected region in `nvim_create_user_command`?

I want to create a user command that can get the visual-selected text (may across multiple lines) from users when the command is calling upon the v-selected range. (so the cursor columns of both the ...
NeoZoom.lua's user avatar
  • 1,570
1 vote
0 answers
21 views

Can I interrupt the loop through a command completion custom list to trigger recomputation of the list?

Here's a minimal example: function s:compl_list(argLead, cmdLine, cursorPos) if a:argLead == 'opts=' return map(['op1', 'op2', 'op3'], {_, v -> a:argLead . v }) endif return ['initial', '...
Enlico's user avatar
  • 2,256
0 votes
0 answers
128 views

How to use <Leader> in a normal command today?

The answer to the question with the same title doesn't seem to work for me. Not sure if the behavior has just changed overtime. To reproduce the issue, open Vim via vim -Nu filebelow.vim, where the ...
Enlico's user avatar
  • 2,256
0 votes
0 answers
166 views

How do I pass multiple optional arguments from custom command to function?

Given a function with two optional arguments fun s:foo(one = v:false, two = v:false) echom '<' . a:one . ',' . a:two . '>' endf and a custom command calling it command! -nargs=* Foo call s:...
Enlico's user avatar
  • 2,256
0 votes
1 answer
81 views

Stop flushing the last command when hitting enter

Suppose I wrote this command: command! -nargs=1 E echo ' -> <args>' and when user feeds an argument, :E abc I intend to see the following effect as they hit Enter: :E abc -> abc Of ...
Futarimiti's user avatar
0 votes
0 answers
104 views

How do I do a keybind involving <C-ñ>?

I use a keyboard layout designed for Spanish speakers and I've remapped hjkl to jklñ because those are the main home row keys. With hjkl I have to be constantly moving my hand to the left in order to ...
Katie And's user avatar