-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
188 lines (155 loc) · 4.85 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
180
181
182
183
184
185
186
187
188
" remap Escape Key
inoremap <CR> <Esc>
" Initially, pressing Enter returns to normal mode.
" In insert mode, pressing Shift-Enter enters "multiline" mode, meaning
" that pressing Enter will insert a newline.
" In insert mode, after pressing Shift-Enter to enter "multiline"
" mode, pressing Shift-Enter again exits (returns Vto normal mode).
" more details: http://vim.wikia.com/wiki/Avoid_the_escape_key
"function! ToggleEnterMapping()
"if empty(mapcheck('<CR>', 'i'))
"inoremap <CR> <Esc>`^
"return "\<Esc>"
"else
"iunmap <CR>
"return "\<CR>"
"endif
"endfunction
"call ToggleEnterMapping()
"inoremap <expr> <C-CR> ToggleEnterMapping()
" Optional (so <CR> cancels prefix, selection, operator).
"nnoremap <CR> <Esc>
"vnoremap <CR> <Esc>gV
"onoremap <CR> <Esc>
" command line abbreviation to open files in current directory
" use :e %%/ will expand the current path and completion is possible
cabbr <expr> %% expand('%:p:h')
" map cursor keys to hjkl (due to using neo layout)
nmap <Up> k
nmap <Down> j
nmap <Left> h
nmap <Right> l
" key mappings for easier split window navigation
" they adher to the neo cursor keys
nnoremap <C-i> <C-w>h
nnoremap <C-e> <C-w>l
nnoremap <C-a> <C-w>j
nnoremap <C-l> <C-w>k
" automatic reloading of .vimrc
autocmd! bufwritepost .vimrc source %
" set wildmode to do autocomplete with ex commands to show all completions
" and complete to the longest full match part
set wildmode=longest,list
" better copy and paste
set pastetoggle=<F2>
set clipboard=unnamed
" remap map leader key
let mapleader=","
" map sort function to a key
vnoremap <Leader>s :sort<CR>
" color schema
set t_Co=256
color wombat256mod
if &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
" enable syntax highlighting
filetype off
filetype plugin indent on
syntax on
" showing line numbers and length
set number " show line numbers
set tw=79 " width of document
set nowrap " don't automatically wrap on load
set fo-=t " don't automatically wrap text when writing
set colorcolumn=80
highlight ColorColumn ctermbg=233
" real programmers don't use tabs but spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set shiftround
set expandtab
" disable backup and swap files
set nobackup
set nowritebackup
set noswapfile
" only use decimal number format
set nrformats=
" set location of tag file
set tags=tags;/
" use pathogen to manage plugins
execute pathogen#infect()
execute pathogen#helptags()
" settings for vim-powerline
" Always show statusline
set laststatus=2
" settings for ctrlp
let g:ctrlp_max_height = 30
set wildignore+=*.pyc
set wildignore+=*_build/*
set wildignore+=*/coverage/*
" settings for NERDTree
map <Leader>nt :NERDTree<CR>
" Python folding
" mkdir -p ~/.vim/ftplugin
" wget -O ~/.vim/ftplugin/python_editing.vim
" http://www.vim.org/scripts/download_script.php?src_id=5492
" use <Leader>f to fold/unfold under cursor
" and <Leader>F to fold/unfold file
set nofoldenable
" settings for easier buffer handling
noremap <leader>bl :ls<CR>
noremap <leader>bn :bn<CR>
noremap <leader>bp :bp<CR>
noremap <leader>bt :b#<CR>
" Python-mode
" Activate rope
" Keys:
" K Show python docs
" Rope autocomplete
" g Rope goto definition
" d Rope show documentation
" f Rope find occurrences
" 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 = 1
" Documentation
let g:pymode_doc = 0
"let g:pymode_doc_key = 'K'
"Linting
let g:pymode_lint = 1
let g:pymode_lint_checkers = ['pyflakes', 'pep8']
let g:pymode_lint_cwindow = 1
let g:pymode_lint_message = 1
" Auto check on save
let g:pymode_lint_on_write = 1
"skip errors and warnings
"E.g. "E501,W002", "E2,W" (Skip all Warnings and Errors startswith E2) and etc
"E501 line too long
"E12{1,2,6,7,8} continuation line intendation errors
let g:pymode_lint_ignore = "E501,E502,E303,E12,E261,E262"
" Support virtualenv
let g:pymode_virtualenv = 1
" Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = 'p'
" 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
" open found definitions in same buffer
let g:pymode_rope_goto_definition_cmd = 'e'
" Don't autofold code
let g:pymode_folding = 0
" Don't autocomplete on dot
let g:pymode_rope_complete_on_dot = 0
" disable preview window for autocompletion
set completeopt-=preview