diff options
-rw-r--r-- | .vimrc | 118 |
1 files changed, 51 insertions, 67 deletions
@@ -1,5 +1,6 @@ " Author: Florian "Bluewind" Pritz <flo@xssn.at> +" misc settings {{{ set nocompatible set encoding=utf-8 " unicode encoding if &term =~# '^\(screen\|rxvt*\)$' "tty blinks otherwise @@ -14,7 +15,6 @@ set softtabstop=4 set ruler " show me where the cursor is set rulerformat=%l/%L(%p%%),%c " a better ruler set showmatch " show matching brackets -"set cindent set number " show line numbers set showmode " show mode at bottom of screen set hlsearch " highlight all search results @@ -26,12 +26,9 @@ set laststatus=2 set mouse=a set nopaste set foldmethod=marker -"set smartindent set scrolloff=3 set showcmd set display=uhex -"set list -"set listchars=tab:>\ ,eol:$ set listchars=trail:·,precedes:«,extends:»,tab:▸\ ,eol:↲ set hidden set display+=lastline @@ -59,10 +56,13 @@ set completeopt=menuone,menu,longest let mapleader = "," let g:sudo_no_gui = 1 + let g:ycm_extra_conf_globlist = ['~/.ycm_extra_conf.py'] +" }}} filetype off -set rtp+=~/.vim/bundle/vundle +set runtimepath+=/usr/share/vim +set runtimepath+=~/.vim/bundle/vundle call vundle#begin() Plugin 'scrooloose/syntastic' @@ -83,89 +83,100 @@ Plugin 'adoy/vim-php-refactoring-toolbox' Plugin 'shawncplus/phpcomplete.vim' call vundle#end() +syntax on +filetype plugin indent on -"aliases -cnorea w!! w !sudo tee "%" > /dev/null -cnorea qpd %!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;' +" functions {{{ function! Filebin(start, end) let range = expand(a:start) . "," . expand(a:end) silent exe expand(range) . "w !fb -n " . expand("%:t") . " -e " . expand(&ft) redraw! endfunction -com! -nargs=0 -range=% Fb :call Filebin(<line1>, <line2>) +" Get the current line number & file name, view the git commit that inserted it +fun! BlameCurrentLine() + let lnum = line(".") + let file = @% + exec "!gitBlameFromLineNo " lnum file +endfun +" }}} -syntax on +"aliases and commands {{{ +cnorea w!! w !sudo tee "%" > /dev/null -filetype plugin indent on +" decode quoted printable encoding +cnorea qpd %!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;' -autocmd FileType text setlocal textwidth=78 +command! -nargs=0 -range=% Fb :call Filebin(<line1>, <line2>) +command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis + \ | wincmd p | diffthis +" }}} + +" Return to last edit position when opening files (You want this!) autocmd BufReadPost * \ if line("'\"") > 1 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif -command! DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis - \ | wincmd p | diffthis - -set runtimepath+=/usr/share/vim - -let python_highlight_all = 1 +" mappings {{{ " common save shortcuts inoremap <C-s> <esc>:w<cr>a nnoremap <C-s> :w<cr> inoremap <C-c> <esc>:q<cr> nnoremap <C-c> :q<cr> -inoremap <C-x> <esc>:bd<cr> -nnoremap <C-x> :bd<cr> -" movement mappings -nnoremap <silent> <C-Right> <c-w>l -nnoremap <silent> <C-Left> <c-w>h -nnoremap <silent> <C-Up> <c-w>k -nnoremap <silent> <C-Down> <c-w>j +" fix some keycodes set <C-Right>=[C set <C-Left>=[D " unsupported options "set <C-Up>=[A "set <C-Down>=[B -nnoremap <silent> <C-W>[A <c-w>K -nnoremap <silent> <C-W>[B <c-w>J + +" movement mappings for splits +nnoremap <silent> <C-Right> <c-w>l +nnoremap <silent> <C-Left> <c-w>h +nnoremap <silent> <C-Up> <c-w>k +nnoremap <silent> <C-Down> <c-w>j nnoremap <silent> <C-W><C-Right> <c-w>L nnoremap <silent> <C-W><C-Left> <c-w>H nnoremap <silent> <C-W><C-Up> <c-w>K nnoremap <silent> <C-W><C-Down> <c-w>J +nnoremap <silent> <C-W>[A <c-w>K +nnoremap <silent> <C-W>[B <c-w>J + nnoremap <Up> gk nnoremap <Down> gj nnoremap j gj nnoremap k gk -"au VimEnter * :NERDTreeToggle +" Get the commit responsible for the current line +nmap <c-b> :call BlameCurrentLine()<cr> + nmap <F1> :TagbarToggle<CR> noremap <F2> :NERDTreeToggle<CR> inoremap <F2> <ESC>:NERDTreeToggle<CR> +" }}} -noremap <C-f> :FufFile<CR> -inoremap <C-f> <ESC>:FufFile<CR> -"noremap <C-b> :FuzzyFinderBuffer<CR> -"inoremap <C-b> <ESC>:FuzzyFinderBuffer<CR> +let python_highlight_all = 1 +" Ultisnips let g:UltiSnipsJumpForwardTrigger="<tab>" let g:UltiSnipsExpandTrigger="<c-j>" let g:UltiSnipsListSnippets="<c-e>" let g:UltiSnipsUsePythonVersion=2 let g:UltiSnipsEditSplit="vertical" +" tagbar let g:tagbar_left=1 let g:tagbar_autofocus=1 let g:tagbar_autoclose=1 -"let g:syntastic_always_populate_loc_list = 1 -"let g:syntastic_auto_loc_list = 1 +" syntastic let g:syntastic_check_on_open = 1 +" completion autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS @@ -173,59 +184,32 @@ autocmd FileType python setlocal omnifunc=pythoncomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP +" automatic folding autocmd FileType php set foldmethod=syntax autocmd FileType php set foldlevelstart=2 foldnestmax=2 autocmd FileType php let g:php_folding=1 - autocmd FileType python set foldmethod=indent autocmd FileType python set foldlevelstart=2 foldnestmax=2 autocmd FileType python set ts=4 sw=4 softtabstop=4 et +" misc autocmd settings autocmd FileType make setlocal noexpandtab +autocmd FileType text setlocal textwidth=78 autocmd BufRead,BufNewFile PKGBUILD let is_bash=1 | set ft=sh +" colorscheme let g:jellybeans_background_color_256 = 'none' let g:jellybeans_overrides = { \ 'SpecialKey': { 'guifg': 'b0b0b0', 'guibg': '000000'} \} colorscheme jellybeans -" Toggle dark/light default colour theme for shitty terms -"map <F2> :let &background = ( &background == "dark" ? "light" : "dark" )<CR> - -" Compile and run keymappings -au FileType php map <F10> :!php %<CR> -au FileType python map <F10> :!python %<CR> -au FileType perl map <F10> :!perl %<CR> -au FileType ruby map <F10> :!ruby %<CR> -au FileType lua map <F10> :!lua %<CR> -au FileType html,xhtml map <F10> :!firefox %<CR> -au FileType tex map <F10> :!texi2pdf -c %<CR> - -" Get the commit responsible for the current line -nmap <c-b> :call BlameCurrentLine()<cr> -" Get the current line number & file name, view the git commit that inserted it -fun! BlameCurrentLine() - let lnum = line(".") - let file = @% - exec "!gitBlameFromLineNo " lnum file -endfun - -map <F12> <ESC>ggg?G``" apply rot13 for people snooping over shoulder, good fun - +" highlight extra whitespace highlight ExtraWhitespace ctermbg=red guibg=red autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL -if !has("gui_running") - if &term == "screen" - set <C-Right>=Oc - set <C-Left>=Od - imap <C-Right> <ESC>:bn<RETURN> - imap <C-Left> <ESC>:bp<RETURN> - endif -else +if has("gui_running") set guifont=Dejavu\ Sans\ Mono\ 10 - "set guioptions-=m set guioptions-=T set lines=80 columns=125 endif |