Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 1 | set whichwrap=b,s,<,>,[,] |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame] | 2 | set mouse= |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 3 | |
Skyler Grey | bca7996 | 2022-11-02 08:50:13 +0000 | [diff] [blame] | 4 | vnoremap <silent> <C-k> :m-2<CR>gv |
| 5 | vnoremap <silent><expr> <C-j> ":m+" . (line("'>") - line("'<") + 1) . "\<CR>gv" |
| 6 | nnoremap <silent> <C-k> :m-2<CR> |
| 7 | nnoremap <silent> <C-j> :m+1<CR> |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 8 | |
Skyler Grey | 0c024ef | 2022-10-31 00:17:14 +0000 | [diff] [blame] | 9 | vmap <F12> <Esc> |
| 10 | imap <F12> <Esc> |
| 11 | nmap <F12> <Esc> |
| 12 | tmap <F12> <C-C> |
| 13 | cmap <F12> <Esc> |
| 14 | omap <F12> <Esc> |
| 15 | smap <F12> <Esc> |
Skyler Grey | f819460 | 2022-10-31 00:07:05 +0000 | [diff] [blame] | 16 | |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 17 | vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR> |
| 18 | |
Skyler Grey | 3c6b6d6 | 2022-09-04 21:53:42 +0100 | [diff] [blame] | 19 | augroup 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 Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame] | 23 | if !isdirectory(a:dir) && !(a:dir =~ "^suda:///.*$") |
Skyler Grey | 3c6b6d6 | 2022-09-04 21:53:42 +0100 | [diff] [blame] | 24 | \ && (a:force |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame] | 25 | \ || input("'" . a:dir . "' does not exist. Create? [y/N]: ") =~? '^y\%[es]$') |
Skyler Grey | 3c6b6d6 | 2022-09-04 21:53:42 +0100 | [diff] [blame] | 26 | call mkdir(iconv(a:dir, &encoding, &termencoding), 'p') |
| 27 | endif |
| 28 | endfunction |
| 29 | augroup END |
| 30 | " https://stackoverflow.com/a/42872275/12293760 |
| 31 | |
Skyler Grey | ee47c9f | 2022-09-05 07:01:33 +0100 | [diff] [blame] | 32 | augroup 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 |
| 40 | augroup END |
| 41 | |
Skyler Grey | 091a22c | 2022-11-05 10:10:38 +0000 | [diff] [blame] | 42 | command! W w |
| 43 | command! Wq wq |
| 44 | call g:SetupCommandAlias("rg","Rg") |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 45 | |
| 46 | set ignorecase |
| 47 | set smartcase |
| 48 | |
| 49 | set expandtab |
Skyler Grey | ee47c9f | 2022-09-05 07:01:33 +0100 | [diff] [blame] | 50 | |
| 51 | let g:cursorhold_updatetime = 1000 |
| 52 | autocmd CursorHoldI,CursorHold,BufLeave ?* silent! update |
Skyler Grey | 55f8455 | 2022-09-05 11:04:39 +0100 | [diff] [blame] | 53 | |
| 54 | set viewoptions-=options |
| 55 | autocmd BufWinLeave ?* silent! mkview! |
| 56 | |
Skyler Grey | f819460 | 2022-10-31 00:07:05 +0000 | [diff] [blame] | 57 | set nofoldenable |
| 58 | autocmd BufWinEnter ?* silent! loadview |
Skyler Grey | e42f435 | 2022-10-30 23:09:36 +0000 | [diff] [blame] | 59 | |
| 60 | tnoremap <Esc><Esc> <C-\><C-n> |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame] | 61 | |
| 62 | let g:camelcasemotion_key = '<leader>m' |
Skyler Grey | bca7996 | 2022-11-02 08:50:13 +0000 | [diff] [blame] | 63 | |
Skyler Grey | 25f875f | 2022-11-02 08:59:18 +0000 | [diff] [blame] | 64 | nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>:redraw!<CR>" |
Skyler Grey | bca7996 | 2022-11-02 08:50:13 +0000 | [diff] [blame] | 65 | nnoremap <nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" |
| 66 | nnoremap <silent> <C-d> <C-d>:redraw!<CR> |