Add installation scripts
This commit is contained in:
103
bash.org
103
bash.org
@@ -106,76 +106,17 @@ alias tmux='tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf'
|
||||
alias mbsync='mbsync -c $XDG_CONFIG_HOME/isync/mbsyncrc'
|
||||
#+END_SRC
|
||||
|
||||
*** One letter aliases
|
||||
#+BEGIN_SRC bash
|
||||
alias y="yazi"
|
||||
alias t="tmux"
|
||||
alias v="nvim"
|
||||
alias sv='sudo -E nvim'
|
||||
alias g="git"
|
||||
alias m="neomutt"
|
||||
alias o="xdg-open"
|
||||
#+END_SRC
|
||||
|
||||
*** Neovim
|
||||
#+begin_src bash
|
||||
command -v nvim >/dev/null && alias vim="nvim" vimdiff="nvim -d" # Use neovim for vim if present.
|
||||
#+end_src
|
||||
|
||||
*** Vim-like
|
||||
#+BEGIN_SRC bash
|
||||
alias :q=exit
|
||||
alias :e=nvim
|
||||
#+END_SRC
|
||||
|
||||
*** Print each PATH entry on a separate line
|
||||
#+BEGIN_SRC bash
|
||||
alias path='echo -e ${PATH//:/\\n}'
|
||||
#+END_SRC
|
||||
|
||||
** Functions
|
||||
*** =colors= - Display colors
|
||||
#+BEGIN_SRC bash
|
||||
colors() {
|
||||
local fgc bgc vals seq0
|
||||
|
||||
printf "Color escapes are %s\n" '\e[${value};...;${value}m'
|
||||
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
|
||||
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
|
||||
printf "Value 1 gives a \e[1mbold-faced look\e[m\n\n"
|
||||
|
||||
# foreground colors
|
||||
for fgc in {30..37}; do
|
||||
# background colors
|
||||
for bgc in {40..47}; do
|
||||
fgc=${fgc#37} # white
|
||||
bgc=${bgc#40} # black
|
||||
|
||||
vals="${fgc:+$fgc;}${bgc}"
|
||||
vals=${vals%%;}
|
||||
|
||||
seq0="${vals:+\e[${vals}m}"
|
||||
printf " %-9s" "${seq0:-(default)}"
|
||||
printf " ${seq0}TEXT\e[m"
|
||||
printf " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
|
||||
done
|
||||
echo; echo
|
||||
done
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
*** =tre= - Tree display
|
||||
=tre= is a shorthand for =tree= with hidden files and color enabled, ignoring
|
||||
the =.git= directory, listing directories first. The output gets piped into
|
||||
=less= with options to preserve color and line numbers, unless the output is
|
||||
small enough for one screen.
|
||||
|
||||
#+BEGIN_SRC bash
|
||||
function tre() {
|
||||
tree -aC -I '.git|node_modules|bower_components' --dirsfirst "$@" | less -FRNX;
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
*** =mkd= - Create a new directory and enter it
|
||||
#+BEGIN_SRC bash
|
||||
function mkd() {
|
||||
@@ -183,29 +124,6 @@ function mkd() {
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
*** =fs= - Filesize of directory
|
||||
#+BEGIN_SRC bash
|
||||
function fs() {
|
||||
if du -b /dev/null > /dev/null 2>&1; then
|
||||
local arg=-sbh;
|
||||
else
|
||||
local arg=-sh;
|
||||
fi
|
||||
if [[ -n "$@" ]]; then
|
||||
du $arg -- "$@";
|
||||
else
|
||||
du $arg .[^.]* ./*;
|
||||
fi;
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
*** =nullify= - Redirect both standard output and standard error, as well as sending to background
|
||||
#+BEGIN_SRC bash
|
||||
function nullify() {
|
||||
"$@" >/dev/null 2>&1
|
||||
}
|
||||
#+END_SRC
|
||||
|
||||
** Bash History
|
||||
Undocumented feature which sets the size to "unlimited". http://stackoverflow.com/questions/9457233/unlimited-bash-history
|
||||
|
||||
@@ -276,7 +194,7 @@ export SUDO_ASKPASS=~/.local/bin/askpass-rofi
|
||||
** Export some default applications
|
||||
#+begin_src bash
|
||||
export EDITOR="nvim"
|
||||
export TERMINAL="kitty -1"
|
||||
export TERMINAL="kitty"
|
||||
export BROWSER="qutebrowser"
|
||||
export READER="zathura"
|
||||
export FILE="yazi"
|
||||
@@ -326,21 +244,10 @@ export LINKDING_TOKEN=`pass nas/linkding_token`
|
||||
|
||||
*** Restic
|
||||
#+begin_src bash
|
||||
export RESTIC_REPOSITORY=sftp:thomas@homelab:/srv/storage/Backups/esrf-laptop
|
||||
export RESTIC_PASSWORD_COMMAND="pass show restic"
|
||||
#+end_src
|
||||
|
||||
*** Go
|
||||
#+begin_src bash
|
||||
export GOPATH=$HOME/.config/go
|
||||
#+end_src
|
||||
|
||||
*** Japanese input
|
||||
#+begin_src bash
|
||||
# Japanese input
|
||||
export QT_IM_MODULE=fcitx
|
||||
export XMODIFIERS=@im=fcitx
|
||||
export GTK_IM_MODULE=fcitx
|
||||
if [ "$(hostname)" = "ldehaeze" ]; then
|
||||
export RESTIC_REPOSITORY=sftp:thomas@homelab:/srv/storage/Backups/esrf-laptop
|
||||
export RESTIC_PASSWORD_COMMAND="pass show restic"
|
||||
fi
|
||||
#+end_src
|
||||
|
||||
** Path
|
||||
|
||||
Reference in New Issue
Block a user