-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
211 lines (170 loc) · 4.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
" long live vim
set encoding=utf-8
set nocompatible
" package manager
call plug#begin()
" core plugins
Plug 'tpope/tpope-vim-abolish'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-eunuch'
Plug 'preservim/nerdtree'
Plug 'jistr/vim-nerdtree-tabs'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'tomtom/tcomment_vim'
Plug 'vim-scripts/taglist.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'michaeljsmith/vim-indent-object'
Plug 'raimondi/delimitMate'
Plug 'gregsexton/gitv'
Plug 'godlygeek/tabular'
Plug 'skywind3000/asyncrun.vim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Better than YCM
" color scheme
Plug 'brendonrapp/smyck-vim'
" syntax
Plug 'sheerun/vim-polyglot'
call plug#end()
" shortcuts to common commands
let mapleader = ","
nnoremap <leader>a :Ag
nnoremap <leader>o :TlistToggle<CR>
nnoremap <leader>c :TComment<CR>
nnoremap <leader>C :TCommentBlock<CR>
vnoremap <leader>c :TComment<CR>
vnoremap <leader>C :TCommentBlock<CR>
nnoremap <leader>nt :tabnew<CR>:CtrlP<CR>
nnoremap <leader>l :NERDTreeTabsToggle<CR>
nnoremap <leader>p :set invpaste<CR>
nnoremap <leader>t :tabnew<CR>
nnoremap <leader>s :vsplit<CR>
nnoremap <leader>hs :split<CR>
nnoremap <leader>w :tabclose<CR>
nnoremap <leader>ed :tabnew ~/.vimrc<cr>
nnoremap <leader>src :source ~/.vimrc<cr>
nnoremap <leader>tgt :set cursorcolumn! cursorline!<CR>
" taglist config
let g:Tlist_Use_Right_Window = 1
" airline config
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#ale#enabled = 1
" use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" FZF (replacement for CtrlP/Command-T)
nnoremap <leader>f :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>h :History<CR>
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" syntax highlighting and auto-indentation
syntax on
filetype indent on
filetype plugin on
inoremap # X<C-H>#
set ai
set si
set nu
" omg folding is the worst
set nofoldenable
" omg automatic comment insertion is the worst
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" expand tabs to 2 spaces
set shiftwidth=2
set tabstop=2
set smarttab
set expandtab
" auto save buffers whenever you lose focus
au FocusLost * silent! wa
" auto save buffers when you switch context
set autowriteall
" leave showtabline as default (for now)
set showtabline=1
" searching options
set incsearch
set ignorecase
set smartcase
set hlsearch
" escape search highliting by hitting return
nnoremap <CR> :noh<CR><CR>
" disable backups
set nobackup
set nowritebackup
set noswapfile
" disable annoying beep on errors
set noerrorbells visualbell t_vb=
if has('autocmd')
autocmd GUIEnter * set vb t_vb=
endif
" font options
set background=dark
set t_Co=256
colorscheme smyck
" keep at least 5 lines below the cursor
set scrolloff=5
" window options
set showmode
set showcmd
set ruler
set ttyfast
set backspace=indent,eol,start
set laststatus=2
" enable mouse support
set mouse=a
" cursor
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
" word wrapping
set wrap
set linebreak
set nolist
" better tab completion on commands
set wildmenu
set wildmode=list:longest
" close buffer when tab is closed
set nohidden
" better moving between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" ; is better than :
nnoremap ; :
nnoremap : ;
" kj/jk is better than ctrl-c or esc - also autosave when leaving insert mode
inoremap kj <Esc>:w<CR>
inoremap jk <Esc>:w<CR>
inoremap jj <Esc>
" remove any trailing whitespace that is in the file
autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
" more logical vertical navigation
nnoremap <silent> k gk
nnoremap <silent> j gj
" make copy/pasting nice
function! ToggleMouse()
if &mouse == 'a'
set mouse=r
set nonu
else
set mouse=a
set nu
endif
endfunction
nnoremap <leader>m :call ToggleMouse()<CR>
" map Clip Board to General Clip Board
set clipboard=unnamed
" use <tab> to trigger completion and navigate to the next complete item
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <Tab>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr> <Tab> coc#pum#visible() ? coc#pum#next(1) : "\<Tab>"
inoremap <expr> <S-Tab> coc#pum#visible() ? coc#pum#prev(1) : "\<S-Tab>"