aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.kshrc22
1 files changed, 20 insertions, 2 deletions
diff --git a/.kshrc b/.kshrc
index 47fc7a6..0b511e6 100644
--- a/.kshrc
+++ b/.kshrc
@@ -3,6 +3,11 @@
#
# See also oksh(1)
+# If helpers exist
+_exists() {
+ type $1 > /dev/null 2>&1
+}
+
# Don't do anything if we don't have a prompt (not an interactive shell)
[[ $- != *i* ]] && return || [ -z "$PS1" ] && return
@@ -19,11 +24,11 @@ HISTCONTROL=ignoredups:ignorespace
# Some useful aliases
# If btop is installed then alias top to btop
-[ -e /usr/local/bin/btop ] && alias top="/usr/local/bin/btop"
+_exists btop && alias top="/usr/local/bin/btop"
alias ls='ls --color=auto -hv'
alias config='/usr/local/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
-command -v bat > /dev/null && alias cat='bat --paging=never'
+_exists bat && alias cat='bat --paging=never'
alias wanip='dig @resolver4.opendns.com myip.opendns.com +short'
# Alias to stop foot terminal confusing ssh
@@ -39,6 +44,19 @@ __get_current_git_branch_name() {
echo -en " $branch_name"
}
+# Pager
+if _exists less; then
+ PAGER=less
+ LESSHISTFILE=-
+# # -I ignore case
+# # -R colored output
+# # -X don't clear on exit
+# # -Ps string prompt
+ # LESS='-IRXPs %lt-%lb (%Pt-%Pb \%) ░ %bt-%bbb ░ %f ░▒▓'
+ LESS='-IRX'
+ export PAGER LESSHISTFILE LESS
+fi
+
# Colored man pages
man() {
sh -c "man '$@' | col -bx | bat -l man"