Cancel split window in Vim

I have split my windows horizontally. Now how can I return to normal mode, i.e. no split window just one window without cancelling all of my open windows. I have 5 and do not want to "quit", just want to get out of split window....Read more

How to set vim incremental search highlight color different from existing search match color

I want vim to start highlighting matches right away as I type after typing '/'. But that highlight color should be different from the color of the existing matches.Example, I have the following text:foo bar bazAfter the end of this sequence: /foo<return>/bar(Note that this sequence was typed in normal mode and no <return> was pressed at the end of the sequence)foo should be highlighted with one color (call it "found match" color) and bar should be highlighted with another color (the incremental search color)....Read more

How to do incremenatal search in Vim like it is done in Emacs?

When using incremental search in vim, the cursor immediately goes to the next occurrence of the search term as far as you have typed it. Emacs has a similar incremental search function. However, there is a feature of emacs isearch that I have found very useful that I really would like in vim. In emacs, if you type:<ctrl-s>wordit immediately goes to "word", just like vim incremental search. In emacs, you can now type additional <ctrl-s> to move to the next result occurrence of "word" and in emacs this does not end your incremental se...Read more

vim: define command for grep + copen + incremental search

I'd like to define a custom command for doing the following steps: grep the current word, copen, incremental search the grep'ed word. Here's the command I'm using:nmap <C-p> :execute "grep! -Irn " . shellescape(expand("<cword>")) . " ."<cr>:copen<cr>:g/<cword>/<cr>But the second cword is expanded to the current word after the quickfix window is opened. How can I use the word that's used by grep earlier?...Read more

syntax - highlight a form with clojure's comment macro in vim

In clojure, you can use #_ to comment out the next form. For example#_(foo 2 3 4)#_foo#_{:a '(1 2 3) :b [1 2 3]}will comment out the above list, symbol and map. Like Emacs, I would expect and want that the form would get the syntax highlightning of a comment.In vim, there is no default syntax highlighting for commented-out-forms. I have also not found any plugin that does this. Have anyone tried to configure this? Thankful for any help....Read more

How to replace a character by a newline in Vim?

I'm trying to replace each , in the current file by a new line::%s/,/\n/g But it inserts what looks like a ^@ instead of an actual newline. The file is not in DOS mode or anything.What should I do?If you are curious, like me, check the question Why is \r a newline for Vim? as well....Read more

What's a quick way to comment/uncomment lines in Vim?

I have a Ruby code file open in vi, there are lines commented out with #:class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # t.string :name # t.string :all_of # t.string :any_of # t.string :none_of # t.string :exact_phrase # # t.timestamps # end end def self.down # drop_table :searches endendSay I want to uncomment all the lines in the first def ... end section. What's an efficient way to do that in Vim?In general, I'm looking for an eas...Read more

How can I change vim status line color?

I'm tring to change vim's status line color by editing my .vimrc .By using the command au, I tried to change the color of the status line when entering or leaving insert mode; by using this command nothing happens:hi StatusLine guibg=whatevercolourIwantBy changing the status line color directly, without any au command, the background remains the same.Is there reason why by executing:hi StatusLine guibg=red,for instance, the background of the status bar still remains greenish?...Read more

How do I set the default font size in Vim?

I am trying to configure the default settings for my GUI with Vim. I already made research on the web, but all the solutions I found and tried did not work.Here are some of the things I tried (in the .vimrc file):set guifont = Monaco:h20set guifont=Monospace 20Actually I don't care about the Monaco font....Read more

Enabling markdown highlighting in Vim

I'm using Vim in a terminal on my MacBook Air with OS X Lion, and I can't seem to find a good plugin for Markdown syntax highlighting. So far I've tried the plasticboy plugin and Tim Pope's plugin. The plasticboy plugin worked OK but was causing white space at the end of lines to be highlighted, and I haven't figured out how to turn that off. (It's really annoying, because every time I hit space when I'm writing it highlights the character.)Tim's plugin didn't seem to do very much in the way of highlighting, other than maybe headers that use ##...Read more

editor - Vim file navigation

I'm trying really hard to learn vim after using TextMate for the last few years.I've started to commit some of the in-file navigation to memory but I'm struggling with navigating between multiple files. In my workflow it is pretty common that I'm flipping between a handful of files pretty regularly (enough files such that split-pane windows become too small).I'm currently using NERDTree but find drilling down into directories cumbersome as well as constantly using CTRL+W h/CTRL+W l to hop back and forth. I think I would do better with tabs I ca...Read more

editor - Using Vim's tabs like buffers

I have looked at the ability to use tabs in Vim (with :tabe, :tabnew, etc.) as a replacement for my current practice of having many files open in the same window in hidden buffers.I would like every distinct file that I have open to always be in its own tab. However, there are some things that get in the way of this. How do I fix these:When commands like gf and ^] jump to a location in another file, the file opens in a new buffer in the current tab. Is there a way to have all of these sorts of commands open the file in a new tab, or switch to t...Read more

How to increase the vertical split window size in Vim

:vsplit (short form: :vs) split the Vim viewport vertically. :30vs splits the viewport, making the new window 30 characters wide. Once this 30 char window is created, how would one change it's size to 31 or 29?With horizontal windows Ctrl-W + increases the number of lines by one. What is the equivalent command to increase the columns by one?...Read more