dotfiles

regexghost dotfiles and scripts
git clone https://git.regexghost.com/dotfiles.git
Log | Files | Refs | README

commit 8e8e0716b0cc7d9ccd4a69cee3551ad26ec71fa8
parent 538549892a8a639424b6fe9214138dae71b6f251
Author: regexghost <dev@regexghost.com>
Date:   Tue, 28 Jul 2026 15:48:29 +0100

truncated prompt in kshrc from function I found on stackoverflow (modified a bit)

Diffstat:
Mdotfiles/.kshrc | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dotfiles/.kshrc b/dotfiles/.kshrc @@ -5,8 +5,20 @@ PROMPT_COMMAND= # If not running interactively, don't do anything [[ $- != *i* ]] && return +# Discipline function for relative present working directory +# by Martijn Dekker <martijn@inlv.org> 2020-08-09; public domain +function truncatedpwd +{ + v=$PWD keep=*/* # add /* for each element to keep + [[ ($v == "$HOME" || $v == "$HOME"/*) && $HOME != / ]] && v=\~${v#"$HOME"} # Replace /home/<user> with "~" + del=${v%/$keep}/ + [[ $v == /*/$keep ]] && v=..${v#"$del"} + [[ $v == \~/*/$keep ]] && v=..${v#"$del"} + echo $v +} + # Add my directory-bookmarks program to the prompt when relevant -PS1='\[\033[1;30m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]\w\[\033[1;34m\]$(directory-bookmarks current)\[\033[1;31m\]\$\[\033[0m\] ' +PS1='\[\033[1;30m\]\u\[\033[1;31m\]@\[\033[1;32m\]\h:\[\033[1;35m\]'"\$(truncatedpwd)"'\[\033[1;34m\]$(directory-bookmarks current)\[\033[1;31m\]\$\[\033[0m\] ' # Basic Aliases alias grep='/usr/bin/grep -i --color=auto'