vim

How do I make vim syntax highlight a whole line?

I'd like to have vim highlight entire lines that match certain patterns. I can get all the text in a line to highlight (by doing syn match MyMatch "^.*text-to-match.*$"), but it always stops at the end of the text. I'd like to to continue to the end of the term, like highlighting CursorLine. I've tried replacing $ with a \n^, hoping t...

Detect filetype from within VIM plugin?

I have a vim plugin that defines a bunch of key mappings. I'm trying to figure out how I can change the defininition of the key mapping based on the filetype. For example: If the file is a *.py: then map the key to X If the file is a *.php: then map the key to Y Thanks! ...

When is Visual mode used in Vim?

I'm relatively new to the world of Vim. I've been learning my way around it but have yet to find a practical purpose to enter visual mode. What are some scenarios when visual mode is especially useful? Are there actions that can only be performed from within visual mode? ...

Good guide on VIM Scripting?

I've used VIM for 10+ years, but never really into VIM scripting (always subjectively beliving that this was one area where VIM was weaker than Emacs). Recently, the realization "in a VIM script, I can execute normal mode commands" made my mind og "a-ha" and suddenly start realizing why parts of VIM script is the way it is. normal ma10...

Using VIM as a HTML editor

You know how Notepad++ has this feature that when you click on a tag (say ) it automatically highlights the ending tag () as well? What's it called? And how do you tweak VIM to have this feature as well? And any more ways you can turn VIM into a powerful and efficient HTML editor? ...

How to mantain or export folds when copying a file in Vim

Every time I copy a file the folds are lost. I understand why this happens, but I can''t figure out out to "export" or "maintain" the folds. Any suggestions? (otherwise I have to rename the view files one by one if I copy a entire folder). EDIT: I'm folding lines by writting for instance: :1,80 fo ...

Vim: transitioning from mouse to movement

I use MacVim (and gvim) a lot. I'm familiar with and use a lot of the basic movement commands (b, w, $, 0, G). However, for a lot of thingssuch as selecting particular lines on the screen or jumping to a particular column in a different lineI use the mouse (sometimes in concert with my left hand on the keyboard). It also helps that my mo...

How do I do a :g with a concatenating of submatches in Vim?

I have a file whose content is roughly something like insert into FooBar values (13, 19, 220, 108); // some text, // some more text insert into MixMax values (22, 5, 87, 1); // and so on insert into HooHoo values (8, 37, 222, 51); // etc ... Now, I'd like to yank the first numbers after the string values ( into a variable, preferably...

Can vim monitor realtime changes to a file

My question is similar to this how to monitor a text file in realtime but I want to do it in vim. I know I can read an opened file use tail -f sample.xml file, and when new content is written to the file, it'll also write the new content to my screen. Can I have vim automatically fill the new data when a file is updated? ...

vim mapping :w with a shell command

First poster here at SO. I'm currently using cygwin with external gvim. I got this in my vimrc autocmd FileType sass setlocal shiftwidth=2 tabstop=2 map <F5> <Esc>:w<CR>:!sass %<.sass %<.css<CR><CR> I want to work just like a normal :w while also running sass, how do i do that? And also, when running this in my vimrc, I always hav...

Is it possible to display Indentation guides in Vim?

I'm a longtime Vim user (3 or 4 years) who has recently started dealing with some deeply nested code. This code is indented with spaces, not tabs. I would like some clean and non-distracting indication of indentation to help with keeping track of which block of code I'm in when I'm looking at something many levels deep. :set list ...

Vim: Delay before 'O' opens a new line?

I've noticed that, occasionally, when I use O (capital 'o') to create a new line and go into insert mode, there is a short delay before anything happens. Is this common? Is there any way to change it? Both :map O and :imap O show "No mapping found", so I don't think it's a strange mapping. ...

Map key to toggle between normal mode and insert mode in Vim

I'd like to use two "controls" as a toggle key to switch between normal mode and insert mode in Vim. So I add the following two lines into my .vimrc nmap <C-><C-> i imap <C-><C-> <ESC> But it doesn't work. What's wrong with the above two lines? ...

Does omnicppcomplete support typedef syntax

I found that omnicppcomplete does not support typedef-ed struct name . I don't know it is a limitation of omnicppcomplet or it is because some missing configuration in my vim enviroment . Let me give you a dummy example to put it more clear. typedef struct foo { int a; int b; }foo_t ; foo a ; foo_t b ; then after I hit "a." in ...

How to write a function or macro to send a parameter to a system call in gVim for Windows?

The useful command :r!date is not so useful in gVim for Windows (not cygwin's gVim) because Windows has its own date function which does not do what I want. so, something like :r!c:\cygwin\bin\date would be great. But that's a lot to type. And considering that I might want to call a few things this way, it would be nice to write a f...

Is the a scheme definition that highlights CSS properties and non-numerical values in Vim with different colors?

In this CSS example, Vim highlights float and left with the same color. #rights { float: left; margin: 30px 0 0; } with the following definition: hi Type guifg=#eeeeee gui=none (in this case both float and left will be light gray. Is the a scheme definition that highlight CSS properties and non-numerical values ...

How do I get the VIM matchit plugin working with ColdFusion and HTML?

I've been attempting to follow the instructions on the Vim wiki to get the matchit plugin working with ColdFusion (*.cfm) files containing both ColdFusion and HTML tags running on MacVim. I've got the syntax file for ColdFusion (cf.vim) installed in $HOME/.vim/syntax/cf.vim, the latest version of matchit installed in .vim/plugin/matchit...

What vim plugins mix results in this interface

I saw this VIM UI and thought it was awesome and now I want it. Anyone know what plugins the author is using? http://werkzeug.pocoo.org/wiki30/files/wiki30.mp4 ...

How to delete bookmarks in NERDTree (Vim)?

I checked the documentation but couldn't find it. Does anybody knows? ...

Vim's autocomplete is excruciatingly slow

Most of the time the autocomplete feature in VIM works nicely for me, but sometimes it seems to be scanning files which the current file references, and then it becomes painfully slow, sometimes taking several seconds to release focus back to me. Sometimes VIM tells me simply that it is "Scanning" other times, it's saying "Scanning tags...