Jochen Sprickerhof
Last changed: 2020-04-10

Software

~/.profile

[ "$BROWSER" ] && exit
export BROWSER=surf
export EDITOR=nvim
export CFLAGS="-Wall -Wextra -Wpedantic -Wabi -Wconversion -pipe -fdiagnostics-color=auto -O3 -march=native"
export CXXFLAGS="$CFLAGS -Weffc++ -Wold-style-cast"
export LDFLAGS="-s"
export BTS_SENDMAIL_COMMAND="msmtp -t"
export _JAVA_AWT_WM_NONREPARENTING=1
export LC_MESSAGES=C.UTF-8
export LESS=-iRwX
export WINEDLLOVERRIDES=winemenubuilder.exe=d
export PYTHONBREAKPOINT=ipdb.set_trace
test -d "$HOME/.local/bin" && export PATH="$HOME/.local/bin:$PATH"
test -d "$HOME/.local" && export CMAKE_PREFIX_PATH="$HOME/.local:$CMAKE_PREFIX_PATH"
test -d "$HOME/.local/include" && export CPATH="$HOE/.local/include:$CPATH"
test -d "$HOME/.local/lib" && export LD_LIBRARY_PATH="$HOME/.local/lib:$LD_LIBRARY_PATH"
test -d "$HOME/.local/lib" && export LIBRARY_PATH="$HOME/.local/lib:$LIBRARY_PATH"
test -d "$HOME/.local/lib/pkgconfig" && export PKG_CONFIG_PATH="$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH"
test -d "$HOME/.local/man" && export MANPATH="$HOME/.local/man:$MANPATH"
test -d "$HOME/.local/share/texmf" && export TEXMFHOME="$HOME/.local/share/texmf"
test -d /usr/lib/ccache && export PATH="/usr/lib/ccache:$PATH"

Fish Config

mesg n
umask 0077
source "$HOME/.profile"
set -x DEB_BUILD_OPTIONS parallel=(nproc)
set -x MAKEFLAGS -j(nproc)
set -x BROWSER lynx

if not status --is-interactive
  exit
end

set fish_greeting
set -q SSH_CONNECTION; and set __fish_prompt_hostname (set_color brblue)(prompt_hostname)' '
set __fish_prompt_normal (set_color -b normal)
set __fish_prompt_jobs (set_color -b green)
set __fish_prompt_status (set_color -b red)
set __fish_prompt_envdirs (set_color cyan)
set fish_color_command (set_color white)

function fish_prompt
  set -l last_status $status
  set -l jobs (jobs | wc -l)
  test $last_status -ne 0; and echo -n -s "$__fish_prompt_status" "$last_status" "$__fish_prompt_normal" ' '
  test $jobs -ne 0; and echo -n -s "$__fish_prompt_jobs" "$jobs" "$__fish_prompt_normal" ' '
  test -n "$envdirs"; and echo -n -s "$__fish_prompt_envdirs" "$envdirs" ' '
  echo -n -s "$__fish_prompt_user" "$__fish_prompt_hostname" "$__fish_prompt_normal" (prompt_pwd) '> '
end

function postexec_bell --on-event fish_postexec
  tput bel
end

function __fish_commandline_insert_escaped --description 'Insert the first arg escaped if a second arg is given'
  if set -q argv[2]
    commandline -i \\$argv[1]
  else
    commandline -i $argv[1]
  end
end

function __fish_start_bracketed_paste
  # Save the last bind mode so we can restore it.
  set -g __fish_last_bind_mode $fish_bind_mode
  # If the token is currently single-quoted,
  # we escape single-quotes (and backslashes).
  __fish_commandline_is_singlequoted
  and set -g __fish_paste_quoted 1
end

function __fish_stop_bracketed_paste
  # Restore the last bind mode.
  set fish_bind_mode $__fish_last_bind_mode
  set -e __fish_paste_quoted
  commandline -f force-repaint
end

function fish_clipboard_paste
  set -l data
  if not set data (xclip -o)
    return 1
  end
  set data (string split \r -- $data)

  if __fish_commandline_is_singlequoted
    set data (string replace -ra "(['\\\])" '\\\\\\\$1' -- $data)
  end
  if test -n "$data"
    commandline -i -- $data
  end
end

function fish_mode_prompt
end

function fish_default_key_bindings
  bind --erase --all
  bind "" self-insert
  bind \n execute
  bind \r execute
  bind \ck kill-line
  bind \cy yank
  bind \ey yank-pop
  bind \cv fish_clipboard_paste
  bind \e cancel
  bind \t complete
  bind \cs pager-toggle-search
  bind -k btab complete-and-search
  bind \e\r "commandline -i \n"

  bind \e\[A up-or-search
  bind \e\[B down-or-search
  bind \ej up-or-search
  bind \ek down-or-search
  bind \e\[C forward-char
  bind \e\[D backward-char
  bind \e. history-token-search-backward
  bind \e, history-token-search-forward

  bind -k backspace backward-delete-char

  bind \en nextd-or-forward-word
  bind \ep prevd-or-backward-word

  bind \ca beginning-of-line
  bind \ce end-of-line
  bind \ch backward-delete-char
  bind \cw backward-kill-word
  bind \cp history-search-backward
  bind \cn history-search-forward
  bind \cf forward-char
  bind \cb backward-char
  bind \ct transpose-chars
  bind \et transpose-words
  bind \ec capitalize-word
  bind \eb backward-word
  bind \ef forward-word
  bind \e\< beginning-of-buffer
  bind \e\> end-of-buffer

  bind \eL __fish_list_current_token
  bind \ew 'set tok (commandline -pt); if test $tok[1]; echo; whatis $tok[1]; commandline -f repaint; end'
  bind \cl 'echo -n (clear | string replace \e\[3J ""); commandline -f repaint'
  bind \cc __fish_cancel_commandline
  bind \cu backward-kill-line
  bind \cd delete-or-exit
  bind \ed kill-word
  bind \eP '__fish_paginate'
  bind \e\# __fish_toggle_comment_commandline
  bind \ee edit_command_buffer

  bind \cx 'commandline | xclip -i'

  bind -M default -m paste \e\[200~ '__fish_start_bracketed_paste'
  bind -M paste \e\[201~ '__fish_stop_bracketed_paste'
  bind -M paste "" self-insert
  bind -M paste \r "commandline -i \n"
  bind -M paste "'" "__fish_commandline_insert_escaped \' \$__fish_paste_quoted"
  bind -M paste \\ "__fish_commandline_insert_escaped \\\ \$__fish_paste_quoted"

  bind \eh __fish_man_page
end

function pkg-config
  /usr/bin/pkg-config $argv | tr -s ' ' '\n'
end

set -x LS_COLORS (dircolors -c | string split "'")[2]

alias vi 'nvim'
alias l '/bin/ls --color=auto'
alias ll '/bin/ls -lh --color=auto'
alias a 'l -A'
alias la 'll -A'
alias psl 'ps auxf | less'
alias psg 'pgrep -af'
alias hist 'history | less'
alias hig 'history --search'
alias df 'df -h -x fuse.sshfs'
alias free 'free -m'
alias rsync 'rsync -ahzP'
alias serv 'python3 -m http.server'
alias ssh_insec 'ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias scp_insec 'scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias pling 'tput bel'
alias studip 'rename s/^\[[0-9]+\]_// *'
alias emacs 'emacs -nw'
alias wodim 'wodim -v'
alias x 'atool -qx'
alias cmake 'cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
alias cmaked 'cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_EXPORT_COMPILE_COMMANDS=ON'
alias grep 'grep --color=auto'
alias p 'ipython3 --no-banner --no-confirm-exit --colors=Linux --TerminalInteractiveShell.true_color=True'
alias rviz 'rviz -s ""'
alias soffice 'soffice --nologo'
alias qr 'qrencode -t ansi'

if test "$USER" = root
  umask 0022
  set __fish_prompt_user (set_color red)$USER' '
  set -x XAUTHORITY ~jspricke/.Xauthority
  alias plingr 'echo -e "\a" > /dev/tty0'
  alias dmesg 'dmesg -H'
end