dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit c276b0b31e998fb8b2bee7ce57cb538957967ed2
parent b0e7f8399915811afdddc8a02395bacc7708ae6b
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date:   Mon, 21 Oct 2019 11:51:59 +0200

Clean up profile and alias configuration

Diffstat:
D.config/nnn/plugins/fzf-edit | 2--
D.config/nnn/plugins/fzf-open | 2--
A.config/nnn/plugins/fzy-edit | 2++
A.config/nnn/plugins/fzy-open | 2++
D.config/sh/commands | 144-------------------------------------------------------------------------------
D.config/sh/profile | 39---------------------------------------
M.kshrc | 2--
M.profile | 150+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
M.xprofile | 4+---
M.xsession | 3+--
M.yashrc | 3+--
D.zprofile | 3---
M.zshrc | 2--
13 files changed, 154 insertions(+), 204 deletions(-)

diff --git a/.config/nnn/plugins/fzf-edit b/.config/nnn/plugins/fzf-edit @@ -1,2 +0,0 @@ -#!/bin/sh -$EDITOR "$(find . -type f | fzf)" diff --git a/.config/nnn/plugins/fzf-open b/.config/nnn/plugins/fzf-open @@ -1,2 +0,0 @@ -#!/bin/sh -setsid xdg-open "$(find . -type f | fzf)" >/dev/null 2>&1 diff --git a/.config/nnn/plugins/fzy-edit b/.config/nnn/plugins/fzy-edit @@ -0,0 +1,2 @@ +#!/bin/sh +$EDITOR "$(find . -type f | fzy)" diff --git a/.config/nnn/plugins/fzy-open b/.config/nnn/plugins/fzy-open @@ -0,0 +1,2 @@ +#!/bin/sh +nohup xdg-open "$(find . -type f | fzy)" >/dev/null 2>&1 & diff --git a/.config/sh/commands b/.config/sh/commands @@ -1,144 +0,0 @@ -#!/bin/sh - -alias e='$EDITOR' - -f() { - $EDITOR $(find "${1:-.}" -type f | fzy -l 25) -} - -if type doas >/dev/null 2>&1; then - alias se='doas $EDITOR' -else - alias se='sudo $EDITOR' -fi -alias n='$FILE' -alias sx="sxiv -ft *" - -alias xq="xbps-query" -alias xr="sudo xbps-remove" - -c() { - dir=$(find "${1:-.}" -type d | grep -v '/\.' | fzy -l 25) - [ -d "$dir" ] && cd "$dir" || return -} -alias cg='c "$(git rev-parse --show-toplevel)"' # cd under git repo - -alias r='fc -s' - -h() { - eval $(cat "$HISTFILE" | fzy -l 25) -} - -o() { - [ "$(uname)" = 'Darwin' ] && open="open" || open="xdg-open" - if [ "$#" -gt 0 ] && [ -f "$1" ]; then - $open "$1" - else - target="$(find "${1:-.}" | fzy -l 25)" - if [ -f "$target" ]; then - $open "$target" - elif [ -d "$target" ]; then - cd "$target" - else - (>&2 echo "unknown target type") - fi - fi -} - -alias ls=ls; unalias ls -alias ls='ls -hF' -alias l='ls' -alias la='l -a' -alias ll='l -l' -alias lo='l -alo' - -alias dot="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME" -alias dotcap="dot commit -a -S -v; dot push" - -alias m="make" -alias mc="make clean" -alias me="make edit" -if type doas >/dev/null 2>&1; then - alias mi="doas make install" -else - alias mi="sudo make install" -fi - -alias date-denmark='TZ=Europe/Copenhagen date' -alias date-eastern='TZ=US/Eastern date' -alias date-pacific='TZ=US/Pacific date' -alias date-mountain='TZ=US/Mountain date' -alias date-central='TZ=US/Central date' -alias date-alaska='TZ=US/Alaska date' -alias date-uk='TZ=Europe/London date' -alias date-israel='TZ=Israel date' -alias now="linkhandler https://imgs.xkcd.com/comics/now.png" - -alias gs='git s' -alias gss='git ss' -alias ga='git add' -alias gd='git diff --' -alias gch='git diff HEAD^..HEAD' -alias gc='git commit --verbose --gpg-sign' -alias gca='git commit --all --verbose --gpg-sign' -alias gp='git push' -alias gpu='git pull && git fetch --all' -alias gcgp='git commit --verbose --gpg-sign && git push' -alias gcagp='git commit --all --verbose --gpg-sign && git push' -alias gl="git log --graph --oneline --decorate --all --color=always | - fzf --ansi +s --preview='git show --color=always {2}' \ - --bind='pgdn:preview-page-down' \ - --bind='pgup:preview-page-up' \ - --bind='enter:execute:git show --color=always {2} | less -R' \ - --bind='ctrl-x:execute:git checkout {2} .'" - -alias w3m="w3m -B" -alias w3mtor='torsocks w3m -B "$@"' - -alias wanip='curl https://ipinfo.io/ip' -news() { - if [ $# -eq 0 ]; then - url="https://text.npr.org" - elif [ "$1" = "npr" ]; then - url="https://text.npr.org" - elif [ "$1" = "cnn" ]; then - url="https://lite.cnn.io/en" - else - url="$1" - fi - torsocks w3m "$url" -} -weather() { curl "wttr.in/?m"; } - -t_add() { transmission-remote --add --download-dir "$PWD" --encryption-required "$@"; } -t_list() { transmission-remote --list; } -t_remove() { transmission-remote --torrent "$@" --remove; } -t_remove_all() { transmission-remote -tall --remove; } -t_stop() { transmission-remote --torrent "$@" --stop; } -t_stop_idle() { - for id in $(t-list | grep Done | grep Idle | awk '{ print $1 }' | tr '\n' ','); do - t-stop "$id" - done -} - -man9() { - if [ -d /usr/lib/plan9 ]; then - plan9mans="/usr/lib/plan9/man/man1" - elif [ -d /opt/plan9 ]; then - plan9mans="/opt/plan9/share/man/man1" - elif [ -d /usr/local/plan9 ]; then - plan9mans="/usr/local/plan9/man/man1" - else - (>&2 echo "no plan9 port installed") - return 1 - fi - m="$1" - if [ $# -lt 1 ]; then - m="$(cd "$plan9mans" && find -- * -type f | sed 's/\.1$//' | fzy)" - fi - f="$plan9mans/${m}.1" - echo "$f" - [ -e "$f" ] && man "$f" -} - -alias julia-fast='julia --procs 1 --optimize=3 --math-mode=fast' diff --git a/.config/sh/profile b/.config/sh/profile @@ -1,39 +0,0 @@ -#!/bin/sh -export LANG=en_US.UTF-8 -export LC_ALL=en_US.UTF-8 -if type vise >/dev/null 2>&1; then - export EDITOR=vise -elif type vis >/dev/null 2>&1; then - export EDITOR=vis -else - export EDITOR=vi -fi -export FCEDIT="$EDITOR" -export TERMINAL=st -export FILE=nnn -export BROWSER=surf-open.sh -export BIB="$HOME/articles/own/BIBnew.bib" -export SXHKD_SHELL=/bin/sh -export PAGER=less -GPG_TTY=$(tty) -export GPG_TTY -[ -f ~/.secret_env_vars ] && . ~/.secret_env_vars -export PATH="$HOME/.local/bin:/usr/local/bin:$PATH" - -NNN_BMS="a:$HOME/articles;b:$HOME/books;c:$HOME/code;d:$HOME/doc;g:$HOME/articles/glaciology_sedimentology;m:/mnt;s:$HOME/uni/postdoc/stanford-sigma;t:$HOME/tmp;u:$HOME/uni;v:$HOME/videos" -NNN_PLUG="o:fzf-open;e:fzf-edit;u:upload;m:movie-info;c:copy-selection-to-clipboard" -export NNN_BMS # bookmarks (max 10) -export NNN_PLUG # x-key binds (max 10) -export NNN_USE_EDITOR=1 # always open text files in $EDITOR -#export NNN_OPENER="$HOME/.local/bin/xdg-open" -export NNN_OPENER_DETACH=1 # do not block nnn with file opener -export NNN_NOTE="$HOME/doc/todo.md" - -export FZF_DEFAULT_OPTS="--exit-0 --select-1 --preview 'cat {} 2>/dev/null'" -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" -export FZF_CTRL_R_OPTS="--exit-0 --select-1 --preview-window=up:0" -if [ -x "$(command -v rg)" ]; then - export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --glob "!.git/*"' -elif [ -x "$(command -v ag)" ]; then - export FZF_DEFAULT_COMMAND='ag --hidden --ignore .git -f --nocolor -g ""' -fi diff --git a/.kshrc b/.kshrc @@ -3,8 +3,6 @@ HISTSIZE=50000 set -o vi -[ -f $HOME/.config/sh/commands ] && . $HOME/.config/sh/commands - HOSTNAME=${HOSTNAME:-$(uname -n)} HOST=${HOSTNAME%%.*} export PS1="\$(id -un)@${HOST} \$( echo \$PWD | sed 's|$HOME|~|') \$( if [ \$(id -u) -gt 0 ]; then print \$; else print \#; fi) " diff --git a/.profile b/.profile @@ -1,6 +1,150 @@ PATH=$HOME/.local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/usr/games -export PATH HOME TERM ENV -[ -f $HOME/.config/sh/profile ] && . $HOME/.config/sh/profile +export LANG=en_US.UTF-8 +export LC_ALL=en_US.UTF-8 +#if type vise >/dev/null 2>&1; then +# export EDITOR=vise +#elif type vis >/dev/null 2>&1; then +# export EDITOR=vis +#else +# export EDITOR=vi +#fi +export EDITOR=vi +export FCEDIT="$EDITOR" +export TERMINAL=st +export FILE=nnn +export BROWSER=surf-open.sh +export BIB="$HOME/articles/own/BIBnew.bib" + +NNN_BMS="a:$HOME/articles;b:$HOME/books;c:$HOME/code;d:$HOME/doc;g:$HOME/articles/glaciology_sedimentology;m:/mnt;s:$HOME/uni/postdoc/stanford-sigma;t:$HOME/tmp;u:$HOME/uni;v:$HOME/videos" +NNN_PLUG="o:fzy-open;e:fzy-edit;u:upload;m:movie-info;c:copy-selection-to-clipboard" +export NNN_BMS # bookmarks (max 10) +export NNN_PLUG # x-key binds (max 10) +export NNN_USE_EDITOR=1 # always open text files in $EDITOR +export NNN_OPENER_DETACH=1 # do not block nnn with file opener + +alias e='$EDITOR' + +f() { + $EDITOR $(find "${1:-.}" -type f | fzy -l 25) +} + +if type doas >/dev/null 2>&1; then + alias se='doas $EDITOR' +else + alias se='sudo $EDITOR' +fi +alias n='$FILE' +alias sx="sxiv -ft *" + +alias xq="xbps-query" +alias xr="sudo xbps-remove" + +c() { + dir=$(find "${1:-.}" -type d | grep -v '/\.' | fzy -l 25) + [ -d "$dir" ] && cd "$dir" || return +} +alias cg='c "$(git rev-parse --show-toplevel)"' # cd under git repo + +alias r='fc -s' + +h() { + eval $(cat "$HISTFILE" | fzy -l 25) +} + +o() { + [ "$(uname)" = 'Darwin' ] && open="open" || open="xdg-open" + if [ "$#" -gt 0 ] && [ -f "$1" ]; then + $open "$1" + else + target="$(find "${1:-.}" | fzy -l 25)" + if [ -f "$target" ]; then + $open "$target" + elif [ -d "$target" ]; then + cd "$target" + else + (>&2 echo "unknown target type") + fi + fi +} -export ENV=$HOME/.kshrc +alias ls=ls; unalias ls +alias ls='ls -hF' +alias l='ls' +alias la='l -a' +alias ll='l -l' +alias lo='l -alo' + +alias dot="git --git-dir=\$HOME/.dotfiles/ --work-tree=\$HOME" +alias dotcap="dot commit -a -S -v; dot push" + +alias m="make" +alias mc="make clean" +alias me="make edit" +if type doas >/dev/null 2>&1; then + alias mi="doas make install" +else + alias mi="sudo make install" +fi + +alias date-denmark='TZ=Europe/Copenhagen date' +alias date-eastern='TZ=US/Eastern date' +alias date-pacific='TZ=US/Pacific date' +alias date-mountain='TZ=US/Mountain date' +alias date-central='TZ=US/Central date' +alias date-alaska='TZ=US/Alaska date' +alias date-uk='TZ=Europe/London date' +alias date-israel='TZ=Israel date' +alias now="linkhandler https://imgs.xkcd.com/comics/now.png" + +alias gs='git s' +alias gss='git ss' +alias ga='git add' +alias gd='git diff --' +alias gch='git diff HEAD^..HEAD' +alias gc='git commit --verbose --gpg-sign' +alias gca='git commit --all --verbose --gpg-sign' +alias gp='git push' +alias gpu='git pull && git fetch --all' +alias gcgp='git commit --verbose --gpg-sign && git push' +alias gcagp='git commit --all --verbose --gpg-sign && git push' +alias gl="git log --graph --oneline --decorate --all --color=always | + fzf --ansi +s --preview='git show --color=always {2}' \ + --bind='pgdn:preview-page-down' \ + --bind='pgup:preview-page-up' \ + --bind='enter:execute:git show --color=always {2} | less -R' \ + --bind='ctrl-x:execute:git checkout {2} .'" + +alias w3m="w3m -B" +alias w3mtor='torsocks w3m -B "$@"' + +alias wanip='curl https://ipinfo.io/ip' +news() { + if [ $# -eq 0 ]; then + url="https://text.npr.org" + elif [ "$1" = "npr" ]; then + url="https://text.npr.org" + elif [ "$1" = "cnn" ]; then + url="https://lite.cnn.io/en" + else + url="$1" + fi + torsocks w3m "$url" +} +weather() { curl "wttr.in/?m"; } + +t_add() { transmission-remote --add --download-dir "$PWD" --encryption-required "$@"; } +t_list() { transmission-remote --list; } +t_remove() { transmission-remote --torrent "$@" --remove; } +t_remove_all() { transmission-remote -tall --remove; } +t_stop() { transmission-remote --torrent "$@" --stop; } +t_stop_idle() { + for id in $(t-list | grep Done | grep Idle | awk '{ print $1 }' | tr '\n' ','); do + t-stop "$id" + done +} + +alias julia-fast='julia --procs 1 --optimize=3 --math-mode=fast' + +ENV=$HOME/.kshrc +export PATH HOME TERM ENV diff --git a/.xprofile b/.xprofile @@ -9,7 +9,7 @@ if [ -z "$SSH_AUTH_SOCK" ] ; then eval $(ssh-agent -s) fi -setxkbmap -option ctrl:nocaps #-option altwin:swap_lalt_lwin +setxkbmap -option ctrl:nocaps xset -b # Disable beeps xset +dpms # Energy Star features on @@ -17,8 +17,6 @@ xset dpms 300 600 900 # standby -> suspend -> off (seconds) [ ! "$(uname)" = "OpenBSD" ] && xset m 1/4 0 xset r rate 300 50 # key repeat rate ([delay in ms] [repeats per sec]) -[ -f $HOME/.profile ] && . $HOME/.profile - # auto-start programs dunst & dwmstatus & diff --git a/.xsession b/.xsession @@ -1,6 +1,5 @@ #!/bin/sh -[ -f ~/.config/sh/profile ] && . ~/.config/sh/profile -[ -f ~/.config/sh/commands ] && . ~/.config/sh/commands +[ -f ~/.profile ] && . ~/.profile [ -f ~/.xprofile ] && . ~/.xprofile xidle -program "/usr/local/bin/slock" -timeout 300 & diff --git a/.yashrc b/.yashrc @@ -1,7 +1,6 @@ #!/bin/yash -[ -f $HOME/.config/sh/profile ] && . $HOME/.config/sh/profile -[ -f $HOME/.config/sh/commands ] && . $HOME/.config/sh/commands +[ -f $HOME/.profile ] && . $HOME/.profile HISTFILE=~/.yash_history HISTSIZE=65536 diff --git a/.zprofile b/.zprofile @@ -1,3 +0,0 @@ -#!/usr/bin/env zsh - -. ~/.config/sh/profile diff --git a/.zshrc b/.zshrc @@ -231,8 +231,6 @@ _fzf_complete_pass() { ) } -. ~/.config/sh/commands - [ -f /usr/share/fzf/key-bindings.zsh ] && \ . /usr/share/fzf/key-bindings.zsh ] || : [ -f /usr/share/doc/fzf/key-bindings.zsh ] && \