-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvim-vimrc
More file actions
193 lines (149 loc) · 4.99 KB
/
vim-vimrc
File metadata and controls
193 lines (149 loc) · 4.99 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
" enable backspace
set backspace=indent,eol,start
" set default encoding
set encoding=utf8
" disable create backup file on save
set nobackup
set nowritebackup
" disable vi compatibility
set nocompatible
" hide current mode in the command line
set noshowmode
" disable swap file creation
set noswapfile
" disable line wrap
set nowrap
" enable mouse in all modes
set mouse=a
" use shift + arrows to start visual mode
set keymodel=startsel
" highlight current line
set cursorline
" show line numbers
set number
set numberwidth=5
" hide filename on tab bar
set showtabline=0
" always show the status line
set laststatus=2
" configure status line
let g:modes={
\ 'n' : 'NORMAL',
\ 'no' : 'NORMAL,OP',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',
\ "\<C-v>" : 'V-BLOCK',
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '^S' : 'S-BLOCK',
\ 'i' : 'INSERT',
\ 'R' : 'REPLACE',
\ 'Rv' : 'V-REPLACE',
\ 'c' : 'COMMAND',
\ 'cv' : 'VIM EX',
\ 'ce' : 'EX',
\ 'r' : 'PROMPT',
\ 'rm' : 'MORE',
\ 'r?' : 'CONFIRM',
\ '!' : 'SHELL',
\ 't' : 'TERMINAL'
\}
set statusline=
set statusline+=\ " space
set statusline+=\ " space
set statusline+=%{g:modes[mode()]} " mode
set statusline+=\ " space
set statusline+=\ " space
set statusline+=\ " space
set statusline+=\ " space
set statusline+=\ " space
set statusline+=%F " file name
set statusline+=%= " align right
set statusline+=%l " current line number
set statusline+=\: " separator
set statusline+=%L " total line number
set statusline+=\ " space
set statusline+=\ " space
" hide line and column number in the command line
set noruler
" hide partial commands in the command line
set noshowcmd
" prevent echoing the file name in the command line
set shortmess+=FW
" show diagnostics and code actions icons over the line number
set signcolumn=number
" allow to keep the buffer unsaved in the background
set hidden
" cursor shape
let &t_SI="\<Esc>[4 q"
let &t_EI="\<Esc>[2 q"
" leader key
let mapleader="\<Space>"
" tabs
set autoindent
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
" whitespace characters
set listchars=space:·,tab:»\ ,trail:·
set nolist
" customize auto-complete popup
set completeopt=menuone,noinsert,noselect,popup
set pumheight=8
set pumwidth=8
set pummaxwidth=64
" enable reading .vimrc from the current directory
set exrc
" disable bell sounds
set belloff=all
" change splits direction
set splitbelow
set splitright
" change vertical separator
set fillchars+=vert:█
" syntax highlighting
syntax on
filetype plugin indent on
" show opened filename in the console title
set title
set titlestring=vim:\ %t
" theme
colorscheme habamax
" buffer keymaps
nnoremap <silent> <Tab> :bn<CR>
nnoremap <silent> <S-Tab> :bp<CR>
nnoremap <silent> <Leader>bd :bd<CR>
" window keymaps
nnoremap <silent> <Leader><Leader> <C-w>w
nnoremap <silent> <Leader>ww <C-w>w
nnoremap <silent> <Leader>wc <C-w>c
nnoremap <silent> <Leader>wh :<C-u>split<CR>
nnoremap <silent> <Leader>wv :<C-u>vsplit<CR>
" use enter to clear last search highlighting
nnoremap <silent> <CR> :noh<CR><CR>
" fzf keymap
nnoremap <silent> <Leader>p :call fzf#vim#files('', fzf#vim#with_preview({ 'options': [ '--prompt', '> ', '--layout', 'reverse', '--border', '--style', 'full', '--preview-window', 'right,70%', '--border-label', ' ' . expand('%:p:h') . ' ' ] }), 1)<CR>
nnoremap <silent> <Leader>P :call fzf#vim#files(expand('%:p:h'), fzf#vim#with_preview({ 'options': [ '--prompt', '> ', '--layout', 'reverse', '--border', '--style', 'full', '--preview-window', 'right,70%', '--border-label', ' ' . expand('%:p:h') . ' ' ] }), 1)<CR>
nnoremap <silent> <Leader>gs :call fzf#vim#gitfiles('?', { 'options': [ '--prompt', '> ', '--layout', 'reverse', '--border', '--style', 'full', '--preview-window', 'bottom,75%', '--border-label', ' Changes ' ] }, 1)<CR>
" reset kitty padding
autocmd VimEnter * execute 'silent! !kitten @ set-spacing padding=0'
autocmd VimLeave * execute 'silent! !kitten @ set-spacing padding=5'
" fzf configuration
let g:fzf_vim={}
let g:fzf_vim.command_prefix='Fzf'
" add plugins
call plug#begin('~/.vim/plug-plugins')
" editorconfig support
Plug 'editorconfig/editorconfig-vim'
" language packs
Plug 'sheerun/vim-polyglot'
" fzf integration
Plug 'junegunn/fzf', {'do': { -> fzf#install() }}
Plug 'junegunn/fzf.vim'
call plug#end()
" install missing plugins when opening vim
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | source $MYVIMRC | q
\| endif