-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
315 lines (240 loc) · 7.82 KB
/
.vimrc
File metadata and controls
315 lines (240 loc) · 7.82 KB
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
let mapleader = " "
syntax on
filetype plugin indent on
filetype plugin on
source $VIMRUNTIME/macros/matchit.vim
set clipboard=unnamed
set scrolloff=8
set number
set relativenumber
set laststatus=2
set ttyfast
set lazyredraw
" Open new split panes to right and bottom, which feels more natural than Vim’s default:
set splitbelow
set splitright
" Remove 'set hidden'
set nohidden
" https://github.com/tpope/vim-vinegar/issues/13
augroup netrw_buf_hidden_fix
autocmd!
" Set all non-netrw buffers to bufhidden=hide
autocmd BufWinEnter *
\ if &ft != 'netrw'
\| set bufhidden=hide
\| endif
augroup end
" https://github.com/thoughtbot/dotfiles/blob/master/vimrc
augroup vimrcEx
autocmd!
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
augroup END
set confirm
set nocompatible
set ts=4
set sw=4
set sts=4
set expandtab
set ruler
set list
set listchars=nbsp:⦸ " CIRCLED REVERSE SOLIDUS (U+29B8, UTF-8: E2 A6 B8)
set listchars+=tab:▷┅ " WHITE RIGHT-POINTING TRIANGLE (U+25B7, UTF-8: E2 96 B7)
" + BOX DRAWINGS HEAVY TRIPLE DASH HORIZONTAL (U+2505, UTF-8: E2 94 85)
set listchars+=extends:» " RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB, UTF-8: C2 BB)
set listchars+=precedes:« " LEFT-POINTING DOUBLE ANGLE QUOTATION MARK (U+00AB, UTF-8: C2 AB)
set listchars+=trail:• " BULLET (U+2022, UTF-8: E2 80 A2)
set gdefault
set mouse=a
set background=dark
set textwidth=150
set autoindent
set backspace=indent,eol,start
set complete-=i
set smarttab
set incsearch
set wildmenu
set history=1000
if !has('gui_running')
set t_Co=256
endif
" persistent undo
set undofile
set undodir=~/.vim/undodir
" let's not do swapfiles, k?
set noswapfile
" donkey!
set noerrorbells
set vb t_vb=
set updatetime=100
set timeoutlen=1000 ttimeoutlen=0
set wildignore=*.class,*.o,*~,*.pyc,.git,node_modules,.terraform,.gradle
set formatoptions+=n " smart auto-indenting inside numbered lists
set foldmethod=indent
set nofoldenable
set hlsearch
" clear highlights of previous searches when opening files
let @/ = ""
hi! MatchParen cterm=none ctermbg=black ctermfg=white
hi! Error cterm=reverse ctermbg=white ctermfg=red
autocmd BufRead,BufNewFile Berksfile set filetype=ruby
autocmd BufRead,BufNewFile Jenkinsfile.* set filetype=Jenkinsfile
autocmd BufNewFile,BufRead *.yml set filetype=yaml
command! Q q " Bind :Q to :q
command! Qall qall
command! QA qall
command! E e
command! W w
command! Wq wq
" Switch between last two files
nnoremap <Leader>b <C-^>
" quickly save the file
nnoremap <Leader>w :write<CR>
" use ripgrep to fuzzy search
nnoremap <Leader>f :Rg<CR>
" Easier editing of .vimrc
nnoremap <Leader>v :sp ~/.vimrc<CR>
nnoremap <Leader>r :source $MYVIMRC<CR>
" hit return again in command mode, and the highlighting disappears.
nnoremap <CR> :noh<CR><CR>
" Quickly switch between buffers
nnoremap <Leader><Left> :bprevious<CR>
nnoremap <Leader><Right> :bnext<CR>
" Turn off highlight searches
nnoremap <Leader><Leader> :noh<CR>
" Remap j and k to act as expected when used on long, wrapped, lines
" https://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
nnoremap <expr> j v:count ? 'j' : 'gj'
nnoremap <expr> k v:count ? 'k' : 'gk'
" Yank to end of line
nnoremap Y y$
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
nmap \q :nohlsearch<CR>
nmap \t :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
nmap \x :cclose<CR>
nmap \g :Gstatus<CR>
autocmd filetype crontab setlocal nobackup nowritebackup
if v:version > 703 || v:version == 703 && has('patch541')
set formatoptions+=j " remove comment leader when joining comment lines
endif
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'sheerun/vim-polyglot'
Plug 'mattn/emmet-vim'
Plug 'alvan/vim-closetag'
" tpop
" Pairs of handy bracket mappings
Plug 'tpope/vim-unimpaired'
" Helpers for UNIX
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-vinegar'
" align blocks of text
Plug 'junegunn/vim-easy-align'
" https://github.com/jiangmiao/auto-pairs/issues/74
Plug 'tylrd/auto-pairs'
Plug 'mhinz/vim-signify'
" Plug 'airblade/vim-gitgutter'
" better vim integration with terminal
Plug 'wincent/terminus'
" fuzzy find
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
" status bar
Plug 'itchyny/lightline.vim'
" wiki
Plug 'vimwiki/vimwiki', { 'branch': 'dev' }
Plug 'Konfekt/FastFold'
Plug 'nanotech/jellybeans.vim'
call plug#end()
""""""""""""""""""""""""""""""""""""""""
" Plugin Configuration goes under here!
""""""""""""""""""""""""""""""""""""""""
let g:jellybeans_overrides = {
\ 'background': { 'ctermbg': 'none', '256ctermbg': 'none' },
\}
if has('termguicolors') && &termguicolors
let g:jellybeans_overrides['background']['guibg'] = 'none'
endif
colorscheme jellybeans
let g:ruby_fold = 1
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.php,*.jsx"
let g:user_emmet_settings = {
\ 'javascript' : {
\ 'extends' : 'jsx',
\ },
\}
" Lightline
let g:lightline = {
\ 'colorscheme': 'jellybeans',
\ }
let g:vimwiki_list = [{'path': '~/vimwiki/', 'syntax': 'markdown', 'ext': '.md'}]
nmap <Leader>n <Plug>VimwikiIndex
nmap <Leader>i <Plug>VimwikiDiaryIndex
nmap <Leader>d <Plug>VimwikiMakeDiaryNote
nmap <Leader>dy <Plug>VimwikiMakeYesterdayDiaryNote
nmap <Leader>c :Calendar<CR>
let g:calendar_options = 'nornu'
let g:go_version_warning = 0
let g:AutoPairsMultilineClose=0
" 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)
function! s:find_git_root()
return system('git rev-parse --show-toplevel 2> /dev/null')[:-2]
endfunction
command! ProjectFiles execute 'Files' s:find_git_root()
" FZF bindings
nmap <silent> <C-p> :Buffers<CR>
nmap <silent> <C-t> :ProjectFiles<CR>
nmap <silent> <C-f> :Ag<CR>
nmap <leader><tab> <plug>(fzf-maps-n)
xmap <leader><tab> <plug>(fzf-maps-x)
omap <leader><tab> <plug>(fzf-maps-o)
nnoremap <C-W>O :call MaximizeToggle()<CR>
nnoremap <C-W>o :call MaximizeToggle()<CR>
nnoremap <C-W><C-O> :call MaximizeToggle()<CR>
" http://vim.wikia.com/wiki/Maximize_window_and_return_to_previous_split_structure
function! MaximizeToggle()
if exists("s:maximize_session")
exec "source " . s:maximize_session
call delete(s:maximize_session)
unlet s:maximize_session
let &hidden=s:maximize_hidden_save
unlet s:maximize_hidden_save
else
let s:maximize_hidden_save = &hidden
let s:maximize_session = tempname()
set hidden
exec "mksession! " . s:maximize_session
only
endif
endfunction
" Fugitive
set diffopt+=vertical
nnoremap <Leader>ga :Git add %:p<CR><CR>
nnoremap <Leader>gs :Gstatus<CR>
nnoremap <Leader>gd :Gdiff<CR>
nnoremap <Leader>gb :Gblame<CR>
highlight SignColumn ctermbg=NONE cterm=NONE guibg=NONE gui=NONE
highlight SignifySignDelete ctermfg=red cterm=NONE guifg=#ff0000 gui=NONE
highlight SignifySignAdd ctermfg=green guifg=NONE cterm=NONE gui=NONE
highlight SignifySignChange ctermfg=yellow guifg=NONE cterm=NONE gui=NONE
" reset certain things to black
hi! Normal ctermbg=000 ctermfg=252 guibg=#161821 guifg=#c6c8d1
hi! LineNr ctermbg=000 ctermfg=239 guibg=#1e2132 guifg=#444b71