Skip to content

Instantly share code, notes, and snippets.

@OlegHahm
Created November 27, 2013 13:34
Show Gist options
  • Save OlegHahm/7675774 to your computer and use it in GitHub Desktop.
Save OlegHahm/7675774 to your computer and use it in GitHub Desktop.
My .vimrc
set ruler
set autoindent
set smartindent
syntax on
set tabstop=4
set shiftwidth=4
set expandtab
set background=dark
"set tw=80
"set mouse=a
set number
set encoding=utf-8
set fileencoding=utf-8
set fileencodings="utf-8,latin1,ucs-bom"
set spelllang=en spell
set t_Co=256
filetype plugin on
set grepprg=grep\ -nH\ $*
filetype indent on
let g:tex_flavor='latex'
let g:Tex_SmartKeyQuote=0
let g:Tex_CompileRule_pdf="pdflatex"
let g:load_doxygen_syntax=1"
let g:spell_choices=["de_DE", "en", "es"]
map <F2> <c-w>gf
map <F3> : call CompileGcc()<CR>
func! CompileGcc()
exec "w"
exec "!gcc % -o %<"
endfunc
map <F4> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc
map <F5> :call SetLangDe()<CR>
func! SetLangDe()
exec "set spelllang=de spell"
endfunc
map <F6> :call SetLangEn()<CR>
func! SetLangEn()
exec "set spelllang=en spell"
endfunc
map <F8> :call CompileMake()<CR>
func! CompileMake()
exec "w"
exec "!make"
endfunc
map <F9> :call CleanCompileMake()<CR>
func! CleanCompileMake()
exec "w"
exec "!make clean"
exec "!make all"
endfunc
map <F10> :call SetNoLang()<CR>
func! SetNoLang()
exec "set spelllang="
endfunc
" set F12 to insert c/c++ header gates, do it automatically for new files
function! Insert_gates()
let gatename = substitute(toupper(expand("%:t")), "\\.", "_", "g")
execute "normal! i#ifndef " . gatename
execute "normal! o#define " . gatename
execute "normal! o"
execute "normal! Go#endif /* " . gatename . " */"
normal! kk
endfunction
autocmd BufNewFile *.{h,hpp} call Insert_gates()
autocmd BufNewFile *.{h,c} call SetNoLang()
autocmd BufRead *.{h,c} call SetNoLang()
map <F12> :call Insert_gates()<C-m>
map <F2> : exec "TlistToggle"<CR>
autocmd BufRead *rc call SetNoLang()
autocmd BufNewFile *rc call SetNoLang()
autocmd BufNewFile *.{c,cpp,py,h,hpp} call SetNoLang()
autocmd BufRead *.{c,cpp,py,h,hpp} call SetNoLang()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment