Skip to content

Commit 6439eeb

Browse files
committed
improved tuifi_cd.sh + added termux script for cd on escape
1 parent 5b3322a commit 6439eeb

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

etc/tuifi_cd.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# You need to copy the content of this file to your shell rc file (e.g. `~/.bashrc` `~/.zshrc`)
22

3-
# Alias for TUIFIManager with cd functionality on exit (Ctrl+E)
4-
alias tuifi='function _tuifi(){
5-
# Run tuifi. Change tuifi_cd_on_esc to True so it CDs with escape key
3+
function _tuifi(){
4+
# Run tuifi. Optionally enable escape-key to cd if set to True
65
tuifi_cd_on_esc=False tuifi "$@"
76

87
# Check if path exists in this virtual file system (stored in RAM) and cd...
98
if [ -e /dev/shm/tuifi_last_path.txt ]; then
109
cd "$(</dev/shm/tuifi_last_path.txt)"
1110
rm /dev/shm/tuifi_last_path.txt
1211
fi
13-
}; _tuifi'
12+
}
13+
14+
# Alias for TUIFIManager with cd functionality on exit (Ctrl+E)
15+
alias tuifi='_tuifi'

etc/tuifi_cd_on_esc_termux.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# You need to copy the content of this file to your shell rc file (e.g. `~/.bashrc` `~/.zshrc`)
2+
# !!! This script defaults to cd-on-escape key
3+
4+
function _tuifi() {
5+
tuifi_cd_on_esc=True tuifi "$@"
6+
cd "$(</data/data/com.termux/files/usr/tmp/tuifi_last_path.txt)"
7+
# (prefer '/dev/shm/tuifi_last_path.txt' instead, if it exists)
8+
}
9+
10+
alias tuifi='_tuifi'
11+

0 commit comments

Comments
 (0)