From: AJ ONeal Date: Mon, 22 Mar 2021 04:11:15 +0000 (+0000) Subject: add vim-mouse X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=499f4a2043833ff366d31ff2e9fc9036c552d4eb;p=webi-installers%2F.git add vim-mouse --- diff --git a/vim-mouse/README.md b/vim-mouse/README.md new file mode 100644 index 0000000..6231120 --- /dev/null +++ b/vim-mouse/README.md @@ -0,0 +1,43 @@ +--- +title: vim-mouse +homepage: https://webinstall.dev/vim-mouse +tagline: | + vim mouse is Vim's built-in mouse support +--- + +To update (replacing the current version) run `webi vim-mouse`. + +## Cheat Sheet + +Vim has built-in mouse support. + +It is turned off by default and when turned on may not behave exactly as +expected. + +This vim-mouse plugin turns on mouse support with insert mode on click, +select-to-copy clipboard, and other GUI options. + +### How to configure manually + +Create the file `~/.vim/plugins/mouse.vim`. Add the same contents as +. + +That will look something like this: + +```vim +" turn on mouse support +set mouse=a + +" keep copy-on-select and other GUI options +set clipboard+=autoselect guioptions+=a + +" enter insert mode on left-click +nnoremap i +``` + +You'll then need to update `~/.vimrc` to source that plugin: + +```vim +" Mouse Support: reasonable defaults from webinstall.dev/vim-mouse +source ~/.vim/plugins/mouse.vim +``` diff --git a/vim-mouse/install.sh b/vim-mouse/install.sh new file mode 100644 index 0000000..fd04407 --- /dev/null +++ b/vim-mouse/install.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +function __init_vim_mouse() { + set -e + set -u + + mkdir -p "$HOME/.vim/plugins" + rm -rf "$HOME/.vim/plugins/mouse.vim" + + echo "" + + if [ ! -e "$HOME/.vimrc" ]; then + touch "$HOME/.vimrc" + fi + + if ! [ -f "$HOME/.vim/plugins/mouse.vim" ]; then + mkdir -p ~/.vim/plugins + WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} + curl -fsS -o ~/.vim/plugins/mouse.vim "$WEBI_HOST/packages/vim-mouse/mouse.vim" + fi + + if ! grep 'source.*plugins.mouse.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then + set +e + mkdir -p ~/.vim/plugins + printf '\n" Mouse Support: reasonable defaults from webinstall.dev/vim-mouse\n' >> ~/.vimrc + printf 'source ~/.vim/plugins/mouse.vim\n' >> ~/.vimrc + set -e + echo "added ~/.vim/plugins/mouse.vim" + echo "updated ~/.vimrc with 'source ~/.vim/plugins/mouse.vim'" + echo "" + fi + + echo "vim-mouse enabled with reasonable defaults" +} + +__init_vim_mouse diff --git a/vim-mouse/mouse.vim b/vim-mouse/mouse.vim new file mode 100644 index 0000000..761cf57 --- /dev/null +++ b/vim-mouse/mouse.vim @@ -0,0 +1,8 @@ +" turn on mouse support +set mouse=a + +" keep copy-on-select and other GUI options +set clipboard+=autoselect guioptions+=a + +" enter insert mode on left-click +nnoremap i