-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
179 lines (138 loc) · 4.57 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
168
169
170
171
172
173
174
175
176
177
178
179
""" Vundle setup
set nocompatible " 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'
" Add all your plugins here (note older versions of Vundle used Bundle instead of Plugin)
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
""" Vundle setup done
""" Plugins (Install with :PluginInstall in vim)
Plugin 'tmhedberg/SimpylFold' " folding of code
Plugin 'vim-scripts/indentpython.vim' " Indent smarter
Plugin 'scrooloose/syntastic' " Check syntax every time you save
Plugin 'nvie/vim-flake8' " Should do pep8 checks
Plugin 'jnurmine/Zenburn' " Terminal mode colors
Plugin 'scrooloose/nerdtree' " File tree
Plugin 'jistr/vim-nerdtree-tabs' " Tabs in the file tree
Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
Plugin 'tpope/vim-fugitive' " Adds git commands
Bundle "myusuf3/numbers.vim"
Bundle 'klen/python-mode'
" Allow mouse scrolling vim + iterm2
set mouse=a
" Use jj to act as <esc>
:imap jj <Esc>
"split navigations
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>
" Folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" See docstrings for folded code
let g:SimpylFold_docstring_preview=1
" Indentation for python and bash scripts
au BufNewFile,BufRead *.py
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=79 |
\ set expandtab |
\ set autoindent |
\ set fileformat=unix
au BufNewFile,BufRead *.sh
\ set tabstop=4 |
\ set softtabstop=4 |
\ set shiftwidth=4 |
\ set textwidth=150 |
" Flag unnecessary whitespace
"au BufRead,BufNewFile *.py,*.pyw,*.c,*.h match BadWhitespace /\s\+$/
" UTF-8 support
set encoding=utf-8
" flake8 settings
let g:syntastic_python_flake8_args='--ignore=E501'
" Syntax highlighting python
let python_highlight_all=1
syntax on
" Color schemes
if has('gui_running')
set background=dark
colorscheme solarized
else
colorscheme zenburn
endif
" Hide .pyc files in file browser
let NERDTreeIgnore=['\.pyc$', '\~$'] "ignore files in NERDTree
" Line numbers
set nu
" Map ctrl+n to toggle NERDTree
map <C-n> :NERDTreeToggle<cr>
nnoremap <C-t> :call NumberToggle()<cr>
" Mapping for running python code using CTRL+m
"autocmd FileType python nnoremap <buffer> <C-m> :w<CR>:exec '!python' shellescape(@%, 1)<cr>
autocmd FileType python nnoremap <buffer> <C-m> :w<CR>:!python ./%<cr>
" Mapping for running shell code using CTRL+m
autocmd FileType sh nnoremap <buffer> <C-m> :w<CR>:!./%<cr>
" Automatically insert ipdb debug line
:map <C-i> oimport ipdb; ipdb.set_trace(context=10) <esc>
" Let terminal use 256 colors
let &t_Co=256
" Prevent documentation window from popping up
set completeopt=menu
" Toggles for line numbers
nnoremap <F3> :NumbersToggle<CR>
nnoremap <F4> :NumbersOnOff<CR>
" Display powerline always
set laststatus=2
" Python-mode
" " Activate rope
" " Keys:
" " K Show python docs
" " <Ctrl-Space> Rope autocomplete
" " <Ctrl-c>g Rope goto definition
" " <Ctrl-c>d Rope show documentation
" " <Ctrl-c>f Rope find occurrences
" " <Leader>b Set, unset breakpoint (g:pymode_breakpoint enabled)
" " [[ Jump on previous class or function (normal, visual, operator
" modes)
" " ]] Jump on next class or function (normal, visual, operator
" modes)
" " [M Jump on previous class or method (normal, visual, operator
" modes)
" " ]M Jump on next class or method (normal, visual, operator
" modes)
let g:pymode_rope = 0
" Documentation
let g:pymode_doc = 0
let g:pymode_doc_key = 'K'
" Linting
let g:pymode_lint = 1
let g:pymode_lint_checker = "pyflakes,pep8"
" Auto check on save
let g:pymode_lint_write = 1
let g:pymode_lint_ignore = "E501"
" Support virtualenv
let g:pymode_virtualenv = 1
" Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_bind = '<leader>b'
" syntax highlighting
"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
" Don't autofold code
let g:pymode_folding = 1
" Don't close split when closing a buffer
map <leader>q :bp<bar>sp<bar>bn<bar>bd<CR>.
nnoremap <C-c> :bp\|bd #<CR>