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

20
votes
8answers
12k views

Vimperator copy/pasting

I'm trying out Vimperator. I mainly wanted it for the hjkl scrolling, and I like its "hint" system for following links. These two features are really all I need; I think. I don't mind the other ...
22
votes
4answers
17k views

In vim, how can I quickly switch between tabs?

In gnome-terminal, I can just press Alt + (1, 2, 3, etc.) to switch to specific tabs. I can also use Ctrl + (PgUp / PgDn) to cycle through tabs (admittedly less convenient, but it can be remapped). ...
17
votes
3answers
11k views

Mousing and Page-Up/Down in Terminal for Mac OS X

Compared to *nix, Terminal.app seems pretty lame. How can I get it to: Send Page-Up/Down to an application, instead of just scrolling the terminal output Mouse around in vim. set mouse=a isn't ...
48
votes
2answers
33k views

How do I find the encoding of the current buffer in vim?

Say I am editing some file with vim (or gvim). I have no idea about the file's encoding and I want to know whether it is in UTF-8 or ISO-8859-1 or whatever? Can I somehow tell vim to show me what ...
40
votes
9answers
32k views

How can I get (g)Vim to display the character count of the current file?

I like to write tutorials and articles for a programming forum I frequent. This forum has a character limit per post. I've used Notepad++ in the past to write posts and it keeps a live character ...
32
votes
4answers
17k views

How to setup a line length marker in vim/gvim?

Some GUI text editors have a vertical line which serves as line length marker (it helps keeping lines shorter than 80 chars in source code files). Is is possible to have something similar in ...
49
votes
5answers
7k views

Invoking vi through find | xargs breaks my terminal. Why?

When invoking vim through find | xargs, like this: find . -name "*.txt" | xargs vim you get a warning about Input is not from a terminal and a terminal with pretty much broken behaviour ...
45
votes
2answers
15k views

How to start vim without executing /etc/vimrc?

On my Linux server at work, the admins did not install cscope, and I installed it from source in my home directory and added it to the $PATH. The trouble is, the /etc/vimrc has a reference to ...
27
votes
1answer
3k views

Can't resize vim splits inside tmux

Everything is working fine outside of tmux. But in tmux I can't resize vim splits with the mouse. I have set mouse=a in my .vimrc. Is there a solution for this? .tmux.conf: $ cat ~/.tmux.conf ...
41
votes
2answers
12k views

How to get vim to open multiple files into tabs at once

Is it possible to get vim to open multiple files into tabs, similar to the way the args <path> command will open multiple files into buffers? Doing something like :tabe ./* results in the error ...
22
votes
6answers
9k 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 ...
15
votes
1answer
6k views

vim delete all lines that do NOT contain a certain word

In vim I can delete all lines that contain the word "price" with this :g /price/d How can I delete all lines that do NOT contain the word "price"?
22
votes
6answers
6k views

How do I replace-paste yanked text in vim without yanking the deleted lines?

So I usually find myself copying text from one point to another while overwriting old text where the new is pasted: blah1 newtext blah2 wrong1 blah3 wrong2 blah4 Suppose I visual-mark newtext and ...
18
votes
8answers
8k 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. ...
27
votes
8answers
23k views

How to remove this symbol “^@” with vim?

I have some files that are corrupted with this symbol: ^@ It's not part of the string; it's not searchable. How do I substitute this symbol with nothing, or how do I delete this symbol? Here ...
21
votes
2answers
4k 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 ...
12
votes
1answer
4k 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
40k 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.
15
votes
5answers
14k 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 ...
9
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 ...
8
votes
3answers
7k 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 ...
28
votes
5answers
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 ...
6
votes
4answers
7k 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 ...
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?
15
votes
5answers
20k 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
5answers
4k 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 ...
11
votes
2answers
5k 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
2answers
7k views

How to run Unix commands from within Vim?

How can I run Unix commands while I'm inside vim?
7
votes
2answers
289 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, ...
7
votes
3answers
8k 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?
5
votes
1answer
3k 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 ...
9
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 ...
7
votes
4answers
2k views

How can I test for plugins and only include them if they exist in .vimrc?

In my .vimrc I am trying to use ftplugin and obviously use some commands relating to that under the assumption that it was loaded successfully. However, I have now encountered a few old machines that ...
6
votes
4answers
835 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
900 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 ...
18
votes
4answers
5k views

How do I get the numpad to work in vim using iterm2 on osx with term=xterm?

My numpad works in iterm2 (bash), but it inserts characters instead of numbers in insert mode for vim. How can I get vim to recognise the correct escape codes. I have tried editing the escape codes ...
6
votes
5answers
4k views

Tips for using vim as a log viewer

As a log viewer, which of vim's features are convenient? less -F is quite good. But I believe vim could be better if we knew its hidden features. * or # v//d g//d etc.. PS. I don't use ...
6
votes
3answers
765 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
1answer
1k 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 ...
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
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
524 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
2answers
358 views

Editor of txt files for Windows with syntax highlight and foldable/collapsible sections for Markdown [closed]

I asked the same for Notepad++, but in fact I don't mind changing of software. I am interested in managing txt files that contain Markdown. I would like to find an editor of txt files for Windows ...
0
votes
4answers
3k 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 ...
16
votes
8answers
25k views

What's the easiest way to delete Vim swapfiles I've already recovered from?

Sometimes Vim crashes and leaves me a swapfile. That's awesome. Then I open the file I was editing and Vim asks me if I want to recover. I do, thanks. When it's done, Vim tells me, You may want ...
10
votes
1answer
595 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 ...
10
votes
9answers
4k 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 *"...
9
votes
5answers
3k 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 ...
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, ...
7
votes
3answers
4k 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 ...