vim (Vi IMproved) is a text editor supporting different editing modes.

learn more… | top users | synonyms

9
votes
4answers
4k views

How to split and edit patches?

Sometimes I need to split a big patch into smaller (disjoint) ones, e.g. for every separate feature included. Usually I do it via standard vim yank/dd commands and split-window switching. But are ...
0
votes
3answers
164 views

Why does my mapping of <C-PageX> to :bY not work in gvim?

In my .vimrc file, I have the following two lines: noremap! <C-PageDown> :bnext <CR> noremap! <C-PageUp> :bprev <CR> but they do not work! In insert mode, typing ...
11
votes
3answers
552 views

Line numbering in Vim

How do I enable line numbers to be displayed in Vim?
3
votes
2answers
182 views

Why does the substitution of newlines using g/re/p only apply to every other line in Vim?

Consider: foo bar .... bar baz Then: :g/bar/s/\n/\r\r/g unexpectedly returns: foo bar bar bar bar bar ... baz when I want newlines after every bar. Yet: :g/bar/p returns: bar bar ... ...
16
votes
3answers
7k views

How to fix Ctrl + arrows in Vim?

I am using Putty -> Suse box -> vim 7.2 combo for editing and want to remap Ctrl + arrows combo to a particular task. But for some reason, Vim ignores the shortcut and goes into insert mode and ...
7
votes
1answer
150 views

Navigate through a stack of locations in vim?

Typing `` at location X brings you back to the last visited location in the text file. Hitting it again brings you back to X This switching is similar to Ctrl+6 to open the last opened file. But how ...
5
votes
1answer
2k views

vim auto indenting even after setting noai option

I am using vim 7.2 from putty terminal. Even if I run set noai it seems vim still trying to indent code. I am copying my code from Notepad++ to vim. following is from Notepad++ and following what I ...
6
votes
1answer
8k views

Vim 7.3 with Lua: How do I use it?

The latest Vim release is awesome! I compiled it with --enable-luainterp=yes and it does have the Lua feature: % gvim --version | egrep '\+lua' +linebreak +lispindent +listcmds +localmap +lua +menu ...
24
votes
3answers
35k views

Comparing two files in Vim

Is it possible to view two files side-by-side in Vim? If so, how can I set up my editor to do this, and is there a way to diff between the two files within Vim? I am aware of the :next and :prev ...
28
votes
6answers
5k views

How to yank a particular line without moving the cursor in vim?

For example How can I yank and paste Line 4 only to Line 12 without having to move the cursor to Line 4?
4
votes
1answer
398 views

How to add a feature to Vim if it's not compiled with that feature?

I am trying to use clewn (full gdb support in the vim editor), but the vim I have on my box doesn't have the netbeans_intg feature enabled. Is it possible to enable it without recompiling vim? I am ...
252
votes
14answers
149k views

What are the pros and cons of Vim and Emacs?

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.
3
votes
3answers
309 views

Persist clipboard contents in vi

If I want to copy text from a file in vi to another file, I have to highlight the text, Control-Shift-C it, quit the first file, open the second, and then paste it via Control-Shift-V. It feels like ...
9
votes
5answers
4k views

vim on FreeBSD does not react on arrow keys correctly and other vi-like behaviours

I tried to use vim on FreeBSD (via ssh on Linux xterm-compatible terminal). However vim behaves similar to vi out-of-box. For example it does not react on delete key, insert F character instead of ...
19
votes
8answers
2k views

What are the best general purpose programming tools to complement Vim?

I've been using Vim as my text editor for a little while now and I feel like I'm taking the long way to do anything. I use ctags to tag my code base for navigation and I use grep (although ...