From 65721319e06789763798d0db1a7c24a08fee0bcd Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Sat, 2 Nov 2019 15:21:20 +0200 Subject: Renamed script files to not mention Bash --- examples/bash_automatic_cd.sh | 22 ---------------------- examples/bash_subshell_notice.sh | 9 --------- examples/shell_automatic_cd.sh | 22 ++++++++++++++++++++++ examples/shell_subshell_notice.sh | 9 +++++++++ 4 files changed, 31 insertions(+), 31 deletions(-) delete mode 100644 examples/bash_automatic_cd.sh delete mode 100644 examples/bash_subshell_notice.sh create mode 100644 examples/shell_automatic_cd.sh create mode 100644 examples/shell_subshell_notice.sh diff --git a/examples/bash_automatic_cd.sh b/examples/bash_automatic_cd.sh deleted file mode 100644 index 294f3aaa..00000000 --- a/examples/bash_automatic_cd.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# Compatible with ranger 1.4.2 through 1.7.* -# -# Automatically change the current working directory after closing ranger -# -# This is a shell function to automatically change the current working -# directory to the last visited one after ranger quits. -# To undo the effect of this function, you can type "cd -" to return to the -# original directory. - -ranger_cd() { - temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")" - ranger --choosedir="$temp_file" -- "${@:-$PWD}" - if chosen_dir="$(cat -- "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then - cd -- "$chosen_dir" - fi - rm -f -- "$temp_file" -} - -# This binds Ctrl-O to ranger-cd: -bind '"\C-o":"ranger-cd\C-m"' diff --git a/examples/bash_subshell_notice.sh b/examples/bash_subshell_notice.sh deleted file mode 100644 index b64ca7fa..00000000 --- a/examples/bash_subshell_notice.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Compatible with ranger 1.5.3 through 1.7.* -# -# Change the prompt when you open a shell from inside ranger -# -# Add this line to your shell startup file (.bashrc, .zshrc etc) for it to work. - -[ -n "$RANGER_LEVEL" ] && PS1="$PS1"'(in ranger) ' diff --git a/examples/shell_automatic_cd.sh b/examples/shell_automatic_cd.sh new file mode 100644 index 00000000..294f3aaa --- /dev/null +++ b/examples/shell_automatic_cd.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +# Compatible with ranger 1.4.2 through 1.7.* +# +# Automatically change the current working directory after closing ranger +# +# This is a shell function to automatically change the current working +# directory to the last visited one after ranger quits. +# To undo the effect of this function, you can type "cd -" to return to the +# original directory. + +ranger_cd() { + temp_file="$(mktemp -t "ranger_cd.XXXXXXXXXX")" + ranger --choosedir="$temp_file" -- "${@:-$PWD}" + if chosen_dir="$(cat -- "$temp_file")" && [ -n "$chosen_dir" ] && [ "$chosen_dir" != "$PWD" ]; then + cd -- "$chosen_dir" + fi + rm -f -- "$temp_file" +} + +# This binds Ctrl-O to ranger-cd: +bind '"\C-o":"ranger-cd\C-m"' diff --git a/examples/shell_subshell_notice.sh b/examples/shell_subshell_notice.sh new file mode 100644 index 00000000..b64ca7fa --- /dev/null +++ b/examples/shell_subshell_notice.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +# Compatible with ranger 1.5.3 through 1.7.* +# +# Change the prompt when you open a shell from inside ranger +# +# Add this line to your shell startup file (.bashrc, .zshrc etc) for it to work. + +[ -n "$RANGER_LEVEL" ] && PS1="$PS1"'(in ranger) ' -- cgit 1.4.1-2-gfad0