Questions tagged [command]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
96 views

creating a “:KeepCursor” command

I'd like to make a command that works like this: :KeepCursor {cmd} will the given execute ex command string, then restore the cursor's position. A primary example is: :KeepCursor normal! * which ...
1
vote
1answer
34 views

How to pass everything from a command into a function with escaped characters

These are my scenarios and expected output function! s:Foo(text) echoerr "'" . a:text . "'" endfunction command ... FooCommand ... (not sure what to write here) FooCommand text 'text' ...
0
votes
1answer
31 views

How can I alias a command with arguments?

All I want to do is to change :vertical resize + arguments into :vr + arguments. for example change: :vertical resize +60 <CR> into: :vr +60 <CR> From other answers Aliasing a command ...
0
votes
1answer
25 views

Print Command Without Hitting Enter

Suppose I map a key to enter a command in the command buffer, but without hitting enter: function! BuildSystemTask() if inProject() "generic function that checks if I am in a buildable project ...
0
votes
1answer
25 views

How to use variables in a user defined command? [duplicate]

I have this user defined command: command! PS silent! w | PlugSnapshot! ~/.vim/plugins/plugins.lock How could I change it to take the filepath from a variable, something like this: let ...
0
votes
1answer
44 views

Are there any performance difference between :edit and :buffer on existing unchanged buffer?

I used to believe that :buffer file is faster than :edit file if file is an existing unchanged buffer. I even created a tiny function for this: function! myvim#open(file) abort let nr = bufnr(a:...