Vim tips: Difference between revisions

From EggeWiki
mNo edit summary
mNo edit summary
 
Line 1: Line 1:
== Switch between header and source file ==
A simple way to manually switch between headers and sources is by using the %< built-in variable, that resolves to the file name without extension. To switch from a header to a source you can do:
  :e %<.c
Or:
  :split %<.c
if you want to open it in a new "window".  From [http://vim.wikia.com/wiki/Easily_switch_between_source_and_header_file Vim Wiki]
== Install color scheme ==
== Install color scheme ==



Latest revision as of 09:27, 8 April 2010

Switch between header and source file

A simple way to manually switch between headers and sources is by using the %< built-in variable, that resolves to the file name without extension. To switch from a header to a source you can do:

 :e %<.c

Or:

 :split %<.c

if you want to open it in a new "window". From Vim Wiki

Install color scheme

<geshi lang="bash"> mkdir -p ~/.vim/colors cd ~/.vim/colors/ wget http://vimcolorschemetest.googlecode.com/svn/colors/darkslategray.vim echo "colorscheme darkslategray" >> ~/.vimrc </geshi>

View tab characters in a file

One easy way is ":set list". It also shows other control characters, including the line ending. Turn it off with ":set nolist".

Paste text without reformat

When I paste code into vim, often it's already formatted. To avoid double formatting, I type ":set paste" before pasting my text.