-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
167 lines (140 loc) · 4.73 KB
/
.vimrc
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
set ignorecase " Do case insensitive matching
set incsearch " Incremental search
set hlsearch " Highligh search results
" Map "set paste" to F10
set pastetoggle=<F10>
set nocompatible " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
Plugin 'tmhedberg/SimpylFold'
Plugin 'hynek/vim-python-pep8-indent'
Bundle 'Valloric/YouCompleteMe'
Plugin 'scrooloose/syntastic'
Plugin 'jnurmine/Zenburn'
Plugin 'scrooloose/nerdtree'
Plugin 'Xuyuanp/nerdtree-git-plugin'
"Plugin 'vim-airline/vim-airline'
"Plugin 'vim-airline/vim-airline-themes'
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'kien/ctrlp.vim'
Plugin 'bitc/vim-bad-whitespace'
Plugin 'easymotion/vim-easymotion'
Plugin 'majutsushi/tagbar'
Plugin 'dkprice/vim-easygrep'
Plugin 'leafgarland/typescript-vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
let mapleader=","
"split navigations
nnoremap <C-S-J> <C-W><C-J>
nnoremap <C-S-K> <C-W><C-K>
nnoremap <C-S-L> <C-W><C-L>
nnoremap <C-S-H> <C-W><C-H>
" FOLDING
"""""""""
" Enable folding
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
let g:SimpylFold_docstring_preview=0
autocmd BufWinEnter *.py setlocal foldexpr=SimpylFold(v:lnum) foldmethod=expr
autocmd BufWinLeave *.py setlocal foldexpr< foldmethod<
" IDENTATION
""""""""""""
set tabstop=4
set softtabstop=4
set shiftwidth=4
autocmd BufNewFile,BufRead *.py,wscript
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
autocmd BufNewFile,BufRead wscript setfiletype python
autocmd BufNewFile,BufRead *.js,*.html,*.css,*.yaml,*.json,*.rst
\ set tabstop=2 |
\ set softtabstop=2 |
\ set shiftwidth=2
" AUTOCOMPLETE
let g:ycm_autoclose_preview_window_after_completion=1
let g:ycm_server_python_interpreter='/usr/bin/python3'
" Collect suggestions from strings and comments as well
let g:ycm_collect_identifiers_from_comments_and_strings = 1
" See here why we need to use execute:
" http://stackoverflow.com/a/27206531/360390
execute "set <A-g>=\eg"
nnoremap <A-g> :YcmCompleter GoToDefinitionElseDeclaration<CR>
map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
" Open GoTo* commands in new tab
let g:ycm_goto_buffer_command = 'new-tab'
" python with virtualenv support
py3 << 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')
exec(open(activate_this).read(), dict(__file__=activate_this))
EOF
" SYNTAX CHECKING
syntax on
let python_highlight_all=1
let g:syntastic_auto_loc_list = 1
let g:syntastic_loc_list_height = 5
" My script that checks version of the `python` executable and invokes proper flake 8
let g:syntastic_python_flake8_exe='flake8.sh'
let g:syntastic_python_flake8_args='--max-line-length=120'
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
" You can use sphinx here, but it compiles the whole docs directory on every save
let g:syntastic_rst_checkers = []
" COLORSCHEME
set t_Co=256
colorscheme zenburn
" FILE BROWSING
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
map <C-t> :NERDTreeToggle<CR>
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "✹",
\ "Staged" : "✚",
\ "Untracked" : "✭",
\ "Renamed" : "➜",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "✗",
\ "Clean" : "✔︎",
\ "Unknown" : "?"
\ }
map <leader>f :NERDTreeFind<cr>
" Enable status line by default
set laststatus=2
" If using airline - enable it to use powerline fonts
"let g:airline_powerline_fonts=1
" update time for vim-gitgutter
set updatetime=250
" Tab navigation
nnoremap <C-Left> :tabprevious<CR>
nnoremap <C-Right> :tabnext<CR>
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . (tabpagenr()+1)<CR>
" Enable bad whitespaces on open
autocmd VimEnter * ShowBadWhitespace
" TagBar outline
nnoremap <F8> :TagbarToggle<CR>
" CtrlP plugin config
"""""""""""""""""""""
" Show currently open buffers
nnoremap <leader>b :CtrlPBuffer<CR>"
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
" Disable line wrapping
set nowrap
noremap <leader>q :q<cr>
nnoremap <leader>s :w<cr>
inoremap <leader>s <C-c>:w<cr>