aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-11-15 16:03:08 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-11-15 16:03:08 +0100
commitfb1379b7c23e84321625ac30365bb2bfff7f569a (patch)
tree9e7650c5fb686a3b3f52cc3daf9d2436db404cc2 /bash
parentb50e1a4e2c2301527af20121fb6dff95158f9467 (diff)
downloaddotfiles-fb1379b7c23e84321625ac30365bb2bfff7f569a.tar.gz
vim-plugins.bash completion
Diffstat (limited to 'bash')
-rw-r--r--bash/vim-plugins.bash42
1 files changed, 41 insertions, 1 deletions
diff --git a/bash/vim-plugins.bash b/bash/vim-plugins.bash
index f987531..1b8d7c6 100644
--- a/bash/vim-plugins.bash
+++ b/bash/vim-plugins.bash
@@ -4,10 +4,10 @@ function vim-add() {
local NAME=$(basename "$1")
[ -d "$DOTFILEBASE/.vim/bundle/$NAME" ] || return 1 # no such plugin
+ [ -L "$DOTFILEBASE/.vim/bundle-active/$NAME" ] && return 2 # Already exists
local OLD_PWD=$(pwd)
cd "$DOTFILEBASE/.vim/bundle-active/"
- [ -L $NAME ] && cd "$OLD_PWD" && return 2 # Already exists
ln -s "../bundle/$NAME"
@@ -18,4 +18,44 @@ function vim-remove {
source ~/.files
local NAME=$(basename "$1")
+
+ [ -L "$DOTFILEBASE/.vim/bundle-active/$NAME" ] || exit 1
+ rm "$DOTFILEBASE/.vim/bundle-active/$NAME"
+}
+
+function _vim_plugins {
+ source ~/.files
+ local cur prev opts plugin
+
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts=""
+
+ for plugin in $DOTFILEBASE/.vim/bundle/*/; do
+ opts+=" $(basename $plugin)"
+ done
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
}
+
+function _vim_plugins_active {
+ source ~/.files
+ local cur prev opts plugin
+
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts=""
+
+ for plugin in $DOTFILEBASE/.vim/bundle-active/*/; do
+ opts+=" $(basename $plugin)"
+ done
+
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+}
+
+complete -F _vim_plugins vim-add
+complete -F _vim_plugins_active vim-remove