add vim-lastplace

This commit is contained in:
AJ ONeal
2021-03-15 19:41:36 +00:00
parent 68a56df529
commit 541bf110df
4 changed files with 81 additions and 0 deletions

28
vim-lastplace/README.md Normal file
View File

@@ -0,0 +1,28 @@
---
title: vim-lastplace
homepage: https://github.com/farmergreg/vim-lastplace
tagline: |
vim-lastplace - Intelligently reopen files at your last edit position in Vim.
---
To update (replacing the current version) run `webi vim-lastplace`.
## Cheat Sheet
> `vim-lastplace` will resume your cursor to its last position when you re-open
> a file, including re-opening folds as needed.
Simply put: installing this plugin will cause your cursor to be put back where
you expect it when switching between files.
### How to remove lastplace
```vim
rm -rf ~/.vim/pack/plugins/start/vim-lastplace
```
### How to configure manually
See
<https://vim.fandom.com/wiki/Restore_cursor_to_file_position_in_previous_editing_session>
and <https://github.com/farmergreg/vim-lastplace>

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env pwsh
New-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start" -ItemType Directory -Force
Remove-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start\vim-lastplace" -Recurse -ErrorAction Ignore
& git clone --depth=1 https://github.com/farmergreg/vim-lastplace.git "$Env:USERPROFILE\.vim\pack\plugins\start\vim-lastplace"

36
vim-lastplace/install.sh Normal file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
function __init_vim_lastplace() {
set -e
set -u
mkdir -p "$HOME/.vim/pack/plugins/start"
rm -rf "$HOME/.vim/pack/plugins/start/vim-lastplace"
git clone --depth=1 https://github.com/farmergreg/vim-lastplace.git "$HOME/.vim/pack/plugins/start/vim-lastplace"
if [ ! -f "$HOME/.vimrc" ]; then
touch "$HOME/.vimrc"
fi
mkdir -p ~/.vim/plugins
if ! [ -f "$HOME/.vim/plugins/lastplace.vim" ]; then
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
curl -fsSL -o ~/.vim/plugins/lastplace.vim "$WEBI_HOST/packages/vim-lastplace/lastplace.vim"
fi
if ! grep 'source.*plugins.lastplace.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then
set +e
mkdir -p ~/.vim/plugins
printf '\n" lastplace: explicit defaults from webinstall.dev/vim-lastplace\n' >> ~/.vimrc
printf 'source ~/.vim/plugins/lastplace.vim\n' >> ~/.vimrc
set -e
echo ""
echo "add ~/.vim/plugins/lastplace.vim"
echo "updated ~/.vimrc with 'source ~/.vim/plugins/lastplace.vim'"
fi
echo ""
echo "vim-lastplace enabled with explicit defaults"
}
__init_vim_lastplace

View File

@@ -0,0 +1,11 @@
" For more configuration details read the source at
" https://github.com/farmergreg/vim-lastplace/blob/master/plugin/vim-lastplace.vim
" configure what file types to ignore
let g:lastplace_ignore = "gitcommit,gitrebase,svn,hgcommit"
" configure buffer types to ignore
let g:lastplace_ignore_buftype = "quickfix,nofile,help"
" automatically open folds when jumping to the last edit position
let g:lastplace_open_folds = 0