Skip to content

Instantly share code, notes, and snippets.

@GrAndSE
Created November 29, 2012 09:15
Show Gist options
  • Select an option

  • Save GrAndSE/4167747 to your computer and use it in GitHub Desktop.

Select an option

Save GrAndSE/4167747 to your computer and use it in GitHub Desktop.
My .vimrc
syntax on
set tabstop=4
set shiftwidth=4
set si
set nu
set showmatch
set hlsearch
set incsearch
set lz
set listchars=tab:..
set list
set ffs=unix,dos,mac
set fencs=utf-8,cp1251,koi8-r,ucs-2,cp866
colorscheme vibrantink
filetype plugin indent on
helptags ~/.vim/doc
" Clojure bindings
let g:clf_highlight_builtins = 1
let vimclojure#ParenRainbow = 1
function GetClojureFold()
if getline(v:lnum) =~ '^\s*(defn.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(defmacro.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*(defmethod.*\s'
return ">1"
elseif getline(v:lnum) =~ '^\s*$'
let my_cljnum = v:lnum
let my_cljmax = line("$")
while (1)
let my_cljnum = my_cljnum + 1
if my_cljnum > my_cljmax
return "<1"
endif
let my_cljdata = getline(my_cljnum)
if my_cljdata =~ '^$'
return "<1"
else
return "="
endif
endwhile
else
return "="
endif
endfunction
function TurnOnClojureFolding()
setlocal foldexpr=GetClojureFold()
setlocal foldmethod=expr
endfunction
autocmd FileType clojure call TurnOnClojureFolding()
" Execute file being edited with <Shift> + e:
map <buffer> <S-e> :w<CR>:!/usr/bin/env python % <CR>
let python_highlight_all = 1
" Pylint and Pyflakes are good tools for python code checking
command Pylint :call Pylint()
function! Pylint()
setlocal makeprg=(echo\ '[%]';\ pylint\ %)
setlocal efm=%+P[%f],%t:\ %#%l:%m
silent make
cwindow
endfunction
command Pyflakes :call Pyflakes()
function! Pyflakes()
let tmpfile = tempname()
execute "w" tmpfile
execute "set makeprg=(pyflakes\\ " . tmpfile . "\\\\\\|sed\\ s@" . tmpfile ."@%@)"
make
cw
endfunction
" for CSS, also have things in braces indented:
autocmd FileType css set smartindent
" for HTML, generally format text, but if a long line has been created leave is
" alone when editing:
autocmd FileType html set formatoptions+=tl
" for both CSS and HTML, use genuine tab characters for indentation, to make
" files a few bytes smaller:
autocmd FileType html,css set noexpandtab tabstop=2 shiftwidth=2
" F7 to toggle spell-checking
map <silent> <F7> :set nospell!<CR>:set nospell?<CR>
" Tidy up html code
setlocal makeprg=tidy\ -quiet\ -errors\ %
setlocal errorformat=line\ %l\ column\ %v\ -\ %m
" And better each time you save your python file in vim , I check for wrong
" imports with Pyflakes with:
autocmd BufWrite *.{py} :call Pyflakes()
autocmd FileType python set et
map <silent> <Leader>ih :call IHighlight( 1, "\^[[:space:]]*\\(def\\\\|class\\)[[:space:]]\\+" )<CR>
map <silent> <Leader>is :call IHighlight( 0, "\^[[:space:]]*\\(def\\\\|class\\)[[:space:]]\\+" )<CR>
" Vala/Genie
"
autocmd BufRead *.vala,*.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m
autocmd BufRead,BufNewFile *.vala,*.vapi setfiletype vala
autocmd FileType vala setlocal cindent
" Enable comment strings
let vala_comment_strings = 1
" Highlight space errors
let vala_space_errors = 1
" Genie script indent
augroup setgenie
au!
autocmd BufRead,BufNewFile *.gs setlocal filetype=genie
augroup END
autocmd FileType vala,genie setlocal formatoptions+=croql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment