Questions tagged [command]

Question about the command functionality that les the user define new Vim commands.

It is possible to define new commands using the :command command. The tag group questions about the command and its options.

90 questions
6
votes
2 answers

how does vim make the difference for "i" between the insert mode and the inner word

I am just a bit curious on how vim makes the difference for i between the insert mode and the inner word. If I am in normal mode, and I type i then I go in insert mode. If I am in normal mode, and if I type ciw, it means that I want to change the…
Makoto
  • 197
  • 6
3
votes
1 answer

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 into: :vr +60 From other answers Aliasing a command in vim, I can see that i can use :command, but there doesn't…
Chan Youn
  • 283
  • 3
  • 8
2
votes
1 answer

How to save buffer from command?

I'm trying to get :W to also save like :w (I often mistype). I tried something like this: command! W execute "norm! w", but that doesn't work. How can I do this?
fbence
  • 677
  • 4
  • 12
2
votes
1 answer

How to define a command if the function needs to take an argument from the script itself?

Suppose I am defining a few commands that are similar in functionality. In this particular case, I am defining a few commands that each echoes a particular message: function! EchoMessage(text) echom text endfunction let thousand_chars =…
Flux
  • 1,041
  • 1
  • 11
  • 25
2
votes
1 answer

'@' in file names and 'gf' (go to file)

Vim/Neovim (this is an issue in both as far as I can tell) does not seem to like files with '@' in the name, even though I have isfname is set to the default, which is @,48-57,/,.,-,_,+,,,#,$,%,~,=, which makes me think that this all should work.…
wsny
  • 23
  • 4
1
vote
1 answer

Is there any way to "capture" the output of `g<`? (i.e. like how :redir works for other cmds)

I have some functions and mappings that echo paragraphs of summary output for me to "take a pulse" on some things I'm working on. I know that if it disappears before I finish perusing, I can use g< to view it again. Now... I am hoping to capture…
CrashNeb
  • 203
  • 1
  • 6
1
vote
1 answer

Is there a way to bind `:qw` to `:wq`?

I often mistype :wq as :qw. I can't create a command for qw though since it doesn't start with an uppercase character. Is there a way I can bind qw to wq?
ChocolateOverflow
  • 677
  • 1
  • 6
  • 15
1
vote
2 answers

Append inside brackets, quotes, double quotes

Been using Vim for a few weeks now and I find myself constantly using ci" or ci( to change whats enclosed in "" or (). I do also find myself wanting to append inside of the brackets e.g.: If I have: if (name == "Frank") { I want to be anywhere on…
Albert
  • 143
  • 4
1
vote
1 answer

What does + preceding command do in vim

What does + preceding command do in vim, for example from this command from this website: botright 10new +setlocal\ buftype=nofile\ bufhidden=wipe\ \ nobuflisted\ nonumber\ norelativenumber\ noswapfile\ nowrap\ \…
1
vote
1 answer

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' FooCommand text asdfsfd 'text asdfsfd' (it's hard to…
ColinKennedy
  • 411
  • 2
  • 9
0
votes
1 answer

set a default value to a command that acccepts two arguments?

I often need to delineate "sections" of source code files using a comment character to create horizontal lines. For example if I wanted to draw such a line in a python file I could do :Hline # 79 where the first argument is the character and the…
First User
  • 391
  • 1
  • 8
0
votes
1 answer

Is it possible to keep editing the same line when I execute code with !%?

Let's say I have a file with the following bash code: echo "line 1" echo "line 2" echo "line 3" echo "line 4" echo "line 5" echo "line 6" echo "line 7" echo "line 8" echo "line 9" echo "line 10" echo "line 11" echo "line 12" echo "line 13" echo…
raylight
  • 535
  • 1
  • 4
  • 12
0
votes
0 answers

When I'm in VI command mode my H and L keys do not work

I am new to using VI. I'm using a virtual machine. When I'm in command mode and pressing l it used to take me to the right and h used to take me to the left. Now when I am in command mode pressing h or l will take me to the first character on the…