add vim-viminfo

This commit is contained in:
AJ ONeal
2021-03-22 05:52:50 +00:00
parent c702f475a3
commit 68a56df529
3 changed files with 89 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
---
title: vim-viminfo
homepage: https://webinstall.dev/vim-viminfo
tagline: |
viminfo keeps track of Vim's state when switching between files
---
To update (replacing the current version) run `webi vim-viminfo`.
## Cheat Sheet
> ~/.viminfo stores cursor position, copy and paste buffers, command history,
> and a few other goodies. The defaults aren't always good, and should be
> tweaked.
In an age where we have terabytes of storage (rather than kilobytes of storage),
it makes sense to bump the size of Vim's copy buffers to match the full size of
largest code file you're likely to come across, and somewhere between several
hours and a few days worth of history.
This one-line plugin does just that.
### How to install manually
Create the file `~/.vim/plugins/viminfo.vim`. Add the same contents as
<https://github.com/webinstall/webi-installers/blob/master/vim-viminfo/viminfo.vim>.
That will look something like this:
```vim
" Tell vim to remember certain things when we exit
" '100 : marks will be remembered for up to 100 previously edited files
" "20000: will save up to 20,000 lines for each register
" :200 : up to 200 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='100,\"20000,:200,%,n~/.viminfo
```
Then `~/.vimrc` should be updated to include it:
```vim
" viminfo: reasonable defaults from webinstall.dev/vim-viminfo
source ~/.vim/plugins/viminfo.vim
```
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
function __init_vim_viminfo() {
set -e
set -u
mkdir -p "$HOME/.vim/plugins"
rm -rf "$HOME/.vim/plugins/viminfo.vim"
echo ""
if [ ! -e "$HOME/.vimrc" ]; then
touch "$HOME/.vimrc"
fi
if ! [ -f "$HOME/.vim/plugins/viminfo.vim" ]; then
mkdir -p ~/.vim/plugins
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsS -o ~/.vim/plugins/viminfo.vim "$WEBI_HOST/packages/vim-viminfo/viminfo.vim"
fi
if ! grep 'source.*plugins.viminfo.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
set +e
mkdir -p ~/.vim/plugins
printf '\n" Vim Info: reasonable defaults (buffers, history, etc) from webinstall.dev/vim-viminfo\n' >> ~/.vimrc
printf 'source ~/.vim/plugins/viminfo.vim\n' >> ~/.vimrc
set -e
echo "added ~/.vim/plugins/viminfo.vim"
echo "updated ~/.vimrc with 'source ~/.vim/plugins/viminfo.vim'"
echo ""
fi
echo "vim-info enabled with reasonable defaults"
}
__init_vim_viminfo
+7
View File
@@ -0,0 +1,7 @@
" Tell vim to remember certain things when we exit
" '100 : marks will be remembered for up to 100 previously edited files
" "20000: will save up to 20,000 lines for each register
" :200 : up to 200 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='100,\"20000,:200,%,n~/.viminfo