blob: 916f3bc1d00003929354d96c9067ac01732ea5b3 [file] [log] [blame]
Skyler Greya7feb6e2022-08-26 06:51:55 +01001set whichwrap=b,s,<,>,[,]
Skyler Grey8fd63d02022-10-31 00:26:44 +00002set mouse=
Skyler Greye9e45852022-10-31 00:16:58 +00003
Skyler Greybca79962022-11-02 08:50:13 +00004vnoremap <silent> <C-k> :m-2<CR>gv
5vnoremap <silent><expr> <C-j> ":m+" . (line("'>") - line("'<") + 1) . "\<CR>gv"
6nnoremap <silent> <C-k> :m-2<CR>
7nnoremap <silent> <C-j> :m+1<CR>
Skyler Greya7feb6e2022-08-26 06:51:55 +01008
Skyler Grey7faf5cb2023-02-21 10:27:05 +00009nnoremap <C-d> <C-d>zz
10nnoremap <C-b> <C-b>zz
11
12nnoremap <C-u> <C-u>zz
13nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>zz:redraw!<CR>"
14
15nnoremap N Nzz
16nnoremap n nzz
17
Skyler Grey0c024ef2022-10-31 00:17:14 +000018vmap <F12> <Esc>
19imap <F12> <Esc>
20nmap <F12> <Esc>
21tmap <F12> <C-C>
22cmap <F12> <Esc>
23omap <F12> <Esc>
24smap <F12> <Esc>
Skyler Greyf8194602022-10-31 00:07:05 +000025
Skyler Greya7feb6e2022-08-26 06:51:55 +010026vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
27
Skyler Grey3c6b6d62022-09-04 21:53:42 +010028augroup vimrc-auto-mkdir
29 autocmd!
30 autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang)
31 function! s:auto_mkdir(dir, force)
Skyler Grey8fd63d02022-10-31 00:26:44 +000032 if !isdirectory(a:dir) && !(a:dir =~ "^suda:///.*$")
Skyler Grey3c6b6d62022-09-04 21:53:42 +010033 \ && (a:force
Skyler Grey8fd63d02022-10-31 00:26:44 +000034 \ || input("'" . a:dir . "' does not exist. Create? [y/N]: ") =~? '^y\%[es]$')
Skyler Grey3c6b6d62022-09-04 21:53:42 +010035 call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
36 endif
37 endfunction
38augroup END
39" https://stackoverflow.com/a/42872275/12293760
40
Skyler Greyee47c9f2022-09-05 07:01:33 +010041augroup vimrc-auto-neoformat
42 autocmd!
43 autocmd BufWritePre * call s:auto_neoformat(v:cmdbang)
44 function! s:auto_neoformat(force)
45 if a:force
46 Neoformat
47 endif
48 endfunction
49augroup END
50
Skyler Grey091a22c2022-11-05 10:10:38 +000051command! W w
52command! Wq wq
53call g:SetupCommandAlias("rg","Rg")
Skyler Greya7feb6e2022-08-26 06:51:55 +010054
55set ignorecase
56set smartcase
57
58set expandtab
Skyler Greyee47c9f2022-09-05 07:01:33 +010059
60let g:cursorhold_updatetime = 1000
61autocmd CursorHoldI,CursorHold,BufLeave ?* silent! update
Skyler Grey55f84552022-09-05 11:04:39 +010062
63set viewoptions-=options
64autocmd BufWinLeave ?* silent! mkview!
65
Skyler Greyf8194602022-10-31 00:07:05 +000066set nofoldenable
67autocmd BufWinEnter ?* silent! loadview
Skyler Greye42f4352022-10-30 23:09:36 +000068
69tnoremap <Esc><Esc> <C-\><C-n>
Skyler Grey8fd63d02022-10-31 00:26:44 +000070
71let g:camelcasemotion_key = '<leader>m'
Skyler Greybca79962022-11-02 08:50:13 +000072
Skyler Greybca79962022-11-02 08:50:13 +000073nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
74nnoremap <silent> <C-d> <C-d>:redraw!<CR>