-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
173 lines (150 loc) · 3.89 KB
/
vimrc
File metadata and controls
173 lines (150 loc) · 3.89 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
" plugin
call plug#begin("~/.vim/plugged")
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'airblade/vim-gitgutter'
call plug#end()
" plugin: coc
let g:coc_node_path = "~/.nvm/versions/node/v16.15.0/bin/node"
" plugin: gitgutter
let g:gitgutter_enabled=1
" settings
filetype on
filetype plugin on
filetype indent on
set autoread
set backspace=indent,eol,start
set confirm
set hidden
set history=1000
set path+=**10
set nobackup
set nocompatible
set noerrorbells
set visualbell
set noswapfile
set shortmess+=c
set showcmd
set showmatch
set showmode
set updatetime=100
set wildignorecase
set wildignore+=*.git,*.tags,*.doc,*.doc,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx,*.swp
" settings: color options
set background=dark
colorscheme hybrid_material
set t_Co=256
" settings: completion options
set complete+=k
set complete-=i
set completeopt=longest,menuone
set omnifunc=syntaxcomplete#Complete
set wildmenu
set wildmode=list,full
" settings: fold options
set nofoldenable
" settings: indention options
set autoindent
set expandtab
set shiftround
set shiftwidth=4
set smarttab
set tabstop=4
" settings: performance options
set lazyredraw
" settings: search options
set hlsearch
set ignorecase
set incsearch
set smartcase
set showmatch
" settings: text rendering options
nohlsearch
set encoding=utf-8
set linebreak
set scrolloff=10
set sidescrolloff=10
set nowrap
syntax enable
syntax on
" settings: ui options
set cursorline
set laststatus=2
set number
set relativenumber
set signcolumn=yes
set splitright
set splitbelow
" mapping: basic options
execute "set <A-h>=\eh"
execute "set <A-j>=\ej"
execute "set <A-k>=\ek"
execute "set <A-l>=\el"
let mapleader = " "
cnoremap <c-k> <esc>
inoremap <c-k> <esc>
vnoremap <c-k> <esc>
nnoremap , <esc>:
nnoremap <leader>q :q <cr>
nnoremap <leader>Q :q! <cr>
nnoremap <leader>w :w <cr>
nnoremap <leader>W :w! <cr>
nnoremap j gj
nnoremap k gk
" mapping: buffers
nnoremap <leader>bb :buffers<cr>:buffer<space>
nnoremap <leader>bd :bdelete<cr>
nnoremap <silent>{ :bprevious<cr>
nnoremap <silent>} :bnext<cr>
" mapping: files
function! g:Fgrep(args) abort
execute ":silent grep -r " . a:args . " **" | redraw!
endfunction
command -nargs=+ -complete=command Filegrep call g:Fgrep(<q-args>)
nnoremap <leader>ff :find **/
nnoremap <leader>fe :edit **/
nnoremap <leader>fg :Filegrep<space>
nnoremap <leader>fr :%s/
nnoremap <leader>fv :vimgrep<space>
nnoremap <leader>fx :Ex<cr>
" mapping: panes
nnoremap <leader>sh :sp<cr>
nnoremap <leader>sv :vs<cr>
nnoremap <silent><c-h> :wincmd h<cr>
nnoremap <silent><c-j> :wincmd j<cr>
nnoremap <silent><c-k> :wincmd k<cr>
nnoremap <silent><c-l> :wincmd l<cr>
"nnoremap <A-up> :resize -2<cr>
"nnoremap <A-down> :resize +2<cr>
"nnoremap <A-left> :vertical resize -2<cr>
"nnoremap <A-left> :vertical resize +2<cr>
" mapping: lines
nnoremap <A-h> 0
nnoremap <A-l> $
nnoremap <A-k> :m .-2<cr>==
nnoremap <A-j> :m .+1<cr>==
nnoremap o o<esc>D<esc>
nnoremap O O<esc>D<esc>
" mapping: quick fix windows
nnoremap <leader>cw :vert cwindow <cr><c-w>=<cr>
nnoremap <silent><leader>cc :cclose <cr>
nnoremap <leader>cf :cfirst <cr>
nnoremap <leader>cl :clast <cr>
nnoremap <leader>co :copen <cr>
nnoremap <silent>[c :cprevious<cr>
nnoremap <silent>]c :cnext <cr>
" mapping: terminal
nnoremap <leader>th :term <cr>
nnoremap <leader>tv :vert term <cr>
" mapping: vim file
nnoremap <silent><leader>ve :vs $MYVIMRC<cr>
nnoremap <silent><leader>vs :so $MYVIMRC<cr>
" mapping: toggle, helpers
nnoremap <silent><bslash>_ :set cursorline! <cr>
nnoremap <silent><bslash>\| :set cursorcolumn!<cr>
nnoremap <silent><bslash>/ :noh<cr>
nnoremap <silent><bslash>+ :execute 'set colorcolumn=' . (&colorcolumn == '' ? '80' : '')<cr>
nnoremap <silent><bslash>r :set rnu! <cr>
nnoremap <silent><bslash>l :set list! <cr>
" mapping: auto completion
inoremap <expr> <tab> pumvisible() ? "\<c-n>" : "\<tab>"
inoremap <expr> <s-tab> pumvisible() ? "\<c-p>" : "\<s-tab>"