Initial commit
authorma <ma@beaudet.xyz>
Wed, 17 Mar 2021 20:43:28 +0000 (21:43 +0100)
committerma <ma@beaudet.xyz>
Wed, 17 Mar 2021 20:43:28 +0000 (21:43 +0100)
16 files changed:
.gitmodules [new file with mode: 0644]
after/ftplugin/mail.vim [new file with mode: 0644]
after/ftplugin/qf.vim [new file with mode: 0644]
after/ftplugin/rust.vim [new file with mode: 0644]
autoload/ccr.vim [new file with mode: 0644]
ftdetect/irssilog [new file with mode: 0644]
ftplugin/rust.vim [new file with mode: 0644]
pack/tpope/start/vim-commentary [new submodule]
pack/tpope/start/vim-fugitive [new submodule]
pack/tpope/start/vim-sensible [new submodule]
pack/tpope/start/vim-surround [new submodule]
pack/tpope/start/vim-unimpaired [new submodule]
pack/tpope/start/vim-vinegar [new submodule]
plugin/strip_trailing_whitespace.vim [new file with mode: 0644]
viminfo [new file with mode: 0644]
vimrc [new file with mode: 0644]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..2af9275
--- /dev/null
@@ -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 (file)
index 0000000..987f78a
--- /dev/null
@@ -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 (file)
index 0000000..ba29ce2
--- /dev/null
@@ -0,0 +1,2 @@
+nnoremap <buffer> <Left> :colder<CR>
+nnoremap <buffer> <Right> :cnewer<CR>
diff --git a/after/ftplugin/rust.vim b/after/ftplugin/rust.vim
new file mode 100644 (file)
index 0000000..8af88f5
--- /dev/null
@@ -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 = "\<Space>"
+
+" nnoremap <buffer> ,c
+"             \ :<C-U>make c<CR>
+" 
+"  nnoremap <buffer> ,c
+"             \ :<C-U>compiler cargo<CR>
+" 
+" nnoremap <buffer> ,r
+"             \ :<C-U>compiler rustc<CR>
+
+" setlocal tags=./rusty-tags.vi;/,$RUST_SRC_PATH/rusty-tags.vi
+" setlocal tags=./tags,.git/hooks/tags
+" 
+" nnoremap <leader>t :silent! exec "!rusty-tags vi --quiet --start-dir=" . expand('%:p:h') . "&" | redraw!
+"
+
+autocmd QuickfixCmdPost [^l]* nested cwindow
+
+nnoremap <buffer> <localleader>c
+            \ :<C-U>make clippy<CR>
+nnoremap <buffer> <localleader>b
+            \ :<C-U>make b<CR>
+nnoremap <buffer> <localleader>t
+            \ :<C-U>make t<CR>
+nnoremap <buffer> <localleader>r
+            \ :<C-U>make r<CR>
+nnoremap <buffer> <localleader>f
+            \ :<C-U>make fmt<CR>
+
+let b:undo_ftplugin .= '|setlocal makeprg< errorformat<'
+            \ . '|nunmap <buffer> <localleader>b'
+            \ . '|nunmap <buffer> <localleader>c'
+            \ . '|nunmap <buffer> <localleader>t'
+            \ . '|nunmap <buffer> <localleader>r'
+            \ . '|nunmap <buffer> <localleader>f'
diff --git a/autoload/ccr.vim b/autoload/ccr.vim
new file mode 100644 (file)
index 0000000..85d5673
--- /dev/null
@@ -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 "\<CR>:b"
+    elseif cmdline =~ '\v\C/(#|nu|num|numb|numbe|number)$'
+        " like :g//# but prompts for a command
+        return "\<CR>:"
+    elseif cmdline =~ '\v\C^(dli|il)'
+        " like :dlist or :ilist but prompts for a count for :djump or :ijump
+        return "\<CR>:" . cmdline[0] . "j  " . split(cmdline, " ")[1] . "\<S-Left>\<Left>"
+    elseif cmdline =~ '\v\C^(cli|lli)'
+        " like :clist or :llist but prompts for an error/location number
+        return "\<CR>:sil " . repeat(cmdline[0], 2) . "\<Space>"
+    elseif cmdline =~ '\C^old'
+        " like :oldfiles but prompts for an old file to edit
+        set nomore
+        return "\<CR>:sil se more|e #<"
+    elseif cmdline =~ '\C^changes'
+        " like :changes but prompts for a change to jump to
+        set nomore
+        return "\<CR>:sil se more|norm! g;\<S-Left>"
+    elseif cmdline =~ '\C^ju'
+        " like :jumps but prompts for a position to jump to
+        set nomore
+        return "\<CR>:sil se more|norm! \<C-o>\<S-Left>"
+    elseif cmdline =~ '\C^marks'
+        " like :marks but prompts for a mark to jump to
+        return "\<CR>:norm! `"
+    elseif cmdline =~ '\C^undol'
+        " like :undolist but prompts for a change to undo
+        return "\<CR>:u "
+    else
+        return "\<CR>"
+    endif
+endfunction
+
+cnoremap <expr> <CR> CCR()
diff --git a/ftdetect/irssilog b/ftdetect/irssilog
new file mode 100644 (file)
index 0000000..da379f0
--- /dev/null
@@ -0,0 +1 @@
+autocmd BufNewFile,BufRead */irc/*.log setfiletype irssilog
diff --git a/ftplugin/rust.vim b/ftplugin/rust.vim
new file mode 100644 (file)
index 0000000..e71eb36
--- /dev/null
@@ -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 (submodule)
index 0000000..f8238d7
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f8238d70f873969fb41bf6a6b07ca63a4c0b82b1
diff --git a/pack/tpope/start/vim-fugitive b/pack/tpope/start/vim-fugitive
new file mode 160000 (submodule)
index 0000000..d73fe3c
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit d73fe3c1920576c10e18d8245b860e29e55a6813
diff --git a/pack/tpope/start/vim-sensible b/pack/tpope/start/vim-sensible
new file mode 160000 (submodule)
index 0000000..2d9f34c
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 2d9f34c09f548ed4df213389caa2882bfe56db58
diff --git a/pack/tpope/start/vim-surround b/pack/tpope/start/vim-surround
new file mode 160000 (submodule)
index 0000000..f51a26d
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit f51a26d3710629d031806305b6c8727189cd1935
diff --git a/pack/tpope/start/vim-unimpaired b/pack/tpope/start/vim-unimpaired
new file mode 160000 (submodule)
index 0000000..4afbe5e
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 4afbe5ebf32ad85341b4c02b0e1d8ca96a64c561
diff --git a/pack/tpope/start/vim-vinegar b/pack/tpope/start/vim-vinegar
new file mode 160000 (submodule)
index 0000000..b245f3a
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit b245f3ab4580eba27616a5ce06a56d5f791e67bd
diff --git a/plugin/strip_trailing_whitespace.vim b/plugin/strip_trailing_whitespace.vim
new file mode 100644 (file)
index 0000000..e062e27
--- /dev/null
@@ -0,0 +1,12 @@
+function StripTrailingWhitespace()
+       if !&binary && &filetype != 'diff'
+               normal mz
+               normal Hmy
+               %s/\s\+$//e
+               normal 'yz<CR>
+               normal `z
+       endif
+endfunction
+
+nnoremap <Plug>StripTrailingWhitespace
+       \ :<C-U>call <SID>StripTrailingWhitespace()<CR>
diff --git a/viminfo b/viminfo
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/vimrc b/vimrc
new file mode 100644 (file)
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<CR>:b<Space>
+nnoremap <leader>b :buffer *
+nnoremap <leader>e :edit **/*
+nnoremap <leader>f :find *
+
+nnoremap <leader>cr :call ccr#CCR()