From 04029c520f4cd1c7fbf9444e6ba5304b632d23f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 18 Sep 2017 20:20:01 +0200 Subject: Add completions for gitbmerge --- bashrc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'bashrc') diff --git a/bashrc b/bashrc index ef4e60c..aee1c22 100644 --- a/bashrc +++ b/bashrc @@ -37,3 +37,27 @@ case "$TERM" in ;; esac +# Completions ################################################## + +# Some completion functions +_gitbmerge() { + local cur prev + _init_completion || return + [ $COMP_CWORD -gt 1 ] && return # Complete only single dependency + COMPREPLY=() + local GDIR="$(pwd)" + while [ ! -d "$GDIR/.git" ]; do + [ -z "$GDIR" ] && return + GDIR="${GDIR%/*}" + done + GDIR="$GDIR/.git" + [ -f "$GDIR" ] && GDIR="$(cat "$GDIR")" # This just points to some other directory + [ -d "$GDIR/refs/heads" ] || return # No completion if there is no local branch + local ops="" + for B in "$GDIR"/refs/heads/*; do + # TODO skip branch on HEAD + ops="$ops ${B#$GDIR/refs/heads/}" + done + COMPREPLY+=($(compgen -W "${ops}" -- ${cur})) +} +complete -F _gitbmerge gitbmerge -- cgit v1.2.3 From 39da53ab62b710a231cef8cea50bfa316816f2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 18 Sep 2017 21:04:04 +0200 Subject: Add completions for usbkey --- bashrc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'bashrc') diff --git a/bashrc b/bashrc index aee1c22..a5462d5 100644 --- a/bashrc +++ b/bashrc @@ -10,6 +10,14 @@ if [ -f /etc/bashrc ]; then . /etc/bashrc fi +# Source all completions +if [ -d ~/.bash_completions ]; then + for F in $(find ~/.bash_completions -type f); do + . "$F" + done +fi + +# PROMPT ####################################################### PS1='$( if [ `id -u` -eq "0" ]; then echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] " -- cgit v1.2.3 From 85c603b086490d5a2f78661bc1e167b11a6ea41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 18 Sep 2017 21:06:19 +0200 Subject: Drop unnecessary comment in bashrc --- bashrc | 1 - 1 file changed, 1 deletion(-) (limited to 'bashrc') diff --git a/bashrc b/bashrc index a5462d5..14ded1a 100644 --- a/bashrc +++ b/bashrc @@ -47,7 +47,6 @@ esac # Completions ################################################## -# Some completion functions _gitbmerge() { local cur prev _init_completion || return -- cgit v1.2.3 From 2fc8d93ef509f583f6977588c7b3fb2cf8ebd332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 5 Oct 2017 23:33:39 +0200 Subject: Drop annoyme from shell and some other small changes --- bashrc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'bashrc') diff --git a/bashrc b/bashrc index 14ded1a..f36391e 100644 --- a/bashrc +++ b/bashrc @@ -22,10 +22,7 @@ PS1='$( if [ `id -u` -eq "0" ]; then echo -n "\[\e[1;31m\]\u@\h:\[\e[1;34m\]\W\[\e[1;31m\]\$\[\e[0m\] " else - if ls ~/.annoyme/*.pid 2>/dev/null >/dev/null; then - ANNOYME_PS="\[\e[1;31m\]!\[\e[0m\]" - fi - echo -n "$ANNOYME_PS\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " + echo -n "\[\e[1;32m\]\u@\h:\[\e[1;34m\]\W\[\e[1;32m\]\$\[\e[0m\] " fi)' PROMPT_COMMAND=' -- cgit v1.2.3