Showing posts with label vimrc. Show all posts
Showing posts with label vimrc. Show all posts

Thursday, May 21, 2009

Example of vimrc

Let's face it,IDEs are fancy and cool, but I sometimes wonder to what extent these tools distract us with the real thing: programming. In this sense, the austerity of vi or vim may be helpful to really focus on the programming tasks. Besides, the fact that is console based makes us aware of the file structure of the application we are developing. I like NetBeans a lot, but frankly speaking, I get a bit lost on the file directory when developing Ruby on Rails applications. I really recommend vim even for this purpose. The learning curve may be daunting at first. But I think that it pays at the end (and not only for RoR, but also for Matlab and IDL programs).

Here I post a small snippet with the vimrc I am using.


" Syntax highlighting
syntax on

" Use spaces instead of tabs
set expandtab

" Set numbering
set numberwidth=5
set number

" Set autoindentation with 4 space indentation
set autoindent
set shiftwidth=4

" Set the ruler
set ruler

" Set the CUDA filetype
au BufNewFile,BufRead *.cu set ft=cu
"au BufNewFile,BufRead *.gnu set ft=gnuplot

" Set the searc highlight
set hlsearch

" Set syntax automatic folding
set foldmethod=syntax

" Set foldcolumns
set foldcolumn=3

" Set colorscheme to desert
colorscheme desert

" Instructions to print
" Courtesy of http://vim.wikia.com/wiki/Print_to_a_Postscript_file
let &printexpr="(v:cmdarg=='' ? ".
\"system('lpr' . (&printdevice == '' ? '' : ' -P' . &printdevice)".
\". ' ' . v:fname_in) . delete(v:fname_in) + v:shell_error".
\" : system('mv '.v:fname_in.' '.v:cmdarg) + v:shell_error)"