-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
143 lines (115 loc) · 3.42 KB
/
Copy pathvimrc
File metadata and controls
143 lines (115 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'VundleVim/Vundle.vim'
" My Bundles here:
"
" original repos on github
Plugin 'flazz/vim-colorschemes'
Plugin 'tpope/vim-fugitive'
Plugin 'mkitt/tabline.vim'
Plugin 'tomtom/tcomment_vim'
Plugin 'rking/ag.vim'
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'godlygeek/tabular'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-unimpaired'
Plugin 'tmhedberg/SimpylFold'
Plugin 'vim-scripts/indentpython.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'nvie/vim-flake8'
" Github repos of the user 'vim-scripts'
" => can omit the username part
" non github repos
call vundle#end()
filetype plugin indent on " required!
syntax on
set encoding=utf-8
let mapleader=" "
set splitbelow
set splitright
" make it easier to switch between splits
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" custom keyboard mappings
map <leader>c :tabclose<CR>
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
"search looks for matches while typing and highlights the matches
set incsearch
set hlsearch
set ignorecase
set smartcase
"tabs = 4 spaces and auto indent
set expandtab
set shiftwidth=4
set softtabstop=4
set tabstop=4
set autoindent
"after 79 characters new line
set textwidth=79
"support for color schemes
set t_Co=256
colorscheme zenburn
"set up folds
set foldmethod=syntax
autocmd FileType python setlocal foldmethod=expr
let g:SimpylFold_fold_docstring = 0
"autocomplete customization
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_goto_buffer_command='new-or-existing-tab'
" keeps the cursor centered on the screen while searching
set scrolloff=7
"persistent undo and auto backup
set backup
set backupdir=~/.vim/backups
set swapfile
set dir=~/.vim/swap
set undofile
set undodir=~/.vim/undo
set undolevels=1000
set undoreload=10000
" better navigation when wrapping
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
"breaks on whitespace
set wrap linebreak nolist
"highlight trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
"can move away from a changed buffer without warning
set hidden
"Shortcut to rapidly toggle `set list`
nmap <leader>l :set list!<CR>
" Only do this part when compiled with support for autocommands
" http://vimcasts.org/episodes/whitespace-preferences-and-filetypes/
if has("autocmd")
autocmd FileType make setlocal ts=4 sts=4 sw=4 noexpandtab
autocmd FileType scss,html,css,ruby,eruby setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType javascript,cucumber,lua setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType python setlocal ts=4 sts=4 sw=4 expandtab
autocmd BufWritePre * :%s/\s\+$//e
autocmd BufRead,BufNewFile *.py let python_highlight_all=1
endif
" Status line including the git branch
set laststatus=2
set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 2
let g:syntastic_auto_jump = 3
let g:syntastic_check_on_open = 0
let g:syntastic_check_on_wq = 0
let g:syntastic_enable_signs=1
let g:syntastic_python_checkers = ['python', 'flake8']
let g:agprg = 'ag --nogroup --nocolor --column'