From 541bf110df267071ca3faa41daef5e855c35d160 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 15 Mar 2021 19:41:36 +0000 Subject: [PATCH] add vim-lastplace --- vim-lastplace/README.md | 28 ++++++++++++++++++++++++++++ vim-lastplace/install.ps1 | 6 ++++++ vim-lastplace/install.sh | 36 ++++++++++++++++++++++++++++++++++++ vim-lastplace/lastplace.vim | 11 +++++++++++ 4 files changed, 81 insertions(+) create mode 100644 vim-lastplace/README.md create mode 100644 vim-lastplace/install.ps1 create mode 100644 vim-lastplace/install.sh create mode 100644 vim-lastplace/lastplace.vim diff --git a/vim-lastplace/README.md b/vim-lastplace/README.md new file mode 100644 index 0000000..192f58c --- /dev/null +++ b/vim-lastplace/README.md @@ -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 + +and diff --git a/vim-lastplace/install.ps1 b/vim-lastplace/install.ps1 new file mode 100644 index 0000000..749d400 --- /dev/null +++ b/vim-lastplace/install.ps1 @@ -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" diff --git a/vim-lastplace/install.sh b/vim-lastplace/install.sh new file mode 100644 index 0000000..fa9e82c --- /dev/null +++ b/vim-lastplace/install.sh @@ -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 diff --git a/vim-lastplace/lastplace.vim b/vim-lastplace/lastplace.vim new file mode 100644 index 0000000..49888bf --- /dev/null +++ b/vim-lastplace/lastplace.vim @@ -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 -- 2.25.1