blob: ad36b972e0d03ee8afc7a9e482fbc6e4d901cca0 [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 Grey0c024ef2022-10-31 00:17:14 +00009vmap <F12> <Esc>
10imap <F12> <Esc>
11nmap <F12> <Esc>
12tmap <F12> <C-C>
13cmap <F12> <Esc>
14omap <F12> <Esc>
15smap <F12> <Esc>
Skyler Greyf8194602022-10-31 00:07:05 +000016
Skyler Greya7feb6e2022-08-26 06:51:55 +010017vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
18
Skyler Grey3c6b6d62022-09-04 21:53:42 +010019augroup vimrc-auto-mkdir
20 autocmd!
21 autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang)
22 function! s:auto_mkdir(dir, force)
Skyler Grey8fd63d02022-10-31 00:26:44 +000023 if !isdirectory(a:dir) && !(a:dir =~ "^suda:///.*$")
Skyler Grey3c6b6d62022-09-04 21:53:42 +010024 \ && (a:force
Skyler Grey8fd63d02022-10-31 00:26:44 +000025 \ || input("'" . a:dir . "' does not exist. Create? [y/N]: ") =~? '^y\%[es]$')
Skyler Grey3c6b6d62022-09-04 21:53:42 +010026 call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
27 endif
28 endfunction
29augroup END
30" https://stackoverflow.com/a/42872275/12293760
31
Skyler Greyee47c9f2022-09-05 07:01:33 +010032augroup vimrc-auto-neoformat
33 autocmd!
34 autocmd BufWritePre * call s:auto_neoformat(v:cmdbang)
35 function! s:auto_neoformat(force)
36 if a:force
37 Neoformat
38 endif
39 endfunction
40augroup END
41
Skyler Grey091a22c2022-11-05 10:10:38 +000042command! W w
43command! Wq wq
44call g:SetupCommandAlias("rg","Rg")
Skyler Greya7feb6e2022-08-26 06:51:55 +010045
46set ignorecase
47set smartcase
48
49set expandtab
Skyler Greyee47c9f2022-09-05 07:01:33 +010050
51let g:cursorhold_updatetime = 1000
52autocmd CursorHoldI,CursorHold,BufLeave ?* silent! update
Skyler Grey55f84552022-09-05 11:04:39 +010053
54set viewoptions-=options
55autocmd BufWinLeave ?* silent! mkview!
56
Skyler Greyf8194602022-10-31 00:07:05 +000057set nofoldenable
58autocmd BufWinEnter ?* silent! loadview
Skyler Greye42f4352022-10-30 23:09:36 +000059
60tnoremap <Esc><Esc> <C-\><C-n>
Skyler Grey8fd63d02022-10-31 00:26:44 +000061
62let g:camelcasemotion_key = '<leader>m'
Skyler Greybca79962022-11-02 08:50:13 +000063
Skyler Grey25f875f2022-11-02 08:59:18 +000064nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>:redraw!<CR>"
Skyler Greybca79962022-11-02 08:50:13 +000065nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
66nnoremap <silent> <C-d> <C-d>:redraw!<CR>