aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2023-05-25 13:07:06 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2023-05-25 13:07:06 +0200
commitfb11d31d6d93e3d5ae7e0748e8e13d530482c4e3 (patch)
tree75e27b490911dbca6624cd6f4fbb230109e23825 /.bashrc
parenteab596b672b18c8db1103d99d7a9408a0fc9a09c (diff)
downloaddotfiles-fb11d31d6d93e3d5ae7e0748e8e13d530482c4e3.tar.gz
dotfiles-fb11d31d6d93e3d5ae7e0748e8e13d530482c4e3.zip
bash: using bat as a replacement for cat
This is only done if the binary actually exists, and then we change environment variables such as MANPAGER and MANROFFOPT so everything works seemlessly. Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc14
1 files changed, 14 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
index bc95137..e70d4a2 100644
--- a/.bashrc
+++ b/.bashrc
@@ -43,6 +43,17 @@ alias ..='cd ..'
alias cd..='cd ..'
##
+# If `bat` is available, use it as a drop-in replacement for `cat (1)`.
+
+if command -v bat &> /dev/null; then
+ alias cat='bat'
+
+ # Use it on man pages too.
+ export MANPAGER="sh -c 'col -bx | bat -l man -p'"
+ export MANROFFOPT="-c"
+fi
+
+##
# Editors & terminals.
# Set GNU Emacs as the default editor. You can find this `emacsclient-a-nw`
@@ -72,6 +83,9 @@ alias gti=git
# Setting up PS1.
PS1='\u:\w$(__git_ps1 "\[\033[0;32m\]@%s\[\033[0m\]\]") $ '
+# Introduce `cclip` as a fast way to use `xclip` but selecting the clipboard.
+alias cclip='xclip -selection clipboard'
+
##
# Programming languages and environments.