-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
262 lines (207 loc) · 6.87 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
258
259
260
261
" Josh Kuiros
" .vimrc
set nocompatible
" Use system clipboard
set clipboard=unnamed
" Turn file autodetect off, required for Vundle
filetype off
" Show line numbers
set number
" Show relative line numbers
set relativenumber
set noswapfile
" Make search case-insensitive, unless they contain upper-case letters
set ignorecase
set smartcase
" Encoding is utf-8
set encoding=utf-8
set fileencoding=utf-8
" Enable matchit plugin, ships with vim and enhances '%'
" Required for vim-textobj-rubyblock
runtime macros/matchit.vim
" Automatically delete line breaks or automatically inserted
" Identation on insert mode backspace
set backspace=indent,eol,start
" Don't unload buffers when they are abandoned, stay in background
set hidden
" Set unix line endings
set fileformat=unix
" Unix for new bufferes and fallback line endings to dos
set fileformats=unix,dos
" Save up to 100 marks, enable capital marks
set viminfo='100,f1
" No redraw while running macros, registers, or other non-typed comments
set lazyredraw
" Indentation
set expandtab " map tabs to spaces
set autoindent " autoindent based on line above
set smartindent " smarter indent for c-like languages
set shiftwidth=2 " 2 space tabs when reading
set softtabstop=2 " 2 space tabs in insert mode
set tabstop=2 " Set tab width to 2
" Map leader to space
let mapleader=" "
" 120 Character Color Column
set colorcolumn=120
highlight ColorColumn ctermbg=black
" Remove highlighting on ESC
nnoremap <esc> :noh<return><esc>
" Change color for matching parens
highlight MatchParen cterm=NONE ctermbg=white ctermfg=black
" Loads vim-plug if needed
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
" Required for Operator Mono
highlight htmlArg gui=italic
highlight htmlArg cterm=italic
highlight Comment gui=italic
highlight Comment cterm=italic
" Plugins
call plug#begin('~/.local/share/nvim/plugged')
" Navigation
Plug 'scrooloose/nerdtree' " Directory Tree
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'easymotion/vim-easymotion'
" Visual
Plug 'vim-airline/vim-airline' " Status/tabline
Plug 'vim-airline/vim-airline-themes' " Status/tabline themes
" Productivity
Plug 'jiangmiao/auto-pairs'
Plug 'qpkorr/vim-bufkill'
Plug 'andrewradev/splitjoin.vim'
Plug 'Asheq/close-buffers.vim'
Plug 'henrik/vim-reveal-in-finder'
Plug 'scrooloose/nerdcommenter'
Plug 'wakatime/vim-wakatime'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
" Linting/Formatting
Plug 'ntpeters/vim-better-whitespace' " Trims trailing whitespace
" Git
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'airblade/vim-gitgutter'
" Languages/Frameworks
Plug 'fatih/vim-go', { 'for': 'go' }
Plug 'elixir-editors/vim-elixir', { 'for': 'elixir' }
Plug 'vim-ruby/vim-ruby', { 'for': 'ruby' }
Plug 'pangloss/vim-javascript', { 'for': 'javascript' }
Plug 'mxw/vim-jsx', { 'for': 'javascript' }
Plug 'kana/vim-textobj-user', { 'for': 'ruby' } " Required for vim-textobj-rubyblock
Plug 'nelstrom/vim-textobj-rubyblock', { 'for': 'ruby' }
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'elixir-lsp/coc-elixir', {'do': 'yarn install && yarn prepack'}
" Markdown / Writing Plugins
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'vimwiki/vimwiki'
Plug 'logico/typewriter-vim'
call plug#end()
" Include .jsx syntax highlighting in .js files
let g:jsx_ext_required = 0
" Airline
let g:airline#extensions#tabline#enabled = 1
set laststatus=2
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_symbols.space = "\ua0"
let g:airline_theme='solarized'
" Required for coffeescript
syntax enable " Syntax highlighting
filetype plugin indent on
" NERDTree
nmap <leader>pt :NERDTreeTabsToggle<CR>
nmap <leader>pf :NERDTreeFind<CR>
let g:NERDTreeWinPos = 'right'
let g:NERDTreeShowHidden=1
" FZF
" Set ack to use the_silver_surfer
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
map <C-b> :Buffers<CR>
map <C-f> :Ag<CR>
map <C-m> :History<CR>
map <C-p> :Files<CR>
map <C-t> :Tags<CR>
command! -bang -nargs=* Ag call fzf#vim#ag(<q-args>, {'options': '--delimiter : --nth 4..'}, <bang>0)
" To open a new empty buffer
" This replaces :tabnew which I used to bind to this mapping
nmap <leader>t :enew<cr>
" Buffers
nmap <leader>bd :BD<CR> " bufkill - close buffer without closing window
nmap <leader>bd! :bd!<CR> " close without saving changes
nmap <leader>bdo :CloseOtherBuffers<CR> " close other buffers
" Show all open buffers and their status
nmap <leader>bl :ls<CR>
" Close quickfix window
nmap <leader>c :ccl<CR>
" Easier split navigation
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-L> <C-W><C-L>
nmap <C-H> <C-W><C-H>
set splitbelow
set splitright
" Markdown Soft Wrap Lines
augroup Markdown
autocmd!
autocmd Filetype vimwiki setlocal colorcolumn=80
autocmd Filetype vimwiki setlocal linebreak
autocmd Filetype vimwiki nnoremap j gj
autocmd Filetype vimwiki nnoremap k gk
autocmd Filetype vimwiki colorscheme typewriter
autocmd Filetype vimwiki let g:airline_theme='typewriter'
augroup end
let g:markdown_fenced_languages = ['bash=sh', 'css', 'javascript', 'js=javascript', 'json=javascript', 'ruby', 'html']
" Close Buffers
nnoremap <silent> <C-q> :CloseBuffersMenu<CR>
" JSON
set conceallevel=0
" Goyo
nmap <leader>g :Goyo<CR>:Limelight<CR>
" Vimwiki
let g:vimwiki_list = [{'path': '~/pensieve/notes',
\ 'syntax': 'markdown', 'ext': '.md',
\ 'diary_index': 'plan', 'diary_header': 'Plan',
\ 'diary_rel_path': 'plan/',
\ 'auto_toc': 1,
\ 'auto_tags': 1,
\ 'auto_diary_index': 1}]
nnoremap <leader>bl :VimwikiBacklinks<cr>
" Whitespace
let g:better_whitespace_enabled=1
let g:strip_whitespace_on_save=1
let g:strip_whitespace_confirm=0
" Coc
set signcolumn=yes
highlight SignColumn ctermbg=NONE
nmap <leader>rn <Plug>(coc-rename)
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
" Use <c-space> to trigger completion.
if has('nvim')
inoremap <silent><expr> <c-space> coc#refresh()
else
inoremap <silent><expr> <c-@> coc#refresh()
endif
" Make <CR> auto-select the first completion item and notify coc.nvim to
" format on enter, <cr> could be remapped by other vim plugin
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"