vimscript

Vimscript: find last open parenthese or bracket

I'd like to write a function in vimscript that finds the last open parenthese or bracket in a line. This isn't necessarily an easy problem, because it needs to be able to handle all of the following: function(abc function(abc, [def function(abc, [def], "string(" function(abc, [def], "string(", ghi( As you can see, nested parenthesis, ...

Testing for locale existence in Vimscript

One of my problems when creating a portable .vimrc is with locales. Let's say I always want to use English language for messages. Depending on OS and Vim version, the command needed may be lang messages en, lang messages en_US, lang messages English_US, etc. Now, I can do this: try lang messages en catch try lang messages en_US ...

Embed vim settings in file

In some files I can see a commented line, usually the last, with vim settings. Does vim read these settings? If it does, are any limitations of what kind of settings man can put there? ...

VIM prompting for a variable when running a macro?

I find I waste a lot of time closing and reopening sets of files so I'd like to improve my VIM macro for loading and saving the session to support multiple sessions. I'd like for it to prompt for a string value, so that I could press my shortcut, then type in for example "foo", and have my macro save the session to .foo (so I also need ...

Skipping a window in VIM with Ctrl-W_W

When I have several windows open in VIM, I'd like to always skip one of them (the one containing my project using Aric Blumer's Project plugin), whenever I press Ctrl-W_W. In other words I'd like to cycle through my document windows as if the Project window wasn't one of them. When I actually do want to go into the project window, I'll ...

vim word completion navigating with 'j' and 'k'.

In vim, I use Ctrl-n to word complete while in insert mode. If there is more than one possible match, I get a dropdown from which I can select one of the possible matches using the arrow keys. However, I don't want to use the arrow keys; I want to use the 'j' and 'k' keys. But when I type 'j' or 'k', it inserts the letters instead of go...