Questions tagged [vim]
vim (Vi IMproved) is a text editor supporting different editing modes.
1,877 questions
482
votes
6
answers
461k
views
Delete from cursor to end of line in `vi`
I know I've probably looked over this a million times in all the vi documents I've read, but I can't seem to find the delete from cursor to end of line command.
441
votes
5
answers
280k
views
refresh changed content of file opened in vi(m)
I have a config-file that I keep open in vim, but that sometimes gets changed on disk, without these changes being reflected on the terminal. Can I refresh the content on the screen without closing ...
413
votes
15
answers
381k
views
What are the pros and cons of Vim and Emacs? [closed]
How would you compare these editors? What are the pros and cons of each?
[note] This is not meant to be answered by those who "hate one and love another" or those who haven't used both.
375
votes
2
answers
230k
views
Ctrl-s hangs the terminal emulator?
I came across a sentence in vimdoc:
Note: CTRL-S does not work on all terminals and might block
further input, use CTRL-Q to get going again.
and using CTRL-S indeed hangs my vim. I ...
353
votes
14
answers
552k
views
What is `^M` and how do I get rid of it?
When I open the file in Vim, I see strange ^M characters.
Unfortunately, the world's favorite search engine does not do well with special characters in queries, so I'm asking here:
What is this ^M ...
329
votes
12
answers
345k
views
Better colors so comments aren't dark blue in Vim?
Mostly I edit Ruby files, although shell script file comments are also #
Currently my comments show as dark blue on black which is really hard to read.
See screenshot.
How can I change their color?
...
253
votes
11
answers
353k
views
How can I edit multiple files in Vim?
I know I can open multiple files with vim by doing something like vim 2011-12*.log, but how can I switch between files and close the files one at a time?
Also, how can I tell the file name of the ...
239
votes
4
answers
341k
views
How can I set "vi" as my default editor in UNIX?
I believe I can do something like export EDITOR=vi, but I'm not sure what exactly to enter, and where.
How can I set "vi" as my default editor?
224
votes
7
answers
487k
views
delete line in vi
How can I delete a line in VI?
Here what I am doing right now:
Open up the terminal alt + ctrl + t
vi a.txt
I move my cursor to the line which I wan to delete, then what key-combination is should use ...
217
votes
2
answers
84k
views
How to put current line at top/center/bottom of screen in vim?
Any quicker navigation trick to place the line at which the cursor is at the moment to the
top of the screen?
center of the screen?
bottom of the screen?
212
votes
9
answers
252k
views
Copy text from one tmux pane to another (using vim)
I have two files opened in vim, each in one tmux pane. I would like to copy let's say 10 lines from one file to another.
How can I accomplish this not using the mouse's Copy -> Paste ?
191
votes
17
answers
115k
views
How can I do a 'change word' in Vim using the current paste buffer?
I have some text in my paste buffer, e.g. I did a yw (yank word) and now I have 'foo' in my buffer.
I now go to the word 'bar', and I want to replace it with my paste buffer.
To replace the text ...
171
votes
1
answer
100k
views
What's the recommended way of copying changes with vimdiff?
When comparing files, and updating a source code repository, I like to use vimdiff. To copy changes made from one file to the other, I usually use a key sequence like this:-
Shift + V (select line)
k ...
168
votes
9
answers
146k
views
How do I remotely edit files via ssh?
I have to edit some files placed on some server I could reach via ssh.
I would prefer to edit these files in customized vim on my workstation (I have not rights to change vim settings on remote ...
156
votes
6
answers
83k
views
Why does Vim indent pasted code incorrectly?
In Vim, if I paste this script:
#!/bin/sh
VAR=1
while ((VAR < 10))
do
echo "VAR1 is now $VAR"
((VAR = VAR +2))
done
echo "finish"
I get these strange results:
#!/bin/...