From 3e8e8c769e7c8c6b10b07c9dcb9f9a6b92134f82 Mon Sep 17 00:00:00 2001 From: inkch Date: Wed, 17 Jan 2024 19:40:29 +0900 Subject: [PATCH] bash: add bashrc, alias and envs (also add .bashrc for root user) --- .chezmoitemplates/bashrc | 11 +++++++++++ dot_bashrc.tmpl | 1 + dot_config/bash/alias.tmpl | 9 +++++++++ dot_config/bash/bashrc.tmpl | 1 + dot_config/bash/envs.tmpl | 15 +++++++++++++++ 5 files changed, 37 insertions(+) create mode 100644 .chezmoitemplates/bashrc create mode 100644 dot_bashrc.tmpl create mode 100644 dot_config/bash/alias.tmpl create mode 100644 dot_config/bash/bashrc.tmpl create mode 100644 dot_config/bash/envs.tmpl diff --git a/.chezmoitemplates/bashrc b/.chezmoitemplates/bashrc new file mode 100644 index 0000000..4152750 --- /dev/null +++ b/.chezmoitemplates/bashrc @@ -0,0 +1,11 @@ +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# Set enviroment variables here. +[[ -f ~/.config/bash/envs ]] && . ~/.config/bash/envs + +# Source (read) `alias` file. +[[ -f ~/.config/bash/alias ]] && . ~/.config/bash/alias + +# Customize prompt +PS1='[\u@\h \W]\$ ' diff --git a/dot_bashrc.tmpl b/dot_bashrc.tmpl new file mode 100644 index 0000000..4852df7 --- /dev/null +++ b/dot_bashrc.tmpl @@ -0,0 +1 @@ +{{- template "bashrc" . -}} diff --git a/dot_config/bash/alias.tmpl b/dot_config/bash/alias.tmpl new file mode 100644 index 0000000..365ea39 --- /dev/null +++ b/dot_config/bash/alias.tmpl @@ -0,0 +1,9 @@ +if command -v exa &> /dev/null +then + alias ls='exa' + alias la='exa -lag' + alias tree='exa -a --tree --git-ignore --level=3' +else + alias ls='ls --color=auto' + alias la='ls --color=auto -la' +fi diff --git a/dot_config/bash/bashrc.tmpl b/dot_config/bash/bashrc.tmpl new file mode 100644 index 0000000..b0e6451 --- /dev/null +++ b/dot_config/bash/bashrc.tmpl @@ -0,0 +1 @@ +{{- template "bashrc" . -}} \ No newline at end of file diff --git a/dot_config/bash/envs.tmpl b/dot_config/bash/envs.tmpl new file mode 100644 index 0000000..2a220c0 --- /dev/null +++ b/dot_config/bash/envs.tmpl @@ -0,0 +1,15 @@ +export XDG_CONFIG_HOME="$HOME"/.config +export XDG_DATA_HOME="$HOME"/.local/share +export XDG_RUNTIME_DIR=/run/user/{{ .chezmoi.uid }} +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_CACHE_HOME="$HOME/.cache" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_DESKTOP_DIR="$HOME/vc/desk" +export XDG_DOCUMENTS_DIR="$HOME/vc/docs" +export XDG_DOWNLOAD_DIR="$HOME/dl" +export XDG_MUSIC_DIR="$HOME/vc/audio" +export XDG_PICTURES_DIR="$HOME/vc/pix" +export XDG_VIDEOS_DIR="$HOME/vc/vids" + +export HISTFILE="$XDG_DATA_HOME"/bash/history +export PATH="$XDG_DATA_HOME/cargo/bin:$PATH"