Repository navigation
Expand file tree
/
Copy pathpython_vimrc
More file actions
293 lines (242 loc) · 9.89 KB
/
Copy pathpython_vimrc
File metadata and controls
293 lines (242 loc) · 9.89 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
set nocompatible " be iMproved, required
filetype off " 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'
"---------=== Code/project navigation ===-------------
Plugin 'scrooloose/nerdtree' " Project and file navigation
Plugin 'majutsushi/tagbar' " Class/module browser
Bundle 'jistr/vim-nerdtree-tabs'
"------------------=== Other ===----------------------
Plugin 'bling/vim-airline'
Plugin 'fisadev/FixedTaskList.vim' " Pending tasks list
Plugin 'rosenfeld/conque-term' " Consoles as buffers
Plugin 'tpope/vim-surround' " Parentheses, brackets, quotes, XML tags, and more
Plugin 'jlanzarotta/bufexplorer' " Buffers (tabs) explorer
"
""--------------=== Snippets support ===---------------
Plugin 'garbas/vim-snipmate' " Snippets manager
Plugin 'MarcWeber/vim-addon-mw-utils' " dependencies #1
Plugin 'tomtom/tlib_vim' " dependencies #2
Plugin 'honza/vim-snippets' " snippets repo
"---------------=== Languages support ===-------------
" --- Python ---
Plugin 'klen/python-mode' " Python mode (docs, refactor, lints, highlighting, run and ipdb and more)
Plugin 'davidhalter/jedi-vim' " Jedi-vim autocomplete plugin
Plugin 'mitsuhiko/jinja2' " Jinja support for vim
Plugin 'mitsuhiko/vim-python-combined' " Combined Python 2/3 for Vim
Plugin 'kien/ctrlp.vim' " Find in files
Plugin 'alvan/vim-closetag' " Auto tag closing
"---------------=== Git support ===------------------
Plugin 'tpope/vim-fugitive' " Provides git integration
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList - lists configured plugins
" :PluginInstall - installs plugins; append `!` to update or just
" :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean - confirms removal of unused plugins; append `!` to
" auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by
" the call to :runtime you can find below. If you wish to change any of those
" settings, you should do it in this file (/etc/vim/vimrc), since debian.vim
" will be overwritten everytime an upgrade of the vim packages is performed.
" It is recommended to make changes after sourcing debian.vim since it alters
" the value of the 'compatible' option.
" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
" runtime! debian.vim
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
syntax on
endif
" source ~/vim_scripts/autoclose.vim
" General python indentation settings
set textwidth=79 " lines longer than 79 columns will be broken
set shiftwidth=4 " operation >> indents 4 columns; << unindents 4 columns
set tabstop=4 " a hard TAB displays as 4 columns
set expandtab " insert spaces when hitting TABs
set softtabstop=4 " insert/delete 4 spaces when hitting a TAB/BACKSPACE
set shiftround " round indent to multiple of 'shiftwidth'
set autoindent " align the new line indent with the previous line
set enc=utf-8 " set utf-8 as default in files
set ls=2 " always show statusbar
set incsearch " incremental search
set hlsearch " highlite search
set nu " show line nubers
set scrolloff=5 " scroll 5 lines at once
" Disable the swap files
set nobackup " no backup files
set nowritebackup " only in case you don't want a backup file while
" editing
set noswapfile " no swap files
"
" " прячем панельки
set guioptions-=m " menu
set guioptions-=T " toolbar
set guioptions-=r " scrollbars
set t_Co=256
set backspace=indent,eol,start
" Keep the selectoin when using <Shift> + <
vnoremap < <gv
vnoremap > >gv
" Map prev tab and next tab
nnoremap <F9> :tabn <CR>
nnoremap <S-F9> :tabp <CR>
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
aunmenu Help.
aunmenu Window.
let no_buffers_menu=1
set mousemodel=popup
let g:pymode = 1 " Turn pymode on
let g:pymode_options_max_line_length = 79
let g:pymode_indent = 1
let g:pymode_lint_on_fly = 1
" autocmd vimenter * TagbarToggle
" autocmd vimenter * NERDTreeTabsToggle
map <F3> :NERDTreeTabsToggle<CR> " Set NERDTree shortcut
let NERDTreeIgnore=['\~$', '\.pyc$', '\.pyo$', '\.class$', 'pip-log\.txt$', '\.o$', '__pycache__']
map <F4> :TagbarToggle<CR> " Set Tagbar shortcut
let g:tagbar_autofocus = 0 " Autofocus Tagbar when opened
" Airline configuration
set laststatus=2
let g:airline_theme='badwolf'
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
" if !exists('g:airline_symbols')
" let g:airline_symbols = {}
" endif
" let g:airline_symbols.space = "\ua0"
"=====================================================
"" Python-mode settings
"=====================================================
" Disable rope completion because we use JediVim instead
let g:pymode_rope = 0
let g:pymode_rope_completion = 0
let g:pymode_rope_complete_on_dot = 0
" Documentation
let g:pymode_doc = 0
let g:pymode_doc_key = 'K'
" Check code after file saving
let g:pymode_lint = 1
let g:pymode_lint_checker = "pyflakes,pep8"
let g:pymode_lint_ignore="E501,W601,C0110"
" Check code after saving
let g:pymode_lint_write = 1
let g:pymode_lint_on_fly = 1
" VirtualEnv support
let g:pymode_virtualenv = 1
"
" Breakpoint shortcut
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = '<leader>b'
" Higlite the synthax
let g:pymode_syntax = 1
let g:pymode_syntax_all = 1
let g:pymode_syntax_indent_errors = g:pymode_syntax_all
let g:pymode_syntax_space_errors = g:pymode_syntax_all
" Disable the autofolding
let g:pymode_folding = 0
" Disable the ability to run code
let g:pymode_run = 0
" ====================== JediVim configuration=======
" Disable choose first function/method at autocomplete
let g:jedi#popup_select_first = 1
" ===================================================
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark
colorscheme molokai
" Uncomment the following to have Vim jump to the last position when
" reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
if has("autocmd")
filetype plugin indent on
endif
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set ignorecase " Do case insensitive matching
set smartcase " Do smart case matching
set incsearch " Incremental search
set autowrite " Automatically save before commands like :next and :make
set hidden " Hide buffers when they are abandoned
set mouse=a " Enable mouse usage (all modes)
" Set run console mode on <F5>>
nnoremap <F5> :ConqueTermSplit ipython3<CR>
" Set debug-mode on <F6>
nnoremap <F6> :exe "ConqueTermSplit ipython3 " . expand("%")<CR>
" Set open console on <F7>
nnoremap <F7> :ConqueTermSplit bash <CR>
nnoremap <F8> :ConqueTermTab bash <CR>
nnoremap <C-Right> <C-W><Right>
nnoremap <C-Left> <C-W><Left>
nnoremap <C-Up> <C-W><Up>
nnoremap <C-Down> <C-W><Down>
" Tell ConqueTerm use python3 by default
let g:ConqueTerm_PyVersion = 3
" Set next buffer on F12
nnoremap <F12> :bn<CR>
" Set prev buffer on Shift F12
nnoremap <S-F12> :bp<CR>
" Synthax highlighting shortcuts
nnoremap <leader>Th :set ft=htmljinja<CR>
nnoremap <leader>Tp :set ft=python<CR>
nnoremap <leader>Tj :set ft=javascript<CR>
nnoremap <leader>Tc :set ft=css<CR>
nnoremap <leader>Td :set ft=django<CR>
" --- Python ---
autocmd FileType python setlocal expandtab shiftwidth=4 tabstop=8
\ formatoptions+=croq softtabstop=4 smartindent
\ cinwords=if,elif,else,for,while,try,except,finally,def,class,with
autocmd FileType pyrex setlocal expandtab shiftwidth=4 tabstop=8 softtabstop=4
\ smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class,with
" --- JavaScript ---
let javascript_enable_domhtmlcss=1
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd BufNewFile,BufRead *.json setlocal ft=javascript
" --- HTML ---
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
" --- template language support (SGML / XML too) ---
autocmd FileType html,xhtml,xml,htmldjango,htmljinja,eruby,mako setlocal
\ expandtab shiftwidth=2 tabstop=2 softtabstop=2
autocmd bufnewfile,bufread *.rhtml setlocal ft=eruby
autocmd BufNewFile,BufRead *.mako setlocal ft=mako
autocmd BufNewFile,BufRead *.tmpl setlocal ft=htmljinja
autocmd BufNewFile,BufRead *.py_tmpl setlocal ft=python
let html_no_rendering=1
let g:sparkupNextMapping='<c-l>'
let g:closetag_filenames = "*.html,*.xhtml,*.phtml"
" --- CSS ---
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType css setlocal expandtab shiftwidth=4 tabstop=4 softtabstop=4
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
source /etc/vim/vimrc.local
endif