aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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