Vim Scratch Plugin

The Vim Scratch plugin is a handy plugin that allows you to open “Scratch buffers”. These are buffers that Vim wont ask you to save, it’s just a temporary buffer that you can create and will be discarded when you quit Vim.

Once installed, you can open a scratch buffer with :Scratch. If you close the buffer and then run :Scratch again, the contents are remembered, but the contents will be lost when you close Vim.

I’ve been using this lots for taking quick notes when working on something, or to note something I need to revisit.

comments powered by Disqus… Click Here

Clearing the Search Highlight

I think it’s the biggest annoyance of any Vim-er. Highlighting something when I search for it is great, but a quick way to get rid of that highlight would be even better. I think today I finally found the perfect way to do it. This is one I picked up from Katrina Owen’s vimrc.

:nnoremap <CR:nohlsearch<cr" clear the search buffer when hitting return

Now once I’ve searched, the highlight is gone the next time I hit enter, which is brilliant.

comments powered by Disqus… Click Here

Repeating last command-line with `@:`

Once you’ve used Vim for a while you become accustomed to repeating the last change in normal mode with .. Being able to repeat actions easily lends itself to some efficient workflows and Vim also provides a way of repeating the last command-line action from normal mode using @:.

I find @: useful to repeat commands such as :cn / :cp to navigate the quickfix list, :bd to easily close a bunch of files and to repeat the last substitution.

See :help @: for more.

Guest post by Matt Walker (@_walkermatt).

comments powered by Disqus… Click Here

Searching again with //

If you’ve searched for something and want to repeat the search again, just use //.

For example, if you run:


To search forward for foo, and then later on you want to repeat this search, you can simply run:


This also works in substitutions. Say you’ve searched /foo and now want to replace it, there’s no need to type foo again:


Will replace all instances of foo with bar (presuming /foo was your last search).

comments powered by Disqus… Click Here