From 244da2546eb15f2dd8a68126d1e48489087985be Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sat, 17 Apr 2021 10:56:20 +0300 Subject: [PATCH] feat(console): make console literate config --- .bash_profile | 6 +- .bashrc | 133 ++++---- .config/alacritty/alacritty.yml | 4 +- .config/fish/config.fish | 10 +- .config/starship.toml | 2 + .profile | 30 +- .tmux.conf | 31 +- .tmux.line.conf | 2 + Console.org | 544 ++++++++++++++++++++++++++++++++ README.org | 10 +- 10 files changed, 680 insertions(+), 92 deletions(-) create mode 100644 Console.org diff --git a/.bash_profile b/.bash_profile index cda13f7..a49a138 100644 --- a/.bash_profile +++ b/.bash_profile @@ -1,7 +1,5 @@ -# -# ~/.bash_profile -# - +# [[file:Shell.org::*=.bash_profile=][=.bash_profile=:1]] [[ -f ~/.profile ]] && . ~/.profile [[ -f ~/.bashrc ]] && . ~/.bashrc +# =.bash_profile=:1 ends here diff --git a/.bashrc b/.bashrc index b551991..d7746a4 100644 --- a/.bashrc +++ b/.bashrc @@ -1,22 +1,23 @@ -# Return if not run interactively +# [[file:Shell.org::*Startup & environment][Startup & environment:1]] [[ $- != *i* ]] && return xhost +local:root > /dev/null 2>&1 use_fish=true +# Startup & environment:1 ends here -# ===================== PROGRAMS ===================== +# [[file:Shell.org::*Startup & environment][Startup & environment:2]] export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'" +# Startup & environment:2 ends here -# ===================== FISH ===================== - +# [[file:Shell.org::*Launch fish][Launch fish:1]] if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]] then - exec fish + exec fish fi +# Launch fish:1 ends here -# ===================== COLORS ===================== - +# [[file:Shell.org::*Colors][Colors:1]] use_color=true # Set colorful PS1 only on colorful terminals. @@ -29,52 +30,75 @@ match_lhs="" [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \ - && match_lhs=$(dircolors --print-database) + && type -P dircolors >/dev/null \ + && match_lhs=$(dircolors --print-database) [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true if ${use_color} ; then - # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 - if type -P dircolors >/dev/null ; then - if [[ -f ~/.dir_colors ]] ; then - eval $(dircolors -b ~/.dir_colors) - elif [[ -f /etc/DIR_COLORS ]] ; then - eval $(dircolors -b /etc/DIR_COLORS) - fi - fi + # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 + if type -P dircolors >/dev/null ; then + if [[ -f ~/.dir_colors ]] ; then + eval $(dircolors -b ~/.dir_colors) + elif [[ -f /etc/DIR_COLORS ]] ; then + eval $(dircolors -b /etc/DIR_COLORS) + fi + fi - if [[ ${EUID} == 0 ]] ; then - PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' - else - PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' - fi + if [[ ${EUID} == 0 ]] ; then + PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' + else + PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' + fi - alias ls='ls --color=auto' - alias grep='grep --colour=auto' - alias egrep='egrep --colour=auto' - alias fgrep='fgrep --colour=auto' + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' else - if [[ ${EUID} == 0 ]] ; then - # show root@ when we don't have colors - PS1='\u@\h \W \$ ' - else - PS1='\u@\h \w \$ ' - fi + if [[ ${EUID} == 0 ]] ; then + # show root@ when we don't have colors + PS1='\u@\h \W \$ ' + else + PS1='\u@\h \w \$ ' + fi fi unset use_color safe_term match_lhs sh +# Colors:1 ends here -# ===================== Settings ===================== +# [[file:Shell.org::*Settings][Settings:1]] +complete -cf sudo # Sudo autocompletion -# Sudo autocompletiong -complete -cf sudo +shopt -s checkwinsize # Check windows size after each command +shopt -s expand_aliases # Aliases +shopt -s autocd # Cd to directory just by typing its name (without cd) +# Settings:1 ends here -shopt -s checkwinsize -shopt -s expand_aliases -shopt -s autocd +# [[file:Shell.org::*Settings][Settings:2]] +shopt -s histappend +export HISTCONTROL=ignoredups:erasedups +HISTSIZE= +HISTFILESIZE= +# Settings:2 ends here -# ===================== ANACONDA ===================== +# [[file:Shell.org::*Settings][Settings:3]] +[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion +if [ -d "/usr/share/fzf" ]; then + source /usr/share/fzf/completion.bash + source /usr/share/fzf/key-bindings.bash +fi +# Settings:3 ends here +# [[file:Shell.org::*Aliases][Aliases:1]] +alias v="vim" +alias gg="lazygit" +alias ls="exa --icons" +alias ll="exa -lah --icons" +alias q="exit" +alias c="clear" +# Aliases:1 ends here + +# [[file:Shell.org::*Anaconda][Anaconda:1]] # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/pavel/Programs/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" @@ -89,33 +113,8 @@ else fi unset __conda_setup # <<< conda initialize <<< +# Anaconda:1 ends here - -# ===================== BASH_IT ===================== - -# History +# [[file:Shell.org::*Starship prompt][Starship prompt:1]] eval "$(starship init bash)" - -shopt -s histappend -export HISTCONTROL=ignoredups:erasedups -# if [[ (! $PROMPT_COMMAND =~ .*history.*) && -z $TMUX ]]; then -# export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r" -# fi -HISTSIZE= -HISTFILESIZE= - -# ===================== AUTOCOMPLETION ===================== - -[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion -source /usr/share/fzf/completion.bash -source /usr/share/fzf/key-bindings.bash - - -# ===================== ALIASES ===================== -alias v="vim" -alias gg="lazygit" -alias ls="exa --icons" -alias ll="exa -lah --icons" -alias q="exit" -alias c="clear" - +# Starship prompt:1 ends here diff --git a/.config/alacritty/alacritty.yml b/.config/alacritty/alacritty.yml index 7303afb..9956f33 100644 --- a/.config/alacritty/alacritty.yml +++ b/.config/alacritty/alacritty.yml @@ -1,3 +1,4 @@ +# [[file:../../Shell.org::*Alacritty][Alacritty:1]] decorations: none font: @@ -9,7 +10,7 @@ font: env: TERM: xterm-256color - + colors: primary: background: '#292d3e' @@ -66,3 +67,4 @@ key_bindings: - { key: NumpadAdd, mods: Control, action: IncreaseFontSize } - { key: Minus, mods: Control, action: DecreaseFontSize } - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } +# Alacritty:1 ends here diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 39b5403..dead4cf 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -1,19 +1,27 @@ +# [[file:../../Shell.org::*Fish][Fish:1]] starship init fish | source +# Fish:1 ends here +# [[file:../../Shell.org::*Fish][Fish:2]] fish_vi_key_bindings -alias c="clear" alias v="vim" alias gg="lazygit" alias ls="exa --icons" alias ll="exa -lah --icons" alias q="exit" +alias c="clear" +# Fish:2 ends here +# [[file:../../Shell.org::*Fish][Fish:3]] # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! eval /home/pavel/Programs/miniconda3/bin/conda "shell.fish" "hook" $argv | source # <<< conda initialize <<< +# Fish:3 ends here +# [[file:../../Shell.org::*Fish][Fish:4]] if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; colorscript random end +# Fish:4 ends here diff --git a/.config/starship.toml b/.config/starship.toml index 2160339..ecc30a6 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -1,3 +1,4 @@ +# [[file:../Shell.org::*Starship prompt][Starship prompt:1]] [character] success_symbol = "➤ " vicmd_symbol = "ᐊ " @@ -74,3 +75,4 @@ symbol = " " [rust] symbol = " " +# Starship prompt:1 ends here diff --git a/.profile b/.profile index d7c9da9..30b6248 100644 --- a/.profile +++ b/.profile @@ -1,37 +1,52 @@ +# [[file:Shell.org::*Environment][Environment:1]] export EDITOR=/usr/bin/vim export BROWSER=/usr/bin/firefox export QT_QPA_PLATFORMTHEME="qt5ct" export QT_AUTO_SCREEN_SCALE_FACTOR=0 export GTK2_RC_FILES="$HOME/.gtkrc-2.0" +# Environment:1 ends here +# [[file:Shell.org::*Various paths][Various paths:1]] if [ -d "$HOME/bin" ] ; then export PATH="$HOME/bin:$PATH" export PATH="$HOME/bin/scripts:$PATH" fi +# Various paths:1 ends here -# ===================== PATHS ===================== -export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH" -export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH" -export PATH="/usr/local/texlive/2020/bin/x86_64-linux:$PATH" +# [[file:Shell.org::*Various paths][Various paths:2]] +if [ -d "/usr/local/texlive/2020" ]; then + export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH" + export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH" + export PATH="/usr/local/texlive/2020/bin/x86_64-linux:$PATH" +fi +# Various paths:2 ends here +# [[file:Shell.org::*Various paths][Various paths:3]] if [ -d "$HOME/.cargo" ] ; then export PATH="$HOME/.cargo/bin:$PATH" fi +# Various paths:3 ends here + +# [[file:Shell.org::*Various paths][Various paths:4]] if [ -d "$HOME/.rvm" ] ; then export PATH="$PATH:$HOME/.rvm/bin" fi # if [ -d "$HOME/.gem" ]; then # export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH" # fi +# Various paths:4 ends here + +# [[file:Shell.org::*Various paths][Various paths:5]] if [ -d "$HOME/go" ] ; then export PATH="$HOME/go/bin:$PATH" fi -# export PATH="$HOME/.gem/ruby/2.7.0/bin/:$PATH" +# Various paths:5 ends here +# [[file:Shell.org::*Various paths][Various paths:6]] [ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env +# Various paths:6 ends here -# ===================== PERL ===================== - +# [[file:Shell.org::*Various paths][Various paths:7]] if [ -d "$HOME/perl5" ] ; then PATH="/home/pavel/perl5/bin${PATH:+:${PATH}}" PERL5LIB="/home/pavel/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; @@ -39,3 +54,4 @@ if [ -d "$HOME/perl5" ] ; then PERL_MB_OPT="--install_base \"/home/pavel/perl5\""; export PERL_MB_OPT; PERL_MM_OPT="INSTALL_BASE=/home/pavel/perl5"; export PERL_MM_OPT; fi +# Various paths:7 ends here diff --git a/.tmux.conf b/.tmux.conf index 7f033b3..a5fcc1b 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -1,17 +1,26 @@ +# [[file:Shell.org::*Term settings][Term settings:1]] set -g default-terminal "screen-256color" set -ga terminal-overrides ",*256col*:Tc" +# Term settings:1 ends here +# [[file:Shell.org::*Term settings][Term settings:2]] +set -g history-limit 20000 +# Term settings:2 ends here + +# [[file:Shell.org::*Keybindings][Keybindings:1]] set-window-option -g mode-keys vi set-option -g xterm-keys on set-option -g mouse on set -sg escape-time 10 +# Keybindings:1 ends here -source ~/.tmux.line.conf - +# [[file:Shell.org::*Keybindings][Keybindings:2]] unbind C-b set -g prefix C-a bind C-a send-prefix +# Keybindings:2 ends here +# [[file:Shell.org::*Keybindings][Keybindings:3]] bind h select-pane -L bind j select-pane -D bind k select-pane -U @@ -20,12 +29,20 @@ bind l select-pane -R bind s split-window bind v split-window -h -bind r source-file ~/.tmux.conf - -bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" -bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" bind-key n new-window bind-key t next-window bind-key T previous-window +# Keybindings:3 ends here -set -g history-limit 20000 +# [[file:Shell.org::*Keybindings][Keybindings:4]] +bind r source-file ~/.tmux.conf +# Keybindings:4 ends here + +# [[file:Shell.org::*Copy to clipboard][Copy to clipboard:1]] +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" +bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" +# Copy to clipboard:1 ends here + +# [[file:Shell.org::*UI][UI:2]] +source ~/.tmux.line.conf +# UI:2 ends here diff --git a/.tmux.line.conf b/.tmux.line.conf index df3c87e..dade644 100644 --- a/.tmux.line.conf +++ b/.tmux.line.conf @@ -1,3 +1,4 @@ +# [[file:Shell.org::*UI][UI:1]] # This tmux statusbar config was created by tmuxline.vim # on Wed, 22 Jan 2020 @@ -19,3 +20,4 @@ set -g status-left "#[fg=#292D3E,bg=#939ede] #S #[fg=#939ede,bg=#474b59,nobold,n set -g status-right "#[fg=#333747,bg=#333747,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#333747] %-H:%M #[fg=#474b59,bg=#333747,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#474b59] %a, %b %d #[fg=#939ede,bg=#474b59,nobold,nounderscore,noitalics]#[fg=#292D3E,bg=#939ede] #H " setw -g window-status-format "#[fg=#333747,bg=#333747,nobold,nounderscore,noitalics]#[default] #I #W #[align=left] #[fg=#333747,bg=#333747,nobold,nounderscore,noitalics]" setw -g window-status-current-format "#[fg=#333747,bg=#474b59,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#474b59] #I #W #[fg=#474b59,bg=#333747,nobold,nounderscore,noitalics]" +# UI:1 ends here diff --git a/Console.org b/Console.org new file mode 100644 index 0000000..77063fd --- /dev/null +++ b/Console.org @@ -0,0 +1,544 @@ +#+TITLE: Console +#+TODO: TODO(t) CHECK(s) | OFF(o) +#+PROPERTY: header-args :mkdirp yes +#+PROPERTY: header-args:conf-space :comments link +#+PROPERTY: header-args:conf-toml :comments link +#+PROPERTY: header-args:sh :tangle-mode (identity #o755) :comments link :shebang "#!/bin/sh" +#+PROPERTY: header-args:bash :tangle-mode (identity #o755) :comments link :shebang "#!/bin/bash" + +* Contents +:PROPERTIES: +:TOC: :include all :depth 3 +:END: +:CONTENTS: +- [[#contents][Contents]] +- [[#profile][.profile]] + - [[#environment][Environment]] + - [[#various-paths][Various paths]] +- [[#bash][Bash]] + - [[#bash_profile][.bash_profile]] + - [[#bashrc][.bashrc]] + - [[#startup--environment][Startup & environment]] + - [[#launch-fish][Launch fish]] + - [[#colors][Colors]] + - [[#settings][Settings]] + - [[#aliases][Aliases]] + - [[#anaconda][Anaconda]] + - [[#starship-prompt][Starship prompt]] +- [[#fish][Fish]] +- [[#starship-prompt][Starship prompt]] +- [[#tmux][Tmux]] + - [[#term-settings][Term settings]] + - [[#keybindings][Keybindings]] + - [[#copy-to-clipboard][Copy to clipboard]] + - [[#ui][UI]] +- [[#alacritty][Alacritty]] +:END: + +* =.profile= +:PROPERTIES: +:header-args+: :tangle ./.profile +:header-args:sh: :shebang "" :comments link +:END: +** Environment +#+begin_src sh +export EDITOR=/usr/bin/vim +export BROWSER=/usr/bin/firefox +export QT_QPA_PLATFORMTHEME="qt5ct" +export QT_AUTO_SCREEN_SCALE_FACTOR=0 +export GTK2_RC_FILES="$HOME/.gtkrc-2.0" +#+end_src +** Various paths +My script folders +#+begin_src sh +if [ -d "$HOME/bin" ] ; then + export PATH="$HOME/bin:$PATH" + export PATH="$HOME/bin/scripts:$PATH" +fi +#+end_src + +LaTeX +#+begin_src sh +if [ -d "/usr/local/texlive/2020" ]; then + export MANPATH="/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH" + export INFOPATH="/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH" + export PATH="/usr/local/texlive/2020/bin/x86_64-linux:$PATH" +fi +#+end_src + +Cargo (Rust) +#+begin_src sh +if [ -d "$HOME/.cargo" ] ; then + export PATH="$HOME/.cargo/bin:$PATH" +fi +#+end_src + +RVM (Ruby) +#+begin_src sh +if [ -d "$HOME/.rvm" ] ; then + export PATH="$PATH:$HOME/.rvm/bin" +fi +# if [ -d "$HOME/.gem" ]; then +# export PATH="$HOME/.gem/ruby/2.7.0/bin:$PATH" +# fi +#+end_src + +Go +#+begin_src sh +if [ -d "$HOME/go" ] ; then + export PATH="$HOME/go/bin:$PATH" +fi +#+end_src + +ghcup (Haskell) +#+begin_src sh +[ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env +#+end_src + +Perl +#+begin_src sh +if [ -d "$HOME/perl5" ] ; then + PATH="/home/pavel/perl5/bin${PATH:+:${PATH}}" + PERL5LIB="/home/pavel/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB; + PERL_LOCAL_LIB_ROOT="/home/pavel/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT; + PERL_MB_OPT="--install_base \"/home/pavel/perl5\""; export PERL_MB_OPT; + PERL_MM_OPT="INSTALL_BASE=/home/pavel/perl5"; export PERL_MM_OPT; +fi +#+end_src +* Bash +:PROPERTIES: +:header-args:bash: :shebang "" :comments link +:END: +** =.bash_profile= +#+begin_src bash :tangle ./.bash_profile +[[ -f ~/.profile ]] && . ~/.profile + +[[ -f ~/.bashrc ]] && . ~/.bashrc +#+end_src +** =.bashrc= +:PROPERTIES: +:header-args+: :tangle ./.bashrc +:END: +*** Startup & environment +Return if not run interactively & stuff +#+begin_src bash +[[ $- != *i* ]] && return + +xhost +local:root > /dev/null 2>&1 + +use_fish=true +#+end_src + +Set manpager to bat +#+begin_src bash +export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'" +#+end_src +*** Launch fish +Launch fish shell unless bash itself is launched from fish. +#+begin_src bash +if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} ]] +then + exec fish +fi +#+end_src +The rest of =.bashrc= is not executed if fish was launched. +*** Colors +Setting for colors, packed in the default =.bashrc= in Manjaro +#+begin_src bash +use_color=true + +# Set colorful PS1 only on colorful terminals. +# dircolors --print-database uses its own built-in database +# instead of using /etc/DIR_COLORS. Try to use the external file +# first to take advantage of user additions. Use internal bash +# globbing instead of external grep binary. +safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM +match_lhs="" +[[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" +[[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \ + && match_lhs=$(dircolors --print-database) +[[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true + +if ${use_color} ; then + # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 + if type -P dircolors >/dev/null ; then + if [[ -f ~/.dir_colors ]] ; then + eval $(dircolors -b ~/.dir_colors) + elif [[ -f /etc/DIR_COLORS ]] ; then + eval $(dircolors -b /etc/DIR_COLORS) + fi + fi + + if [[ ${EUID} == 0 ]] ; then + PS1='\[\033[01;31m\][\h\[\033[01;36m\] \W\[\033[01;31m\]]\$\[\033[00m\] ' + else + PS1='\[\033[01;32m\][\u@\h\[\033[01;37m\] \W\[\033[01;32m\]]\$\[\033[00m\] ' + fi + + alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' +else + if [[ ${EUID} == 0 ]] ; then + # show root@ when we don't have colors + PS1='\u@\h \W \$ ' + else + PS1='\u@\h \w \$ ' + fi +fi + +unset use_color safe_term match_lhs sh +#+end_src +*** Settings +Some general bash settings. + +References: +- [[https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html][shopt list]] +#+begin_src bash +complete -cf sudo # Sudo autocompletion + +shopt -s checkwinsize # Check windows size after each command +shopt -s expand_aliases # Aliases +shopt -s autocd # Cd to directory just by typing its name (without cd) +#+end_src + +History control +#+begin_src bash +shopt -s histappend +export HISTCONTROL=ignoredups:erasedups +HISTSIZE= +HISTFILESIZE= +#+end_src + +Autocompletions +#+begin_src bash +[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion +if [ -d "/usr/share/fzf" ]; then + source /usr/share/fzf/completion.bash + source /usr/share/fzf/key-bindings.bash +fi +#+end_src +*** Aliases +#+begin_src bash :noweb-ref shell-aliases +alias v="vim" +alias gg="lazygit" +alias ls="exa --icons" +alias ll="exa -lah --icons" +alias q="exit" +alias c="clear" +#+end_src +*** Anaconda +#+begin_quote +managed by 'conda init' !!! +#+end_quote +Yeah, tell this to yourself + +#+begin_src bash +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$('/home/pavel/Programs/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh" ]; then + . "/home/pavel/Programs/miniconda3/etc/profile.d/conda.sh" + else + export PATH="/home/pavel/Programs/miniconda3/bin:$PATH" + fi +fi +unset __conda_setup +# <<< conda initialize <<< +#+end_src +*** Starship prompt +#+begin_src bash +eval "$(starship init bash)" +#+end_src +* Fish +:PROPERTIES: +:header-args+: :tangle ./.config/fish/config.fish :comments link +:END: + +[[https://fishshell.com/][Fish shell]] is a non-POSIX-compliant shell, which offers some fancy UI & UX features. + +Launch starship +#+begin_src fish +starship init fish | source +#+end_src + +Enable vi keybindings & aliases. The alias syntax is the same as in bash, so it's just a noweb reference to =.bashrc=. +#+begin_src fish :noweb yes +fish_vi_key_bindings + +<> +#+end_src + +Anaconda +#+begin_src fish +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +eval /home/pavel/Programs/miniconda3/bin/conda "shell.fish" "hook" $argv | source +# <<< conda initialize <<< +#+end_src + +Launch a random [[https://gitlab.com/dwt1/shell-color-scripts][DT's colorscript]] unless ran inside tmux or Emacs. +#+begin_src fish +if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; + colorscript random +end +#+end_src +* Starship prompt +[[https://starship.rs/][Starship]] is a nice cross-shell prompt, written in Rust. + +References: +- [[https://starship.rs/config/][Startship config guide]] + +#+begin_src conf-toml :tangle ./.config/starship.toml +[character] +success_symbol = "➤ " +vicmd_symbol = "ᐊ " +error_symbol = " " +use_symbol_for_status = true + +[aws] +symbol = " " + +[battery] +full_symbol = "" +charging_symbol = "" +discharging_symbol = "" + +[conda] +symbol = " " + +[cmd_duration] +min_time = 500 +format = " [$duration]($style) " + +[docker] +symbol = " " + +[elixir] +symbol = " " + +[elm] +symbol = " " + +[git_branch] +symbol = " " +truncation_length = 20 + +[golang] +symbol = " " + +[haskell] +symbol = " " + +[hg_branch] +symbol = " " + +[java] +symbol = " " + +[julia] +symbol = " " + +[memory_usage] +symbol = " " + +[nim] +symbol = " " + +[nix_shell] +symbol = " " + +[nodejs] +symbol = " " + +[package] +symbol = " " +disabled = true + +[php] +symbol = " " + +[python] +symbol = " " + +[ruby] +symbol = " " + +[rust] +symbol = " " +#+end_src +* Tmux +:PROPERTIES: +:header-args+: :tangle ./.tmux.conf +:END: +[[https://github.com/tmux/tmux][tmux]] is my terminal multiplexer of choice. + +It provides pretty sane defaults, so the config is not too large. I rebind the prefix to =C-a= though. +** Term settings +I have no idea how and why these two work. +#+begin_src conf-space +set -g default-terminal "screen-256color" +set -ga terminal-overrides ",*256col*:Tc" +#+end_src + +History limit. +#+begin_src conf-space +set -g history-limit 20000 +#+end_src +** Keybindings +Enable vi keys and mouse. +#+begin_src conf-space +set-window-option -g mode-keys vi +set-option -g xterm-keys on +set-option -g mouse on +set -sg escape-time 10 +#+end_src + +Change prefix from =C-b= to =C-a=. +#+begin_src conf-space +unbind C-b +set -g prefix C-a +bind C-a send-prefix +#+end_src + +Vi-like keybindings to manage panes & windows. +#+begin_src conf-space +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R + +bind s split-window +bind v split-window -h + +bind-key n new-window +bind-key t next-window +bind-key T previous-window +#+end_src + +Reload the config. +#+begin_src conf-space +bind r source-file ~/.tmux.conf +#+end_src +** Copy to clipboard +Make tmux copying copy to clipboard as well +#+begin_src conf-space +bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" +bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i" +#+end_src +** UI +I generated the following with [[https://github.com/edkolev/tmuxline.vim][tmuxline.vim]] plugin and palenight theme for [[https://github.com/vim-airline/vim-airline][vim-airline]] +#+begin_src conf-space :tangle ./.tmux.line.conf +# This tmux statusbar config was created by tmuxline.vim +# on Wed, 22 Jan 2020 + +set -g status-justify "centre" +set -g status "on" +set -g status-left-style "none" +set -g message-command-style "fg=#bfc7d5,bg=#474b59" +set -g status-right-style "none" +set -g pane-active-border-style "fg=#939ede" +set -g status-style "none,bg=#333747" +set -g message-style "fg=#bfc7d5,bg=#474b59" +set -g pane-border-style "fg=#474b59" +set -g status-right-length "100" +set -g status-left-length "100" +setw -g window-status-activity-style "none,fg=#939ede,bg=#333747" +setw -g window-status-separator "" +setw -g window-status-style "none,fg=#bfc7d5,bg=#333747" +set -g status-left "#[fg=#292D3E,bg=#939ede] #S #[fg=#939ede,bg=#474b59,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#474b59] #W #[fg=#474b59,bg=#333747,nobold,nounderscore,noitalics]" +set -g status-right "#[fg=#333747,bg=#333747,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#333747] %-H:%M #[fg=#474b59,bg=#333747,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#474b59] %a, %b %d #[fg=#939ede,bg=#474b59,nobold,nounderscore,noitalics]#[fg=#292D3E,bg=#939ede] #H " +setw -g window-status-format "#[fg=#333747,bg=#333747,nobold,nounderscore,noitalics]#[default] #I #W #[align=left] #[fg=#333747,bg=#333747,nobold,nounderscore,noitalics]" +setw -g window-status-current-format "#[fg=#333747,bg=#474b59,nobold,nounderscore,noitalics]#[fg=#bfc7d5,bg=#474b59] #I #W #[fg=#474b59,bg=#333747,nobold,nounderscore,noitalics]" +#+end_src + +Source the line config: +#+begin_src conf-space +source ~/.tmux.line.conf +#+end_src +* Alacritty +:PROPERTIES: +:header-args+: :tangle ./.config/alacritty/alacritty.yml :comments link +:END: + +[[https://github.com/alacritty/alacritty][Alacritty]] is a GPU-accelerated terminal emulator. I haven't found it to be an inch faster than st, but configuration the in yml format is way more convinient than patches. + +References: +- [[https://github.com/alacritty/alacritty/blob/master/alacritty.yml][default config]] + +#+begin_src yaml +decorations: none + +font: + normal: + family: JetBrainsMono Nerd Font + style: Regular + + size: 10 + +env: + TERM: xterm-256color + +colors: + primary: + background: '#292d3e' + foreground: '#d0d0d0' + normal: + black: '#292d3e' + red: '#f07178' + green: '#c3e88d' + yellow: '#ffcb6b' + blue: '#82aaff' + magenta: '#c792ea' + cyan: '#89ddff' + white: '#d0d0d0' + bright: + Black: '#434758' + Red: '#ff8b92' + Green: '#ddffa7' + Yellow: '#ffe585' + Blue: '#9cc4ff' + Magenta: '#e1acff' + Cyan: '#a3f7ff' + White: '#ffffff' + +background_opacity: 0.80 + +window: + padding: + x: 0 + y: 0 + dynamic_padding: true + +key_bindings: + - { key: Paste, action: Paste } + - { key: Copy, action: Copy } + - { key: L, mods: Control, action: ClearLogNotice } + - { key: L, mods: Control, mode: ~Vi|~Search, chars: "\x0c" } + - { key: PageUp, mods: Shift, mode: ~Alt, action: ScrollPageUp, } + - { key: PageDown, mods: Shift, mode: ~Alt, action: ScrollPageDown } + - { key: Home, mods: Shift, mode: ~Alt, action: ScrollToTop, } + - { key: End, mods: Shift, mode: ~Alt, action: ScrollToBottom } + + # Turn off vi mode + - { key: Space, mods: Shift|Control, mode: ~Search, action: ReceiveChar } + + # (Windows, Linux, and BSD only) + - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } + - { key: C, mods: Control|Shift, action: Copy } + - { key: F, mods: Control|Shift, mode: ~Search, action: ReceiveChar } + - { key: B, mods: Control|Shift, mode: ~Search, action: ReceiveChar } + - { key: Insert, mods: Shift, action: PasteSelection } + - { key: Key0, mods: Control, action: ResetFontSize } + - { key: Equals, mods: Control, action: IncreaseFontSize } + - { key: Plus, mods: Control, action: IncreaseFontSize } + - { key: NumpadAdd, mods: Control, action: IncreaseFontSize } + - { key: Minus, mods: Control, action: DecreaseFontSize } + - { key: NumpadSubtract, mods: Control, action: DecreaseFontSize } +#+end_src diff --git a/README.org b/README.org index c4e5ef8..9176fab 100644 --- a/README.org +++ b/README.org @@ -5,15 +5,15 @@ Deployed with [[https://yadm.io/][yadm]] | Group | Program | Purpose | Status | Documented? | Notes | |-----------+----------------+--------------------------------+-------------------+-------------+-----------------------------------------------------------| -| console | bash | shell | launches fish :) | - | | -| console | [[https://fishshell.com/][fish]] | shell | *active* | - | | -| console | [[https://github.com/starship/starship][starship]] | prompt | *active* | - | | -| console | [[https://github.com/tmux/tmux][tmux]] | terminal multiplexer | *active* | - | | +| console | bash | shell | launches fish :) | [[file:Console.org::*Bash][Console.org]] | | +| console | [[https://fishshell.com/][fish]] | shell | *active* | [[file:Console.org::*Fish][Console.org]] | | +| console | [[https://github.com/starship/starship][starship]] | prompt | *active* | [[file:Console.org::*Starship][Console.org]] | | +| console | [[https://github.com/tmux/tmux][tmux]] | terminal multiplexer | *active* | [[file:Console.org::*Tmux][Console.org]] | | | console | [[https://github.com/ogham/exa][exa]] | ls clone | *active* | - | | | console | [[https://github.com/moonpyk/dtrx][dtrx]] | archive extractor | *active* | - | | | console | [[https://github.com/jhspetersson/fselect][fselect]] | SQL-like find | *active* | - | | | console | [[https://github.com/sharkdp/bat][bat]] | cat clone | *active* | - | | -| console | [[https://github.com/alacritty/alacritty][alacritty]] | terminal emulator | *active* | - | | +| console | [[https://github.com/alacritty/alacritty][alacritty]] | terminal emulator | *active* | [[file:Console.org::*Alacritty][Console.org]] | | | console | [[https://vifm.info/][vifm]] | file manager with vim bindings | archive | - | | | mail | [[https://notmuchmail.org/][notmuch]] | mail indexer | *active* | [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][post]] | | | mail | [[https://github.com/gauteh/lieer][lieer]] | gmail API client | *active* | [[https://sqrtminusone.xyz/posts/2021-02-27-gmail/][post]] | credentials are encrypted |