Questions tagged [vim]

Vim is a free and open-source modal text editor available for most major platforms. It allows high efficiency in many text editing tasks but has a steep learning curve. To learn the basics, run ":help vimtutor". For non-programming questions please use https://vi.stackexchange.com/ instead.

Vim is a free and open source text editor with a steep learning curve that leads to high efficiency in many tasks related to text editing. If you wish to start with Vim, run :help vimtutor in Vim or run the vimtutor command in shell, which will teach you basic commands.

Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor distributed with most UNIX systems and is available on a large number of other systems including Win32, MS-DOS, OS X, AMIGA, OS/2, Cygwin and many more. Vim is written by Bram Moolenaar.

Vim is often called a "programmer's editor," and is so useful for programming that many consider it an entire IDE. It's not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.

Before you ask

  • If your question is not about programming, consider posting Vim related questions at the dedicated Vim Stack Exchange site.
  • Vim has an extensive help system that will often address your questions. Type :help <subject> within Vim to search for help on a particular subject; for instance: :help search. The help documentation is also available online.
  • Search Stack Overflow for similar or duplicate questions.

Free Vim books

Vim books

Documentation

Tutorial

See also

License/charityware

Vim is Charityware. You can use and copy it as much as you like, but you are encouraged to make a donation for needy children in Uganda. Please see |kcc| below or visit the ICCF web site, available at these URLs:

Related tags

27998 questions
5175
votes
13 answers

How do I exit Vim?

I am stuck and cannot escape. It says: type :quit to quit VIM But when I type that it simply appears in the object body.
jclancy
  • 49,598
  • 5
  • 30
  • 34
3259
votes
34 answers

How do I make git use the editor of my choice for editing commit messages?

How do I globally configure git to use a particular editor (e.g. vim) for commit messages?
brasskazoo
  • 76,030
  • 23
  • 64
  • 76
2396
votes
34 answers

Indent multiple lines quickly in vi

It should be trivial, and it might even be in the help, but I can't figure out how to navigate it. How do I indent multiple lines quickly in vi?
Allain Lalonde
  • 91,574
  • 70
  • 187
  • 238
2370
votes
12 answers

How to replace a character by a newline in Vim

I'm trying to replace each , in the current file by a new line: :%s/,/\n/g But it inserts what looks like a ^@ instead of an actual newline. The file is not in DOS mode or anything. What should I do? If you are curious, like me, check the question…
Vinko Vrsalovic
  • 330,807
  • 53
  • 334
  • 373
2324
votes
32 answers

Vim clear last search highlighting

After doing a search in Vim, I get all the occurrences highlighted. How can I disable that? I now do another search for something gibberish that can't be found. Is there a way to just temporarily disable the highlight and then re-enable it when…
Gabriel Solomon
  • 29,065
  • 15
  • 57
  • 79
2007
votes
16 answers

How to do case insensitive search in Vim

I'd like to search for an upper case word, for example COPYRIGHT in a file. I tried performing a search like: /copyright/i # Doesn't work but it doesn't work. I know that in Perl, if I give the i flag into a regex it will turn the regex into a…
Haiyuan Zhang
  • 40,802
  • 41
  • 107
  • 134
1956
votes
22 answers

How to duplicate a whole line in Vim?

How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+↑/↓ in Eclipse?
sumek
  • 26,495
  • 13
  • 56
  • 75
1706
votes
9 answers

How does the vim "write with sudo" trick work?

Many of you have probably seen the command that allows you to write on a file that needs root permission, even when you forgot to open vim with sudo: :w !sudo tee % The thing is that I don't get what is exactly happening here. I have already…
Doppelganger
  • 20,114
  • 8
  • 31
  • 29
1517
votes
53 answers

What's a quick way to comment/uncomment lines in Vim?

I have a Ruby code file open in vi, there are lines commented out with #: class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # t.string :name # t.string :all_of # …
Ethan
  • 57,819
  • 63
  • 187
  • 237
1484
votes
27 answers

Turning off auto indent when pasting text into vim

I am making the effort to learn Vim. When I paste code into my document from the clipboard, I get extra spaces at the start of each new line: line line line I know you can turn off auto indent but I can't get it to work because I have some…
Rimian
  • 36,864
  • 16
  • 117
  • 117
1419
votes
12 answers

Tab key == 4 spaces and auto-indent after curly braces in Vim

How do I make vi-Vim never use tabs (converting spaces to tabs, bad!), makes the tab key == 4 spaces, and automatically indent code after curly brace blocks like Emacs does? Also, how do I save these settings so I never have to input them…
mmcdole
  • 91,488
  • 60
  • 186
  • 222
1410
votes
5 answers

What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?

What is the difference between the remap, noremap, nnoremap and vnoremap mapping commands in Vim?
Chetan
  • 46,743
  • 31
  • 106
  • 145
1408
votes
15 answers

How do I move to end of line in Vim?

I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?
salt.racer
  • 21,903
  • 14
  • 44
  • 51
1317
votes
5 answers

What is the in a .vimrc file?

I see in many .vimrc files, and I am wondering what does it mean? What is it used for? Just a general overview of the purpose and usage would be great.
Bob Martens
  • 13,542
  • 3
  • 17
  • 9
1310
votes
13 answers

Redefine tab as 4 spaces

My current setting assumes 8 spaces; how could I redefine it?
Ricky
  • 34,377
  • 39
  • 91
  • 131
1
2 3
99 100