dotfiles/.vimrc

222 lines
6.0 KiB
VimL

let VIMHOME = split(&rtp, ",")[0]
" Vundle package managment
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'altercation/vim-colors-solarized'
Plugin 'cohama/lexima.vim'
Plugin 'gmarik/Vundle.vim'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'easymotion/vim-easymotion'
Plugin 'hdima/python-syntax'
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
Plugin 'tomtom/tcomment_vim'
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'nixprime/cpsm'
Plugin 'Valloric/YouCompleteMe'
Plugin 'rhysd/vim-clang-format'
Plugin 'tmux-plugins/vim-tmux'
Plugin 'tmux-plugins/vim-tmux-focus-events'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'Valloric/ListToggle'
Plugin 'jeetsukumaran/vim-buffergator'
call vundle#end()
set exrc
set secure
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'
let mapleader=","
:command W w
:command Q q
:command WQ wq
:command Wq wq
nnoremap j gj
nnoremap k gk
"python with virtualenv support
py << EOF
import os
import sys
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" don't store .swp files in the file's own directory
" neither for .ext~ files
set directory=/home/billie/.vim/tmp/
set backupdir=/home/billie/.vim/tmp/
" Autoindent for filetype
filetype plugin indent on
set autoindent
set encoding=utf-8
set scrolloff=5
set sidescrolloff=10
set completeopt-=preview
set backspace=indent,eol,start
" CtrlP
nnoremap <silent> <C-o> :CtrlPBuffer<CR>
let g:ctrlp_match_func = {'match': 'cpsm#CtrlPMatch'}
let g:cpsm_unicode=1
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" Unsaved buffer switching
set hidden
let g:clang_format#style_options = {
\ "AccessModifierOffset" : -4,
\ "AlignAfterOpenBracket" : "true",
\ "AlignEscapedNewlinesLeft" : "false",
\ "AlignOperands" : "false",
\ "AlignTrailingComments" : "true",
\ "AllowAllParametersOfDeclarationOnNextLine" : "true",
\ "AllowShortBlocksOnASingleLine" : "false",
\ "AllowShortCaseLabelsOnASingleLine" : "false",
\ "AllowShortFunctionsOnASingleLine" : "All",
\ "AllowShortIfStatementsOnASingleLine" : "true",
\ "AllowShortLoopsOnASingleLine" : "true",
\ "AlwaysBreakAfterDefinitionReturnType" : "false",
\ "AlwaysBreakBeforeMultilineStrings" : "false",
\ "AlwaysBreakTemplateDeclarations" : "true",
\ "BinPackArguments" : "true",
\ "BinPackParameters" : "true",
\ "BreakBeforeBinaryOperators" : "None",
\ "BreakBeforeBraces" : "Attach",
\ "BreakBeforeTernaryOperators" : "true",
\ "BreakConstructorInitializersBeforeComma" : "false",
\ "ColumnLimit" : 0,
\ "ConstructorInitializerAllOnOneLineOrOnePerLine" : "true",
\ "ConstructorInitializerIndentWidth" : 4,
\ "ContinuationIndentWidth" : 4,
\ "Cpp11BracedListStyle" : "true",
\ "DerivePointerAlignment" : "true",
\ "DisableFormat" : "false",
\ "ExperimentalAutoDetectBinPacking" : "false",
\ "IndentCaseLabels" : "true",
\ "IndentWidth" : 4,
\ "IndentWrappedFunctionNames" : "false",
\ "KeepEmptyLinesAtTheStartOfBlocks" : "false",
\ "Language" : "Cpp",
\ "MaxEmptyLinesToKeep" : 1,
\ "NamespaceIndentation" : "None",
\ "ObjCBlockIndentWidth" : 4,
\ "ObjCSpaceAfterProperty" : "false",
\ "ObjCSpaceBeforeProtocolList" : "false",
\ "PenaltyBreakBeforeFirstCallParameter" : 1,
\ "PenaltyBreakComment" : 300,
\ "PenaltyBreakFirstLessLess" : 120,
\ "PenaltyBreakString" : 1000,
\ "PenaltyExcessCharacter" : 1000000,
\ "PenaltyReturnTypeOnItsOwnLine" : 200,
\ "PointerAlignment" : "Left",
\ "SpaceAfterCStyleCast" : "false",
\ "SpaceBeforeAssignmentOperators" : "true",
\ "SpaceBeforeParens" : "ControlStatements",
\ "SpaceInEmptyParentheses" : "false",
\ "SpacesBeforeTrailingComments" : 4,
\ "SpacesInAngles" : "false",
\ "SpacesInCStyleCastParentheses" : "false",
\ "SpacesInContainerLiterals" : "true",
\ "SpacesInParentheses" : "false",
\ "SpacesInSquareBrackets" : "false",
\ "Standard" : "Auto",
\ "TabWidth" : 4,
\ "UseTab" : "Never"}
let g:clang_format#code_style = 'Google'
" Line numbering
set number
set numberwidth=4
:set mouse=a
" Allow xterm-key usage inside tmux
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
" Persistent undo
set undodir=~/.vim/undodir/
set undofile
set undolevels=1000
set undoreload=10000
" Searching
set ignorecase
set smartcase
set incsearch
set hlsearch
nnoremap <leader><space> :noh<CR>
" Text wrapping
set lbr
" Tabs
if has("autocmd")
filetype plugin indent on
autocmd FileType make set tabstop=8 shiftwidth=8 softtabstop=0 noexpandtab
endif
" Quickfix
nnoremap <silent> <leader>f :YcmCompleter FixIt<CR>
nnoremap <silent> <leader>g :YcmCompleter GoTo<CR>
" Terminal colors
set t_Co=256
let g:airline_theme="solarized"
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Commenting
nnoremap <silent> <leader>c :TComment<CR>
nnoremap <silent> <leader>C :TCommentBlock<CR>
vnoremap <silent> <leader>c :TCommentInline<CR>
vnoremap <silent> <leader>C :TCommentBlock<CR>
" Tab completion
set wildmode=longest,list
set wildmenu
set guifont=Ubuntu\ Mono\ derivative\ Powerline\ 13
let g:airline_powerline_fonts = 1
set laststatus=2
set ttimeoutlen=50
" Color scheme
syntax enable
let python_highlight_all=1
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
let g:tmux_navigator_no_mappings = 1
nnoremap <silent> {Left-mapping} :TmuxNavigateLeft<cr>
nnoremap <silent> {Down-Mapping} :TmuxNavigateDown<cr>
nnoremap <silent> {Up-Mapping} :TmuxNavigateUp<cr>
nnoremap <silent> {Right-Mapping} :TmuxNavigateRight<cr>
nnoremap <silent> {Previous-Mapping} :TmuxNavigatePrevious<cr>
let g:tmux_navigator_save_on_switch = 2