summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2023-04-05 14:30:21 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2023-04-05 14:30:21 +0200
commite4c833e535dcda3dd3145e06f2d7f187e2197efb (patch)
tree10be7ce47fd56cf3f8e694efe266c5c6e67f4b0c
parenta86e7cfce4bc2167383a071856f5deba77f30a5b (diff)
parentc41328bec94c2d3fe58b6cc0db7336702b054cb7 (diff)
Merge remote-tracking branch 'refs/remotes/origin/main'
-rwxr-xr-xbin/common/autofetch2
-rwxr-xr-xbin/common/gign2
-rwxr-xr-xbin/common/hextorgb15
-rwxr-xr-xbin/common/wt4
-rwxr-xr-xbin/common/y2feed2
-rwxr-xr-xbin/extra/arr_hjkl2
-rwxr-xr-xbin/extra/cht.sh8
-rwxr-xr-xbin/extra/colorscript2
-rwxr-xr-xbin/extra/cycleKB2
-rwxr-xr-xbin/extra/ehbtodl2
-rwxr-xr-xbin/extra/vimastp2
-rwxr-xr-xbin/guiscripts/dmclip4
-rwxr-xr-xbin/guiscripts/dmdsktp2
-rwxr-xr-xbin/guiscripts/dmemoji4
-rwxr-xr-xbin/guiscripts/dmfm2
-rwxr-xr-xbin/guiscripts/dmhelp2
-rwxr-xr-xbin/guiscripts/dminw4
-rwxr-xr-xbin/guiscripts/dmlang10
-rwxr-xr-xbin/guiscripts/dmpass2
-rwxr-xr-xbin/guiscripts/dmpassgen5
-rwxr-xr-xbin/guiscripts/dmpdf2
-rwxr-xr-xbin/guiscripts/dmpower2
-rwxr-xr-xbin/guiscripts/dmvid2
-rwxr-xr-xbin/guiscripts/dmvol14
-rwxr-xr-xbin/guiscripts/dmyt-not2
-rwxr-xr-xbin/guiscripts/sturl2
-rw-r--r--config/X/picom/picom.conf2
-rw-r--r--config/essentials/nvim/after/plugin/luasnip.lua40
-rw-r--r--config/essentials/nvim/ftplugin/lua.lua1
-rw-r--r--config/essentials/nvim/ftplugin/telekasten.lua9
-rw-r--r--config/essentials/nvim/lua/user/remap.lua2
-rw-r--r--config/essentials/zsh/.zshrc24
-rw-r--r--config/essentials/zsh/aliases.zsh76
-rw-r--r--config/essentials/zsh/functions.zsh53
34 files changed, 203 insertions, 106 deletions
diff --git a/bin/common/autofetch b/bin/common/autofetch
index 3dcdc15..ae48444 100755
--- a/bin/common/autofetch
+++ b/bin/common/autofetch
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
GREEN='\033[0;32m'
NC='\033[0m'
# Fetches for git repos, meant to run at startup
diff --git a/bin/common/gign b/bin/common/gign
index e3ba12a..e82c0b8 100755
--- a/bin/common/gign
+++ b/bin/common/gign
@@ -1,2 +1,2 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
git status --porcelain=v1 | grep "^??" | cut -d' ' -f2- | sed -r 's/^["](.*)["]$/\1/' >> .gitignore
diff --git a/bin/common/hextorgb b/bin/common/hextorgb
index b268db5..e70040e 100755
--- a/bin/common/hextorgb
+++ b/bin/common/hextorgb
@@ -1,7 +1,8 @@
-#!/usr/bin/env bash
-cat /dev/stdin \
- | tr -d '#' | tr '[:lower:]' '[:upper:]' \
- | sed -r 's/([0-9A-F]{2})/\1\n/g ; i ibase=16' \
- | bc \
- | tr '\n' ',' \
- | sed 's/.$// ; s/.*/rgb(&)/'
+#!/usr/bin/env sh
+cat /dev/stdin |
+ tr -d '#' |
+ tr '[:lower:]' '[:upper:]' |
+ sed -r 's/([0-9A-F]{2})/1n/g ; i ibase=16' |
+ bc |
+ tr 'n' ',' |
+ sed 's/.$// ; s/.*/rgb(&)/'
diff --git a/bin/common/wt b/bin/common/wt
index 81081c8..0568b99 100755
--- a/bin/common/wt
+++ b/bin/common/wt
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!/bin/sh
echo "$@" > /tmp/truewhile.tmp
while true
do
- bash /tmp/truewhile.tmp
+ sh /tmp/truewhile.tmp
sleep 1
clear
done
diff --git a/bin/common/y2feed b/bin/common/y2feed
index e5e2201..0f27d68 100755
--- a/bin/common/y2feed
+++ b/bin/common/y2feed
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
test -z "${url:=$1}" \
&& url="$(cat /dev/stdin)"
diff --git a/bin/extra/arr_hjkl b/bin/extra/arr_hjkl
index 0ef542e..d134c78 100755
--- a/bin/extra/arr_hjkl
+++ b/bin/extra/arr_hjkl
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
if [ "$(xmodmap -pke | grep ' = h')" ]
then
diff --git a/bin/extra/cht.sh b/bin/extra/cht.sh
index 7cd4892..681fc69 100755
--- a/bin/extra/cht.sh
+++ b/bin/extra/cht.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# shellcheck disable=SC1117,SC2001
#
# [X] open section
@@ -234,13 +234,13 @@ EOF
if CHEATSH_TEST_STANDALONE=YES \
CHEATSH_TEST_SKIP_ONLINE=NO \
CHEATSH_TEST_SHOW_DETAILS=NO \
- PYTHON=../ve/bin/python bash run-tests.sh | tee -a "$LOG"
+ PYTHON=../ve/bin/python sh run-tests.sh | tee -a "$LOG"
then
printf "\033[0;32m%s\033[0m\n" "SUCCESS"
else
printf "\033[0;31m%s\033[0m\n" "FAILED"
echo "Some tests were failed. Run the tests manually for further investigation:"
- echo " cd $PWD; bash run-tests.sh)"
+ echo " cd $PWD; sh run-tests.sh)"
fi
)
@@ -773,7 +773,7 @@ while true; do
fi
input=$(
- rlwrap -H "$CHTSH_HOME/history" -pgreen -C cht.sh -S "$full_prompt" bash "$0" --read | sed 's/ *#.*//'
+ rlwrap -H "$CHTSH_HOME/history" -pgreen -C cht.sh -S "$full_prompt" sh "$0" --read | sed 's/ *#.*//'
)
cmd_name=${input%% *}
diff --git a/bin/extra/colorscript b/bin/extra/colorscript
index 90dacb1..ad74d67 100755
--- a/bin/extra/colorscript
+++ b/bin/extra/colorscript
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
counter=0
var1="$(seq 30 38)"
diff --git a/bin/extra/cycleKB b/bin/extra/cycleKB
index 5674786..e2cb19d 100755
--- a/bin/extra/cycleKB
+++ b/bin/extra/cycleKB
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
keyboards_file="/home/aluc/bin/keyboards.txt"
cur_keyboard="$(setxkbmap -print | grep "xkb_symbols" | cut -f 2 -d "+")"
# Get line number of match
diff --git a/bin/extra/ehbtodl b/bin/extra/ehbtodl
index 39d8621..df11797 100755
--- a/bin/extra/ehbtodl
+++ b/bin/extra/ehbtodl
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
echo "$1" | sed 's/-H/\\\n\t&/g' | sed '/gzip/d' > /tmp/curlcommand.sh
sh /tmp/curlcommand.sh > /tmp/ehbso.html
vids="$(grep -oE "youtube\.com/embed/.{11}" /tmp/ehbso.html | cut -d'/' -f 3 | tr '\n' ' ')"
diff --git a/bin/extra/vimastp b/bin/extra/vimastp
index f4ae6b5..28e00a3 100755
--- a/bin/extra/vimastp
+++ b/bin/extra/vimastp
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
for var in name vcpus memory cdrom disk_size osinfo
do
read -p "${var}:" "$var"
diff --git a/bin/guiscripts/dmclip b/bin/guiscripts/dmclip
index 9c09b04..a1ca634 100755
--- a/bin/guiscripts/dmclip
+++ b/bin/guiscripts/dmclip
@@ -9,7 +9,7 @@ NotImage () {
exit
}
-selection="$(echo -e "primary\nclipboard\nswap" |
+selection="$(echo "primary\nclipboard\nswap" |
dmenu -l 1 -g 3 -p "selection:")"
if [[ "$selection" == "swap" ]]
then
@@ -37,7 +37,7 @@ else
cut -c -"$DICL_LEN")"
fi
-menu_option="$(echo -e "save\nload\nimage\nreplace" |
+menu_option="$(echo "save\nload\nimage\nreplace" |
dmenu -l 1 -g 4 -p "'$disp_clip'")"
[ "${menu_option}" ] || exit
diff --git a/bin/guiscripts/dmdsktp b/bin/guiscripts/dmdsktp
index d0905b7..3711f13 100755
--- a/bin/guiscripts/dmdsktp
+++ b/bin/guiscripts/dmdsktp
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Searches through .desktop files and prompt to launch them via dmenu
gtk-launch "$(find ~/.local/share/applications \
-maxdepth 1 \
diff --git a/bin/guiscripts/dmemoji b/bin/guiscripts/dmemoji
index e9bd4f4..8225f12 100755
--- a/bin/guiscripts/dmemoji
+++ b/bin/guiscripts/dmemoji
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# This files comes from:
# https://github.com/porras/dmenu-emoji
#
@@ -21,7 +21,7 @@ case "$1" in
fi
;;
"")
- bash $0 list | dmenu -x -i -g 1 -l 20 -p 'Emoji:' | bash $0 copy
+ sh $0 list | dmenu -x -i -g 1 -l 20 -p 'Emoji:' | sh $0 copy
;;
esac
diff --git a/bin/guiscripts/dmfm b/bin/guiscripts/dmfm
index 34a9e2c..969c111 100755
--- a/bin/guiscripts/dmfm
+++ b/bin/guiscripts/dmfm
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
file=1
while [ "$file" ]; do
diff --git a/bin/guiscripts/dmhelp b/bin/guiscripts/dmhelp
index 653fa1f..6199c21 100755
--- a/bin/guiscripts/dmhelp
+++ b/bin/guiscripts/dmhelp
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
program="${1:-$(dmenu_path | dmenu -l 4 -g 5)}"
opfil="/tmp/dmh_options.txt"
test -z "${program}" && exit 1
diff --git a/bin/guiscripts/dminw b/bin/guiscripts/dminw
index 2ff32a1..5066ca8 100755
--- a/bin/guiscripts/dminw
+++ b/bin/guiscripts/dminw
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
WINDOWID=${1:-$(xdotool getwindowfocus)}
WIDTH=$(xdotool getwindowgeometry -s ${WINDOWID} | grep WIDTH | cut -d ' ' -f 2)
-dmenu_run -w ${1:-$(xdotool getwindowfocus)} -z ${WIDTH}
+dmenu_run -w ${1:-$(xdotool getwindowfocus)} -c
diff --git a/bin/guiscripts/dmlang b/bin/guiscripts/dmlang
index 0009704..0e9672e 100755
--- a/bin/guiscripts/dmlang
+++ b/bin/guiscripts/dmlang
@@ -1,7 +1,5 @@
-#!/usr/bin/env bash
-choice="$(\
- echo -e "us\ngb\nbe" \
- | dmenu \
- -p "($(setxkbmap -query | awk 'NR==3 {print $2}'))" \
-)"
+#!/usr/bin/env sh
+choice="$(echo "us\ngb\nbe" |
+ dmenu -p "($(setxkbmap -query |
+ awk 'NR==3 {print $2}'))")"
setxkbmap "${choice:-us}"
diff --git a/bin/guiscripts/dmpass b/bin/guiscripts/dmpass
index 9d79660..bb7bee2 100755
--- a/bin/guiscripts/dmpass
+++ b/bin/guiscripts/dmpass
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
store="$HOME/.password-store"
lscmd="ls --group-directories-first"
dmenucmd="dmenu -l 4 -g 2"
diff --git a/bin/guiscripts/dmpassgen b/bin/guiscripts/dmpassgen
index c627a1d..12d911d 100755
--- a/bin/guiscripts/dmpassgen
+++ b/bin/guiscripts/dmpassgen
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
choice="$(echo -ne "multiline\nsingle" | dmenu -l 1 -g 2)"
test -z "${choice}" && exit 1
@@ -12,7 +12,8 @@ then
test -z "${login}" && exit 1
url="$(echo -n "" | dmenu -p "url:")"
test -z "${url}" && exit 1
- echo -e "${password}\nlogin: ${login}\nurl: ${url}" | pass insert -mf "${password}"
+ echo "${password}\nlogin: ${login}\nurl: ${url}" |
+ pass insert -mf "${password}"
pass generate -ci "${password}"
else
pass generate -cf "${password}"
diff --git a/bin/guiscripts/dmpdf b/bin/guiscripts/dmpdf
index 2d51760..e8d4601 100755
--- a/bin/guiscripts/dmpdf
+++ b/bin/guiscripts/dmpdf
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
tmp="/tmp/dmpdf"
find ${1:-$HOME/docs $HOME/dl} 2> /dev/null | grep -E ".+\.pdf" | sort > "$tmp"
diff --git a/bin/guiscripts/dmpower b/bin/guiscripts/dmpower
index c6c7fe4..5c333a8 100755
--- a/bin/guiscripts/dmpower
+++ b/bin/guiscripts/dmpower
@@ -1,3 +1,3 @@
#!/bin/sh
-choice="$(echo -e "poweroff\nreboot\nhibernate" | dmenu -l 1 -g 3)"
+choice="$(echo "poweroff\nreboot\nhibernate" | dmenu -l 1 -g 3)"
test -z "$choice" || doas "$choice"
diff --git a/bin/guiscripts/dmvid b/bin/guiscripts/dmvid
index fe3155e..51971e6 100755
--- a/bin/guiscripts/dmvid
+++ b/bin/guiscripts/dmvid
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
find ${1:-~/vids ~/dl} 2> /dev/null | grep -E ".+\.(webm|mp4|mpeg|mkv)$" | sort > /tmp/dmvids
diff --git a/bin/guiscripts/dmvol b/bin/guiscripts/dmvol
index ccbf46b..8909de7 100755
--- a/bin/guiscripts/dmvol
+++ b/bin/guiscripts/dmvol
@@ -1,10 +1,12 @@
#!/bin/sh
-volume=0
while true
do
- volume="$(dmenu -p "$(mpc volume)" < /dev/null)"
- test -z "$volume" && break
- mpc volume "$(echo -e "plus\nmin" |
- dmenu -g 2 -l 1 |
- sed 's/plus/+/;s/min/-/')$volume"
+ volume="$(mpc volume | awk '{print $2}' | cut -f1 -d'%')"
+ choice="$(echo "plus\nmin" |
+ dmenu -g 2 -l 1 -p "$volume" |
+ sed 's/plus/+/;s/min/-/')"
+ test -z "$choice" && break
+ nb="$(dmenu -g 2 -l 1 -p "$volume$choice" < /dev/null)"
+ test -z "$nb" && break
+ mpc volume "$choice$nb"
done
diff --git a/bin/guiscripts/dmyt-not b/bin/guiscripts/dmyt-not
index 4783a8d..293ddde 100755
--- a/bin/guiscripts/dmyt-not
+++ b/bin/guiscripts/dmyt-not
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
# Open a video from channels.yt-not by selecting the channel
channel="$(awk '{print $2}' ~/.local/share/yt-not/channels.yt-not | dmenu -l 2 -g 4)"
video_id="$(awk "/$channel/ {print \$3}" ~/.local/share/yt-not/channels.yt-not )"
diff --git a/bin/guiscripts/sturl b/bin/guiscripts/sturl
index bf1fb02..c738c8e 100755
--- a/bin/guiscripts/sturl
+++ b/bin/guiscripts/sturl
@@ -1,7 +1,7 @@
#!/bin/sh
regex='(((https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
-url="$(cat | tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)"
+url="$(tr -d '\n' | grep -Eo "$regex" | dmenu -x -c -g 1 -l 10)"
[ -z "$url" ] && exit 1
case $1 in
diff --git a/config/X/picom/picom.conf b/config/X/picom/picom.conf
index 4a677de..3e15abf 100644
--- a/config/X/picom/picom.conf
+++ b/config/X/picom/picom.conf
@@ -39,7 +39,7 @@ fade-delta = 0;
# Transparency / Opacity #
#################################
-inactive-dim = 0.04;
+inactive-dim = 0.00;
frame-opacity = 0.7;
diff --git a/config/essentials/nvim/after/plugin/luasnip.lua b/config/essentials/nvim/after/plugin/luasnip.lua
index b110322..2f3f620 100644
--- a/config/essentials/nvim/after/plugin/luasnip.lua
+++ b/config/essentials/nvim/after/plugin/luasnip.lua
@@ -39,19 +39,19 @@ ls.add_snippets("lua", {
s("pt", fmt("print({}){}", { i(1, "\"Hello World!\"") , i(0) })),
-- local function
parse("lf", "local $1 = function($2)\n\t$3\nend$0", {}),
- -- require
- s("lrq", fmt("local {} = require('{}')", { i(1), rep(1) })),
- parse("rq", "require('$1')$0", {}),
- parse("rqs", "require('$1').setup {\n\t$2\n}$0", {}),
- parse("use", "use('$1')$0", {}),
- -- function
- s("fn", fmt(
+ -- require
+ s("lrq", fmt("local {} = require('{}')", { i(1), rep(1) })),
+ parse("rq", "require('$1')$0", {}),
+ parse("rqs", "require('$1').setup {\n\t$2\n}$0", {}),
+ parse("use", "use('$1')$0", {}),
+ -- function
+ s("fn", fmt(
[[
function {}({})
- {}
- end{}
- ]],
- { i(1), i(2), i(3), i(0) })),
+ {}
+ end{}
+ ]],
+ { i(1), i(2), i(3), i(0) })),
parse("sn", "s(\"$1\", fmt(\n[[\n$2\n]],\n{ $3 })),$0", {}),
})
@@ -59,7 +59,7 @@ ls.add_snippets("html", {
s("<!DOCTYPE>", {
t({"<!DOCTYPE html>", "<html lang=\"en\">", "\t<head>", "\t\t<title>"}),
i(1, "title"),
- t("</title>"), i(2),
+ t("</title>"), i(2),
t({"", "\t</head>", "\t<body>", "\t\t<h1>"}),
i(3, "Header"),
t("</h1>"), i(0),
@@ -137,3 +137,19 @@ ls.add_snippets("javascript", {
-- print
s("pt", fmt("console.log({}){}", { i(1, "\"Hello World!\"") , i(0) })),
})
+
+ls.add_snippets("telekasten", {
+ --link
+ s("ln", fmt(
+ [[
+ [{}]({}){}
+ ]],
+ {
+ i(1),
+ f(function ()
+ return vim.fn.getreg('+')
+ end),
+ i(0)
+ }
+ )),
+})
diff --git a/config/essentials/nvim/ftplugin/lua.lua b/config/essentials/nvim/ftplugin/lua.lua
new file mode 100644
index 0000000..07538ed
--- /dev/null
+++ b/config/essentials/nvim/ftplugin/lua.lua
@@ -0,0 +1 @@
+vim.keymap.set("i", "{(<cr>", "{<cr>})<C-o>O", { noremap = true })
diff --git a/config/essentials/nvim/ftplugin/telekasten.lua b/config/essentials/nvim/ftplugin/telekasten.lua
index 5986ff6..99bb361 100644
--- a/config/essentials/nvim/ftplugin/telekasten.lua
+++ b/config/essentials/nvim/ftplugin/telekasten.lua
@@ -1,4 +1,4 @@
-vim.opt.spell = true
+-- vim.opt.spell = true
vim.opt.textwidth = 65
vim.opt.signcolumn = "no"
@@ -17,12 +17,13 @@ vim.keymap.set("n", "<LocalLeader>a", "<cmd>Telekasten show_tags<cr>")
vim.keymap.set("n", "<LocalLeader>b", "<cmd>Telekasten show_backlinks<cr>")
vim.keymap.set("n", "<LocalLeader>c", "<cmd>Telekasten show_calendar<cr>")
vim.keymap.set("n", "<LocalLeader>C", "<cmd>CalendarT<cr>")
-vim.keymap.set({"n", "i"}, "<LocalLeader>i", "<cmd>Telekasten insert_link<cr>")
+vim.keymap.set({"n", "i"}, "<LocalLeader>i", "<Esc><cmd>Telekasten insert_link<cr>")
vim.keymap.set({"n", "i"}, "<LocalLeader>I", "<cmd>Telekasten insert_img_link<cr>")
vim.keymap.set("n", "<LocalLeader>F", "<cmd>Telekasten find_friends<cr>")
vim.keymap.set("n", "<LocalLeader>r", "<cmd>Telekasten rename_note<cr>")
-vim.keymap.set({"n", "i"}, "<LocalLeader>t", "<cmd>Telekasten toggle_todo<cr>")
+vim.keymap.set("n", "<LocalLeader>t", "<cmd>Telekasten toggle_todo<cr>")
+vim.keymap.set("i", "<LocalLeader>t", "<cmd>Telekasten toggle_todo<cr><Esc>A")
vim.keymap.set("n", "<LocalLeader>y", "<cmd>Telekasten yank_notelink<cr>")
vim.keymap.set("n", "<LocalLeader>z", "<cmd>Telekasten follow_link<cr>")
-vim.keymap.set("i", "<LocalLeader>l", "<esc>I![<esc>A]()<left><C-r>+<esc>")
+vim.keymap.set("i", "<LocalLeader>l", "<esc>![<esc>A]()<left><C-r>+<esc>A")
diff --git a/config/essentials/nvim/lua/user/remap.lua b/config/essentials/nvim/lua/user/remap.lua
index bc2646b..30e1e2d 100644
--- a/config/essentials/nvim/lua/user/remap.lua
+++ b/config/essentials/nvim/lua/user/remap.lua
@@ -57,7 +57,7 @@ end, { noremap = true })
-- utils
vim.keymap.set("i", "<LocalLeader>r", "<cmd>r!echo -n $RANDOM<cr><esc>kJA", { noremap = true })
-- ordered list
-vim.keymap.set("n", "<LocalLeader>n", "0vap<C-v>I0. <esc>gvg<C-a>", { noremap = true })
+vim.keymap.set("n", "<LocalLeader>n", "<C-v>I0. <esc>gvg<C-a>", { noremap = true })
vim.keymap.set("v", "<Leader>u", "<cmd>'<,'>s/^[0-9]\\+\\. //<cr><esc>", { noremap = true })
-- scripts
vim.keymap.set("n", "<Leader>x", "<cmd>!chmod +x %<cr>", { noremap = true, silent = true})
diff --git a/config/essentials/zsh/.zshrc b/config/essentials/zsh/.zshrc
index 2d3f30d..617cd00 100644
--- a/config/essentials/zsh/.zshrc
+++ b/config/essentials/zsh/.zshrc
@@ -23,13 +23,23 @@ zle -N add-surround surround
zle -N change-surround surround
compinit
-for f in \
- /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh \
- /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh \
- ~/.config/zsh/functions.zsh \
- ~/.config/zsh/aliases.zsh
-do
- test -f $f && source $f
+if grep -qi "debian\|ubuntu" /etc/os-release; then
+ sfiles=(
+ /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
+ /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+ )
+else
+ sfiles=(
+ /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
+ /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+ )
+fi
+sfiles+=(
+ ~/.config/zsh/functions.zsh
+ ~/.config/zsh/aliases.zsh
+)
+for f in "${sfiles[@]}"; do
+ test -f "$f" && source "$f"
done
bindkey -v
diff --git a/config/essentials/zsh/aliases.zsh b/config/essentials/zsh/aliases.zsh
index 58ffae1..79a35e0 100644
--- a/config/essentials/zsh/aliases.zsh
+++ b/config/essentials/zsh/aliases.zsh
@@ -1,11 +1,16 @@
#!/bin/zsh
# s/alias \([^-]\)/alias -g \1
+if grep -qi "debian\|ubuntu" /etc/os-release
+then
+ alias aptup='apt update && apt upgrade -y'
+fi
+
# Programs
alias nv='nvim'
-alias -g nb='newsboat'
-alias -g sr='surfraw'
-alias -g ccu='calcurse'
+alias nb='newsboat'
+alias sr='surfraw'
+alias ccu='calcurse'
alias arduino-cli='arduino-cli --config-file $XDG_CONFIG_HOME/arduino15/arduino-cli.yaml'
@@ -63,43 +68,46 @@ alias grub-update='doas grub-mkconfig -o /boot/grub/grub.cfg'
# vim
alias scr='nvim +"setlocal buftype=nofile bufhidden=hide noswapfile filetype=txt" scratch'
-alias -g vimp="vim '+PlugInstall'"
-alias -g nvimp="nvim '+PackerSync'"
-alias -g nvg='git status > /dev/null 2>&1 && nv "+Git"'
+alias vimp="vim '+PlugInstall'"
+alias nvimp="nvim '+PackerSync'"
+alias nvg='git status > /dev/null 2>&1 && nv "+Git"'
+alias nvn='nv "+Telekasten panel"'
alias -g xclipp='xclip -selection clipboard -r'
alias -g xclipo='xclip -o -selection clipboard -r'
alias -g xclippc='xclip -o -selection primary | xclip -selection clipboard -r'
alias -g xclipcp='xclip -o -selection clipboard | xclip'
-alias -g xrandr-rpgmaker='xrandr --auto --output VGA-1 --mode 1024x768 --left-of HDMI-1 && ~/.fehbg'
-alias -g xrandr-default='xrandr --auto --output VGA-1 --mode 1920x1080 --left-of HDMI-1 --output HDMI-1 --mode 1920x1080 && ~/.fehbg'
+alias xrandr-rpgmaker='xrandr --auto --output VGA-1 --mode 1024x768 --left-of HDMI-1 && ~/.fehbg'
+alias xrandr-default='xrandr --auto --output VGA-1 --mode 1920x1080 --left-of HDMI-1 --output HDMI-1 --mode 1920x1080 && ~/.fehbg'
-alias mv='mv -i'
-alias df='df -h'
-alias -g dud='du -d 1 -h 2>/dev/null | sort -h'
+alias dud='du * -d 0 -h 2>/dev/null | sort -h'
alias df='df -h'
alias shred='shred -uz'
alias lsblk='lsblk -o name,type,fsused,size,fstype,label,mountpoint'
-alias -g floc='doas find / -type "f" 2> /dev/null | grep'
-alias -g dloc='doas find / -type "d" 2> /dev/null | grep'
-alias lsblk='lsblk -o name,type,fsused,size,fstype,label,mountpoint'
-alias -g fif='find . -type "f" | grep'
-alias -g fid='find . -type "d" | grep'
-alias -g sha 'ssh-add'
+alias floc='doas find / -type "f" 2> /dev/null | grep'
+alias dloc='doas find / -type "d" 2> /dev/null | grep'
+alias fif='find . -type "f" | grep'
+alias fid='find . -type "d" | grep'
+
+# ssh
+alias sha='ssh-add'
+alias ssh-start='eval "$(ssh-agent)" && ssh-add'
+
alias vidlen='ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i'
alias whatsmyip='curl "ifconfig.me"'
alias icognito='unset HISTFILE'
-alias sgd='
-for dir in ~/src/*
-do
- cd $dir
- test "$(git status --short 2>/dev/null | grep -v "??" | head -1)" && echo "$PWD \e[1;31m*changes\e[0m"
- test "$(parse_git_remote)" && echo "$PWD \e[0;32m*push/pull\e[0m" ;
-done'
+alias webcam='v4l2-ctl --set-fmt-video=width=1280,height=720; mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0 --profile=low-latency --untimed --no-resume-playback'
+alias wtip='wt ip -c -brief addr'
+# swallow gui
+if which devour > /dev/null
+then
+ alias mpv='devour mpv'
+ alias zathura='devour zathura'
+fi
# Python
-alias penv='python -m venv env'
+alias penv='python3 -m venv env'
alias pipreq='pip install -r requirements.txt'
alias -g '...'='../..'
@@ -115,10 +123,12 @@ alias -g smcu='systemctl --user'
alias zsr='source ${ZDOTDIR:-$HOME}/.zshrc && rehash'
alias -g wf='doas wipefs -a'
alias -g dmci="doas make clean install"
+alias rmd='rm -f *.{orig,rej}'
# quick config
alias -g ez='$EDITOR ${ZDOTDIR:-$HOME}/.zshrc'
alias -g eza='$EDITOR ${ZDOTDIR}/aliases.zsh'
+alias -g ezf='$EDITOR ${ZDOTDIR}/functions.zsh'
alias -g eto='$EDITOR ~/sync/TODO'
alias -g edw='$EDITOR ~/src/dwm/config.def.h'
alias -g edm='$EDITOR ~/src/dmenu/config.def.h'
@@ -126,18 +136,24 @@ alias -g ehist='$EDITOR $ZDOTDIR/histfile'
alias -g est='$EDITOR ~/src/st/config.def.h'
alias -g esl='$EDITOR ~/src/slock/config.def.h'
alias -g esls='$EDITOR ~/src/slstatus/config.def.h'
-alias -g cfdef='$EDITOR config.def.h'
+alias -g cfd='$EDITOR config.def.h'
alias -g cdo='$HOME/src/dotfiles'
-alias -g ff='"`fzffile`"'
-alias -g fd='"`fzfdir`"'
-alias -g fdf='"`fzfdirfile`"'
+# googoo aliases
+alias o.='o .'
+alias go.='go .'
+alias ogo.='ogo .'
+alias o/='o /'
+alias go/='go /'
+alias ogo/='ogo /'
+
alias fzps='ps aux | tail +2 | fzf --bind \
"1:execute(echo -n {} | awk '\''{print \$1}'\'' | xclip -sel c -r),\
2:execute(echo -n {} | awk '\''{print \$2}'\'' | xclip -sel c -r),\
3:execute(echo -n {} | awk '\''{print \$7}'\'' | xclip -sel c -r),\
4:execute(echo -n {} | awk '\''{print \$9}'\'' | xclip -sel c -r),\
5:execute(echo -n {} | tr -s '\'' '\'' | cut -f 11- -d '\'' '\'' | xclip -sel c -r)"'
+alias asf='alias | fzf'
alias -s conf="$EDITOR"
alias -s txt="$EDITOR"
@@ -190,6 +206,7 @@ alias gclr='git clone --recurse-submodules'
alias gc1='git clone --depth 1'
alias gclean='git clean --interactive -d'
alias gpristine='git reset --hard && git clean --force -dfx'
+alias grsf='git reset --soft HEAD~'
alias gcm='git checkout $(git_main_branch)'
alias gcd='git checkout $(git_develop_branch)'
alias gcmsg='git commit --message'
@@ -210,6 +227,7 @@ alias gds='git diff --staged'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdup='git diff @{upstream}'
alias gdw='git diff --word-diff'
+alias gdl='git diff HEAD^ HEAD'
alias gf='git fetch'
alias gfo='git fetch origin'
alias gfg='git ls-files | grep'
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh
index 637df07..9ee4b93 100644
--- a/config/essentials/zsh/functions.zsh
+++ b/config/essentials/zsh/functions.zsh
@@ -72,8 +72,57 @@ esc () {
}
delfile () {
- curl "https://upfast.craftmenners.men/delete/$1"
+ curl ${2:-"https://upfast.craftmenners.men/delete/$1"}
}
upfile () {
- curl -F "file=@\"$1\"" "https://upfast.craftmenners.men"
+ curl -F "file=@\"$1\"" ${2:-"https://upfast.craftmenners.men"}
+}
+
+sgd () {
+ for dir in ${1:-$HOME/src/*}
+ do
+ cd $dir
+ if [ "$(git status --short 2>/dev/null | grep -v "??" | head -1)" ]
+ then
+ # There are changes, and this is a git repo
+ echo "$PWD \e[1;31m*changes\e[0m"
+ git fetch > /dev/null 2>&1
+ fi
+ test "$(parse_git_remote)" &&
+ echo "$PWD \e[0;32m*push/pull\e[0m"
+ done
+}
+
+# Git functions
+# Returns current branch
+function git_current_branch()
+{
+ command git rev-parse --git-dir &>/dev/null || return
+ git branch --show-current
+}
+
+# Check if main exists and use instead of master
+function git_main_branch() {
+ command git rev-parse --git-dir &>/dev/null || return
+ local ref
+ for ref in refs/{heads,remotes/{origin,upstream}}/{main,trunk,mainline,default}; do
+ if command git show-ref -q --verify $ref; then
+ echo ${ref:t}
+ return
+ fi
+ done
+ echo master
+}
+
+# Check for develop and similarly named branches
+function git_develop_branch() {
+ command git rev-parse --git-dir &>/dev/null || return
+ local branch
+ for branch in dev devel development; do
+ if command git show-ref -q --verify refs/heads/$branch; then
+ echo $branch
+ return
+ fi
+ done
+ echo develop
}