-
Notifications
You must be signed in to change notification settings - Fork 15
/
wim-vim
656 lines (559 loc) · 18.2 KB
/
wim-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
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
"===[ Setting up Wim ]==="
function! VimplugInstaller()
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endfunction
call VimplugInstaller()
"===[ Encoding ]==="
set encoding=utf-8
"===[ VimWiki Prefix ]==="
"has to come before the plugin is loaded
let g:vimwiki_map_prefix = '<leader>v'
let g:vimwiki_list = [{'path': '~/.vim/vimwiki'}]
"===[ Plugins ]==="
call plug#begin()
" LSP, Completion, Snippers
Plug 'sheerun/vim-polyglot'
Plug 'honza/vim-snippets'
Plug 'SirVer/ultisnips'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Colors
Plug 'catppuccin/vim', { 'as': 'catppuccin' }
Plug 'chriskempson/base16-vim'
" Web Development
Plug 'wolandark/vim-live-server'
Plug 'alvan/vim-closetag'
Plug 'ap/vim-css-color'
Plug 'DougBeney/pickachu', {'for':['css','html']}
" Git
Plug 'airblade/vim-gitgutter'
Plug 'tpope/vim-fugitive'
Plug 'rhysd/git-messenger.vim'
" Usability, Enhancements
Plug 'ryanoasis/vim-devicons'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'junegunn/vim-peekaboo'
Plug 'itchyny/lightline.vim'
Plug 'mengelbrecht/lightline-bufferline'
Plug 'voldikss/vim-floaterm'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
Plug 'godlygeek/tabular'
Plug 'markonm/traces.vim'
Plug '907th/vim-auto-save'
Plug 'mhinz/vim-startify'
Plug 'ubaldot/vim-highlight-yanked'
" Jumping Around
Plug 'rhysd/clever-f.vim'
Plug 'monkoose/vim9-stargate'
" Utility, Integrations
Plug 'ptzz/lf.vim'
Plug 'vimwiki/vimwiki'
Plug 'preservim/tagbar'
Plug 'lifepillar/vim-cheat40'
Plug 'wolandark/vimdict'
Plug 'wolandark/vim-ddgpb'
call plug#end()
"===[ Theme ]==="
set background=dark
" Inspect $TERM. Set your TERM variable to xterm-256color for good colors
if &term =~ '256color'
" Enable true (24-bit) colors instead of (8-bit) 256 colors.
if has('termguicolors')
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
let &t_TI = ""
let &t_TE = ""
set termguicolors
set mouse=a
colorscheme catppuccin_mocha
endif
else
let &t_TI = ""
let &t_TE = ""
colorscheme catppuccin_mocha
endif
if has('gui_running')
set mouse=a
set guicursor+=a:blinkon0
set guifont=FiraCodeNerdFont\ 14
colorscheme catppuccin_mocha
endif
"===[ Curosr Shape ]==="
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
"===[ Startify ]==="
let g:startify_disable_at_vimenter = 0
let g:startify_custom_header = [
\' ',
\' ██╗ ██╗██╗███╗ ███╗',
\' ██║ ██║██║████╗ ████║',
\' ██║ █╗ ██║██║██╔████╔██║',
\' ██║███╗██║██║██║╚██╔╝██║',
\' ╚███╔███╔╝██║██║ ╚═╝ ██║',
\' ╚══╝╚══╝ ╚═╝╚═╝ ╚═╝',
\ ]
let g:startify_custom_footer = split(system('fortune'), '\n') + ['','']
"Bookmarks. Syntax is clear. Add yours
let g:startify_bookmarks = [ {'B': '~/.bashrc'},{'V': '~/.vim/vimrc'}]
let g:startify_lists = [
\ { 'type': 'bookmarks' , 'header': [' Bookmarks'] } ,
\ { 'type': 'files' , 'header': [' Recent' ] } ,
\ { 'type': 'sessions' , 'header': [' Sessions' ] } ,
\ { 'type': 'commands' , 'header': [' Commands' ] } ,
\ ]
hi StartifyBracket ctermfg=240
hi StartifyFile ctermfg=147
hi StartifyFooter ctermfg=240
hi StartifyHeader ctermfg=114
hi StartifyNumber ctermfg=215
hi StartifyPath ctermfg=245
hi StartifySlash ctermfg=240
hi StartifySpecial ctermfg=240
"===[ Clipboard ]==="
set clipboard=unnamedplus,unnamed
"===[ Remember Cursor Position ]==="
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
"===[ Persistent Undo History ]==="
function! EnsureVimhisExists()
let vimhis_path = expand('~/.vim/history')
if !isdirectory(vimhis_path)
call mkdir(vimhis_path, 'p')
echo "Created directory: " . vimhis_path
" else
" echo "Directory already exists: " . vimhis_path
endif
endfunction
call EnsureVimhisExists()
if has('persistent_undo')
set undodir=$HOME/.vim/history
set undolevels=5000
set undofile
endif
set emoji
set autochdir
set hidden
set modifiable
set conceallevel=0
set concealcursor=n
set scrolloff=6
set autoread
set cmdheight=1
set foldmethod=manual
set foldlevel=0
set foldclose=all
set path+=**
set noswapfile
set autoindent
set ignorecase
set incsearch
set noerrorbells
set novisualbell
set t_vb=
set relativenumber
set number
set hlsearch
set termbidi
set autowrite
set autowriteall
set laststatus=2
set showtabline=2
set noshowmode
set colorcolumn=80
set shiftwidth=4
set tabstop=4
syntax on
filetype plugin indent on
"===[ NETRW ]==="
" Start with dotfiles hidden
let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+'
" Usual things
let g:netrw_special_syntax = 3
let g:netrw_banner = 0
let g:netrw_keepdir=0
"===[ Lightline Statusbar ]==="
let g:lightline = {
\ 'colorscheme': 'catppuccin_mocha',
\ 'active': {
\ 'right': [ [ 'lineinfo' ], [ 'percent' ], [ 'filetype' ], ['syntaxitem'], ['bufnum' ] ],
\ 'left': [ [ 'mode' ], [ 'readonly' ], [ 'absolutepath' ], [ 'modified' ], [ 'gitbranch' ] ],
\ },
\ 'component_function': {
\ 'gitbranch': 'FugitiveHead',
\ },
\ 'component': {
\ 'charvaluehex': '0x%B',
\ 'lineinfo': '%l\%L',
\ },
\ 'component_expand': {
\ 'buffers': 'lightline#bufferline#buffers'
\ },
\ 'component_type': {
\ 'buffers': 'tabsel'
\ }
\ }
let g:lightline.separator={ 'left': "\ue0b0", 'right': "\ue0b2" }
let g:lightline.subseparator={ 'left': "\ue0b1", 'right': "\ue0b3" }
"===[ SpellCheking ]==="
nnoremap <F6> :setlocal spell! spelllang=en_us<CR>
hi SpellBad ctermfg=red guifg=red
set wildmode=longest,list,full
function! FixSpell()
normal! 1z=<CR>
endfunction
nnoremap gs :call FixSpell()<CR>
"===[ Custom Mappings ]==="
let mapleader =" "
"===[ Auto Save ]==="
nnoremap <nowait>\a :call AutoSaveToggle()<CR>
" nnoremap <leader>t :FloatermToggle<CR>
nnoremap <nowait><leader>M :Maps <CR>
" Switch Buffers
nnoremap <PageUp> :bn<Cr>
nnoremap <PageDown> :bp<CR>
nnoremap <Del> :bd<CR>
" Border Around (Uses the toilet cli tool)
nnoremap <leader>\ :.!toilet -w 200 -f term -F border<CR>
" nnoremap <leader>e :Ex <CR>
nnoremap <space>e <Cmd>CocCommand explorer<CR>
nnoremap <leader>T :tabnew file <CR>
nnoremap <leader>i :Startify <CR>
nnoremap <silent><ESC> <ESC>:noh<CR><ESC>
"adding empty line above and below cursor
nnoremap <leader>S :normal! O<ESC>jo<ESC>kzzk<CR>
nnoremap <leader>[ :normal! O<ESC>j
nnoremap <leader>] :normal! o<ESC>k
"Quick save and source
nnoremap <nowait><leader>w :w!<CR>
nnoremap <leader>so :w<CR>:source %<CR>
nnoremap <leader>k :m .-2<CR>
nnoremap <leader>j :m .+1<CR>
vnoremap K :m .-2<CR>gv=gv
vnoremap J :m .+1<CR>gv=gv
inoremap <nowait> jj <ESC>
" VimPlug
nnoremap <leader>pli :PlugInstall<CR>
nnoremap <leader>plc :PlugClean<CR>
nnoremap <leader>plu :PlugUpdate<CR>
nnoremap <leader>pld :PlugUpgrade<CR>
"===[ Split Navigation ]==="
set splitbelow splitright
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
nnoremap <C-LEFT> <C-w>h
nnoremap <C-DOWN> <C-w>j
nnoremap <C-UP> <C-w>k
nnoremap <C-RIGHT> <C-w>l
nnoremap <leader>R <C-w>R "rotate window up/left
nnoremap <leader>r <C-w>r "rotate window down/right
"shift arrows to resize splits
nnoremap <s-Right> :vertical resize +5 <CR>
nnoremap <s-LEFT> :vertical resize -5 <CR>
nnoremap <s-UP> :resize +5 <CR>
nnoremap <s-DOWN> :resize -5 <CR>
"Alt arrows to go to next/previous tab
nnoremap <M-Left> :tabprevious<CR>
nnoremap <M-Right> :tabnext<CR>
"Keybindings for tab navigation with leader and number
nnoremap <leader>1 1gt
nnoremap <leader>2 2gt
nnoremap <leader>3 3gt
nnoremap <leader>4 4gt
nnoremap <leader>5 5gt
nnoremap <leader>6 6gt
nnoremap <leader>7 7gt
nnoremap <leader>8 8gt
nnoremap <leader>9 9gt
nnoremap <leader>0 :tablast<CR>
nnoremap <leader>x :tabclose<CR>
" FZF 🙂
nnoremap \c :Colors<CR>
nnoremap <nowait><leader>bu :Buffers<CR>
" nnoremap <nowait><leader>fi :Files<CR>
" nnoremap <nowait><leader>W :Windows<CR>
" nnoremap <nowait><leader>hi :History<CR>
" nnoremap <nowait><leader>hc :History:<CR>
" nnoremap <nowait><leader>rg :Rg <CR>
" nnoremap <nowait><leader>li :Lines <CR>
" nnoremap <nowait><leader>bli :BLines <CR>
" nnoremap <nowait><leader>ju :Jumps <CR>
" nnoremap <nowait><leader>ma :Marks <CR>
" nnoremap <nowait><leader>sn :Snippets <CR>
" nnoremap <nowait><leader>com :Commands <CR>
" nnoremap <nowait><leader>ag :Ag <CR>
" nnoremap <nowait><leader>tag :Tags <CR>
" Tabular
if exists(":Tabularize")
vnoremap \\ta :Tabularize /\|<CR>
endif
"===[ Enuch ]==="
nnoremap <nowait><leader>ch :Chmod +x <CR>
" nnoremap <nowait><leader>suw :SudoWrite <CR>
" nnoremap <nowait><leader>sue :SudoEdit <CR>
" nnoremap <nowait><leader>rm :Remove <CR>
" nnoremap <nowait><leader>del :Delete! <CR>
" nnoremap <nowait><leader>mv :Move
" nnoremap <nowait><leader>dup :Duplicate
" nnoremap <nowait><leader>mkd :Mkdir
"===[ Live Server ]==="
" nnoremap <F2> :StartBrowserSync <CR>
" nnoremap <F3> :KillBrowserSync <CR>
"===[ Floaterm ]==="
let g:floaterm_autoclose = 1
nnoremap \t :FloatermToggle<CR>
nnoremap \q :FloatermKill <CR>
nnoremap \n :FloatermNext<CR>
nnoremap \p :FloatermPrev<CR>
" Filemanagers
nnoremap \v :FloatermNew! vifm <CR>
nnoremap \ra :FloatermNew! ranger <CR>
" Terminal Right/Bottom
nnoremap \\tr :FloatermNew --wintype=vsplit --position=right --width=0.4 <CR>
nnoremap \\tb :FloatermNew --wintype=split --position=bottom --height=0.2 <CR>
" Run Go Files
nnoremap \rg :FloatermNew --autoclose=0 --wintype=split --position=bottom --height=0.3 go run % <Cr>
" Run Bash Files
nnoremap \rb :FloatermNew --autoclose=0 --wintype=split --position=bottom --height=0.3 bash % <CR>
" Run NodeJs Files
nnoremap \rj :FloatermNew --autoclose=0 --wintype=split --position=bottom --height=0.3 node % <CR>
" Run Python Files
nnoremap \rp :FloatermNew --autoclose=0 --wintype=split --position=bottom --height=0.3 python % <CR>
"===[ GitGutter ]==="
let g:gitgutter_enabled = 1
let g:gitgutter_sign_added = '√'
let g:gitgutter_sign_modified = '+'
let g:gitgutter_sign_removed = '×'
let g:gitgutter_sign_removed_first_line ='▲'
let g:gitgutter_sign_modified_removed = '-'
"===[ Close Tag ]==="
let g:closetag_filenames = '*.html,*xml,*.php,*.phtml,*.md'
let g:closetag_filetypes = 'html,xhtml,phtml,php,md'
let g:closetag_shortcut = '>'
"===[ Tagbar ]==="
let g:tagbar_ctags_bin = '~/.vim/uctags/bin/ctags'
"===[ Terminal ]==="
" let g:terminal_height = -10
" This wont work in neovim
" set termwinsize=10x200
nnoremap <leader>' :botright terminal<CR>
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-Down> <C-\><C-n><C-w>j
tnoremap <C-Up> <C-\><C-n><C-w>k
set shell=/bin/bash
" Clear Terminal in BG
nnoremap \l :!clear<CR><CR>
"===[ Runtime Macros ]==="
runtime macros/emoji-ab.vim
" use _j to justify
runtime macros/justify.vim
runtime macros/matchit.vim
"===[ SNIPPETS ]==="
"Use Ctrl j key to trigger the snippets, default was TAB but that conflicts with
"the Completion trigger see :h keycodes to change this to sth else
"use Ctrl j and k to move visually within the snippet that was just triggered
"Ctrl l lists the available snippets
let g:UltiSnipsExpandTrigger='<C-j>'
let g:UltiSnipsListSnippets='<C-l>'
let g:UltiSnipsJumpForwardTrigger='<C-j>'
let g:UltiSnipsJumpBackwardTrigger='<C-k>'
let g:copypath_copy_to_unnamed_register = 1
"===[ CleverF ]==="
let g:clever_f_across_no_line=1
let g:clever_f_mark_cursor=1
let g:clever_f_mark_char=1
let g:clever_f_ignore_case=0
let g:clever_f_smart_case=0
let g:clever_f_show_prompt=0
let g:clever_f_mark_char_color = "SpellBad"
let g:clever_f_mark_cursor_color = "DiffDelete"
"===[ Stargate ]==="
" For 1 character to search before showing hint
noremap \f <Cmd>call stargate#OKvim(1)<CR>
" For 2 consecutive characters to search
noremap \F <Cmd>call stargate#OKvim(2)<CR>
"===[ Disable a lot of unnecessary internal plugins ]==="
let g:loaded_2html_plugin = 1
let g:loaded_getscriptPlugin = 1
let g:loaded_gzip = 1
let g:loaded_logipat = 1
let g:loaded_rrhelper = 1
let g:loaded_spellfile_plugin = 1
let g:loaded_tarPlugin = 1
let g:loaded_vimballPlugin = 1
let g:loaded_zipPlugin = 1
"===[Coc.nvim]==="
" let g:coc_node_path = "/usr/bin/node"
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#_select_confirm() : "\<C-g>u\<CR>"
" use <tab> to trigger completion and navigate to the next complete item
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <Tab>
\ coc#pum#visible() ? coc#pum#next(1) :
\ CheckBackspace() ? "\<Tab>" :
\ coc#refresh()
inoremap <expr><s-tab> coc#pum#visible() ? coc#pum#prev(1) : "\<c-h>"
" Enhanced <CR> for pairs
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
" Disable < expansion for pairs
autocmd FileType * let b:coc_pairs_disabled = ["<"]
" on demand hover diagnostics
nnoremap <silent> <leader>? :call CocAction('diagnosticInfo') <CR>
" refresh
" nnoremap <silent><expr> \co coc#refresh()
nnoremap <silent> \rc :CocRestart<CR>
"===[ Coc-Explorer ]==="
" set up coc-explorer to open in the current directory
let g:coc_explorer_global_mirror = 0
let g:coc_explorer_disable_default_keybindings = 1
let g:coc_explorer_global_root = 'current'
nnoremap <leader>e <Cmd>CocCommand explorer<CR>
"===[ Coc Global Extensions ]==="
let g:coc_global_extensions = [
\ 'coc-explorer',
\ 'coc-tsserver',
\ 'coc-sh',
\ 'coc-vimlsp',
\ 'coc-html',
\ 'coc-css',
\ 'coc-pairs',
\ 'coc-emmet',
\ 'coc-prettier',
\ 'coc-marketplace'
\ ]
" Navigations
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)
"
" List code actions available for the current buffer
nmap <leader>ca <Plug>(coc-codeaction)
nnoremap <silent> K :call ShowDocumentation()<CR>
function! ShowDocumentation()
if CocAction('hasProvider', 'hover')
call CocActionAsync('doHover')
else
call feedkeys('K', 'in')
endif
endfunction
" Add `:Format` command to format current buffer
command! -nargs=0 Format :call CocActionAsync('format')
" Formatting selected code
vmap <leader>f <Plug>(coc-format-selected)
" coc-pairs
" disable characters for a specified filetypes
autocmd FileType markdown let b:coc_pairs_disabled = ['txt']
"===[ Coc-Snippets ]==="
"Use <C-l> for trigger snippet expand.
" imap <C-l> <Plug>(coc-snippets-expand)
"Use <C-j> for select text for visual placeholder of snippet.
"vmap <C-j> <Plug>(coc-snippets-select)
"Use <C-j> for jump to next placeholder, it's default of coc.nvim
"let g:coc_snippet_next = '<c-j>'
"Use <C-k> for jump to previous placeholder, it's default of coc.nvim
"let g:coc_snippet_prev = '<c-k>'
"Use <C-j> for both expand and jump (make expand higher priority.)
"imap <C-j> <Plug>(coc-snippets-expand-jump)
"Use <leader>x for convert visual selected code to snippet
"xmap <leader>x <Plug>(coc-convert-snippet)
"===[ Compile and Run C ]==="
nnoremap <F8> :call CompileAndRun()<CR>
function! CompileAndRun()
let current_file = expand('%')
let file_name = fnamemodify(current_file, ':t:r')
let compile_cmd = 'gcc ' . current_file . ' -o ' . file_name . ' && ./' . file_name
execute '!'.compile_cmd
endfunction
"===[ Execute From Vim ]==="
function! CodeRunner()
if &ft ==# 'python'
execute 'RPy'
elseif &ft ==# 'sh'
execute 'RB'
elseif &ft ==# 'javascript'
execute 'RJs'
elseif &ft ==# 'go'
execute 'RGo'
endif
endfunction
" Define several language specific Run commands
augroup code_runner
au!
au FileType python command! RPy :!python3 %
au FileType sh command! RB :!bash %
au FileType javascript command! RJs :!node %
au FileType go command! RGo :!go run %
nnoremap <F12> :call CodeRunner()<CR>
augroup end
"===[ ZWNJ ]==="
"call matchadd('Conceal', '\%u200c', 10, -1, {'conceal':'|'})
"set conceallevel=2 concealcursor=nv
"=== [ Bilingual Settings ] ==="
let g:alt_keymap = 'persian'
let g:alt_enabled = 0
function! CallToggleKeymap()
if g:alt_enabled
call ToggleKeymap()
endif
endfunction
function! ToggleKeymap()
if &keymap == ''
execute 'setlocal keymap=' . g:alt_keymap
silent !echo -ne "\033]12;cyan\007"
redraw!
autocmd VimLeave * silent !echo -ne "\033]112\007"
else
set keymap=
silent !echo -ne "\033]112\007"
redraw!
endif
endfunction
command! SwitchKeymap call CallToggleKeymap()
function! ListKeymapFiles()
:Explore $VIMRUNTIME/keymap/
endfunction
" Bilingual Mappings
inoremap <C-p> <C-o>:SwitchKeymap<CR>
nnoremap <C-p> :SwitchKeymap<CR>
"===[ Abbreviations ]==="
iab sh: #!/bin/sh
iab bsh: #!/usr/bin/env bash
iab pys: #!/usr/bin/env python
iab br <br>
iab Lorem Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent at
\ massa et est vulputate sollicitudin vitae at libero. Pellentesque iaculis neque
\ diam, vulputate tempor est ullamcorper quis. Lorem ipsum dolor sit amet, consectetur
\ adipiscing elit. Vivamus sed purus risus. Nunc vitae augue sit amet magna semper
\ efficitur quis at erat. Suspendisse commodo sem at neque feugiat auctor. Praesent
\ pretium tellus odio. Integer a facilisis nibh. Duis hendrerit nibh quis turpis
\ vulputate aliquam id quis nibh. Suspendisse ut quam quis arcu sodales luctus.
\ Ut id sagittis ex. Praesent facilisis velit blandit dictum luctus. Cras in erat
\ malesuada nisi dignissim tempus. Ut in placerat tortor.
"===[ LF ]==="
let g:lf_map_keys = 0
let g:lf_width = 100
let g:lf_height = 40
nnoremap <leader>lf :Lf<CR>
"===[ Custom Cheat40.txt ]==="
let g:cheat40_use_default = 0