19 KiB
Console
- Contents
.profile- Bash
- Fish
- Starship prompt
- Tmux
- Alacritty
- Various console applications
- Guix settings
Contents
.profile
Environment
# 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"
My paths
My script folders
if [ -d "$HOME/bin" ] ; then
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/bin/scripts:$PATH"
fi
Guix settings
Enable extra profiles
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
for i in $GUIX_EXTRA_PROFILES/*; do
profile=$i/$(basename "$i")
if [ -f "$profile"/etc/profile ]; then
GUIX_PROFILE="$profile"
. "$GUIX_PROFILE"/etc/profile
fi
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$profile/share"
unset profile
done
Enable Nix
if [ -f /run/current-system/profile/etc/profile.d/nix.sh ]; then
. /run/current-system/profile/etc/profile.d/nix.sh
fi
Set a folder for my packages.
export GUIX_PACKAGE_PATH=~/guix-packages
Make flatpak apps visible to launchers
export XDG_DATA_DIRS="$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share"
XResources
| Guix dependency |
|---|
| xrdb |
xrdb ~/.Xresources
OFF (OFF) Package manager paths
Turned off for now, because probably it won't be necessary in Guix.
LaTeX
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
Cargo (Rust)
if [ -d "$HOME/.cargo" ] ; then
export PATH="$HOME/.cargo/bin:$PATH"
fi
RVM (Ruby)
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
Go
if [ -d "$HOME/go" ] ; then
export PATH="$HOME/go/bin:$PATH"
fi
ghcup (Haskell)
[ -f "/home/pavel/.ghcup/env" ] && source "/home/pavel/.ghcup/env" # ghcup-env
Perl
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
Bash
.bash_profile
[[ -f ~/.profile ]] && . ~/.profile
[[ -f ~/.bashrc ]] && . ~/.bashrc
.bashrc
My .bashrc, which has pieces from the default ones in Guix & Manjaro, as well some mine settings.
Startup & environment
Export 'SHELL' to child processes. Programs such as 'screen' honor it and otherwise use /bin/sh.
export SHELL
We are being invoked from a non-interactive shell. If this is an SSH session (as in "ssh host command"), source /etc/profile so we get PATH and other essential variables.
if [[ $- != *i* ]]
then
[[ -n "$SSH_CLIENT" ]] && source /etc/profile
return
fi
Source the system-wide file
source /etc/bashrc
| Guix dependency |
|---|
| xhost |
Allow other users to access X server. Necessary for stuff like aw-watcher-window.
xhost +local:root > /dev/null 2>&1
Set manpager to bat
export MANPAGER="sh -c 'sed -e s/.\\\\x08//g | bat -l man -p'"
Launch fish
Launch fish shell unless bash itself is launched from fish.
use_fish=true
if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" && ${use_fish} && $(command -v fish) ]]
then
exec fish
fi
The rest of .bashrc is not executed if fish was launched.
Colors
Setting for colors, packed in the default .bashrc in Manjaro
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}$(</etc/DIR_COLORS)"
[[ -z ${match_lhs} ]] \
&& 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
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
Settings
Some general bash settings.
References:
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)
History control
shopt -s histappend
export HISTCONTROL=ignoredups:erasedups
HISTSIZE=
HISTFILESIZE=
Autocompletions
[ -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
Aliases
alias v="vim"
alias gg="lazygit"
alias ls="exa --icons"
alias ll="exa -lah --icons"
alias q="exit"
alias c="clear"
alias ic="init_conda"
if [[ ! -z "$SIMPLE" ]]; then
unalias ls
alias ll="ls -lah"
fi
Anaconda
managed by 'conda init' !!!
Yeah, tell this to yourself
init_conda () {
__conda_setup="$('/home/pavel/.guix-extra-profiles/dev/dev/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh" ]; then
. "/home/pavel/.guix-extra-profiles/dev/dev/etc/profile.d/conda.sh"
else
# export PATH="/home/pavel/Programs/miniconda3/bin:$PATH"
echo "what"
fi
fi
unset __conda_setup
}
Starship prompt
if [[ -z "$SIMPLE" ]]; then
eval "$(starship init bash)"
fi
Fish
| Guix dependency | Description |
|---|---|
| fish | An alternative non POSIX-compliant shell |
Fish shell is a non-POSIX-compliant shell, which offers some fancy UI & UX features.
Launch starship
starship init fish | source
Enable vi keybindings & aliases. The alias syntax is the same as in bash, so it's just a noweb reference to .bashrc.
fish_vi_key_bindings
<<shell-aliases>>
Anaconda
function init_conda
eval /home/pavel/.guix-extra-profiles/dev/dev/bin/conda "shell.fish" "hook" $argv | source
end
| Guix dependency |
|---|
| dt-colorscripts |
Launch a random DT's colorscript unless ran inside tmux or Emacs.
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS";
colorscript random
end
Suppress fish greeting
set fish_greeting
Starship prompt
| Guix dependency | Description |
|---|---|
| rust-starship | my prompt of choice |
Starship is a nice cross-shell prompt, written in Rust.
References:
[character]
success_symbol = "[➤ ](bold green)"
error_symbol = "[ ](bold red)"
vicmd_symbol = "[ᐊ ](bold green)"
[aws]
symbol = " "
[battery]
full_symbol = ""
charging_symbol = ""
discharging_symbol = ""
[conda]
symbol = " "
[cmd_duration]
min_time = 500
format = " [$duration]($style) "
[docker_context]
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 = " "
Tmux
| Guix dependency |
|---|
| tmux |
| python-tmuxp |
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.
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",*256col*:Tc"
History limit.
set -g history-limit 20000
Keybindings
Enable vi keys and mouse.
set-window-option -g mode-keys vi
set-option -g xterm-keys on
set-option -g mouse on
set -sg escape-time 10
Change prefix from C-b to C-a.
unbind C-b
set -g prefix C-a
bind C-a send-prefix
Vi-like keybindings to manage panes & windows.
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
Reload the config.
bind r source-file ~/.tmux.conf
Copy to clipboard
| Guix dependency |
|---|
| xclip |
Make tmux copying copy to clipboard as well
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"
UI
I generated the following with tmuxline.vim plugin and palenight theme for vim-airline
# 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]"
Source the line config:
source ~/.tmux.line.conf
Alacritty
| Guix dependency |
|---|
| 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.
Once again, we have an application which doesn't support reading Xresources, so here goes noweb.
xrdb -query all | grep "$color:" | cut -f 2
(setq-local org-confirm-babel-evaluate nil)
References:
decorations: none
font:
normal:
family: JetBrainsMono Nerd Font
style: Regular
size: 10
env:
TERM: xterm-256color
colors:
primary:
background: '<<get-xrdb(color="color0")>>'
foreground: '<<get-xrdb(color="color7")>>'
normal:
black: '<<get-xrdb(color="color0")>>'
red: '<<get-xrdb(color="color1")>>'
green: '<<get-xrdb(color="color2")>>'
yellow: '<<get-xrdb(color="color3")>>'
blue: '<<get-xrdb(color="color4")>>'
magenta: '<<get-xrdb(color="color5")>>'
cyan: '<<get-xrdb(color="color6")>>'
white: '<<get-xrdb(color="color7")>>'
bright:
Black: '<<get-xrdb(color="color8")>>'
Red: '<<get-xrdb(color="color9")>>'
Green: '<<get-xrdb(color="color10")>>'
Yellow: '<<get-xrdb(color="color11")>>'
Blue: '<<get-xrdb(color="color12")>>'
Magenta: '<<get-xrdb(color="color13")>>'
Cyan: '<<get-xrdb(color="color14")>>'
White: '<<get-xrdb(color="color15")>>'
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 }
Various console applications
| Guix dependency | Description |
|---|---|
| ncurses | Provides stuff like clear |
| exa | ls replacement, written in Rust |
| bat | cat clone with syntax highlighting |
| htop | Interactive process viewer |
| nethogs | A tool to group processed by used bandwidth |
| osync | rsync wrapper |
| neofetch | Fetch system info |
| Note | Description |
|---|---|
| TODO | package fselect |
Guix settings
(my/format-guix-dependencies)
(specifications->manifest
'(
<<packages()>>))