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

12
votes
4answers
4k views

Count highlighted string length in VIM

I wonder is there a way to count highlighted symbols in vim (including white spaces)? UPDATE It shows rows count if my selection is on multiple rows. I need symbols count.
12
votes
3answers
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 ...
12
votes
1answer
4k 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 ...
12
votes
2answers
2k views

How to set background color for Vim's active window only?

A small but visually pleasing feature, and slightly adding to usability, I'd like to have Vim use different background color for the active window. Here's a sketch of what I am after: Normally ...
12
votes
4answers
694 views

How can I keep a buffer list per window in Vim?

I'm surprised that I haven't been able to find an answer to this, but maybe I'm missing something obvious: is it possible to keep a buffer list per window? I often have around 4 splits, and each one ...
11
votes
4answers
6k views

Remove VIM search highlight

After a search I've done, all the matches for the respective query remain highlighted and it's annoying. This happens even after I close the respective file (normal behavior?). How to I remove this?
11
votes
6answers
2k views

vim : toggle number with relativenumber

with setl nu! I can toggle number (on/off), similar with relativenumber setl rnu! how I can toggle {off,number,relativenumber} ?
11
votes
2answers
3k views

In Vim, what are settings/commands that that being with a prefix (b:, g:)

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 ...
11
votes
6answers
6k 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
3answers
7k 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 ...
11
votes
7answers
3k views

vim multiuser editing?

With vim, can two users edit the same file at the same time?
11
votes
4answers
4k 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 ...
11
votes
4answers
10k 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 ...
11
votes
3answers
8k 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 ...
11
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 ...
11
votes
3answers
5k 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 ...
11
votes
3answers
2k views

How to break long lines in vim?

I have a quite big text file formed of blocks like Short line. Really long line. Short line. separated by empty lines, and I would like to use vim (on Linux) to break down the long lines and obtain ...
11
votes
5answers
8k views

Always use :set paste, Is it a good idea?

In a terminal vim, pasting clipboard data often messes up the code indent. I just knew if I uses :set paste the indent is not broken. Though, after pasting data, should I do :set nopaste again? What ...
11
votes
3answers
14k 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?
11
votes
1answer
2k views

Vim Ignores Aliases

If I map a command in vim using something like map <f4> :! pdflatex %<cr> Vim will ignore my alias for pdflatex (something like alias pdflatex='pdflatex --temp-dir=something'). Is it ...
11
votes
3answers
5k views

Can I use vim to open a huge file effectively?

sometime I need to open a several GB log file, now I need to use tail to get suitable part but that is very tedious. Can I just use vim to open it directly? Currently vim will occupy a lot memory ...
11
votes
4answers
6k 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 ...
11
votes
2answers
143 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 ...
10
votes
2answers
2k 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 ...
10
votes
7answers
3k 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
10
votes
4answers
9k 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 ...
10
votes
6answers
2k views

Using Vim key bindings in Onenote

I found ViEmu, which allows you to use Vim key bindings in Visual Studio and certain Office applications. Does anyone know of similar software for using Vim key bindings in Microsoft Onenote? Free or ...
10
votes
3answers
24k views

Using vim to force edit a file when you opened without permissions

I use vim to edit a file. Sometimes, I forget to have the appropriate permissions. I run vim and the file as a read only file. I can make changes, but I can't actually write the changes. Every once in ...
10
votes
1answer
3k views

How can I hide the insert status in vim?

I want to hide -- INSERT -- from the status line.
10
votes
5answers
12k 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.
10
votes
2answers
679 views

How to read Vim keystroke syntax?

I'm trying to learn Vim and I'm seeing a lot of documentation use syntax like <C-v>. Is there a general guide on how to read this correctly? I've attached an example SO post below that uses ...
10
votes
4answers
4k 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 ...
10
votes
6answers
6k 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 ...
10
votes
1answer
3k 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
2answers
2k 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 ...
10
votes
1answer
4k views

How do I unset a specific vim command?

set listchars=tab:>-,trail:_ I tried to unset the above command this way: unset listchars=tab:>-,trail:_ But only get: E492: Not an editor command: unset listchars=tab:>-,trail:_ ...
10
votes
5answers
4k 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
10
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 ...
10
votes
2answers
4k views

how to make vim's auto-complete behave like bash's default auto-complete?

When you type :e some/path/file<Tab> if there are several matches, vim just picks the first one and you have to cycle through the rest of them with the Tab key. (pretty much like the behavior of ...
10
votes
3answers
2k 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 ...
10
votes
1answer
18k 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
1answer
2k views

List all filetype plugins known to Vim

I want to list all filetypes Vim recognizes from its runtimepath. For example: ada arc c clojure common-lisp elisp go python How can I do it?
10
votes
2answers
5k 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 ...
10
votes
2answers
4k views

Fuzzy find within file in Vim

I love using the Command-T plugin in Vim to do fuzzy searches for filenames. I like it so much that I've started to want to do the same fuzzy searches for arbitrary strings within an open buffer. For ...
10
votes
3answers
8k 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 ...
10
votes
1answer
9k 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 ...
10
votes
3answers
5k views

Can I use the `<cmd>` key in terminal Vim at all?

Following on from my other recent question: How do I map <cmd>-<shift>-f to run Ack plugin in Vim? Is is possible to use the <cmd> key in Vim at all? If Vim doesn't recognise the ...
10
votes
1answer
1k views

Is there a way to use multiple vim folding methods at once?

I have foldmethod=indent set in my ~/.vimrc, and in general that works for me and I'd like to keep it. However, there are a few files I have which I edit regularly (and which are under my exclusive ...
10
votes
4answers
4k 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
315 views

How to disable alternate buffer in GNU screen itself but not for vim, less inside it?

What I would like to accomplish is mouse wheel scrolling behavior that I'm used to in a regular ssh session. In bash prompt mouse wheel should scroll my terminal output, and inside less/vim - the ...