From: ma Date: Wed, 17 Mar 2021 20:43:28 +0000 (+0100) Subject: Initial commit X-Git-Url: https://git.beaudet.xyz/?a=commitdiff_plain;h=e6b7cd967044ff492f28e6b3c80931e16546967c;p=vim.git Initial commit --- e6b7cd967044ff492f28e6b3c80931e16546967c diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2af9275 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,18 @@ +[submodule "pack/tpope/start/vim-surround"] + path = pack/tpope/start/vim-surround + url = https://github.com/tpope/vim-surround +[submodule "pack/tpope/start/vim-commentary"] + path = pack/tpope/start/vim-commentary + url = https://github.com/tpope/vim-commentary +[submodule "pack/tpope/start/vim-fugitive"] + path = pack/tpope/start/vim-fugitive + url = https://github.com/tpope/vim-fugitive +[submodule "pack/tpope/start/vim-unimpaired"] + path = pack/tpope/start/vim-unimpaired + url = https://github.com/tpope/vim-unimpaired +[submodule "pack/tpope/start/vim-vinegar"] + path = pack/tpope/start/vim-vinegar + url = https://github.com/tpope/vim-vinegar +[submodule "pack/tpope/start/vim-sensible"] + path = pack/tpope/start/vim-sensible + url = https://github.com/tpope/vim-sensible diff --git a/after/ftplugin/mail.vim b/after/ftplugin/mail.vim new file mode 100644 index 0000000..987f78a --- /dev/null +++ b/after/ftplugin/mail.vim @@ -0,0 +1,2 @@ +setlocal spell +let b:undo_ftplugin .= '|setlocal spell<' diff --git a/after/ftplugin/qf.vim b/after/ftplugin/qf.vim new file mode 100644 index 0000000..ba29ce2 --- /dev/null +++ b/after/ftplugin/qf.vim @@ -0,0 +1,2 @@ +nnoremap :colder +nnoremap :cnewer diff --git a/after/ftplugin/rust.vim b/after/ftplugin/rust.vim new file mode 100644 index 0000000..8af88f5 --- /dev/null +++ b/after/ftplugin/rust.vim @@ -0,0 +1,43 @@ +setlocal path+=.,src/ +setlocal path+=$RUST_SRC_PATH +setlocal path-=/usr/include +setlocal tags=tags;/ +setlocal tags+=rusty-tags.vi;/ +setlocal tags+=$RUST_SRC_PATH/tags +compiler cargo +let maplocalleader = "\" + +" nnoremap ,c +" \ :make c +" +" nnoremap ,c +" \ :compiler cargo +" +" nnoremap ,r +" \ :compiler rustc + +" setlocal tags=./rusty-tags.vi;/,$RUST_SRC_PATH/rusty-tags.vi +" setlocal tags=./tags,.git/hooks/tags +" +" nnoremap t :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw! +" + +autocmd QuickfixCmdPost [^l]* nested cwindow + +nnoremap c + \ :make clippy +nnoremap b + \ :make b +nnoremap t + \ :make t +nnoremap r + \ :make r +nnoremap f + \ :make fmt + +let b:undo_ftplugin .= '|setlocal makeprg< errorformat<' + \ . '|nunmap b' + \ . '|nunmap c' + \ . '|nunmap t' + \ . '|nunmap r' + \ . '|nunmap f' diff --git a/autoload/ccr.vim b/autoload/ccr.vim new file mode 100644 index 0000000..85d5673 --- /dev/null +++ b/autoload/ccr.vim @@ -0,0 +1,39 @@ +" make list-like commands more intuitive +function! CCR() + let cmdline = getcmdline() + if cmdline =~ '\v\C^(ls|files|buffers)' + " like :ls but prompts for a buffer command + return "\:b" + elseif cmdline =~ '\v\C/(#|nu|num|numb|numbe|number)$' + " like :g//# but prompts for a command + return "\:" + elseif cmdline =~ '\v\C^(dli|il)' + " like :dlist or :ilist but prompts for a count for :djump or :ijump + return "\:" . cmdline[0] . "j " . split(cmdline, " ")[1] . "\\" + elseif cmdline =~ '\v\C^(cli|lli)' + " like :clist or :llist but prompts for an error/location number + return "\:sil " . repeat(cmdline[0], 2) . "\" + elseif cmdline =~ '\C^old' + " like :oldfiles but prompts for an old file to edit + set nomore + return "\:sil se more|e #<" + elseif cmdline =~ '\C^changes' + " like :changes but prompts for a change to jump to + set nomore + return "\:sil se more|norm! g;\" + elseif cmdline =~ '\C^ju' + " like :jumps but prompts for a position to jump to + set nomore + return "\:sil se more|norm! \\" + elseif cmdline =~ '\C^marks' + " like :marks but prompts for a mark to jump to + return "\:norm! `" + elseif cmdline =~ '\C^undol' + " like :undolist but prompts for a change to undo + return "\:u " + else + return "\" + endif +endfunction + +cnoremap CCR() diff --git a/ftdetect/irssilog b/ftdetect/irssilog new file mode 100644 index 0000000..da379f0 --- /dev/null +++ b/ftdetect/irssilog @@ -0,0 +1 @@ +autocmd BufNewFile,BufRead */irc/*.log setfiletype irssilog diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim new file mode 100644 index 0000000..e71eb36 --- /dev/null +++ b/ftplugin/rust.vim @@ -0,0 +1,3 @@ +let g:rust_fold = 1 +let g:rustfmt_autosave = 1 +let g:ftplugin_rust_source_path = $HOME . '/dev/rust' diff --git a/pack/tpope/start/vim-commentary b/pack/tpope/start/vim-commentary new file mode 160000 index 0000000..f8238d7 --- /dev/null +++ b/pack/tpope/start/vim-commentary @@ -0,0 +1 @@ +Subproject commit f8238d70f873969fb41bf6a6b07ca63a4c0b82b1 diff --git a/pack/tpope/start/vim-fugitive b/pack/tpope/start/vim-fugitive new file mode 160000 index 0000000..d73fe3c --- /dev/null +++ b/pack/tpope/start/vim-fugitive @@ -0,0 +1 @@ +Subproject commit d73fe3c1920576c10e18d8245b860e29e55a6813 diff --git a/pack/tpope/start/vim-sensible b/pack/tpope/start/vim-sensible new file mode 160000 index 0000000..2d9f34c --- /dev/null +++ b/pack/tpope/start/vim-sensible @@ -0,0 +1 @@ +Subproject commit 2d9f34c09f548ed4df213389caa2882bfe56db58 diff --git a/pack/tpope/start/vim-surround b/pack/tpope/start/vim-surround new file mode 160000 index 0000000..f51a26d --- /dev/null +++ b/pack/tpope/start/vim-surround @@ -0,0 +1 @@ +Subproject commit f51a26d3710629d031806305b6c8727189cd1935 diff --git a/pack/tpope/start/vim-unimpaired b/pack/tpope/start/vim-unimpaired new file mode 160000 index 0000000..4afbe5e --- /dev/null +++ b/pack/tpope/start/vim-unimpaired @@ -0,0 +1 @@ +Subproject commit 4afbe5ebf32ad85341b4c02b0e1d8ca96a64c561 diff --git a/pack/tpope/start/vim-vinegar b/pack/tpope/start/vim-vinegar new file mode 160000 index 0000000..b245f3a --- /dev/null +++ b/pack/tpope/start/vim-vinegar @@ -0,0 +1 @@ +Subproject commit b245f3ab4580eba27616a5ce06a56d5f791e67bd diff --git a/plugin/strip_trailing_whitespace.vim b/plugin/strip_trailing_whitespace.vim new file mode 100644 index 0000000..e062e27 --- /dev/null +++ b/plugin/strip_trailing_whitespace.vim @@ -0,0 +1,12 @@ +function StripTrailingWhitespace() + if !&binary && &filetype != 'diff' + normal mz + normal Hmy + %s/\s\+$//e + normal 'yz + normal `z + endif +endfunction + +nnoremap StripTrailingWhitespace + \ :call StripTrailingWhitespace() diff --git a/viminfo b/viminfo new file mode 100644 index 0000000..e69de29 diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..fed727a --- /dev/null +++ b/vimrc @@ -0,0 +1,28 @@ +let mapleader="\\" + +set hidden + +set number +set relativenumber + +set encoding=utf-8 + +set shiftwidth=4 +let &softtabstop = &shiftwidth +set expandtab + +set wildignore+=tags,cscope.out +set wildignorecase + +if executable('rg') + set grepprg=rg\ --vimgrep +endif + +set statusline=%<\ %f\ %m%r%y%w%=\ L:\ \%l\/\%L\ C:\ \%c\ + +nnoremap gb :ls:b +nnoremap b :buffer * +nnoremap e :edit **/* +nnoremap f :find * + +nnoremap cr :call ccr#CCR()