-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
207 lines (177 loc) · 6.01 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
""""" Install instruction "
""" clone repository
" git https://github.com/bifurcationman/dotfiles.git
"
""" create symlinks
" bin/make-symlinks.sh
"
""" install vundle and plugins
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
" vim +PluginInstall +qall
"
""" allow ctrl+s/q forwarding
" echo 'stty -ixon' >> .bashrc
" source .bashrc
"
""""" For installation on OSX:
""" Install Seil (CAPSLOCK remapping) and Karabiner (key repeat config)
" seil : https://pqrs.org/osx/karabiner/
" karabiner : https://pqrs.org/osx/karabiner/
""""" Vundle
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')
" Essential Plugins
Plugin 'VundleVim/Vundle.vim'
" Core Plugins
Plugin 'Lokaltog/vim-powerline'
Plugin 'Syntastic'
Plugin 'fugitive.vim'
Plugin 'nvie/vim-flake8'
" Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'fatih/vim-go'
Plugin 'vim-ruby/vim-ruby'
Plugin 'keith/swift.vim'
" Plugin 'elixir-lang/vim-elixir'
Plugin 'digitaltoad/vim-pug'
" Other Plugins
Plugin 'L9'
Plugin 'ctrlp.vim'
Plugin 'scrooloose/nerdtree'
Plugin 'nathanaelkane/vim-indent-guides'
" Plugin 'klen/python-mode'
" Plugin 'sgeb/vim-diff-fold'
" gS and gJ to split and join structs (resp); not AST aware so you must be on the
" line with the struct definition (i.e. not the middle of the struct).
Plugin 'AndrewRadev/splitjoin.vim'
Plugin 'valloric/youcompleteme'
" non-vundle Plugins
" https://valloric.github.io/YouCompleteMe/#intro # autocomplete
" cd ~/.vim/bundle/plugin/YouCompleteMe/ && python install.py --gocode-completer
" Plugin 'Valloric/YouCompleteMe'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Put your non-Plugin stuff after this line
" powerline
set laststatus=2 " Always show the statusline
set encoding=utf-8 " Necessary to show Unicode glyphs
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" General
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
let mapleader=","
set autoindent
set backspace=indent,eol,start
set clipboard=unnamed
set hlsearch
" set incsearch
set nowrap
set nu
set rnu
syntax on
" tab defaults
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
" disable arrow keys
noremap <up> :echom 'Stop being dumb...'<CR>
noremap <down> :echom 'Stop being dumb...'<CR>
noremap <left> :echom 'Stop being dumb...'<CR>
noremap <right> :echom 'Stop being dumb...'<CR>
inoremap <up> <ESC>:echom 'Stop being dumb...'<CR>
inoremap <down> <ESC>:echom 'Stop being dumb...'<CR>
inoremap <right> <ESC>:echom 'Stop being dumb...'<CR>
inoremap <left> <ESC>:echom 'Stop being dumb...'<CR>
" vim split navigation
noremap <c-h> <c-w>h
noremap <c-j> <c-w>j
noremap <c-k> <c-w>k
noremap <c-l> <c-w>l
" map sort function to key
vnoremap <Leader>s :sort<CR>
" Show whitespace
" autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
" au InsertLeave * match ExtraWhitespace /\s\+$/
" Remove whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
" Color scheme
" mkdir -p ~/.vim/colors && cd ~/.vim/colors
" wget -O wombat256mod.vim http://www.vim.org/scripts/download_script.php?src_id=13400
set t_Co=256
color wombat256mod
" crontab
au BufEnter /private/tmp/crontab.* setl backupcopy=yes
" NerdTree
noremap <Leader>n :NERDTreeToggle<CR>
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.js,*.java,*.pyc,*.h,*.log,*.properties,*.mp3,*.jar,*.pyo,*.cpp
" if executable('ag')
" let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" endif
let g:ctrlp_follow_symlinks=0
let g:ctrlp_clear_cache_on_exit=0
" syntastic
let g:syntastic_check_on_open = 1 " check syntax on file open
" make saving/opening files less laggy when used with vim-go
" src: https://github.com/fatih/vim-go#using-with-syntastic
let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
""" General
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" save file
nnoremap <c-s> :w<CR>
vnoremap <c-s> <Esc><c-s>gv
imap <c-s> <Esc><c-s>
" close file
nnoremap <c-q> :q<CR>
vnoremap <c-q> <Esc><c-q>
inoremap <c-q> <Esc><c-q>
" force close file
nnoremap <c-q><c-q> :q!<CR>
vnoremap <c-q><c-q> <Esc><c-q><c-q>
inoremap <c-q><c-q> <Esc><c-q><c-q>
set timeoutlen=250 " wait 300 ms for follow-up keys before executing
" allow scrolling beyond EOF
set scrolloff=99
" visual code block indenting
vnoremap < <gv
vnoremap > >gv
" quickfix navigation
noremap <c-n> :cprevious<CR>
noremap <c-m> :cnext<CR>
let g:quickfix_is_open = 1
" toggle QuickFix window
function! QuickFixToggle()
if g:quickfix_is_open
cclose
let g:quickfix_is_open = 0
else
copen
let g:quickfix_is_open = 1
endif
endfunction
nnoremap <c-f> :call QuickFixToggle()<CR>
" highlight word under cursor
autocmd CursorMoved * exe printf('match IncSearch /\V\<%s\>/', escape(expand('<cword>'), '/\'))
" toggle paste mode
set pastetoggle=<F12> " doesn't work with <c-\>???
" vim-indent-guides specifics
let g:indent_guides_exclude_filetypes = ['help', 'nerdtree', 'go']
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=grey ctermbg=8 " dark grey
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=grey ctermbg=8 " dark grey
let g:indent_guides_start_level = 2
let g:indent_guides_guide_size = 1
" cursorline (only in Normal mode)
" set cursorline
highlight CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
" autocmd InsertEnter * set nocursorline
" autocmd InsertLeave * set cursorline