diff --git a/.bin/dexec_browser b/.bin/dexec_browser index 64a9e5f..f229876 100755 --- a/.bin/dexec_browser +++ b/.bin/dexec_browser @@ -23,7 +23,7 @@ touch "${HISTFILE}" read_input() { local S=$( { echo "paste_from_clipboard"; tail -r ${HISTFILE}; } \ | awk '!seen[$0]++' \ - | ${DMENU_CMD} -p "Bookmarks" -l 20) + | ${DMENU_CMD} -p "Bookmarks") case "${S}" in paste_from_clipboard) S=$(xclip -o | head -n 1); ;; @@ -93,7 +93,7 @@ Zalando" esac local S="$(printf "%s\n%s" "${DEFAULT}" "${SE}" \ - | ${DMENU_CMD} -p "Search Where?" -l 20)" + | ${DMENU_CMD} -p "Search Where?")" C=$(echo "$C" | sed 's/ /%20/g') case "${S}" in OPEN*) URI="${C}"; ;; @@ -146,7 +146,7 @@ choose_browser() { esac local S="${DEFAULT}\nLuakit\nVimb\nFirefox\nChrome\nQutebrowser\nWyeb\nNetsurf\nTor-Browser\nDillo\nSurf\nMpv" - case $(echo "${S}" | ${DMENU_CMD} -p "Browser" -l 20) in + case $(echo "${S}" | ${DMENU_CMD} -p "Browser") in [Nn]etsurf*) BROWSER=netsurf-gtk3 ;; [Vv]imb*) BROWSER="vimb --no-maximize" ;; [Dd]illo*) BROWSER=dillo; ;; diff --git a/.bin/luakit-env b/.bin/luakit-env new file mode 100755 index 0000000..bef67d7 --- /dev/null +++ b/.bin/luakit-env @@ -0,0 +1,89 @@ +#!/bin/sh + +# fallback to no config +if [ -z "$HOME/.lenv" ] +then + echo "_env=dev" > $HOME/.lenv + echo "_dir=$HOME/src/luakit-dev" >> $HOME/.lenv +fi + +# load config +. $HOME/.lenv +_action="$1" +shift + +# validation +if [ -z "$_env" ] || [ -z "$_dir" ] +then + echo "Incomplete environment" + exit 1 +fi +if [ -z "$_action" ] +then + echo "No action provided" + exit 1 +fi + +# now we can start... +echo "luakit-$_env: perform $_action $@ (in $_dir)" | xargs + +# change into environment +mkdir -p "$_dir" +cd "$_dir" + +# perform actions +if [ "$_action" == "test" ] +then + export G_ENABLE_DIAGNOSTIC=1; + luajit tests/run_test.lua $@; +fi + +if [ "$_action" == "make" ] +then + gmake clean + gmake options + gmake -j 8 luakit +fi + +if [ "$_action" == "remake" ] +then + gmake -j1 luakit +fi + +if [ "$_action" == "debug" ] +then + egdb -ex "break luakit.c:main" -ex "run $@" ./luakit +fi + +if [ "$_action" == "reset" ] +then + cd /tmp + rm -rf "$_dir" + mkdir -p "$_dir" + git clone git@github.com:luakit/luakit "$_dir" + cd "$_dir" +fi + + +if [ "$_action" == "pr" ] +then + if [ -n "$1" ] + then + for pr in $@ + do gh pr checkout $pr + done + else + gh pr --repo luakit/luakit list $@ | cat + fi +fi + +if [ "$_action" == "update-port" ] +then + cd /usr/ports/mystuff/www/luakit + commit="$(basename $(gh browse --repo luakit/luakit -c -n))" + sed -i "s/^COMMIT =.*/COMMIT = $commit/" Makefile + make clean=all + portbump + make makesum + make reinstall +fi diff --git a/.config/luakit/rc.lua b/.config/luakit/rc.lua index 1448ebe..48c63c5 100644 --- a/.config/luakit/rc.lua +++ b/.config/luakit/rc.lua @@ -55,12 +55,12 @@ local binds = require "binds" -- Settings (the commented ones do not [yet] work) local settings = require "settings" -local settings_chrome = require "settings_chrome" +-- local settings_chrome = require "settings_chrome" settings.window.home_page = "luakit://newtab" --- settings.window.scroll_step = 20 +settings.window.scroll_step = 20 settings.window.zoom_step = 0.2 -settings.webview.zoom_level = 150 +settings.webview.zoom_level = 100 settings.window.close_with_last_tab = true -- search engines @@ -94,7 +94,7 @@ local webinspector = require "webinspector" -- local quickmarks = require "quickmarks" -- Add session saving/loading support --- local session = require "session" +local session = require "session" -- Enable Gopher protocol support local gopher = require "gopher" diff --git a/.kshrc b/.kshrc index 7738c33..c7e35e9 100644 --- a/.kshrc +++ b/.kshrc @@ -127,11 +127,21 @@ RED="\[$(tput setaf 196)\]" GREY="\[$(tput setaf 248)\]" RESET="\[$(tput op)\]" +gitstatus() { + _path="$PWD" + while [ -n "$_path" ] + do [ -d "$_path/.git" ] \ + && echo " ($(git branch --no-color --show-current)) " \ + && break + _path="${_path%/*}" + done +} + if [ $(id -u) -eq 0 ] then PS1="${x}${RED}\${?}|\w\\$ ${RESET}${x}" else - PS1="${x}${GREY}\${?}|\w\\$ ${RESET}${x}" + PS1="${x}${GREY}\${?}|\w\$(gitstatus)\\$ ${RESET}${x}" fi ######################################################################## @@ -148,6 +158,10 @@ alias spectrwmrc="vim ~/.config/spectrwm/spectrwm.conf" alias vifmrc="vim ~/.config/vifm/vifmrc" alias tmuxrc="vim ~/.tmux.conf" +pastebinvim() { + vim "https://pastebin.com/raw/$(basename "$1")"; +} + # task warrior alias t=task alias ta="t add" @@ -168,6 +182,8 @@ alias inssh="ssh -o HostKeyAlgorithms=+ssh-rsa \ myps() { ps -fU $(whoami); } mytop() { top -u $(whoami); } +alias pkgreadme="cd /usr/local/share/doc/pkg-readmes; ls" + # other alias portroach="portroach-cli -m codevoid" diff --git a/.mutt/rc-common b/.mutt/rc-common index b57a29e..1e34dd7 100644 --- a/.mutt/rc-common +++ b/.mutt/rc-common @@ -211,20 +211,16 @@ unalternative_order * alternative_order text/plain text/enriched text/html auto_view text/html text/enriched text/calendar -# Preview HTML -macro pager,attach \cs "cat > /tmp/muttpatch.diff~/.mutt/scripts/apply_patch.sh /tmp/muttpatch.diff" -macro index L '| git am'\n - - -# Save Patch -#macro pager \cs "rm -f /tmp/mutt-patch.diff/tmp/mutt-patch.diffecho 'Saved as /tmp/mutt-patch.diff'~/.mutt/scripts/portpatch.sh /tmp/mutt-patch.diff" +# apply inline patch +macro index,pager,attach \cs "| ~/.mutt/scripts/patch.sh patch" +macro index,pager,attach \ca "| ~/.mutt/scripts/patch.sh git" # pipe-message set pipe_decode_weed = no set pipe_decode = yes # when piping via pipe-message command, strip headers and decode set pipe_split = yes # if several msgs are tagged, do the pipe-message command for each set prompt_after = no # promt if external pager exits -set wait_key = no # wait for a key-press after performing shell/external commands +set wait_key = yes # wait for a key-press after performing shell/external commands set beep_new = no # beep if new message arrives set check_new = no # check for new mails, while the mailbox is open set auto_tag = yes # function will applied to all tagged messages in the index diff --git a/.mutt/scripts/apply_patch.sh b/.mutt/scripts/apply_patch.sh deleted file mode 100755 index 51ee3e3..0000000 --- a/.mutt/scripts/apply_patch.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/ksh -e - -# needs converters/qprint -# mutt: macro pager,attach \cs "cat > /tmp/muttpatch.diff~/.mutt/scripts/apply_patch.sh /tmp/muttpatch.diff" - -clear - -printf '\n---------------------------------------------------------------------\n' -grep -E 'Subject: |^Index|^RCS|^diff --git|^file +|^[-+]{3} ' "${1}" -printf '---------------------------------------------------------------------\n\n' - -printf "Base path for the patch?\n" -printf "Example: /usr/ports or /usr/src\n" -printf ": " -read -r _path -cd $_path - -print "Using: $_path" - -printf "Fix quoted-printable mangeled patch? [y/N]: " -read -r _qprint - -case ${_qprint} in - [y|Y]) _catcmd="qprint -d"; ;; - *) _catcmd="cat"; ;; -esac - -printf "Strip? [0]: " -read -r _strip - -echo "CMD: ${_catcmd} "${1}" | doas -u sdk patch -E -pp${_strip:=0} -d ${_path}" -${_catcmd} "${1}" | doas -u sdk patch -E -N -p${_strip:=0} -d ${_path} -echo ${_path} | xclip -echo "done." -read diff --git a/.mutt/scripts/attic/portpatch.sh b/.mutt/scripts/attic/portpatch.sh deleted file mode 100755 index 8622531..0000000 --- a/.mutt/scripts/attic/portpatch.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -strip=0 - -clear -printf '\n---------------------------------------------------------------------\n' -egrep '^Index|^RCS|^diff --git|^file +' "$1" | sed 's,/cvs,/usr,g' -printf '---------------------------------------------------------------------\n\n' - -printf "Path for patch [/usr/ports]? " -read _path - -[ -z "$_path" ] && _path=/usr/ports -egrep -q '^diff --git a/' "$1" && strip=1 - -#print "Trying to apply patch" -#qprint -d "$1" "$1.out" - -doas patch -Ep"$strip" -d $_path < "$1" -cd $_path && ksh diff --git a/.mutt/scripts/patch.sh b/.mutt/scripts/patch.sh new file mode 100755 index 0000000..c78c568 --- /dev/null +++ b/.mutt/scripts/patch.sh @@ -0,0 +1,62 @@ +#!/bin/ksh -e +# needs converters/qprint + +if [ -t 0 ] || [ -z "$1" ] +then + echo "usage: patch.sh [git|patch] < patchfile.diff" + exit 2 +fi + +echo "Shortcuts:" +echo "ld - luakit-dev" +echo "lt - luakit-test" +echo "ltmp - luakit-tmp" +echo "src - /usr/src" +echo "sys - /usr/src/sys" +echo "ports - /usr/ports" +echo "www - /usr/www" +echo +printf "Path [$PWD]: " +read _path < /dev/tty + +# shortcuts!!! +case "$_path" in + ld) _path="/home/sdk/src/luakit-dev" ;; + lt) _path="/home/sdk/src/luakit-test" ;; + ltmp) _path="/home/sdk/src/luakit-tmp" ;; + src) _path="/usr/src" ;; + sys) _path="/usr/src/sys" ;; + ports) _path="/usr/ports" ;; +esac + +if [ ! -d "$_path" ] +then + _path="$(port-jump $_path)" +fi + +_path=${_path:=$PWD} +print "Using: $_path" + +if [ ! -d "$_path" ] +then + echo "Error with path: $_path" + exit 2 +fi + +cd "$_path" +if [ "$1" == "git" ] +then + cat /dev/stdin | git am +fi + +if [ "$1" == "patch" ] +then + printf "Strip [0]: " + read _strip < /dev/tty + _strip=${_strip:=0} + + cat /dev/stdin | doas -u sdk patch -E -N -p$_strip -d "$_path" +fi + +echo "$_path" | xclip + diff --git a/.mutt/scripts/portpatch2.sh b/.mutt/scripts/portpatch2.sh deleted file mode 100755 index 9b17904..0000000 --- a/.mutt/scripts/portpatch2.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/ksh -e - -# needs converters/qprint -# mutt: macro pager,attach \cs "cat > /tmp/muttpatch.diff~/.mutt/scripts/portpatch2.sh /tmp/muttpatch.diff" - -clear - -printf '\n---------------------------------------------------------------------\n' -grep -E 'Subject: |^Index|^RCS|^diff --git|^file +|^[-+]{3} ' "${1}" -printf '---------------------------------------------------------------------\n\n' - -printf "Base path for the patch?\n" -printf "Example: /usr/ports or /usr/src\n" -printf ": " -read -r _path -cd $_path - -print "Using: $_path" - -printf "Fix quoted-printable mangeled patch? [y/N]: " -read -r _qprint - -case ${_qprint} in - [y|Y]) _catcmd="qprint -d"; ;; - *) _catcmd="cat"; ;; -esac - -printf "Strip? [0]: " -read -r _strip - -echo "CMD: ${_catcmd} "${1}" | doas -u sdk patch -E -pp${_strip:=0} -d ${_path}" -${_catcmd} "${1}" | doas -u sdk patch -i -E -N -p${_strip:=0} -d ${_path} -echo ${_path} | xclip -echo "done. -read diff --git a/.vim/vimrc b/.vim/vimrc index 6bd5a0a..50a8eda 100644 --- a/.vim/vimrc +++ b/.vim/vimrc @@ -322,13 +322,13 @@ nmap ga (EasyAlign) inoremap { { } " CUSTOM: TREAT C FILES AS C, NOT C++ -augroup project +augroup Programming autocmd! autocmd BufRead,BufNewFile *.h,*.c set filetype=c.doxygen augroup END " CUSTOM: AUTORELOAD ON VIMRC CHANGE -augroup myvimrc +augroup AutoReloadVimrc au! au BufWritePost vimrc so $MYVIMRC augroup END @@ -339,14 +339,18 @@ augroup myquickfix autocmd QuickFixCmdPost l* lwindow augroup END -augroup cursorpos +augroup CurorPosOnLoad autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal! g`\"" | \ endif augroup END -augroup diffsyntax +augroup DiffSyntax autocmd! OptionSet diff syntax off augroup END +augroup AutoSplitResize + autocmd! + autocmd VimResized * wincmd = +augroup END