Bunch of changes on OpenBSD
Anirudh Oppiliappan x@icyphox.sh
Sat, 18 Dec 2021 21:15:26 +0530
7 files changed,
85 insertions(+),
5 deletions(-)
M
bash/.bashrc.d/04-exports.bash
→
bash/.bashrc.d/04-exports.bash
@@ -10,6 +10,7 @@ export PATH=$PATH:$PLAN9/bin
# export thingys export EDITOR=nvim +export BROWSER=firefox export SSH_KEY_PATH="~/.ssh/id_rsa" export GPG_TTY=$(tty) export INPUTRC=~/.inputrc
M
bash/.bashrc.d/99-prompt.bash
→
bash/.bashrc.d/99-prompt.bash
@@ -1,6 +1,52 @@
-PS1='$(~/dotfiles/prompt/prompt) ' -PS2="> " +red="\e[31m" +grn="\e[32m" +ylw="\e[33m" +cyn="\e[36m" +blu="\e[34m" +prp="\e[35m" +bprp="\e[35;1m" +gry="\e[94m" +rst="\e[0m" -# terminal title -# trap 'printf "\033]2;$(history 1 | sed "s/^[ ]*[0-9]*[ ]*//g"): $PWD\007"' DEBUG +git_branch() { + [[ -d "$PWD/.git" ]] && { + local git_status="$(git status 2> /dev/null)" + local on_branch="On branch ([^${IFS}]*)" + local on_commit="HEAD detached at ([^${IFS}]*)" + status="$(git status --porcelain 2> /dev/null)" + local exit="$?" + color="" + if [[ "$exit" -eq 0 ]]; then + if [[ "${#status}" -eq 0 ]]; then + color="${grn}" + else + color="${red}" + fi + else + printf '' + fi + + + if [[ $git_status =~ $on_branch ]]; then + local branch=${BASH_REMATCH[1]} + printf '%b' "($color$branch$rst)" + elif [[ $git_status =~ $on_commit ]]; then + local commit=${BASH_REMATCH[1]} + printf '%b' "($color$commit$rst)" + fi + + } +} + +prompt_pwd() { + printf '%b' "\001${cyn}\002$(dirs +0)\001${rst}\002" +} + +rootornot() { + [[ "$(id -u)" -eq 0 ]] && + printf '%b' "\001${red}\002#\001${rst}\002" +} + +PS1='\n$(prompt_pwd) $(git_branch)\n▲$(rootornot) ' +PS2="> "
A
bin/xurls
@@ -0,0 +1,28 @@
+#!/usr/bin/env bash +# extract urls in current tmux pane and pass it to fzy + +content="$(tmux capture-pane -J -p)" + +mapfile -t urls < <(echo "$content" | grep -oE '(https?|ftp|file):/?//[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]') +mapfile -t wwws < <(echo "$content" | grep -oE '(http?s://)?www\.[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}(/\S+)*' | grep -vE '^https?://' |sed 's/^\(.*\)$/http:\/\/\1/') +mapfile -t ips < <(echo "$content" | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]{1,5})?(/\S+)*' |sed 's/^\(.*\)$/http:\/\/\1/') +mapfile -t gits < <(echo "$content" | grep -oE '(ssh://)?git@\S*' | sed 's/:/\//g' | sed 's/^\(ssh\/\/\/\)\{0,1\}git@\(.*\)$/https:\/\/\2/') + +items="$(printf '%s\n' "${urls[@]}" "${wwws[@]}" "${ips[@]}" "${gits[@]}" | + grep -v '^$' | + sort -u | + nl -w3 -s ' ' +)" + +[ -z "$items" ] && exit + +chosen="$(fzy <<< "$items" | awk '{ print $2 }')" + +case "$OSTYPE" in + darwin*) + printf "$chosen" | pbcopy + ;; + *) + printf "$chosen" | xclip -sel c + ;; +esac
M
home/.cwmrc
→
home/.cwmrc
@@ -25,6 +25,7 @@ bind-key CS-Print "/home/icy/bin/scr -s"
bind-key C-Print "/home/icy/bin/scr -f" bind-key 4-n "st -e nvim /home/icy/notes" bind-key 4-l "/home/icy/bin/log" +bind-key 4C-q "xlock -mode space" # keybinds bind-key 4-d menu-exec
M
home/.tmux.conf
→
home/.tmux.conf
@@ -32,6 +32,9 @@ bind-key ) swap-window -t +2
bind-key ( swap-window -t -1 bind-key [ copy-mode +# pop-up pane +bind-key u display-popup -E "xurls" + # statusline on top set-option -g status-position top
M
home/.xsession
→
home/.xsession
@@ -16,7 +16,7 @@ xrdb -l ~/.Xresources &
~/bin/bgfill syndaemon -k -i 0.5 -d xsetroot -cursor_name left_ptr -redshift -l 12.972442:12.972442 -t 3600:5700 -g 0.8 -m randr -v & +redshift -l 12.972442:77.580643 -t 3600:5700 -g 0.8 -m randr -v & # xnotify XNOTIFY_FIFO="$HOME/.cache/xnotify$DISPLAY.fifo"
M
weechat/weechat.conf
→
weechat/weechat.conf
@@ -404,6 +404,7 @@ default.buffer = "irc;server.rizon;2"
default.buffer = "irc;rizon.#buddy;3" default.buffer = "irc;rizon.#homescreen;4" default.buffer = "irc;rizon.#rice;5" +default.buffer = "irc;rizon.#taigobot-test;6" default.window = "1;0;0;0;irc;rizon.Carp" default.current = on