dotfiles/.vimrc

222 lines
6.0 KiB
VimL
Raw Normal View History

2017-01-06 16:48:51 +01:00
let VIMHOME = split(&rtp, ",")[0]
2016-01-24 19:32:42 +01:00
" Vundle package managment
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'altercation/vim-colors-solarized'
2016-09-03 15:46:24 +02:00
Plugin 'cohama/lexima.vim'
2016-01-24 19:32:42 +01:00
Plugin 'gmarik/Vundle.vim'
2017-01-06 16:48:51 +01:00
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
2016-01-24 19:32:42 +01:00
Plugin 'easymotion/vim-easymotion'
Plugin 'hdima/python-syntax'
2016-09-03 15:46:24 +02:00
Plugin 'scrooloose/syntastic'
Plugin 'nvie/vim-flake8'
2016-01-24 19:32:42 +01:00
Plugin 'kien/ctrlp.vim'
Plugin 'mattn/emmet-vim'
2016-09-03 15:46:24 +02:00
Plugin 'tomtom/tcomment_vim'
2016-01-24 19:32:42 +01:00
Plugin 'octol/vim-cpp-enhanced-highlight'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
2016-09-03 15:46:24 +02:00
Plugin 'nixprime/cpsm'
2016-01-24 19:32:42 +01:00
Plugin 'Valloric/YouCompleteMe'
2016-09-03 15:46:24 +02:00
Plugin 'rhysd/vim-clang-format'
Plugin 'tmux-plugins/vim-tmux'
Plugin 'tmux-plugins/vim-tmux-focus-events'
2017-01-06 16:48:51 +01:00
Plugin 'christoomey/vim-tmux-navigator'
2016-09-03 15:46:24 +02:00
Plugin 'Valloric/ListToggle'
Plugin 'jeetsukumaran/vim-buffergator'
2016-01-24 19:32:42 +01:00
call vundle#end()
set exrc
set secure
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'
let mapleader=","
2016-09-03 15:46:24 +02:00
:command W w
:command Q q
:command WQ wq
:command Wq wq
2017-01-06 16:48:51 +01:00
nnoremap j gj
nnoremap k gk
2016-09-03 15:46:24 +02:00
"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
2017-01-06 16:48:51 +01:00
" 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/
2016-09-03 15:46:24 +02:00
" Autoindent for filetype
2016-01-24 19:32:42 +01:00
filetype plugin indent on
set autoindent
set encoding=utf-8
2016-09-03 15:46:24 +02:00
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']
2016-01-24 19:32:42 +01:00
" Unsaved buffer switching
set hidden
2016-09-03 15:46:24 +02:00
let g:clang_format#style_options = {
2017-01-06 16:48:51 +01:00
\ "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'
2016-01-24 19:32:42 +01:00
" Line numbering
set number
2016-09-03 15:46:24 +02:00
set numberwidth=4
:set mouse=a
2017-01-06 16:48:51 +01:00
" 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"
2016-01-24 19:32:42 +01:00
" Persistent undo
2016-09-03 15:46:24 +02:00
set undodir=~/.vim/undodir/
2016-01-24 19:32:42 +01:00
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
2016-09-03 15:46:24 +02:00
" Quickfix
nnoremap <silent> <leader>f :YcmCompleter FixIt<CR>
2017-01-06 16:48:51 +01:00
nnoremap <silent> <leader>g :YcmCompleter GoTo<CR>
2016-09-03 15:46:24 +02:00
2016-01-24 19:32:42 +01:00
" Terminal colors
set t_Co=256
2017-01-06 16:48:51 +01:00
let g:airline_theme="solarized"
2016-01-24 19:32:42 +01:00
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
2017-01-06 16:48:51 +01:00
" 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>
2016-01-24 19:32:42 +01:00
" 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
2016-09-03 15:46:24 +02:00
" Color scheme
2016-01-24 19:32:42 +01:00
syntax enable
2016-09-03 15:46:24 +02:00
let python_highlight_all=1
2016-01-24 19:32:42 +01:00
set background=dark
let g:solarized_termcolors=256
colorscheme solarized
2017-01-06 16:48:51 +01:00
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