From e4b1559fd273bf5798d536dce40b604cc98018b2 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Thu, 12 May 2011 17:23:04 +0200 Subject: initial config --- vimrc | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 vimrc (limited to 'vimrc') diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..c2b821a --- /dev/null +++ b/vimrc @@ -0,0 +1,132 @@ +" vim configuration of Sebastian Reichel + +set nocompatible " vim native mode +syntax on " enable syntax highlighting +colorscheme elektranox " cool colors +set hlsearch " highlight searched word +set number " numberize lines +set ruler " lower file +set nowrap " do not wrap lines +set incsearch " search while typing +set foldmethod=syntax " automatic code-folding +set autoindent " automatic indention +set noerrorbells visualbell t_vb= " no audible bell +set mouse=a " set mouse to auto +set ruler " show cursor position all the time +set wildmode=longest,list " setup wildmode +set showmatch " show matching brackets +set encoding=utf-8 " UTF-8 +set iskeyword-=_ " _ is a word delimiter +set autoread + +" Configure the status line show something useful. +"set statusline=%F%m%r%h%w\ %y\ [%{&ff}]%=[%l,%v][%p%%]\ [%L] +"set laststatus=2 " Ensure status line is visible. + +" Sane handling of whitespace. +set tabstop=4 +set shiftwidth=4 +set softtabstop=4 + +" The h and l keystrokes can be made to wrap over lines (so that trying to +" move left past the beginning of a line puts the cursor at the end of the +" line above). This command does that, and also allows ~ (convert case) to +" wrap over lines, and the cursor keys to wrap when in insert mode: +set whichwrap=h,l,~,[,] + +" Get useful auto-completion in command mode. +set wildmenu +set wildmode=list:longest,full + +" copy&paste via +nnoremap \tp :set invpaste paste? +nmap \tp +imap \tp +set pastetoggle= + +" clear search via +nnoremap \clearsearch :let @/ = "" +nmap \clearsearch +imap \clearsearch + +" compile latex/code via +nnoremap \make :!make +nmap \make +imap \make + +" add vala support +autocmd BufRead *.vala set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m +autocmd BufRead *.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m +autocmd BufRead *.gtkaml set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m +au BufRead,BufNewFile *.vala setfiletype vala +au BufRead,BufNewFile *.vapi setfiletype vala +au BufRead,BufNewFile *.gtkaml setfiletype vala +let vala_comment_strings = 1 +let vala_comment_ifdef = 1 +"let vala_space_errors = 1 + +" add support for subtitle files +au BufNewFile,BufRead *.ssa setf ssa +au BufNewFile,BufRead *.ass setf ssa + +" configure printing stuff +set pdev=Default " printer device +set printoptions=paper:A4,syntax:n,wrap:y,duplex:long " print options +set penc=utf-8 " print encoding +"set pfn=courier:h10 " print font +"set pheader=... " print header + +" set terminal title +if &term == "screen" + set t_ts=k + set t_fs=\ +endif +if &term == "screen" || &term == "xterm" + set title +endif + +" Set a nicer foldtext function +set foldtext=MyFoldText() +function! MyFoldText() + let line = getline(v:foldstart) + if match( line, '^[ \t]*\(\/\*\|\/\/\)[*/\\]*[ \t]*$' ) == 0 + let initial = substitute( line, '^\([ \t]\)*\(\/\*\|\/\/\)\(.*\)', '\1\2', '' ) + let linenum = v:foldstart + 1 + while linenum < v:foldend + let line = getline( linenum ) + let comment_content = substitute( line, '^\([ \t\/\*]*\)\(.*\)$', '\2', 'g' ) + if comment_content != '' + break + endif + let linenum = linenum + 1 + endwhile + let sub = initial . ' ' . comment_content + else + let sub = line + let startbrace = substitute( line, '^.*{[ \t]*$', '{', 'g') + if startbrace == '{' + let line = getline(v:foldend) + let endbrace = substitute( line, '^[ \t]*}\(.*\)$', '}', 'g') + if endbrace == '}' + let sub = sub.substitute( line, '^[ \t]*}\(.*\)$', '...}\1', 'g') + endif + endif + endif + let n = v:foldend - v:foldstart + 1 + let info = " " . n . " lines" + let sub = sub . " " + let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' ) + let fold_w = getwinvar( 0, '&foldcolumn' ) + let sub = strpart( sub, 0, winwidth(0) - strlen( info ) - num_w - fold_w - 1 ) + return sub . info +endfunction + +" enable plugins depending on filetype +filetype plugin on + +" git branch in ruler +set rulerformat=%33(%{fugitive#statusline()}%=%10(%l,%c%V%=%5(%p%%%)%)%) + +" copy & paste +vmap y: call system("xclip -i -selection clipboard", getreg("\"")) +nmap :call setreg("\"",system("xclip -o -selection clipboard"))p -- cgit v1.2.3