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 | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame^] | 4 | vmap <C-k> :m-2<CR> |
| 5 | vmap <C-j> :m+1<CR> |
| 6 | nmap <C-k> :m-2<CR> |
Skyler Grey | e9e4585 | 2022-10-31 00:16:58 +0000 | [diff] [blame] | 7 | nmap <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 | |
| 19 | fun! SetupCommandAlias(from, to) |
| 20 | exec 'cnoreabbrev <expr> '.a:from |
| 21 | \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")' |
| 22 | \ .'? ("'.a:to.'") : ("'.a:from.'"))' |
| 23 | endfun |
| 24 | |
Skyler Grey | 3c6b6d6 | 2022-09-04 21:53:42 +0100 | [diff] [blame] | 25 | augroup vimrc-auto-mkdir |
| 26 | autocmd! |
| 27 | autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang) |
| 28 | function! s:auto_mkdir(dir, force) |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame^] | 29 | if !isdirectory(a:dir) && !(a:dir =~ "^suda:///.*$") |
Skyler Grey | 3c6b6d6 | 2022-09-04 21:53:42 +0100 | [diff] [blame] | 30 | \ && (a:force |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame^] | 31 | \ || input("'" . a:dir . "' does not exist. Create? [y/N]: ") =~? '^y\%[es]$') |
Skyler Grey | 3c6b6d6 | 2022-09-04 21:53:42 +0100 | [diff] [blame] | 32 | call mkdir(iconv(a:dir, &encoding, &termencoding), 'p') |
| 33 | endif |
| 34 | endfunction |
| 35 | augroup END |
| 36 | " https://stackoverflow.com/a/42872275/12293760 |
| 37 | |
Skyler Grey | ee47c9f | 2022-09-05 07:01:33 +0100 | [diff] [blame] | 38 | augroup vimrc-auto-neoformat |
| 39 | autocmd! |
| 40 | autocmd BufWritePre * call s:auto_neoformat(v:cmdbang) |
| 41 | function! s:auto_neoformat(force) |
| 42 | if a:force |
| 43 | Neoformat |
| 44 | endif |
| 45 | endfunction |
| 46 | augroup END |
| 47 | |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 48 | command W w |
| 49 | command Wq wq |
| 50 | call SetupCommandAlias("git","Git") |
Skyler Grey | 55f8455 | 2022-09-05 11:04:39 +0100 | [diff] [blame] | 51 | call SetupCommandAlias("rg","Rg") |
Skyler Grey | a7feb6e | 2022-08-26 06:51:55 +0100 | [diff] [blame] | 52 | |
| 53 | set ignorecase |
| 54 | set smartcase |
| 55 | |
| 56 | set expandtab |
Skyler Grey | ee47c9f | 2022-09-05 07:01:33 +0100 | [diff] [blame] | 57 | |
| 58 | let g:cursorhold_updatetime = 1000 |
| 59 | autocmd CursorHoldI,CursorHold,BufLeave ?* silent! update |
Skyler Grey | 55f8455 | 2022-09-05 11:04:39 +0100 | [diff] [blame] | 60 | |
| 61 | set viewoptions-=options |
| 62 | autocmd BufWinLeave ?* silent! mkview! |
| 63 | |
Skyler Grey | f819460 | 2022-10-31 00:07:05 +0000 | [diff] [blame] | 64 | set nofoldenable |
| 65 | autocmd BufWinEnter ?* silent! loadview |
Skyler Grey | e42f435 | 2022-10-30 23:09:36 +0000 | [diff] [blame] | 66 | |
| 67 | tnoremap <Esc><Esc> <C-\><C-n> |
Skyler Grey | 8fd63d0 | 2022-10-31 00:26:44 +0000 | [diff] [blame^] | 68 | |
| 69 | let g:camelcasemotion_key = '<leader>m' |