From 1cb30bb3dc3eec0624d7c34ebe0c51ddc176d6c0 Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Sat, 7 Jul 2018 20:09:08 +0200 Subject: [PATCH] Change path to ranger --- .config/bash/aliases | 20 ++++++++++++++++---- .config/bash/functions | 13 ------------- 2 files changed, 16 insertions(+), 17 deletions(-) delete mode 100644 .config/bash/functions diff --git a/.config/bash/aliases b/.config/bash/aliases index 7f92651..134e809 100644 --- a/.config/bash/aliases +++ b/.config/bash/aliases @@ -21,7 +21,6 @@ alias l.='ls -d .[a-z]*' alias grep='grep --color=auto' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' -#alias less='less -RX' # raw control characters, don't clear the screen after quitting alias less='less -m -N -g -i -J --underline-special --SILENT -X' alias more='less' @@ -39,9 +38,6 @@ alias open='xdg-open &>/dev/null' alias dit='git --git-dir=$HOME/.dit --work-tree=$HOME' alias ag='ag --path-to-ignore=$HOME/.ignore --skip-vcs-ignores' alias rg='rg --path-separator="//"' -alias r=ranger-cd - - if [ ! -x "$(which tree 2>/dev/null)" ] then @@ -59,3 +55,19 @@ alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date # make date folders alias mkdate='mkdir "$(date +'%Y%m%d')"' + +# Automatically change the directory in bash after closing ranger +function ranger-cd { + tempfile="$(mktemp -t tmp.XXXXXX)" +# /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" + ~/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" + test -f "$tempfile" && + if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then + cd -- "$(cat "$tempfile")" + fi + rm -f -- "$tempfile" +} + +# This binds Ctrl-O to ranger-cd: +bind '"\C-o":"ranger-cd\C-m"' +alias r='ranger-cd' diff --git a/.config/bash/functions b/.config/bash/functions deleted file mode 100644 index c265d39..0000000 --- a/.config/bash/functions +++ /dev/null @@ -1,13 +0,0 @@ -# Automatically change the directory in bash after closing ranger -function ranger-cd { - tempfile="$(mktemp -t tmp.XXXXXX)" - /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" - test -f "$tempfile" && - if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then - cd -- "$(cat "$tempfile")" - fi - rm -f -- "$tempfile" -} - -# This binds Ctrl-O to ranger-cd: -bind '"\C-o":"ranger-cd\C-m"' -- 2.43.0