Questions on ex- or colon-commands. For questions about command-line options used to launch the editor, use the [invocation] tag.
Questions tagged [command-line]
470 questions
20
votes
3 answers
vim doesn't show the command that is being typed
I was reading vimtutor and in lesson 2.1 there was this note about typing commands like dw:
NOTE: The letter d will appear on the last line of the screen as you type
it. Vim is waiting for you to type w . If you see another character
…
Hamon
- 303
- 1
- 2
- 4
20
votes
3 answers
What is the '[Command Line]' that sometimes comes up when I try to quit, and how can I quickly exit it?
Occasionally when I try to quit Vim, I get something that looks like this:
I'm not sure how I accidentally invoke this, but my current method for escaping it is to hit random keys and eventually it goes away. Two questions:
How am I invoking it (I…
user2
15
votes
1 answer
What is the difference between :quit and :close commands?
In vim docs, the description is very similar:
Quit:
:q[uit]
:{count}q[uit]
CTRL-W q *CTRL-W_q*
CTRL-W CTRL-Q *CTRL-W_CTRL-Q*
Without {count}: Quit the current window. If {count} is
given quit the…
Neith
- 253
- 2
- 5
14
votes
2 answers
How to escape a whole string in a : command?
Let's see. I have a gvim running and I want open a file, respecting the autocmds (which rules out --remote-tab).
Now I know I can do (basically, with some tweak):
gvim --remote-send ":tabe my_file"
which works. But if a file has spaces or…
Rmano
- 758
- 5
- 18
13
votes
3 answers
Make Command-line mode type and Ctrl commands
Imagine you want to quote the word below. If | is the cursor position you can easily quote the word with cw""P from Normal mode.
|below
I want to achieve the same behaviour in Command-line mode. My question is how can I say to the Command-line…
Gonçalo Ribeiro
- 1,991
- 1
- 18
- 28
13
votes
2 answers
How to work with command-line mode the vi way?
Is there a way to interact with the command-line mode while always remaining in the home position?
In particular, the following two actions are cumbersome, requiring moving the fingers away to the arrow keys and sometimes worse, the mouse.
Moving…
Shahbaz
- 549
- 3
- 14
11
votes
4 answers
Bring up the current file name for edition in the command line
How can I bring up the path to the current file in the command line, so as to type a similar file name? I don't want an abbreviation that would be replaced by the current file name, I want to edit the file name, complete with its directory path. For…
Gilles 'SO- stop being evil'
- 1,898
- 1
- 19
- 32
10
votes
2 answers
What does :%! mean?
I saw an editor command which started like this:
:%! sort
What does that mean? Specifically, the :%!.
minseong
- 2,313
- 1
- 19
- 38
9
votes
1 answer
Difference between full and short command
Is there a practical difference between using
:e
and
:edit
Except for readability, where it make sense in a mapping to use :edit, because it's more explicit.
Is there a difference between them?
Note: This apply as well to all other commands.
nobe4
- 16,033
- 4
- 48
- 81
8
votes
1 answer
'<,'> in command prompt
Occasionally when I type : to quit or write my file the prompt already contains the characters :'<,'> without me typing anything. It causes an error if I type w or q. I cannot replicate this problem. It happens at the oddest times and I have not…
mas
- 555
- 1
- 4
- 13
8
votes
1 answer
How to navigate using vim keybindings in command line mode?
When using vim in commandline mode, I have to navigate using only arrow keys. I can't use the native vim bindings because when I key , it exits commandline mode.
For example, if I was typing a command in commandline mode, :w eiff.txt, but I…
TheChetan
- 417
- 4
- 11
7
votes
2 answers
Opening multiple files on specific line numbers in vim
I would find it useful to open several files at the same time on specific lines.
I know I can open a single file on a specific line with:
vi +123 ~/.zshrc
And I can open multiple files with:
vi ~/.zshrc ~/.profile
But how can I open both files on…
Jim
- 73
- 2
7
votes
2 answers
Populate ex command line
I'm trying to write a simple mapping that will pre-populate the vim ex command line but leave the user there to execute the command on their own.
The use-case is for the user to type /foo which would then open the command line with :e **/foo…
Jonathan.Brink
- 581
- 7
- 15
7
votes
3 answers
How can I bind :Set to work exactly like :set?
I quite often start typing the s before fully releasing the shift key, and having to correct the command afterwards is a bit annoying.
Is there any way to make :Set ... an alias for :set ...?
ThiefMaster
- 173
- 4
6
votes
2 answers
Setting a default file extension
Can I tell vim to assume a filename ends in .tex if no extension is given? e.g. to open bird.tex if I say :e bird (unless there is a file bird with no extension).
Toothrot
- 3,129
- 13
- 27