-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
257 lines (196 loc) · 6.53 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
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
set nocompatible
" filetype must be off for vundle
filetype off
" Set up vundle
" Do this first:
" git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/vundle/
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" ~~~~~~~~~~~~~~~~~~~~~~
" Vundle plugins go here
" ~~~~~~~~~~~~~~~~~~~~~~
" Let vundle manage itself
Plugin 'gmarik/vundle'
Plugin 'editorconfig/editorconfig-vim'
" File navigation
Plugin 'L9'
Plugin 'FuzzyFinder'
Plugin 'scrooloose/nerdtree'
" Python integration
Plugin 'klen/python-mode'
Plugin 'tclem/vim-arduino'
" Ruby linting
Plugin 'ngmy/vim-rubocop'
" Source control integration
Plugin 'tpope/vim-fugitive'
Plugin 'airblade/vim-gitgutter'
Plugin 'mhinz/vim-signify'
" Colors!
Plugin 'flazz/vim-colorschemes'
" Font size adjustment
Plugin 'drmikehenry/vim-fontsize'
" session management
Plugin 'xolox/vim-misc'
Plugin 'xolox/vim-session'
filetype on
scriptencoding utf-8
set modeline " enable modelines to be read
set bs=2 " allow backspacing over everything
set ruler " show current coords of cursor
set nu " line numbering
set ttymouse=xterm2 " allows mouse to work in screen sessions
set mouse=a " allow mouse support in console
"
" Searching
"
set ignorecase " case insensitive searching
set incsearch " search as you type
"
" Tabbing
"
set autoindent " auto indent on new line
set smartindent
set tabstop=4
set shiftwidth=4
set softtabstop=4
set noexpandtab " use tabs by default
" allow toggling between local and default mode
if !exists("*TabToggle")
function TabToggle()
if &expandtab
set shiftwidth=4
set softtabstop=0
set noexpandtab
else
set shiftwidth=4
set softtabstop=4
set expandtab
endif
endfunction
nmap <F9> mz:execute TabToggle()<CR>'z
endif
set formatoptions=ro " Enable automatic comment leaders
" set the title of the terminal to the name of the file you are editing
set title
set titleold=""
" command line completion
set wildmode=list:longest,full
" fold level
set foldmethod=indent
set foldlevel=20
set foldlevelstart=20
" make tabs and trailing spaces visible
set list listchars=tab:▷⋅,trail:⋅
filetype plugin on
filetype indent on
" Funny file extensions
autocmd BufRead,BufNewFile *.spv setlocal filetype=php
autocmd BufRead,BufNewFile *.phtml setlocal filetype=php
autocmd BufRead,BufNewFile *.pxl setlocal filetype=python
autocmd BufRead,BufNewFile *.pxlt setlocal filetype=python
autocmd BufRead,BufNewFile *.kv setlocal filetype=kivy
autocmd BufRead,BufNewFile *.less setlocal filetype=less
autocmd BufRead,BufNewFile *.scss setlocal filetype=sass
autocmd BufRead,BufNewFile *.pde setlocal filetype=arduino
autocmd BufRead,BufNewFile *.ino setlocal filetype=arduino
autocmd BufRead,BufNewFile *.md setlocal filetype=markdown
" HTML - 2 spaces. Also, no wrapping since lines get quite long but we want
" indentation to be clear.
autocmd FileType html,htmldjango,xml,xsd,xslt setlocal nowrap tabstop=2 shiftwidth=2 softtabstop=2 expandtab
" CSS / SASS / LESS - 2 spaces
autocmd FileType css,sass,less setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
" Various languages: 2 spaces
autocmd FileType ruby,javascript,scala,erlang,haskell,clojure,yaml setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab
" Python: 4 spaces
autocmd FileType python,kivy setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab
" Markdown: wrap whole words
autocmd FileType markdown setlocal nolist lbr formatoptions+=l
syntax enable " syntax highlighting
" ToDo keywords
syn keyword Todo contained TODO FIX FIXME XXX HACK
syn keyword pythonTodo contained TODO FIX FIXME XXX HACK
" Python PEP8 checking - requires pep8.py somewhere in the $PATH
" Control-P to run a PEP8 check on the current file...
nnoremap <silent> <C-p> :cexpr system("pep8 --repeat ".expand("%:p"))<CR>
" Then Control-J and Control-K to move between the 'errors'
nnoremap <silent> <C-j> :cnext<CR>
nnoremap <silent> <C-k> :cprevious<CR>
" Don't let pymode autoedit whitespace
let g:pymode_trim_whitespaces = 0
" Don't let pymode worry about long lines
let g:pep8_ignore="E501,E226"
let g:pymode_lint_ignore="E501,E226"
" Enable breakpoints plugin
let g:pymode_breakpoint = 1
let g:pymode_breakpoint_key = '<leader>b'
" It should pick up on ipdb if present, but doesn't always find it (e.g. not
" started from the right virtualenv etc)
let g:pymode_breakpoint_cmd = 'import ipdb; ipdb.set_trace()'
" I just don't trust rope anymore.
let g:pymode_rope = 0
" Use vim-signify for hg (for git, we have git-gutter)
let g:signify_vcs_list = ['hg']
" Don't show scratch window
set completeopt-=preview
" No, really don't create a new pane.
let g:pymode_lint_cwindow = 0
"
" Function key mappings
"
" F2 saves
map <F2> :w<CR>
imap <F2> <ESC>:w<CR>
" Show/hide NERDTree
map <F3> :NERDTreeToggle<CR>
" Toggle search highlighting
nmap <silent> <F4> :set invhlsearch<CR>
" F5 toggles the invpaste setting -
" this stops auto-indentation going nuts when you paste stuff in terminal
nnoremap <F5> :set invpaste paste?<Enter>
imap <F5> <C-O><F5>
set pastetoggle=<F5>
nmap <silent> <F6> :set invlist<CR> " Toggle whitespace display
" Edit/save another file in the same directory as the current file
" uses expression to extract path from current file's path
map ,e :e <C-R>=expand("%:p:h") . "/" <CR>
map ,sp :sp <C-R>=expand("%:p:h") . "/" <CR>
map ,vsp :vsp <C-R>=expand("%:p:h") . "/" <CR>
map ,w :w <C-R>=expand("%:p:h") . "/" <CR>
map ,sav :sav <C-R>=expand("%:p:h") . "/" <CR>
map ,t :tabe <C-R>=expand("%:p:h") . "/" <CR>
" FuzzyFinder shortcut
map ,f :FufFile **/<CR>
map ,b :FufBuffer <CR>
" python 3 print fixer
map ,3 :s/\vprint\s+(.+)$/print(\1)/ <CR>
" create an __init__.py in current NERDTree folder
map ,i ma__init__.py<CR>
" switch gitgutter on and off
map ,g :GitGutterToggle<CR>
let NERDTreeChDirMode=2
let NERDTreeShowBookmarks=1
let NERDTreeIgnore = ['\.pyc$', '\.swp$', '^__pycache__$']
" Ctrl arrows to move between windows
noremap <Esc>[1;5D <C-W><Left>
noremap <Esc>[1;5C <C-W><Right>
noremap <Esc>[1;5A <C-W><Up>
noremap <Esc>[1;5B <C-W><Down>
noremap <C-Left> <C-W><Left>
noremap <C-Right> <C-W><Right>
noremap <C-Up> <C-W><Up>
noremap <C-Down> <C-W><Down>
" Move text, but keep selection
vnoremap > ><CR>gv
vnoremap < <<CR>gv
vnoremap ;rv c<C-O>:set revins<CR><C-R>"<Esc>:set norevins<CR>
" colorscheme. I use dark terminals so this works for me!
set background=dark
try
colorscheme vividchalk
catch /^Vim\%((\a\+)\)\=:E185/
" doesn't matter
endtry
" Auto save/load sessions
let g:session_autosave="yes"
let g:session_autoload="no"
" Put extra local .vim files into ~/.vim/plugin and they will be loaded automatically