-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc.bak
333 lines (322 loc) · 11.1 KB
/
.vimrc.bak
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" ██╗ ██╗██╗███╗ ███╗██████╗ ██████╗
" ██║ ██║██║████╗ ████║██╔══██╗██╔════╝
" ██║ ██║██║██╔████╔██║██████╔╝██║
" ╚██╗ ██╔╝██║██║╚██╔╝██║██╔══██╗██║
" ╚████╔╝ ██║██║ ╚═╝ ██║██║ ██║╚██████╗
" ╚═══╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝
"
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" DEFAULT SETTINGS-------------------------------------------------------- {{{
source $VIMRUNTIME/defaults.vim
" INITIAL SETTINGS-------------------------------------------------------- {{{
" set background=dark
" colorscheme dracula
set title titlestring=
set relativenumber number
set mouse=a
set mousehide
set ttyfast
set clipboard=unnamedplus
set hidden
set tabstop=2
set shiftwidth=2
set softtabstop=2
set noerrorbells
set visualbell t_vb=
set noswapfile
set splitright
set splitbelow
set showtabline=4
set autoindent
set smartindent
set backspace=indent,eol,start
set nocompatible
set wildmode=longest,list,full
set showmatch
set autochdir
set hlsearch
set incsearch
set list
set fillchars+=vert:\
set listchars=tab:\ \ ┊
" hi SpecialKey ctermfg=236 ctermbg=none
set ignorecase
set confirm
set linebreak
set cmdheight=1
set ruler
set scrolloff=10
set history=1000
set nowrap
set textwidth=80
set colorcolumn=+1
set cursorline
hi clear CursorLine
hi CursorLine ctermbg=None
hi clear CursorLineNr
"hi CursorLineNr ctermfg=10
hi CursorLineNr ctermfg=Green
set guicursor=a:blinkon1
syntax on
syntax enable
set omnifunc=syntaxcomplete
set omnifunc=htmlcomplete
set omnifunc=csscomplete
set omnifunc=javascriptcomplete
set omnifunc=pythoncomplete
set omnifunc=cppcomplete
set omnifunc=ccomplete
filetype on
filetype indent on
set spell
set spelllang=en_us
" hi SpellLocal ctermfg=red ctermbg=236
" hi SpellBad ctermfg=red ctermbg=236
" hi SpellCap ctermfg=red ctermbg=236
" hi SpellCap ctermfg=red ctermbg=236
" hi SpellBad ctermfg=red ctermbg=236
" hi SpellLocal ctermfg=red ctermbg=236
hi CocFloating ctermbg=236
hi CocPMenu ctermbg=236
hi EndOfBuffer ctermfg=Green
hi NonText ctermfg=Green
hi VertSplit ctermfg=Green ctermbg=Green
hi PmenuSel ctermfg=White ctermbg=236
" SHORTCUTS======S---------------------------------------------------------{{{
"Using Control Key:
inoremap <c-j> <Down>
inoremap <c-k> <Up>
inoremap <c-h> <Left>
inoremap <c-l> <Right>
nnoremap <C-q> :q!<CR>
nnoremap <c-b> :%bd\|e#<CR>
nnoremap <C-s> :w!<CR>
nnoremap <C-t> :below vertical terminal<CR>
nnoremap <C-d> :Lex<CR>
nnoremap <C-c> :close<CR>
" nnoremap <C-a> :Startify<CR>
nnoremap <C-w> <C-W>w
nnoremap <S-TAB> :bprevious<CR>
nnoremap <TAB> :bnext<CR>
nnoremap <C-h> :help<CR>
nnoremap <C-u> :call CompileRun()<CR>
nnoremap o o<ESC>
nnoremap O O<ESC>
" noremap <Up> <Nop>
" noremap <Down> <Nop>
" noremap <Left> <Nop>
" noremap <Right> <Nop>
" Using Leader Key:
let mapleader = "\<Space>"
tnoremap <Leader>ma ./
nnoremap <Leader>sh :sh <CR>
nnoremap <Leader>sw :set wrap <CR>
nnoremap <Leader>sn :set nowrap <CR>
nnoremap <Leader>ss :w! <CR>
nnoremap <Leader>cl :!clear <CR>
nnoremap <Leader>ff :find
nnoremap <Leader>re :%s/
nnoremap <Leader>ll :vertical resize +2<CR>
nnoremap <Leader>rr :vertical resize -2<CR>
nnoremap <Leader>sp zg
nnoremap <Leader>ps zug
nnoremap <Leader>bb 0
nnoremap <Leader>ee $
nnoremap <Leader>re <C-r> <CR>
nnoremap <Leader>sa ggVG
nnoremap <Leader>hh :help<CR>
nnoremap <Leader>tp :tabprevious<CR>
nnoremap <Leader>tn :tabnext<CR>
nnoremap <Leader>tc :tabclose<CR>
nnoremap <Leader>to :tabonly<CR>
nnoremap <Leader>tb :tab ball<CR>
nnoremap <Leader>tt :terminal<CR>
nnoremap <Leader>vb :vertical ball<CR>
nnoremap <Leader>vs :vertical split<CR>
nnoremap <Leader>ls :ls<CR>
nnoremap <Leader>dd L<CR>zz<CR>
nnoremap <Leader>bp :bprevious<CR>
nnoremap <Leader>bn :bnext<CR>
nnoremap <Leader>bd :bdelete<CR>
nnoremap <Leader>bo :%bd\|e#<CR>
nnoremap <Leader>nh :noh<CR>
nnoremap <Leader>py :!clear; python3 %<CR>
nnoremap <Leader>no :w !node<CR>
nnoremap <Leader>so :source %<CR>
nnoremap <Leader>sv :source $MYVIMRC<CR>
nnoremap <Leader>mc :w <CR> :!gcc % -o %< <CR>
nnoremap <Leader>mp :w <CR> :!g++ % -o %< <CR>
nnoremap <Leader>cc :!clear <CR> :!gcc % -o %<&& ./%< <CR>
nnoremap <Leader>pp :!clear <CR> :!g++ % -o %<&& ./%< <CR>
nnoremap <Leader>vi :tab new ~/.vimrc<CR>
nnoremap <Leader>da :1read !date<CR>
nnoremap <Leader>ht :read ~/.vim/templates/html5.html<CR>
nnoremap <Leader>ct :read ~/.vim/templates/c.c<CR>
inoremap <expr> <cr> coc#pum#visible() ? coc#_select_confirm() : "\<CR>"
inoremap <silent><expr> <C-y> coc#pum#visible() ? coc#pum#confirm() : "\<C-y>"
" STATUS LINE ------------------------------------------------------------ {{{
hi normalcolor guifg=white guibg=green ctermbg=46 ctermfg=White cterm=bold
hi insertcolor guifg=white guibg=cyan ctermbg=51 ctermfg=White cterm=bold
hi replacecolor guifg=white guibg=maroon1 ctermbg=165 ctermfg=White cterm=bold
hi commandcolor guifg=white guibg=yellow ctermbg=11 ctermfg=White cterm=bold
hi visualcolor guifg=white guibg=orange ctermbg=202 ctermfg=White cterm=bold
set statusline=
set statusline+=%#insertcolor#%{(mode()=='i')?'\ \ INSERT\ ':''}
set statusline+=%#replacecolor#%{(mode()=='r')?'\ \ REPLACE\ ':''}
set statusline+=%#commandcolor#%{(mode()=='c')?'\ \ COMMAND\ ':''}
set statusline+=%#visualcolor#%{(mode()=='v')?'\ \ VISUAL\ ':''}
set statusline+=%#normalcolor#%{(mode()=='n')?'\ \ NORMAL\ ':''}
set statusline+=%#PmenuSel#
set statusline+=\[%n]
set statusline+=\ CWD:\%{getcwd()}
set statusline+=\/%f
set statusline+=\ STATUS\ %{coc#status()}%{get(b:,'coc_current_function','')}
set statusline+=%=
set statusline+=[%M]
set statusline+=\%{&fileformat}
set statusline+=\ %{strlen(&fenc)?&fenc:'none'}
set statusline+=\ %Y
set statusline+=\ %{strftime('%d\-%b\-%y')}
set statusline+=\ W:\%{wordcount().words}
set statusline+=\ D:\%b\ R:\%l/%l\ C:\%c\ %p%%\
set laststatus=2
autocmd User CocStatusChange redrawstatus
" CONFIGURATIONS ----------------------------------------------------- {{{
let g:netrw_liststyle = 0
let g:netrw_banner = 0
let g:netrw_winsize = 20
let g:netrw_browse_split = 3
let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu"
" let g:ascii = [
" \' ███╗░░██╗░█████╗░██████╗░██╗░░░██╗██╗███╗░░░███╗',
" \' ████╗░██║██╔══██╗██╔══██╗██║░░░██║██║████╗░████║',
" \' ██╔██╗██║███████║██║░░██║╚██╗░██╔╝██║██╔████╔██║',
" \' ██║╚████║██╔══██║██║░░██║░╚████╔╝░██║██║╚██╔╝██║',
" \' ██║░╚███║██║░░██║██████╔╝░░╚██╔╝░░██║██║░╚═╝░██║',
" \' ╚═╝░░╚══╝╚═╝░░╚═╝╚═════╝░░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝',
" \]
"
" let g:startify_custom_header = g:ascii
" let g:startify_custom_footer = startify#fortune#boxed()
" let g:startify_lists = [
" \ { 'header': [' MRU:'], 'type': 'files' },
" \ { 'header': [' MRU: '. getcwd()], 'type': 'dir' },
" \ { 'header': [' Bookmarks:'], 'type': 'bookmarks' },
" \ { 'header': [' Commands:'], 'type': 'commands' },
" \ ]
"
" let g:startify_bookmarks = [
" \ { 'a': '~/.vim/backup/.zshrc.bak' },
" \ { 'b': '~/.vim/backup/.vimrc.bak' },
" \ { 'p': '~/.vim/templates/c.c' },
" \ { 'u': '~/.vim/templates/html5.html' },
" \ { 'v': '~/.vimrc' },
" \ { 'z': '~/.zshrc' },
" \ ]
"
" let g:startify_commands = [
" \ {'d': ['<directory>',':Lex']},
" \ {'h': ['<help>',':below vertical help']},
" \ {'l': ['<layout>',':Lex|:wincmd l|:below vertical terminal']},
" \ {'t': ['<terminal>',':below vertical terminal']},
" \ ]
"
" hi StartifyHeader guifg=Green ctermfg=Green
" hi StartifyFooter guifg=Green ctermfg=Green
"
" FUNCTIONS ------------------------------------------------------------ {{{
" function BufferMiddle()
" lefta vnew
" wincmd w
" exec 'vertical resize '. string(&columns *0.80)
" endfunction
"
" nnoremap <Leader>bm :call BufferMiddle()<CR>
let s:comment_map = {
\ "c": '\/\/',
\ "cpp": '\/\/',
\ "javascript": '\/\/',
\ "lua": '--',
\ "python": '#',
\ "zsh": '#',
\ "sh": '#',
\ "vim": '"',
\ }
function! ToggleComment()
if has_key(s:comment_map, &filetype)
let comment_leader = s:comment_map[&filetype]
if getline('.') =~ "^\\s*" . comment_leader . " "
" Uncomment the line
execute "silent s/^\\(\\s*\\)" . comment_leader . " /\\1/"
else
if getline('.') =~ "^\\s*" . comment_leader
" Uncomment the line
execute "silent s/^\\(\\s*\\)" . comment_leader . "/\\1/"
else
" Comment the line
execute "silent s/^\\(\\s*\\)/\\1" . comment_leader . " /"
end
end
else
echo "No comment leader found for filetype"
end
endfunction
vnoremap <leader>gc :call ToggleComment()<cr>
vnoremap <leader>gu :call ToggleComment()<cr>
" function MyTabLine()
" let s = ''
" for i in range(tabpagenr('$'))
" if i + 1 == tabpagenr()
" let s .= '%#TabLineSel#'
" else
" let s .= '%#TabLine#'
" endif
"
" let s .= '%' . (i + 1) . 'T'
"
" let s .= ' %{MyTabLabel(' . (i + 1) . ')} '
" endfor
"
" let s .= '%#TabLineFill#%T'
"
" if tabpagenr('$') > 1
" let s .= '%=%#TabLine#%999Xclose'
" endif
"
" return s
" endfunction
"
" function MyTabLabel(n)
" let buflist = tabpagebuflist(a:n)
" let winnr = tabpagewinnr(a:n)
" return buflist[winnr - 1] . ') ' . bufname(buflist[winnr - 1])
" endfunction
"
" :set tabline=%!MyTabLine()
function CompileRun()
if &filetype == 'python'
exec "!python3 %"
elseif &filetype == 'cpp'
exec "!gcc % -o %<&& ./%<"
elseif &filetype == 'c'
exec "!cc % -o %<&& ./%<"
" exec "!gcc % -o %<&& ./%<"
elseif &filetype == 'javascript'
exec "!node %"
elseif &filetype == 'sh'
exec "!sh %"
endif
endfunction
nnoremap <leader>cr :call CompileRun()<CR>
" function SetIndent()
" if &filetype == 'html'
" setlocal tabstop=2
" setlocal shiftwidth=2
" setlocal softtabstop=2
" setlocal showtabline=2
" endif
" endfunction
"
" nnoremap <leader>si :call SetIndent()<CR>