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

8
votes
4answers
2k views

How to replace vim screen buffer with previous bash activity after quitting?

I'm trying to find out what a bash (or vim) feature is. Here's the scenario. I'm in a bash terminal, then edit something with vim, then exit back to bash. In some terminals, the vim session screen ...
8
votes
1answer
2k 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?
8
votes
3answers
4k views

vim new line with same indentation

Then I press [Enter] in insert mode, there is a new line. But cursor places in the very beginning of a line. What do I do to create new line with the same indentation as the current's?
8
votes
3answers
780 views

Is there a way to “lock” the viewport in vim?

I recently started using Vim with NERDTree. The annoying thing is when I close the buffer, NERDTree expands to fill the rest of the screen, and I have to open another file and reopen NERDTree to get ...
8
votes
3answers
752 views

How can I keep the color when I run the external command inside vim?

For example, for the command ls --color displays colorful results when being executed in the shell. However, when I call :!ls --color inside vim, all color information is gone. What should I do to ...
8
votes
3answers
2k views

Vim - dynamic list of open buffers in a window

I've investigated a few ways to maintain a list of open buffers in Vim, and some of them are very good, but none of them seem to behave the way I'd like. It's very possible that nothing like what I ...
8
votes
3answers
2k views

Synchronize pasteboard between remote tmux session and local Mac OS pasteboard

Setup: I use iTerm2 on MacOS to connect to a remote server. The remote server runs tmux, in which I open files and edit in vim sessions. Problem: I can't copy/paste between the remote tmux session ...
8
votes
4answers
1k views

Using VIM keys in shell (zsh or bash)

I want to use vim editing keys in my shell (zsh). With bindkey -v i get VI keys, but i want visual and more advanced key shortcuts (like change inner word (ciw), which i use all the time) btw, is ...
8
votes
5answers
5k views

How can I remap my Caps-Lock key to Escape (for Vim) in Snow Leopard?

Obviously, in Linux I can use xmodmap. On Leopard, I used an InputManager called PCKeyboardHack. But InputManagers are now broken. How can I preserve my sanity and keep on using Caps Lock to Escape ...
8
votes
3answers
2k views

Vim powerline doesn't show the current branch

I'm using the vim plugin called powerline and it isn't showing the git branch I'm on, while it's supposed to be activated by default. The fugitive plugin is installed, though I don't think it was ...
8
votes
2answers
154 views

Maintain permissions bits when writing new file with VIM

In Vim, when I write a copy of the current buffer to a new file using :w [filename], it appears that Vim uses the default (i.e. set by umask or whatever) file permissions for the new file. If the ...
8
votes
2answers
471 views

Vim across multiple monitors

Does anyone have an elegant solution for having MacVim or gvim span across multiple(potentially different resolution) monitors? Having 2 sessions doesn't work well due to separate buffers and swap ...
7
votes
2answers
718 views

Why is vim leaving temporary file versions all over the place?

First of all I assume those files ending with "~" which are created by vim when editing a file are indeed serving the purpose of temporary backups while editing. But every time I open a file with vim ...
7
votes
3answers
5k 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?
7
votes
2answers
1k views

Lost left/right cursor keys in VIM insert mode?

When I edit .sql file in VIM, I can't use left/right cursor keys while in insert mode. In normal mode they work just fine. In another file types - they work fine as well. in ~/.vim/ftplugin/sql.vim ...
7
votes
7answers
961 views

Vim - Adding empty line between lines

How do I insert a blank line between every non-blank lines? eg. from line 1 line 2 line 3 line 4 line 5 to line 1 line 2 line 3 line 4 line 5
7
votes
6answers
4k 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
1answer
2k views

Can't run Vimdiff (7.4) on Windows 7

I recently installed the 7.4 version of gVim on a Win 7 machine. Trying to diff two files from the context-sensitive menu on Windows Explorer, I keep getting the error messages: E810: Cannot read or ...
7
votes
2answers
4k 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
2answers
5k views

How to search for one of two similar strings in Vim?

This is a pretty simple regex question, I think. In Vim, if I want do a search that matches planA or planB, I know that I can do this: /plan[AB] This works because the regex allows for either A or B ...
7
votes
3answers
2k views

Go to middle of line in vim

I know 0 goes to the beginning of line and $ goes to the end, but is there something for the middle?
7
votes
2answers
18k 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 ...
7
votes
2answers
2k 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, ...
7
votes
4answers
2k 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 ...
7
votes
3answers
1k views

How to run Vim command from the shell?

This might be a dumb question, but bear with me. I'm automating some of the usual stuff I do when setting up a new work environment, and would like to automate the Vim command :BundleInstall (for ...
7
votes
1answer
10k 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 ...
7
votes
4answers
5k views

Enable mouse for scrolling only in Vim in iTerm (MacOSX)

I'd like to use the mouse in Vim only for scrolling (not to enable other Vim modes or otherwise interact with Vim). Using :set mouse=a seems to be an all or nothing operation, can this be altered? ...
7
votes
3answers
1k views

bulleted lists for plain-text documents in Vim

While Vim supports automatic indenting in lists, the default setting only covers ordered lists, starting with digits, such as: 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do ...
7
votes
3answers
14k views

How do I make Vim beautiful (read: Textmate font/color ) on Mac OS X Lion?

I am just starting to make the Textmate to Vim switch. I love it, but it's so ugly. I'm running Mac OS X Lion and needed Ruby support so I am using Vim 7.3 as installed via Homebrew not the Vim Lion ...
7
votes
6answers
3k 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 ...
7
votes
3answers
1k views

vim and TeX filetypes: plaintex vs. tex

I open .tex files with Vim, but some files are recognized as filetype=plaintex and others as filetype=tex. Why is this? What is the trigger that recognizes the file as tex, which has the highlighting ...
7
votes
3answers
3k 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 ...
7
votes
3answers
3k 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 ...
7
votes
1answer
1k views

How to get back to insert mode in VIM when you accidentally hit C-x C-s

Given this vim session: % vim test-file.txt iHello there!C-x C-s How do I get back to insert/command mode again? (C-x C-s means Control-x Control-s, not sure if it's normal vi terminology for ...
7
votes
1answer
2k views

how can I tell vimdiff to ignore whitespace?

I made a number of changes in a file I'm working on, including indentation changes. I'm using vimdiff to compare the file to the original version, and I don't want to see these changes, since they're ...
7
votes
4answers
6k views

VIM and putty - mouse issues

i'm not very experienced in VIM. i'm using VIM with putty, and i often use mouse scroll and move text cursor with mouse. also sometimes i need to paste some code from windows clipboard, so i have to ...
7
votes
3answers
246 views

vim can not execute unix command with :! due to shell changing

Our company uses red hat linux system and allocate everyone an account in /home. Unfortunately, our system is using tsch, which is not favorable for me. Moreover, as I do not have the super user ...
7
votes
6answers
3k views

Compile gvim from sources?

Recently, I've installed vim like so: hg clone https://vim.googlecode.com/hg/ vim cd vim sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2 --prefix=/opt/vim make ...
7
votes
2answers
960 views

vim macro to convert CamelCase to lowercase_with_underscores

Is there a vim macro to convert CamelCase to lowercase_with_underscores and vice versa?
7
votes
2answers
3k views

Auto-reloading a file in VIM as soon as it changes on disk

Assuming that a file doesn't have unsaved changes in the VIM buffer, I'd like it to reload automatically if the file changes on disk. The most frequent use case for this is when I update the working ...
7
votes
2answers
2k 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?
7
votes
3answers
830 views

PDF reader for the CLI

I'm looking for a PDF reader that I can use over SSH in a terminal, and have it running in screen. Does such a thing exist? Ideally I'd like at least a less-esque pager but with some PDF formatting, ...
7
votes
2answers
2k views

vim's autocomplete: how to prevent vim to read some include files?

Vim has handy Ctrl-N key that autocompletes word under the cursor with word in current file or any included file. If Once I include boost library, this feature becomes absolutely useless because it ...
7
votes
2answers
695 views

Slowness in Vim's bracket-matching with the default PHP syntax

I am experiencing a noticeable slowness in Vim's bracket-matching and -highlighting feature. When the cursor is placed over a parenthesis or bracket, there is a delay of about 300ms on the console's ...
7
votes
2answers
577 views

Can I steal a vim session from another terminal?

I forgot to start screen before I started working, and now I've SSH'd into my machine from my laptop. ps -a gives me the process ID of the vim process. Can I steal the vim session from my other ...
7
votes
1answer
9k views

Setting background color in gvim

I use a terminal with white text on black background (I just like it better), so I wrote the following line in my .vimrc file: set background=dark However, gvim has black on white text. How do I do ...
7
votes
6answers
3k views

Editing a huge file - Vim or something else?

I am Vim fan for most of my editing purposes. But these days when I have to open huge file ~1-2 gigs, its is vert slow to load and perform operations What are the other ways I can edit such huge ...
7
votes
4answers
6k views

Solarized colors in vim don't seem to be working for me

I am running vim, and trying to get the vim solarized colors to work in terminal. I have this in my vimrc file: set syntax on set t_Co=256 " let g:solarized_termcolors=16 set background=light ...
7
votes
4answers
2k views

VIM - leaves .swp files after crash

I use MacVim (snapshot 51) to edit a the Python/HTML/etc files in moderately sized project. Every few months my system locks up or crashes, and Vim leaves a plethora of .*.swp files around. When I go ...
7
votes
4answers
2k views

How do I keep vim from highlighting matches after a replace?

I have set hlsearch in my ~/.vimrc. This is normally very useful, but it's annoying to have to do :noh after I do a replace like '<,'>s/$/',/ (which highlights the end of every line after I run ...