Source

dotfiles / vimrc

The default branch has multiple heads

Full commit
set nocompatible               " be iMproved
filetype off                   " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" --- github plugins
" let Vundle manage Vundle ( https://github.com/gmarik/vundle/ )
Bundle 'gmarik/vundle'
Bundle 'Raimondi/delimitMate'
Bundle 'majutsushi/tagbar'
Bundle 'bernh/pss.vim'
Bundle 'scrooloose/nerdtree'
Bundle 'scrooloose/nerdcommenter'
Bundle 'kana/vim-scratch'
Bundle 'tpope/vim-surround'
Bundle 'kien/ctrlp.vim'
Bundle 'altercation/vim-colors-solarized'

" from vim-scripts
Bundle 'a.vim'
Bundle 'Mark--Karkat'

" Brief Help
" :BundleInstall  - install bundles (won't update installed)
" :BundleInstall! - update if installed
" :BundleClean    - uninstall bundles

filetype plugin indent on
syntax on


" backup
set backup
set backupdir=$HOME/.vim/backup
" clipboard handling
set clipboard=unnamed
" to get rid of ^M
set fileformats=unix,dos
" use the directory of the current buffer for the file browser
set browsedir=buffer
" behaviour of the backspace-key
set backspace=indent,eol,start
" save before calling make
set autowrite
" always allows rectangles in visual block mode
set virtualedit=block
" nicer view on binary files
set display=uhex
" allow hidden buffers without saving
set hidden
" statusline
set laststatus=2
" don't move cursor to first char in line
set nosol
" everything in English please
language en_US
" enable spell checking by default, 10 suggestions are enough
set spell
set spellsuggest=10
" current position with line+column and the percentage within the buffer.
set ruler
" 80 is the texwidth god intended
set textwidth=80
set colorcolumn=80
set formatoptions=qrn1
" wrapped lines are annoying and nothing else
set nowrap
" relativenumber... the best thing since sliced bread!
set relativenumber
" set default encoding
set encoding=utf-8
" show mode (INSERT, VISUAL, etc.)
set showmode
set showcmd
" better completion for command line
set wildmenu
" smother redraw"
set ttyfast
" set terminal title
set title
" no beep
set noeb
" I will never care about these files
set wildignore+=*.pyc,*.swp,*.o

" --- GUI specific settings----------------------------------------------------

if has("gui_running")
    " away with the toolbar and the menu
    set guioptions-=T
    set guioptions-=m
    colorscheme solarized
    " highlight current line
    set cursorline
else
    set t_Co=256
endif

set guitablabel=%N

" --- settings for searching --------------------------------------------------
set ignorecase
set smartcase
set incsearch
set hlsearch
set showmatch
" These two lines fix Vim's horribly broken default regex 'handling' by
" automatically inserting a \v before any string you search for.
nnoremap / /\v
vnoremap / /\v

" --- indentation -------------------------------------------------------------
set expandtab
set tabstop=4
set shiftwidth=4
set autoindent

" --- mappings ----------------------------------------------------------------
" set the leader from \ to ,
let mapleader = ","

" alternative to ESC
inoremap jk <ESC>

" reload and edit vimrc
nnoremap <leader>sv :source $MYVIMRC<CR>
nnoremap <leader>ev :vsplit $MYVIMRC<CR>

nnoremap <leader>l  :edit $HOME\log.rst<CR>

" keep Ctrl pressed to move around between window
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l

" Get rid of that stupid goddamned help key that you will invariably hit
" constantly while aiming for escape:
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>

nnoremap <F5> :nohlsearch<CR>:MarkClear<CR>
nnoremap <F6> :set invspell<CR>
nnoremap <F8> :%s/\s\+$//e<CR>

" always save all files when editor looses focus
" au FocusLost * :wa

" --- abbreviations -----------------------------------------------------
:iab pdb import pdb;pdb.set_trace()

" --- configure Plugins -------------------------------------------------
" Ack
nnoremap <F2> :Pss <CR>
nnoremap <leader>a :Ack<Space>
nnoremap <leader>p :Pss<Space>

" tagbar
nnoremap <F3> :TagbarToggle<CR>
" special settings for rst2ctags usage
let g:tagbar_type_rst = {
    \ 'ctagstype': 'rst',
    \ 'ctagsbin' : '/home/bernhard/Documents/src/rst2ctags/rst2ctags.py',
    \ 'ctagsargs' : '-f - --sort=yes',
    \ 'kinds' : [
        \ 's:sections',
        \ 'i:images'
    \ ],
    \ 'sro' : '|',
    \ 'kind2scope' : {
        \ 's' : 'section',
    \ },
\ }


" NERDTree
nnoremap <F4> :NERDTreeToggle ~/Documents/src<CR>
let NERDTreeShowBookmarks=1
let NERDTreeShowLineNumbers=0
let NERDTreeIgnore=['\.vim$', '\~$']
" Scratch
nnoremap <leader><tab> :ScratchOpen<CR>
" ToggleBg (comes with solarized)
call togglebg#map("<F7>")

" some ctrlp settings
let g:ctrlp_max_height = 20
let g:ctrlp_working_path_mode = 0
let g:ctrlp_dotfiles = 0  " do not search dotfiles or within dot directories