blob: 83df6b07aa8578c0c51503de0381f0d4616e8824 [file] [log] [blame]
Skyler Greya7feb6e2022-08-26 06:51:55 +01001set whichwrap=b,s,<,>,[,]
Skyler Greye9e45852022-10-31 00:16:58 +00002" set mouse=a
3
4nmap <C-k> :m-2<CR>
5nmap <C-j> :m+1<CR>
Skyler Greya7feb6e2022-08-26 06:51:55 +01006
Skyler Greyf8194602022-10-31 00:07:05 +00007vnoremap <F12> <Esc>
8inoremap <F12> <Esc>
9nnoremap <F12> <Esc>
10tnoremap <F12> <C-C>
11cnoremap <F12> <Esc>
12onoremap <F12> <Esc>
13snoremap <F12> <Esc>
14
Skyler Greya7feb6e2022-08-26 06:51:55 +010015vnoremap // y/\V<C-R>=escape(@",'/\')<CR><CR>
16
17fun! SetupCommandAlias(from, to)
18 exec 'cnoreabbrev <expr> '.a:from
19 \ .' ((getcmdtype() is# ":" && getcmdline() is# "'.a:from.'")'
20 \ .'? ("'.a:to.'") : ("'.a:from.'"))'
21endfun
22
Skyler Grey3c6b6d62022-09-04 21:53:42 +010023augroup vimrc-auto-mkdir
24 autocmd!
25 autocmd BufWritePre * call s:auto_mkdir(expand('<afile>:p:h'), v:cmdbang)
26 function! s:auto_mkdir(dir, force)
27 if !isdirectory(a:dir)
28 \ && (a:force
29 \ || input("'" . a:dir . "' does not exist. Create? [y/N]") =~? '^y\%[es]$')
30 call mkdir(iconv(a:dir, &encoding, &termencoding), 'p')
31 endif
32 endfunction
33augroup END
34" https://stackoverflow.com/a/42872275/12293760
35
Skyler Greyee47c9f2022-09-05 07:01:33 +010036augroup vimrc-auto-neoformat
37 autocmd!
38 autocmd BufWritePre * call s:auto_neoformat(v:cmdbang)
39 function! s:auto_neoformat(force)
40 if a:force
41 Neoformat
42 endif
43 endfunction
44augroup END
45
Skyler Greya7feb6e2022-08-26 06:51:55 +010046command W w
47command Wq wq
48call SetupCommandAlias("git","Git")
Skyler Grey55f84552022-09-05 11:04:39 +010049call SetupCommandAlias("rg","Rg")
Skyler Greya7feb6e2022-08-26 06:51:55 +010050
51set ignorecase
52set smartcase
53
54set expandtab
Skyler Greyee47c9f2022-09-05 07:01:33 +010055
56let g:cursorhold_updatetime = 1000
57autocmd CursorHoldI,CursorHold,BufLeave ?* silent! update
Skyler Grey55f84552022-09-05 11:04:39 +010058
59set viewoptions-=options
60autocmd BufWinLeave ?* silent! mkview!
61
Skyler Greyf8194602022-10-31 00:07:05 +000062set nofoldenable
63autocmd BufWinEnter ?* silent! loadview
Skyler Greye42f4352022-10-30 23:09:36 +000064
65tnoremap <Esc><Esc> <C-\><C-n>