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

10
votes
1answer
2k views

Automatically close NERDtree when opening file

I have installed NERDtree 4.1.0. I have mapped <leader>n to :NERDTreeToggle<CR>. I would like to use this in a way where I can press <leader>n, then locate the deisred file in the ...
10
votes
1answer
4k views

How can I export my Ubuntu terminal's color scheme for use on other computers?

How can I export my Ubuntu terminal's color scheme for use on other computers? I've set up a color scheme that I like and I'd like to put it in a git repo for easy loading from other machines. Any ...
10
votes
4answers
5k views

How to exit help in vim

I just used the help files in vim and now I am stuck in help. :q Exits the entire program and I am getting tired of having to close and reopen vim every time I use help. I would prefer a command that ...
10
votes
2answers
32k views

Install Vim in Cygwin

I have installed Cygwin on my Windows machine and I have also selected some additional packages as part of my installation (like GCC etc). Now I want to add Vim also to my existing Cygwin setup. What ...
10
votes
1answer
15k views

Using colour schemes with vim and putty

I am trying to use the desert color scheme with VIM 7.0 on CentOS 5.6 x64 located here: http://hans.fugal.net/vim/colors/desert.vim I've downloaded the file and saved it in my ~/.vim/colors ...
10
votes
2answers
2k views

Setting up multiple highlight rules in vim

I am trying to set up rules to highlight both trailing whitespace and lines which are over a certain length by adding this to my .vimrc: highlight ExtraWhitespace ctermbg=lightgray guibg=lightgray ...
10
votes
2answers
4k views

How do I use installed Vim in Git Bash instead of the one that came with Git?

I've installed Vim and Git to C:\Program Files (x86)\(vim|git) respectively. When I run Vim from Git Bash, it runs the internal version of Vim that came with the Git installer. Is there a way to ...
10
votes
1answer
3k views

Hide certain files in NERDTree

I would like to hide object files (*.o) in the Vim NERDTree plugin. Does the plugin support this feature, yet?
10
votes
1answer
3k views

How can I tell Vim to show ANSI escape codes properly?

I'm trying to view and edit a file in Vim, but this file has ANSI escape codes: ^[[1m[0.05s elapsed, 00:00:13 total]^[[0m How can I tell Vim to interpret them properly instead of just showing the ...
10
votes
4answers
3k views

iTerm2 Vim alt+right/left arrow

As a Linux user, I am very used to jump from word to word in vim/nano using ALT+left or right. This doesn't seem to work properly using iTerm, I am using zsh, I tried adding; bindkey -e bindkey ...
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
2answers
130 views

vi / vim abrumpt buffer movements within window

When using :set wrap in vi/vim, the contents of an entire wrapped line are placed in the display buffer upon moving the cursor into a new line, even when navigating through a file by display line ...
9
votes
2answers
7k views

How to run Unix commands from within Vim?

How can I run Unix commands while I'm inside vim?
9
votes
8answers
5k views

$PATH in Vim doesn't match Terminal

I'm using MacVim and when I don't launch it from the Terminal (mvim) its $PATH does not include what I have set in my .bash_profile. It only seems to have the default values, ...
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 ...
9
votes
3answers
1k views

GNU Screen - Removing vim window after quit

I use urxvt with GNU screen with X11 on my mac. I like it a lot. My only issue, is that when I quit vim, it puts the shell prompt underneath the vim window. This isn't a huge issue, but it ...
9
votes
3answers
6k views

Vim: how to paste a block of text at the end of multiple lines?

Say I have a block of text like this: // Comment1 // Comment2 // Comment3 And I want to append each of these lines to the end of 3 corresponding lines of code: foo = 1; bar = 2; baz = 3; So ...
9
votes
4answers
3k views

How do I copy command output in vim?

For example, if I type ':pwd' to get the current working directory, I can select the text in gvim but I can't figure out how to copy it to the clipboard. If I try the same in console vim, I can't even ...
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 ...
9
votes
2answers
598 views

Write vim file as super-user?

This is a usability problem that happens often to me: I open a read-only system file with vim, even editing it, because I'm not attentive enough, or because the vim on the system is badly configured. ...
9
votes
3answers
2k views

How to display the line number in Vim?

I'm using the Vim text editor GVIM on a Windows-based machine. How can I show the line numbers? Provided that I'm not using it in the console?
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 ...
9
votes
4answers
3k views

Can I use perl regular expressions in the vim command line?

I want to use perl regular expressions on the vim command line. For example, to capitalize the words on the current line, you could type: :s/(\w+)/\u$1/g
9
votes
3answers
5k views

Mouse cursor in Terminal?

I use Mac OS X Terminal.app. But the answer to this would probably apply to any typical UNIX-ish terminal emulator in a graphical environment. Question -- what do I do to: Use my mouse cursor to ...
9
votes
1answer
1k views

Why can Vim open large files faster than some other text editors?

When opening large log files (well, not that large, but 80mb is still a lot of text!), I've always used Vim since it loads them almost instantly. Other text editors like Notepad, Notepad++, etc will ...
9
votes
5answers
2k views

Disable mouse clicks in gvim on ubuntu

How do I make gvim ignore mouse clicks. I'm really sick of the trackpad making my cursor all over the place. I use xubuntu if that means anything.
9
votes
3answers
12k views

Configure VIM for copy and paste keyboard shortcuts from system buffer in Ubuntu?

How do I configure VIM for using Ctrl-c to copy and Ctrl-v to paste from system buffer in Ubuntu?
9
votes
3answers
4k views

How do I enable syntax highlighting for .bash_aliases in vim?

I'm working on reorganizing my .bashrc. I moved my aliases to .bash_aliases (which is sourced by .bashrc, but I can't figure out how to enable syntax highlighting for this file. vim seems unable to ...
9
votes
1answer
2k views

How to refresh vim layout when split

After setting up some splits/vsplits and resizing gvim or the console running vim, splitter positions are not updated. Is there a way to force updating splitter positions (by retaining them in the ...
9
votes
1answer
8k views

Mapping Left Alt key in Vim?

I am able to map the key combination Right Alt+Left Arrow with <a-left> or by <m-left>. But I am not able to map the Left Alt key. Is there a way to do that? Edit: Just to clarity ...
9
votes
2answers
4k views

How do I only dp or do just the lines, not the entire block in Vim diff?

I'm currently using MacVim (Snapshot 64) "Split Diff by..." menu option. The file is Django's my settings.py from version 1.3.1 to a fresh file from version 1.4. (Open the image on a separate ...
9
votes
3answers
6k 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 ...
9
votes
2answers
6k views

VIM: How to configure Solarized colorscheme in Konsole

I am trying to configure Solarized for use in VIM in Konsole (KDE terminal). This is the result that I get: Note that Solarized looks fine in GVIM on the same machine: I suspect that it is ...
9
votes
2answers
2k views

Can I add a set of words to the Vim autocomplete vocabulary?

In Vim, I'm aware of using CTRL-n and CTRL-p to autocomplete words found in the document. This is great for promoting the use of descriptive method and variable names. I would like to add a set of ...
9
votes
3answers
881 views

gvim redraw failure

I have a problem with gvim where the screen redraw partially fails. It's hard to explain but when I open a text file and page down or up the entire text file is not redraw properly. I have to move the ...
8
votes
5answers
2k views

Highlighting a search term without moving the cursor

Using Vim, I sometimes find myself staring at a section of source code for a while and suddenly want some variable on the screen to pop out. That's easy: /<var> which highlights them all. My ...
8
votes
5answers
8k views

Vim: insert empty line above current line (not open, i.e. without entering Insert mode)

is there a way of inserting a new line above the current, without opening the line (so without entering Insert mode)? That is, like "O", but without opening.
8
votes
3answers
3k views

How to paste from multiple clipboards vim without leaving insert mode?

Suppose you are typing in vim and there are 5 common expressions that you need to insert into the text over and over. Is there a way you can tell vim to paste from multiple clipboards without ...
8
votes
2answers
1k views

Prefixed (b:, g:) settings in Vim

I installed this plugin with Vundle and noticed that it has some settings (the README calls them variables) like: b:javascript_fold and g:javascript_conceal The README says I, "can add ...
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 ...
8
votes
4answers
5k views

How to I use Textmate color themes with vim?

I have a textmate color theme I really like this, But I am a hardcore vim user. Is there an easy (painless) way for me to use this color scheme with vim?
8
votes
2answers
6k views

How do you change the default colorscheme in gvim?

In GVIM for Windows I know you are supposed to be able to add something to the $VIM/_vimrc file in order to customize the start up and I have managed how to figure out a few neat tricks with that but ...
8
votes
1answer
261 views

How to navigate 'logical' lines individually in vim?

I know that there is a setting for this in vim, I just can't find it now... Basically, I like set wrap. I like it alot. I'm less fond of it skipping down to each actual line, rather than the more ...
8
votes
2answers
3k views

textwidth=0 and wrapwidth=0 in .vimrc.local not being respected

I have the following lines at the bottom of my .vimrc.local: set textwidth=0 set wrapmargin=0 However, whenever I open a new file, both these values are set to their defaults (72 and 2, ...
8
votes
7answers
3k views

Dvorak hotkey remapping in vim, worth it?

I've been trying to learn the dvorak keyboard layout of late and I have been making some good progress this time around. The trouble I am finding now is that all of my hotkeys are all in the wrong ...
8
votes
4answers
2k views

Setting vim options only for files in a certain directory tree?

There is a programming project I work on where everyone else uses a tabsize of 4, so I find it most straightforward to set tabstop=4 in my ~/.vimrc. However, I'd rather not have this affect every file ...
8
votes
2answers
8k views

How do I set the default window size in vim?

When I right click on a file and open it in Vim, the default window size is too small. How can I change the settings so that the default window size is bigger? I'm running Vim 7.3.46 in Windows 7.
8
votes
3answers
1k views

Repeat last normal mode command, including moves, in Vim

In Vim, with ., I can repeat the last normal mode command; for example: dd. deletes a line twice. But, if I type 5j. the cursor does't move 10 lines down. How do I repeat the last normal mode ...
8
votes
6answers
5k views

How can I make .vimrc read from an external file?

I'd like to modify my .vimrc to read the value of a variable from an external file. How can I do this? Specifically, a friend and I share a git repo with our .vim files, but there are a few small ...
8
votes
2answers
3k views

Notetaking file-based system for Vim

I'm looking actually for something similar to Deft, only for Vim. Does anyone know of any with which he/she has had good experiences?