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
25
votes
2 answers

How do I generate ctags for CoffeeScript?

Is it possible to generate a ctags file for CoffeeScript in vim/MacVim?
Darren Newton
  • 2,847
  • 1
  • 29
  • 31
25
votes
16 answers

In Vim, what is the best way to select, delete, or comment out large portions of multi-screen text?

Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks of text or write e.g. three large methods out to…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
25
votes
4 answers

ctags ignore lists for libc6, libstdc++ and boost

I use ctags with vim and the OmniCppComplete plugin. Currently when generating my tags I do it individually for each library. For libc6 I use the following list of tokens / macros in a file named libc6-ignore to ignore during…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
25
votes
4 answers

Enable syntax highlighting for various filetypes in vim

I can enable syntax highlighting for a file that has an extension that is unknown to vim by doing the following set syntax=c Every time I switch tabs however, I have to renter the command. Is there any way to let vim know that a file with an…
Samaursa
  • 16,527
  • 21
  • 89
  • 160
25
votes
7 answers

Save file as root after editing as non-root

Ok so this happens to me all the time. There has to be a better solution. Let's say you do vim /etc/somefile.conf and then you do i but realize you are not sudo and you can't write. So then I lose my changes by doing :q then sudo !! and make my…
Amir Raminfar
  • 33,777
  • 7
  • 93
  • 123
25
votes
2 answers

is there a vimscript equivalent for Ruby's strip() (strip leading and trailing spaces)?

I'm looking for a VimScript function that strips any trailing or leading spaces before a string.
dan
  • 43,914
  • 47
  • 153
  • 254
25
votes
4 answers

How can I sort alphanumeric strings in Unix?

I have a list of table names, which are out of order. How can I get them in the correct logical order? $ cat list.txt TAB1 TAB13 TAB11 TAB19 TAB2 TAB3 TAB16 TAB17 TAB18 TAB9 TAB10 TAB8 TAB12 TAB20 $ cat list.txt | sort…
Lazer
  • 90,700
  • 113
  • 281
  • 364
25
votes
7 answers

how to use pylint in vim

I do not want to install another plugin, like pylint.vim, And today, I decide to use vim edit python instead of pydev which is a eclipse plugin. But I got issues. I have add this in my vimrc autocmd BufWritePost *.py !pylint but pylint does…
guilin 桂林
  • 17,050
  • 29
  • 92
  • 146
25
votes
7 answers

How to use a template in vim

This is really a newbie question - but basically, how do I enable a template for certain filetypes. Basically, I just want the template to insert a header of sorts, that is with some functions that I find useful, and libraries loaded etc. I…
Andreas
  • 6,612
  • 14
  • 59
  • 69
25
votes
5 answers

vim limited line memory

im trying to copy 300 lines from one file to another, in source file i type "300yy", it says it has yanked 300 lines. go to destination file and press p, it pastes, but only the first 50 lines. any idea why it isn't pasting the 300?
john-jones
  • 7,490
  • 18
  • 53
  • 86
25
votes
1 answer

How to search a string with spaces and special characters in vi editor

I edit in the vi editor. I want to search in the text for a specific phrase, e.g "Dec 1 15:13:00". I have tried this search string, but it's not working: /Dec\ 1\ 15 How do I search for this string properly? Note that there may be more than one…
user5628973
  • 311
  • 1
  • 3
  • 5
25
votes
7 answers

How to update Vim to color-code new html elements

I am wondering how I might set vim to color the new html5 elements (ie "canvas" and "video") as it does with the existing "script", "body" elements (or reserved words in other languages like python's "def") etc. Current version is from MacPorts…
unmounted
  • 33,530
  • 16
  • 61
  • 61
25
votes
4 answers

How do I turn off automatic saving of a vim file with a ~ suffix

In my environment, I share vim configuration with other developers (and have my own configuration additions as well) in various .vimrc files. Some places in the environment, I edit a file in vim and automagically a copy of that file with a trailing…
Leonard
  • 13,269
  • 9
  • 45
  • 72
25
votes
2 answers

git: new blank line at EOF

So I run git diff --check before add-ing files and commit-ing them, and on two specific files I get path/filename:linenumber: new blank line at EOF. If I delete the last empty line in those files, I don't get any messages, but I think it is good…
Maxim Chetrusca
  • 3,262
  • 1
  • 32
  • 28
25
votes
2 answers

How to enable completion of C++ template classes in vim using YouCompleteMe

When using the vim plugin YouCompleteMe for C++ code completion I stumbled over an issue. Using nested template classes stops the completion to work properly. Consider the following example to reproduce the behaviour: #include…
Phil
  • 259
  • 3
  • 6