-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
237 lines (202 loc) · 7.04 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
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'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
" Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html
" Plugin 'L9'
" Git plugin not hosted on GitHub
" Plugin 'git://git.wincent.com/command-t.git'
" git repos on your local machine (i.e. when working on your own plugin)
" Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
" Plugin 'user/L9', {'name': 'newL9'}
" Tools (sorted)
Plugin 'godlygeek/tabular' " :Tabularize motion
Plugin 'groenewege/vim-less'
Plugin 'mattn/gist-vim' " :Gist
Plugin 'tpope/vim-abolish' " :Subvert/di{e,ce}/spinner{,s}/g
Plugin 'tpope/vim-commentary' " gc(motion, gc to undo)
Plugin 'tpope/vim-fugitive' " :Gedit :Gsplit :Gvsplit :Gdiff
Plugin 'tpope/vim-repeat' " makes . repeat plugin commands defined by tpope
Plugin 'tpope/vim-scriptease'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-speeddating' " ^A ^X on dates, e.g., Oct 10, 1980
Plugin 'tpope/vim-surround' " cs old quote new quote
Plugin 'tpope/vim-unimpaired' " :help unimpaired
Plugin 'tpope/vim-vinegar' " - up, . command ! command ~ home cg cl to cd or lcd
" Plugin 'scrooloose/syntastic'
Plugin 'Valloric/YouCompleteMe'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'junegunn/vim-easy-align' " ga
Plugin 'majutsushi/tagbar'
" Plugin 'w0rp/ale' " asynchronous linter
" Neovim plugins
if has("nvim")
Plugin 'Shougo/deoplete.nvim' " tab completion
Plugin 'ervandew/supertab' " to use tab for tab completion
endif
" Language modes
Plugin 'alunny/pegjs-vim'
" Plugin 'othree/yajs.vim'
Plugin 'elzr/vim-json'
Plugin 'fatih/vim-go'
Plugin 'othree/html5.vim'
Plugin 'solarnz/thrift.vim'
Plugin 'mxw/vim-jsx'
" Plugin 'zchee/deoplete-go'
" Color schemes
Plugin 'baycomb'
Plugin 'w0ng/vim-hybrid'
" All of your Plugins must be added before the following line
call vundle#end() " required
" load the plugin and indent settings for the detected filetype
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
" Regarding the HUD
let mapleader=";"
set number
set ruler
set scrolloff=3
set laststatus=2
set mouse=a
syntax on
" Regarding space
set autoindent
set expandtab
set nowrap
set lbr " break on words
set bri " preserve indent on break
set shiftwidth=4
set softtabstop=4
set tabstop=4
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
" set virtualedit=all
filetype indent on
" Makefile, respect tabs
au FileType make set noexpandtab
" Python, follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
au FileType python set softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79
" Searching
set incsearch
set hlsearch
set ignorecase
set smartcase
" % to bounce from do to end etc.
runtime! macros/matchit.vim
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*
" Color / Appearance
set background=dark
colorscheme hybrid " from vim-hybrid
set fillchars=
" Backups
set noswapfile
" Alternately,
" Directories for swp files
" set backupdir=~/.vim/backup
" set directory=~/.vim/backup
" Make uses real tabs
" Regarding easy-align
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
" fugitive:
" set statusline=%{fugitive#statusline()}
" ALE lint status line
" let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok']
" nmap <silent> <C-k> <Plug>(ale_previous_wrap)
" nmap <silent> <C-j> <Plug>(ale_next_wrap)
" Remember last location in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif
" Use modeline overrides
set modeline
set modelines=10
" Include user's local vim config
if filereadable(expand("~/.vimrc.local"))
source ~/.vimrc.local
endif
" easier use of ranged global normal
nnoremap <leader>gn :'<,'>g/^/normal<space>
vnoremap <leader>gn :g/^/normal<space>
" fzf
nmap <silent> <C-P> :Files<CR>
nmap <silent> <leader>f :Files<CR>
nmap <silent> <leader>t :Trees<CR>
nmap <silent> <leader>r :History<CR>
nmap <silent> <leader>b :Buffers<CR>
nmap <silent> <leader>w :Windows<CR>
nmap <silent> <leader>: :Commands<CR>
" Regarding Go
au FileType go nmap <Leader>rs <Plug>(go-run-split)
au FileType go nmap <Leader>rv <Plug>(go-run-vertical)
au FileType go nmap <Leader>ts <Plug>(go-test-split)
au FileType go nmap <Leader>tv <Plug>(go-test-vertical)
au FileType go nmap <leader>ds <Plug>(go-doc)
au FileType go nmap <leader>dv <Plug>(go-doc-vertical)
au FileType go nmap <leader>db <Plug>(go-doc-browser)
au FileType go nmap <Leader>gd <Plug>(go-def)
au FileType go nmap <leader>gs <Plug>(go-def-split)
au FileType go nmap <leader>gv <Plug>(go-def-vertical)
au FileType go nmap <leader>s <Plug>(go-implements)
au FileType go nmap <leader>i <Plug>(go-info)
let g:go_term_enabled = 1
" let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck']
let g:syntastic_go_checkers = ['go', 'golint', 'govet', 'errcheck']
" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] }
let g:go_list_type = "quickfix"
let g:go_fmt_command = "goimports" " vim-go
" let g:go_def_mode = 'godef' " So much faster
nnoremap <leader>gf :GoTestFunc<CR>
nnoremap <leader>gt :GoTest<CR>
nnoremap <leader>gc :GoCoverage<CR>
nnoremap <leader>gg :GoCoverageClear<CR>:syntax on<CR>
let g:vim_json_syntax_conceal = 0
let g:jsx_ext_required = 0 " Allow JSX in normal JS files
let g:deoplete#enable_at_startup = 1
function! s:close_preview() " {{{2
if pumvisible() == 0 && bufname('%') != "[Command Line]"
silent! pclose
endif
endfunction
function! s:close_preview_on_move() " {{{2
au CursorMovedI <buffer> call s:close_preview()
au InsertLeave <buffer> call s:close_preview()
endfunction
" Regarding Kni
autocmd BufNewFile,BufRead *.kni setlocal filetype=kni
" Regarding Git
autocmd Filetype gitrebase silent %!restack
" Conveniences for editing vimrc
nnoremap <leader>ev :e $MYVIMRC<cr>
inoremap <leader>ev <esc>:e $MYVIMRC<cr>
nnoremap <leader>sv :source $MYVIMRC<cr>
nnoremap <leader>s% :source %<cr>