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

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
2k 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 ...
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
5answers
9k views

How to jump to the beginning or end of line in vim + OS X

In terminal I can do this by pressing shift+home and shift+end, but it doesn't seem to work in vim. Home and end keys scroll terminal window only. I would like to jump in edit mode.
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
4k 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
1answer
3k 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 ...
9
votes
2answers
11k 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
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 ...
9
votes
1answer
1k 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
2answers
5k 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
3k 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 ...
9
votes
3answers
2k 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 ...
8
votes
5answers
6k 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
2k 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
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
3answers
6k 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
5k 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
2answers
578 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. ...
8
votes
1answer
247 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
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, ...
8
votes
2answers
4k 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 ...
8
votes
7answers
2k 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
2answers
6k 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
6answers
4k 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
28k 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 ...
8
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 ...
8
votes
1answer
2k views

Using clipboard through SSH in vim

I have Ubuntu 11.04 desktop and a 11.04 VPS server. After replacing vim with vim-gtk (I don't need GUI though), I'm able to use the system's clipboard in vim. I'd like to use the same feature in ...
8
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 ...
8
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?
8
votes
4answers
1k views

Vim: Is there a downside to using <Space> as your <Leader> key? [closed]

I recently started using <Space> as my mapleader, and I find it very comfortable and fast. I can slap that key with either thumb, freeing up whichever hand I need for the next keystroke, and ...
8
votes
2answers
1k views

How can I tell vim to compile a document on save?

I'd like that vim automatically compiles a lout document (similar to LaTeX) every time I save the document. Is there a possibility to add such functionality to save? (Preferably without using ...
8
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 ...
8
votes
1answer
2k views

How do I do a block search-and-replace with Vim?

I have text in Vim hit Ctrl+V to put VIm in block mode highlight the text I want type : this gives the this prompt :'<,'> I add to the prompt my regex s/ /*/g. This leaves me with ...
8
votes
2answers
3k 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 ...
8
votes
3answers
1k views

Can I use Vim editing mode on the command line without losing recursive history search?

I'm uzing zsh and, because I'm an avid Vim user, I just switched to using Vim-style editing on the command line. (That means if I type ls foo/bar and decide I want to cd instead, I can hit Esc ^ to ...
8
votes
2answers
1k 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 ...
8
votes
1answer
11k 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 ...
8
votes
4answers
9k 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 ...
8
votes
2answers
1k views

How do I make vim's undo buffer persistent across sessions?

When I make an edit to a file and then leave vim, I would like to be able to undo that change when I reopen it later.
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
3answers
3k views

Mac OS X: how to open vim in terminal when double click on a file

I have defined my own custom vim file type with highlighting etc. I would like to open it using the terminal based vim when I double click on it. I am using mac os x. Any pointers on how to start ...
8
votes
2answers
1k 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 ...
8
votes
1answer
3k views

vim not loading _vimrc file when launched from git bash

I have downloaded and installed git for windows (msysgit) and frequently used the included git bash. Whenever I run vim from git bash my _vimrc file is not loaded because there is syntax highlighting ...
8
votes
2answers
2k views

Why does Vim ignore files in ~/.vim/after/ftplugin?

I seem to have a problem with my local Vim configuration but I'm not sure what it is. I need to override some filetype-specific settings. As per multiple tutorials/howtos, I created ...
8
votes
3answers
917 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 ...