From 9c4c1b7e5d15b748530f1950e36317661afa1684 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 17 May 2015 16:02:31 +0200 Subject: vimrc: cleanup Signed-off-by: Florian Pritz --- .vimrc | 118 ++++++++++++++++++++++++++++------------------------------------- 1 file changed, 51 insertions(+), 67 deletions(-) (limited to '.vimrc') diff --git a/.vimrc b/.vimrc index 8adbf22..2177af2 100644 --- a/.vimrc +++ b/.vimrc @@ -1,5 +1,6 @@ " Author: Florian "Bluewind" Pritz +" 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(, ) +" 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(, ) +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 :wa nnoremap :w inoremap :q nnoremap :q -inoremap :bd -nnoremap :bd -" movement mappings -nnoremap l -nnoremap h -nnoremap k -nnoremap j +" fix some keycodes set = set = " unsupported options "set = "set = -nnoremap  K -nnoremap  J + +" movement mappings for splits +nnoremap l +nnoremap h +nnoremap k +nnoremap j nnoremap L nnoremap H nnoremap K nnoremap J +nnoremap  K +nnoremap  J + nnoremap gk nnoremap gj nnoremap j gj nnoremap k gk -"au VimEnter * :NERDTreeToggle +" Get the commit responsible for the current line +nmap :call BlameCurrentLine() + nmap :TagbarToggle noremap :NERDTreeToggle inoremap :NERDTreeToggle +" }}} -noremap :FufFile -inoremap :FufFile -"noremap :FuzzyFinderBuffer -"inoremap :FuzzyFinderBuffer +let python_highlight_all = 1 +" Ultisnips let g:UltiSnipsJumpForwardTrigger="" let g:UltiSnipsExpandTrigger="" let g:UltiSnipsListSnippets="" 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 :let &background = ( &background == "dark" ? "light" : "dark" ) - -" Compile and run keymappings -au FileType php map :!php % -au FileType python map :!python % -au FileType perl map :!perl % -au FileType ruby map :!ruby % -au FileType lua map :!lua % -au FileType html,xhtml map :!firefox % -au FileType tex map :!texi2pdf -c % - -" Get the commit responsible for the current line -nmap :call BlameCurrentLine() -" 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 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 =Oc - set =Od - imap :bn - imap :bp - endif -else +if has("gui_running") set guifont=Dejavu\ Sans\ Mono\ 10 - "set guioptions-=m set guioptions-=T set lines=80 columns=125 endif -- cgit v1.2.3-24-g4f1b