commit 63635955f81feb90fa3c2ceaa18f898aeee9d8fa (patch)
parent 53b0e9011bd6050106ea21e84b46ed4324edf869
Author: Alex Karle <alex@karle.co>
Date: Wed, 12 Feb 2020 23:42:57 -0500
sh: simpler PS1, migrate w3m funcs to common aliases
I'm experimenting with a one-line PS1. It's been a _long_ time
since I've used such a simple prompt, but I want to give it a
go. It's an interesting exercise in simplicity -- if the paths
are so long that they get in the way of the prompt, maybe there's
a bigger issue?
Also `git log` on OpenBSD with a 2 line prompt pushes back the
first line out of sight, so that's a bummer.
Diffstat:
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/bash/bashrc b/bash/bashrc
@@ -15,11 +15,8 @@ HISTIGNORE=fg:pwd:ls # Don't store common commands in history
HISTCONTROL=ignoreboth # Don't store duped / whitespace-led commands in history
PROMPT_COMMAND="echo; history -a" # Record history after each command
-# Custom functions
-aw() { w3m "https://wiki.archlinux.org/index.php?search=$1"; }
-ddg() { w3m "https://duckduckgo.com/lite?q=$1"; }
+# Includes
include() { [ -r "$1" ] && source "$1"; }
-
include "$HOME/.shrc" # Common shell configuration
include "$HOME/.bash/git-completion.bash" # Git Completion
include "$HOME/.console_theme" # Virtual Console colors (if TERM == "linux")
diff --git a/sh/aliases b/sh/aliases
@@ -38,3 +38,7 @@ alias cddv='cd ~/.vim'
alias ...='cd ../../..'
alias ....='cd ../../../..'
alias .....='cd ../../../../..'
+
+# Lightweight funcs
+aw() { w3m "https://wiki.archlinux.org/index.php?search=$1"; }
+ddg() { w3m "https://duckduckgo.com/lite?q=$1"; }
diff --git a/sh/shrc b/sh/shrc
@@ -6,10 +6,13 @@
PATH=$HOME/bin:$PATH # Put ~/bin on the for personal scripts
EDITOR='vi' # $EDITOR, the most important (personal) of exports
VISUAL='vi' # Some programs give priority to this
+MANPAGER="less" # less is more
+
+export PATH EDITOR VISUAL MANPAGER
# Build up a somewhat fancy prompt (with SSH and error code indicators!)
if [ -n "$SSH_CLIENT" ]; then
- SSH_PROMPT="[$USER@$(hostname)] "
+ SSH_PROMPT="$USER@$(hostname -s):"
fi
last_err() {
@@ -19,10 +22,7 @@ last_err() {
fi
}
-PS1='$(last_err)$PWD $SSH_PROMPT
-$ '
+PS1='$(last_err)[${SSH_PROMPT}${PWD}]\$ '
PS2="> "
-export PATH EDITOR VISUAL
-
[ -r "$HOME/.aliases" ] && . "$HOME/.aliases"