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

learn more… | top users | synonyms

5
votes
2answers
2k views

Turning off splitting lines in vim

One of the most annoying features of vim is splitting lines. For some reasons someone found it would be good to split lines even in whitespace sensitive formats. For example changing: echo ...
4
votes
2answers
601 views

viewing info documentation with vim

I'm trying to use the ManPageView addon to view info documentation within vim. Although I find ManPageView very useful for, well, viewing manpages, its info-reading functionality doesn't seem to work ...
5
votes
1answer
407 views

As we call `#!/bin/perl` 'shebang', what we call `-*- perl -*-`?

The first line of a script may be in format of #! interpreter, so the shell will execute the script using the specific interpreter. This is so called shebang or shbang. Similarly, there can be some ...
17
votes
3answers
6k views

Buffers or tabs in vim? What are advantages/disadvantages of each approach?

I'm used to modeless editors. Only the past year I've been using vim/gvim, which has a modal approach. I'm used to tabs in all editors, since before vim all of them are used to it. In gvim, you don't ...
4
votes
2answers
954 views

cursor position after pasting in vi / vim

One thing that has always bothered me in vi / vim: If I "yank" (a.k.a. "copy") some text, then move to another place in the file and do a "paste", my cursor remains at the beginning of the text I ...
12
votes
2answers
6k views

Best way to upgrade vim/gvim to 7.3 in Ubuntu 10.04?

I have to use Ubuntu 10.04 at work, and cant upgrade it. I'm using Vim/gVim 7.2. I want to upgrade it to 7.3 (with Python and Ruby extension support). Which is the best way? Add an entry in ...
2
votes
2answers
391 views

lookbehind and using it with grep in Vi?

Trying to get into Vi (not Vim), after learning Vim. Vim has a lookabehind like /\(Not this\)\@<!$, how to do it in Vi? If I want to search recurvively down directory in Vim, I could do :vimgrep ...
9
votes
2answers
376 views

How do I modify the ci command in vim

Just like "ci(" changes everything between parentheses, I want "ci$" to change everything between dollar signs (for editing LaTeX.) Is this possible?
8
votes
2answers
328 views

Vim command for inserting a character

I'm looking for the opposite of x. I want to insert just one character and stay in command mode.
7
votes
3answers
445 views

Block motion for any bracket type?

If I want to, say delete a block, I can use text object motions. I.e if my text looks like this: (let [a 1 b {:x 3 :y 4}] a) And the cursor is for example on character 3. If I type diB ...
15
votes
1answer
2k views

Is it possible to have vim key bindings in terminal?

I'm getting used to vim bindings (like pressing w to go to word, dw to delete a word, and such) and it's modes (insert, normal, visual), and, out of curiosity would like to know: is there some kind of ...
53
votes
3answers
35k views

Delete from cursor to end of line on 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.
7
votes
3answers
609 views

Temporary .vimrc

Is there a way to read a .vimrc file for only a single ssh session? That is, when I log in I perform some operation so that vim uses say /tmp/myvimrc until I log out? I do not want to permanently ...
9
votes
3answers
616 views

GVim compiled from source opened via SSH -X does not copy paste on selection

I'm using SSH (with -X specified) from a Ubuntu box to a RHEL4 box and running GVim. It opens as expected in my local X, but the copy and paste via select doesn't work. I cannot select text in GVim ...
2
votes
2answers
497 views

How to turn off permanent highlighting of all braces (not just pairs) in vim

I have no idea how I modified vim such that all braces are highlighted, not just matching ones, but I want to turn it off now. How do I do that? The usual highlighting of matching braces works fine.
6
votes
2answers
1k views

red-green color blindness compatible vim theme

I am looking for a vim theme accessible to users with red green color blindness. In particular, the red text on a dark terminal background all but disappears. Do any of you know of a good theme? Or ...
7
votes
2answers
948 views

What encryption does vim -x use?

I read man vim, :h -x and :h encryption none of this actually says what algorithm it's encrypted with.
8
votes
1answer
1k views

How to change the name of a vim buffer

Is it possible to change the name of a buffer in vim? Specifically, I'm using Conque Shell to open shells in vim (each shell is in a buffer) and with multiple shells, I see: 10: bash - 1 11: bash - ...
10
votes
4answers
18k views

How do I quit from Vi?

I started Vi on my Ubuntu machine. However I don't know Vi, and now I can not quit. I see the editor and I can write text, at the bottom line there is a label "recording". How do I quit from Vi?
6
votes
1answer
289 views

Application-specific keymapping

In general, I want to make specific keymaps for application, that working only in it and doesn't affect any other app. For example, I already use my Caps key to toggle input language (via xorg.conf), ...
0
votes
1answer
1k views

Why does 'set' syntax not work for syntax highlighting in vim?

On searching how to set syntax highlighting on in vim, I found this page which says that vimrc should have the following line syntax on Why is it not something like set syntax on? Like we have set ...
1
vote
3answers
2k views

What is a vi equivalent of vim's 'set ruler' command?

Is there a way to show the current row and column position in vi? In vim, I know there is the set ruler command, but what are my options when using vi?
5
votes
3answers
3k views

Why does my vim-7.3 compile fail to include clientserver?

I am trying to compile vim-7.3 will all features enabled. I ran configure with $ ./configure --with-features=huge --enable-gui --enable-cscope $ make ; make install When I check the version, it ...
6
votes
4answers
3k 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
147 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
483 views

Line numbering in Vim

How do I enable line numbers to be displayed in Vim?
3
votes
2answers
177 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 ... ...
15
votes
3answers
4k 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
147 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
1k 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 ...
5
votes
1answer
5k 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 ...
15
votes
3answers
13k 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 ...
16
votes
5answers
2k 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
288 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 ...
158
votes
14answers
48k 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
296 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 ...
7
votes
5answers
3k 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 ...
14
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 ...