vim

How do i replace a visually selected range with the contents of the paste buffer in vim?

I want to replace a selection of text with is present in the default paste buffer. Say, I yanked a word with yaw and now I want to replace a word with that, how do I do it? I saw similar questions answered with suggestions to use a named register and delete the text-to-be-replaced into the black hole etc, but I am looking for a cleaner ...

Scripting Vim with find -exec

Hello, I have a little Vim script which does a multi-line search and replace: vim -c 's/^ *<hi a=\"26\">\nHello/<td height=\"26\">\r<\/table>\r<bla \/>' \ -c 'w!' -c 'q' test.html That works. However, when I put that in a find -exec to do this recursively in the directory: find . -iname 'test.html' -exec \ vim -c 's/^ *<hi a=...

How can i change my vim vimrc to know when I am typing a php variable and match the color?

I know I did not word the question right but I was not sure how. So here it goes. when using vim the way my color syntax is now, when i type in $ it shows yellow and when i write text it comes in white. How can I configure my vimrc to know when I am writing a php variable ($variable) and keep the color consistent between the $ and the ...

Changing the background color of the active buffer/pane in Emacs or Vim

I usually work fullscreen with Vim and Emacs on a 30" monitor which means I tend to have a lot of splits. The active pane's modeline changes background in Vim and Emacs, but sometimes that's not an easy to see indicator of the active pane. Is there a way to change the background color of the active pane so I can easily, at a glance, se...

Vim trifling question : different colors for folds and subfolds

Is it possible to have different set of colors for folds and subfolds, eg : blue fg on grey bg for fold level 1 (default) black fg on darkyellow bg for fold level 2 etc... (although going further down would seem a bit excessive) Thanks ThG ...

regex: sentence selection

how do i preserve sentences that start with X criteria and delete sentences that match Y criteria. using vim, I would like to delete all sentences that do not start with void. void set_first_name(string in_first_name); string first_name(); void set_last_name(string in_last_name); string last_name(); void set_composer_yob(in...

vim: open preview window without moving text in main window

When omni-completion (or other things) opens the preview window, the size of the main window is reduced in order to make room for the preview window. By default, the first line that was visible in the main window before the preview window pops up will also be the same after the preview window pops up. This has the unfortunate effect tha...

How set "args" to the list of files of the current buffer

In the current buffer I have a list of file paths (one per line). I want set "args" to that file list. How can I do this? Thanks. ...

Vim: How to map Ctrl-M without affecting Return keypress as well?

I want to map Ctrl-M to Ctrl-N in insert mode. If I simply do imap <C-M> <C-N> then Ctrl-M does start to behave just like Ctrl-N, but then hitting Enter does the same as well. I want pressing Return to keep inserting new lines, and at the same time make Ctrl-M insert the next keyword completion match just like Ctrl-N does. Is that possib...

Piping rectangle region of text from vim to an external program?

I am editing a large text array in vim, and I want to compute on one sub-column of it. Simplified example of edited file: name value name saturation red 5 green 2 blue 7 yellow 7 other text I want to pipe column 4 through an external program calc.pl, calc.pl replaces numbers with new numbers in the input, for example: ...

vim select paragraph -- how to redefine paragraph boundaries?

In vim, vip selects "inner paragraph" :help v_ip, however it is of limited use. vim paragraph boundary is hard coded, a paragraph is separated by 2 or more blank lines. :help paragraph Some archaic marcos like .IP, also seem to be supported as paragraph separators, but it is all hard coded. I want to specify my own paragraph separa...

gVim + US-International: Not combining dead keys with space

Hi, I am using "United States-International" on Windows 7, which courses problems in combination with gVim 7.3. In the US-International keyboard layout the keys " and ' are dead keys, that means, you can combine them with another key. For example pressing "+a results in ä and the keys '+a in á. In order to insert one double quote you s...

Vim won't load plugins when I change the runtimepath.

Basically I want to move everything from ~/.vim into a separate folder, let's say ~/vim_config. I added this setup my ~/.gvimrc set runtimepath^=~/vim_config If I do a :set rtp the ~/vim_config folder is at the top of the list. But no plugins are loaded. Colorschemes are loaded though. ...

vim: autoindent not working

my autoindent is not working, any diagnostic tests to figure it out? my ":set" is: :set --- Options --- cindent laststatus=2 scroll=17 tabstop=4 window=36 filetype=cpp number smartindent ttyfast helplang=en paste syntax=cpp ttymouse=xterm2 backspace=indent,...

Pros and cons for each vimrc cross-platform solution?

When dealing with .vimrc configuration files in Linux and Windows (two systems I've been using so far) and trying to keep configurations cross-platform, I've found mainly two solutions: Create a new folder for vim files in /home/user, so both systems have the same vim dirname (instead of default .vim in linux and vimfiles in Windows), ...

vim auto indenting lines without semicolons in Ruby

For some reason, in vim whenever there is a line of ruby code with a function including parentheses, eg: string = gets() without a semicolon the next line is indented a level. When there is a semicolon, it works fine. Any ideas as to why this is happening and how to fix it? Also, since it will probably be requested, here is my ~/.vimrc ...

regex: attach a newline to every sentence using vim

i was wondering how to turn a paragraph, into bullet sentences in vim. before: sentence1. sentence2. sentence3. sentence4. sentence5. sentence6. sentence7. after: sentence1. sentence2. sentence3 sentence4. sentence5. ...

In vi/vim is there any way to make Visual Block Mode unconstrained by line endings?

In vi/vim is there any way to make Visual Block Mode unconstrained by line endings? ...

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? ...

How do I get the behaviour of the 'Insert' key on VIM using a Macbook Pro without an insert key?

Because the apple store couldn't help me, and indeed had never seen VIM before, despite the fact it comes installed as standard on OSX ;-). ...