-
Notifications
You must be signed in to change notification settings - Fork 2
/
init.vim
187 lines (142 loc) · 3.65 KB
/
init.vim
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
" plugins {{{
" plugin management (https://github.com/junegunn/vim-plug) {{{
call plug#begin('~/.local/share/nvim/plugged')
" workflow
Plug 'ratmav/ctrlp.vim'
Plug 'ratmav/marv'
Plug 'ratmav/nerdtree'
Plug 'ratmav/syfe'
Plug 'ratmav/vim-bufkill'
Plug 'ratmav/vim-maximizer'
Plug 'ratmav/winresizer.vim'
Plug 'ratmav/vim-fugitive'
Plug 'sindrets/diffview.nvim'
" display
Plug 'nvim-tree/nvim-web-devicons'
Plug 'ratmav/vim-gitgutter'
Plug 'ratmav/gruvbox'
Plug 'ratmav/rainbow_parentheses.vim'
Plug 'ratmav/vim-airline'
" langs
Plug 'ratmav/vim-ps1'
call plug#end()
" }}}
" vim-airline {{{
let g:airline_section_b = "%{fnamemodify(getcwd(), ':t\')} %{airline#extensions#branch#get_head()}"
let g:airline_section_x = "l(%{line('.')}/%{line('$')}) c(%{virtcol('.')})"
let g:airline_section_y = "%{&fileformat}[%{&encoding}]"
" }}}
" rainbow parentheses {{{
augroup rainbow_parentheses
autocmd!
autocmd BufEnter * RainbowParentheses
augroup END
" }}}
" ctrl-p {{{
let g:ctrlp_show_hidden = 1
let g:ctrlp_max_files = 0
let g:ctrlp_custom_ignore = '\v\.git|node_modules'
" }}}
" nerdtree:
let g:NERDTreeShowHidden = 1
" }}}
" behavior {{{
" use the system clipboard by default:
set clipboard=unnamedplus
" no mouse:
set mouse-=a
" no backups:
set nobackup
set nowritebackup
" no swap:
set noswapfile
" code folding:
set foldmethod=syntax
set foldcolumn=2
set foldlevelstart=100
" autoindent width:
set expandtab
set shiftwidth=2
set softtabstop=2
" backspace should behave like other applications:
set backspace=2
" disable sql omnicomplete, which is tied to <c-c> for some reason.
let g:omni_sql_no_default_maps = 1
" }}}
" display {{{
" colors
set termguicolors
colorscheme gruvbox
syntax on
" highlight current line:
set cursorline
" highlight search results:
set hlsearch
set incsearch
" display line numbers:
set number
" always show the status line:
set laststatus=2
" embedded terminal {{{
augroup terminal_settings
autocmd!
autocmd TermOpen * set bufhidden=hide
" hide line numbers in terminals:
autocmd TermOpen * setlocal nonumber norelativenumber
augroup END
" }}}
" }}}
" bindings {{{
" window management:
let g:winresizer_start_key = '<silent><C-w>r'
nnoremap <silent><C-w>z :MaximizerToggle<CR>
" buffer management {{{
nnoremap <silent><C-b>h :bn<CR>
nnoremap <silent><C-b>l :bp<CR>
nnoremap <silent><C-b>r :edit!<bar>:echo "refreshed buffer"<CR>
nnoremap <silent><C-b>q :BD!<CR>
" }}}
" embedded terminal management {{{
" if windows.
if has('win64') || has('win32')
nnoremap <silent><C-t> :terminal powershell -NoLogo<CR>
else
nnoremap <silent><C-t> :terminal<CR>
end
tnoremap <Esc> <C-\><C-n>
tnoremap <A-h> <C-\><C-N><C-w>h
tnoremap <A-j> <C-\><C-N><C-w>j
tnoremap <A-k> <C-\><C-N><C-w>k
tnoremap <A-l> <C-\><C-N><C-w>l
inoremap <A-h> <C-\><C-N><C-w>h
inoremap <A-j> <C-\><C-N><C-w>j
inoremap <A-k> <C-\><C-N><C-w>k
inoremap <A-l> <C-\><C-N><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l
" }}}
" plugins (leader-driven) {{{
" use space as leader:
let mapleader=" "
" ctrl-p {{{
nnoremap <Leader>f :CtrlP .<CR>
nnoremap <Leader>b :CtrlPBuffer<CR>
nnoremap <Leader>c :CtrlPClearCache<CR>
" }}}
" reload config:
nnoremap <silent><Leader>r :source $MYVIMRC<bar>:edit!<bar>:echo "reloaded config"<CR>
" marv {{{
nnoremap <silent><Leader>h :execute 'MarvHTML'<CR>
nnoremap <silent><Leader>p :execute 'MarvPDF'<CR>
" }}}
" nerdtree:
nnoremap <silent><Leader>n :NERDTreeToggle<CR>
" syfe:
nnoremap <silent><Leader>l :execute 'SyfeCrlfClear'<CR>
nnoremap <silent><Leader>w :execute 'SyfeWhitespaceClear'<CR>
" diffview:
nnoremap <silent><Leader>d :execute 'DiffviewOpen'<CR>
" }}}
" }}}