-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path.vimrc
More file actions
235 lines (186 loc) · 5.25 KB
/
.vimrc
File metadata and controls
235 lines (186 loc) · 5.25 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
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
" __ ___
" \ \ / (_)_ __ ___
" \ \ / /| | '_ ` _ \
" \ V / | | | | | | |
"(.) \_/ |_|_| |_| |_|rc
" vim config file
" https://github.com/cherrynoize/dotfiles
" author: cherrynoize
"
" if alt key does not send escape try adding to .Xresources
" URxvt*altSendsEscape: true
" xterm*altSendsEscape: true
" <m-key> instead of <esc>key should also work
"if &shell =~# 'fish$' " if using fish
se shell=sh " revert shell to sh
"endif
" appearance
""""""""""""
" syntax highlighting
syntax on
" tabline
"hi TabLineFill ctermfg=LightBlue ctermbg=DarkBlue
"hi TabLine ctermfg=Black ctermbg=White
" window counter per tab
"hi Title ctermfg=Black
" colors
"se termguicolors
"se background=dark
se signcolumn=yes
" line width marker
se colorcolumn=80
" custom modes
au BufNewFile,BufRead /*.rasi setf css
" switch between hybrid/absolute line numbers with different modes
:se relativenumber
:se number
:augroup numbertoggle
: autocmd!
: autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu && mode() != "i" | set rnu | endif
: autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif
:augroup END
" don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
" selection
"""""""""""
" select with shift + cursor keys
se keymodel=startsel
se keymodel=startsel,stopsel
" behaviour
"""""""""""
" make cw behave like it should
se cpoptions-=_
" search defaults to case sensitive if pattern contains
" an uppercase character
se ignorecase smartcase
" disable search highlighting
se nohlsearch
" backspace, del, c-w and c-u behavior
se backspace=indent,eol,start " run over pretty much everything
" no line wraparound
se nowrap
" se which characters wrap around lines
se whichwrap+=<,>,[,]
" highlight cursor line
se cursorline
" indentation
"""""""""""""
" tab size
se tabstop=2
" indent size
se shiftwidth=2
" show tab as spaces
se expandtab
" indent automatically
se autoindent
" filetypes
"""""""""""
" auto-detect filetype and load plugin and indent files
filetype plugin indent on
" define modes
"autocmd FileType sh setlocal shiftwidth=2 tabstop=2
"autocmd FileType fish setlocal shiftwidth=2 tabstop=2
"autocmd FileType rasi setlocal shiftwidth=2 tabstop=2
"autocmd FileType c setlocal shiftwidth=2 tabstop=2
"autocmd FileType lua setlocal shiftwidth=2 tabstop=2
autocmd FileType python setlocal shiftwidth=4 tabstop=4
" edit
""""""
" use clipboard for copy/paste
set clipboard+=unnamedplus
" undo
inoremap <c-Z> <cmd>:undo<cr>
" rebind to delete instead of cut
nnoremap x i<del><c-o><cmd>stopinsert<cr>
" replicate original x keybinding (cut char)
nnoremap <esc>x vd
" paste before current line
nnoremap <c-p> 0i<cr><esc>kP
" paste after current line
nnoremap <c-n> 0ji<cr><esc>kP
" insert single character
nnoremap <esc>i i <esc>r
" insert whitespace
"nnoremap <esc><space> i<space><c-o><cmd>stopinsert<cr>
" insert backspace
"nnoremap <esc><bs> i<bs><c-o><cmd>stopinsert<cr>
" copy word
inoremap <c-c> <esc>yiwea
vnoremap <c-c> <esc>yiwea
" delete till the beginning of a word
" (<c-h> is <c-bs>)
"nnoremap <c-h> db
inoremap <c-h> <c-w>
" delete till the end of a word
"nnoremap <c-del> de
inoremap <c-del> <c-o>de
" duplicate line
inoremap <c-d> <cmd>:copy+0<cr>
noremap <esc>d <cmd>:copy+0<cr>
" append newline after current line
nnoremap <cr> o<esc>
" insert newline character at cursor
nnoremap <esc><cr> i<cr><esc>
" delete from last newline up to cursor
nnoremap <esc>o d0i<bs><c-o><cmd>stopinsert<cr>
" append to all selected lines
vnoremap A :s/$/
" search and replace
""""""""""""""""""""
" toggle search highlighting and move to next match
noremap <f3> <cmd>se hlsearch!<cr>
inoremap <f3> <cmd>se hlsearch!<cr>
" indent
""""""""
" align on equals sign
vnoremap <esc>= :! column -t -s= -o=<cr>
nnoremap <esc>= Vk:! column -t -s= -o=<cr>2$
" buffer navigation
"""""""""""""""""""
" move to beginning/end of paragraph
noremap è {
noremap ò }
" buffer editing
""""""""""""""""
" open buffer command menu
nnoremap <f12> :buffers<cr>:buffer<space>
" workflow
""""""""""
" move between windows
nnoremap <esc>h <c-w>h
nnoremap <esc>j <c-w>j
nnoremap <esc>k <c-w>k
nnoremap <esc>l <c-w>l
" open new empty tab
nnoremap <esc>t :tabe<cr>
" move to next tab
nnoremap <esc><Tab> gt
inoremap <esc><Tab> <esc>gt<cr>
" move to previous tab
nnoremap <S-Tab> gT
inoremap <S-Tab> <esc>gT<cr>
" close current window
nnoremap <esc>c :clo<cr>
" close tab
nnoremap <esc>w :tabc<cr>
" window splitting
se splitright splitbelow
" session and file handling
"""""""""""""""""""""""""""
" save file
"nnoremap <c-s> <cmd>w!<cr>
"inoremap <c-s> <cmd>w<cr>
nnoremap <esc>s <cmd>w<cr>
" write all and save default session
"nnoremap <esc>s :wa!<cr>:mksession! ~/.vim/sessions/main.vim<cr>
" save and close all files
nnoremap <esc>q <cmd>qa<cr>
"nnoremap <esc>q :xa<cr>
nnoremap <esc>Q <cmd>q!<cr>
" codeium
"""""""""""""""""""""""""""
inoremap <script><silent><nowait><expr> <c-f> codeium#Accept()
" vim: sw=2:ts=2