Vim is a highly configurable text editor built to enable efficient text editing. It is an improved version of the vi editor.

learn more… | top users | synonyms

18
votes
4answers
8k views

How do I edit an existing buffer in a new tab in vim?

Suppose I have started vim like this: vim foo bar Now I decide that I want each of those files in its own tab. Is there a way to do that without exiting vim and adding the -p option to my command ...
18
votes
8answers
7k views

VIM: “sudo vim bad_idea”?

An irc-user in #Vim urged me not to use Sudo with Vim like: sudo vim bad_idea When I am doing things in locations such as /var/www/, I cannot write without it. So not-using sudo becomes a problem. ...
12
votes
1answer
3k views

How can I use the Homebrew Python version with Homebrew MacVim on Snow Leopard?

Note: For Mountain Lion, see: How can I use the Homebrew Python with Homebrew MacVim on Mountain Lion? I've installed Python 2.7 with Homebrew on Mac OS X Snow Leopard. When I install MacVim ...
19
votes
3answers
38k views

How to install vim.full in Ubuntu?

I've installed Ubuntu Server but I have only vim.basic? How do i install vim.full? Tried with aptitude install vim but it said it's always installed. Because vim is a soft link to vim.basic.
18
votes
2answers
3k views

vim scrolls very slow when a line is too long

I would never have thought that vim would be so slow. All I have is the following long line: I run vim (MacVim) under Mac OSX with the terminal app. Here is my vimrc. Hope that it has nothing to do ...
8
votes
2answers
1k views

how do I copy/paste in vim ex mode

I'm increasingly frustrated by typing this :%s/some_really_long_string/some_other_really_really_long_string_that_may_or_may_not_related_to_the_first_one/gc Is there any way to copy/paste those ...
24
votes
1answer
3k views

How can I select an html tag's content in Vim?

Is it possible to select an html tag's content in Vim? For example: <p>I am a silly butterfly</p> I would like to select "I am a silly butterfly"! I know that you can use vi" to select ...
7
votes
3answers
5k views

What could cause strange characters in Vim?

I'm have this really strange problem in Vim using the NERD tree plugin, where, as you can see in the picture, the characters are showing up very strange. Where there is the ahat, ~V 3/4 it should be ...
4
votes
4answers
6k views

Vim and mouse with ssh from Mac to Linux

I certainly know it's possible to make the mouse work in Vim on a remote session to a Linux machine from my Mac, but I haven't figured out just how. Daily vim gives a tip on making it work but if I ...
23
votes
4answers
3k views

Vim - select text highlighted by search?

In vim, I often perform searches to hop to a word or phrase instead of navigating there with h/j/k/l. Then I hit n to hop between occurrences. Say I've got this text: Time flies like an arrow; fruit ...
13
votes
5answers
12k views

Copy to system clipboard instead of vim buffer

I would like to set Y and P to copy and paste directly to the system clipboard instead of vim buffer. I don't want any additional commands. Just the normal ones, but they should copy to and paste ...
11
votes
5answers
3k views

Vim configuration slow in Terminal & iTerm2 but not in MacVim

Ideally, I want to use Vim from Terminal or iTerm2. However, it becomes unbearably slow so I had to resort to using MacVim. There is nothing wrong with MacVim, however my workflow would be much ...
7
votes
3answers
6k views

I just got a Mac! How do I do “end” , “home”, “page up” and “page down” in my terminal/VIM editor?

I write a lot of python in my VIM, on the terminal. What do I do?
6
votes
2answers
277 views

Is it possible to not trigger my normal search highlighting when using search as a movement?

When I do a search in vim, I like to have my results highlighted and super-visible, so I give them a bright yellow background and a black foreground in my .vimrc. " When highlighting search terms, ...
5
votes
3answers
3k views

Vim command to map CapsLock to Escape

What command do I have to enter to be able to leave editmode by pressing CapsLock in Vim?
13
votes
4answers
15k views

How can I recover the original file from a .swp file?

I tried opening the .swp file using vi and cat but it displays junk.
11
votes
2answers
4k views

How to install VIM on Linux when I don't have root permissions?

I've got some troubles when I try to install Vim on Linux while I don't have a root account. The error information is shown below: How can I solve this? Can I install it in another directory other ...
9
votes
3answers
5k views

How to run vimtutor on windows?

I'm running vim on Windows 7. It works, but when I type vimtutor on the command line, a window opens and closes immediately, and nothing else happens. Is there a way to run vimtutor with Vim for ...
8
votes
6answers
5k views

Custom vim highlighting

I am editing some xml right now and I have been leaving myself some comments of things to come back to. Like this <!-- Question: bla bla --> I am editing with vim right now and I would like ...
6
votes
2answers
4k views

How to run Unix commands from within Vim?

How can I run Unix commands while I'm inside vim?
6
votes
4answers
788 views

VIM destroys symbolic links under Windows

It seems that when working with a file in VIM it primarily uses a backup version of the file then overwrites the original on save. This is a problem when using symbolic links under Windows (e.g. ...
5
votes
2answers
730 views

Weird insertion from Vim on mouse click

I'm using putty (on windows 7) to connect to shell and Vim as editor. I also have mouse=a option enabled in Vim, but I get some strange behavior (such as random insertions of characters and/or ...
15
votes
7answers
4k views

How to make Emacs read buffer from stdin on start?

With Vim I can easily do $ echo 123 | vim - Is it possible to do with Emacs? $ echo 123 | emacs23 ... Emacs starts with a Welcome message $ echo 123 | emacs23 - ... Emacs starts with an empty ...
5
votes
3answers
705 views

gVIM breaks symlinks on windows?

I'm trying to keep my gVIM config in centralized place. For this, i have done mklink c:\users\me\.vimrc c:\users\me\configs\_vimrc That works fine until i change $MYVIMRC inside VIM. This instantly ...
4
votes
4answers
1k views

Features of Emacs that are complementary to Vim?

I've been using Vim extensively for a while now, and I really enjoy working with it. However, I keep reading praises for Emacs. I've decided to take a look at Emacs to round out my knowledge of the ...
3
votes
1answer
2k views

tmux: enable mouse scrolling in vim instead of history buffer

I have just started using tmux 1.8 recently, after working with screen for a while. After reading things here and there on the internet, I came up with following ~/.tmux.conf However when I open vim ...
3
votes
1answer
875 views

Vim enable mouse scroll only - not cursor positioning

I want to enable the mouse wheel for scrolling like ^e and ^y do. I don't want clicking in a buffer to move the cursor though, so :set mouse=a does not help me. Reason is that I have a bunch of gui ...
3
votes
2answers
1k views

Settings in my .vimrc file are being superseded by other things - vim-gnome on ubuntu

I installed vim-gnome on ubuntu. I notice that things I put in my $HOME/.vimrc file, like colorscheme and so on, are being overwritten by something else. If I start Vim, another colorscheme is used, ...
1
vote
1answer
403 views

Vim has unexpected key presses on startup, what could be causing this?

Whenever I open a file with vim, the vim session starts with 2c having been automatically/programmatically 'pressed'. This means that if I start off trying to move down the file by pressing j, then ...
0
votes
4answers
2k views

Open a text file in cygwin's VIM

Is there any way to configure Windows to open text files in Cygwin's VIM instance? I am currently using GVIM but I find it limiting for many reasons. Unfortunately, I can't just install Debian on this ...
10
votes
1answer
507 views

Different background color for multiple filetypes in vim

Is it possible to have different background colors in vim (ie. one light, one dark) when dealing with files with multiple filetypes (ie. :set ft=html.php)? In PHP code with HTML embedded, it can be ...
8
votes
5answers
2k views

bashrc: how to know X window is available or not?

There is a part in my ~/.bashrc, which sets $EDITOR to be gvim. It works fine when I am in X window. However, if I ssh to my workstation (from another workstation) gvim starts to complain "cannot open ...
8
votes
7answers
3k views

Emacs equivalent to VIM ci"?

Does emacs have the equivalent of VIMs ci" command? Basically I want to replace the text inside a set of quotation marks. In vim I can ci) or ci] or ci} to "change inner *"...
7
votes
2answers
5k views

Using JSLint with Syntastic in Vim

I'm using Syntastic for syntax checking in Vim - whenever I save an .rb file, it runs it through a syntax checker and highlights errors for me. Spiffy. Same for several other file types: HAML, HTML, ...
6
votes
2answers
2k views

Vim - Displaying Code Output in a New Window á la Textmate?

A few months back I switched from Textmate to Vim. Overall I really love Vim, but one of the things I miss from Textmate is using the ⌘R command to run Ruby code and having the results neatly ...
6
votes
3answers
3k views

Vim: How to handle Unicode files with text in multiple (more than two) languages?

What settings do I need to set in Vim/gVim to be able to view Unicode text files which have text in many languages? You may make these assumptions: The number of languages is more than two. Some of ...
4
votes
1answer
323 views

Vim process stops after executing an external command

I've been using vim recently to program in C. I have created shortcuts for compiling and running the programs from within vim itself, but recently vim's process has been stopping after executing the ...
4
votes
2answers
2k views

How can I make terminal VIM my default editor application in Mac OS X?

I am aware of MacVim, and while it's very nice I am constantly in the terminal. Why have two programs running when I could stay in one? So the question is, how can I make VIM (run in iTerm2) the ...
4
votes
2answers
374 views

Make vim yankings global via a shared text file

In a nutshell, I want the following: y(ank) actually writes the yanked text to a line in a text file, maybe in your .vim directory that line is prefixed with the name of the register, so "qyy yields ...
4
votes
5answers
2k views

Sharing Vim Yank Register

Is it possible to run multiple instances of Vim which share their yank registers? I'd like to avoid having to yank to the system clipboard with "+y or opening my files in split windows within the same ...
4
votes
1answer
2k views

Underlining search results in vim (instead of highlighting them)

Right now, all of my search results in vim are highlighted in a bright (i.e. unreadable) yellow. I was wondering if there was a way to set the highlighting for search results to underline instead of ...
3
votes
2answers
127 views

How to have ESC also cancel CAPS if CAPS is enabled?

Is there any way to configure the keyboard so that pressing ESC will also cancel the Capslock feature, if Capslock is enabled? I specifically use Kubuntu Linux with ESC and Caps keys switched (VIM ...
3
votes
3answers
633 views

Vim not restoring screen contents on Debian?

I always thought Vim restored the previous contents of the screen upon closing. This allows me to remember what commands I was typing previously and what I wanted to do next. Recently I've been using ...
3
votes
2answers
1k views

Installing Command-T breaks MacVim

I am trying to install Command-T on MacVim. I followed the installation instructions exactly but I get this error when trying to start MacVim (from a terminal via the mvim command line utility). ...
3
votes
3answers
815 views

Tutorial for those who know Vim but want to learn Emacs as well

I would like to find a resource listing all the Emacs equivalents (for performing various common tasks or using features in common to both editors) for the Vim commands/features that I know well.
2
votes
1answer
721 views

Running vim in Console2 does not show colours properly

So I am currently using Console2 for my command line stuff, the background shell is just the cmd.exe from windows. My problem is that I have the theme set to 'twilight` in vim, and it works perfectly ...
2
votes
1answer
1k views

How to create custom keyboard shortcuts in vim?

For example - when coding in Perl, I need to sometimes comment out a bunch of lines. What I do is something like :80,96 s/^\(.*\)$/#\1/ I want to create a custom shortcut for this so that I can do ...
2
votes
2answers
11k views

How do I get Vim home directory?

I wanted to set the VIMHOME variable this way (common to Windows and Linux), let $VIMHOME=expand("%:p")."/..", so that VIMHOME is "~/.vim" in Linux or "path/to/vimfiles" in Windows. I put this in ...
1
vote
2answers
43 views

How to determine what buffer was changed externally with gVim?

I am using the following Vim autocommand in my .gvimrc file: augroup MyAuGroup autocmd MyAuGroup FileChangedShell * call FileChanedEvent_BuffUpdate() augroup END function ...
1
vote
1answer
938 views

Cygwin vim doesnt show 256 colors under ConEMu

When using cygwin vim under ConEmu, the default vim theme doesnt display correctly after I set t_Co=256. This is how ConEmu looks after the command: http://postimg.org/image/g6g98exbx/ My .vimrc: ...