summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 13:49:00 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-22 13:49:00 +0200
commit30f72f36d20e9757eddcd71301403920779f31d6 (patch)
tree24179cac49835de6570ea7ec38fb6a9076b4f39e
parent32256e087aaf7744348a5ba33e802d5c8d9d97dd (diff)
checkpoint
-rwxr-xr-xbin/common/askpass8
-rwxr-xr-xbin/common/gt4
-rwxr-xr-xbin/extra/myalscore.sh3
-rw-r--r--config/essentials/shell/aliases.sh4
-rw-r--r--config/essentials/vis/visrc.lua30
5 files changed, 25 insertions, 24 deletions
diff --git a/bin/common/askpass b/bin/common/askpass
index 2725dbf..c7d2249 100755
--- a/bin/common/askpass
+++ b/bin/common/askpass
@@ -3,11 +3,15 @@
# We can figure out the password for the key based on $1
# which is in the following form:
# Enter passphrase for key 'path/to/key':
-# The point is to retrieve the path and use the final name of the key
-# find the according password.
+# The point is to retrieve the path where the filename is the name of
+# the key.
+# Then we can construct the path for pass and get the password.
key="$(printf '%s\n' "$1" |
cut -f 2 -d \' |
awk -F '/' '{print $NF}')"
pass="keys/$(hostname)/ssh/$key"
+# optional: add key to running ssh-agent
+keyadd "$key" &
+
pass show "$pass" | head -n 1
diff --git a/bin/common/gt b/bin/common/gt
index c679b23..ceb58a8 100755
--- a/bin/common/gt
+++ b/bin/common/gt
@@ -15,10 +15,10 @@ help() {
usage: gt [OPTION]
-a PATH add repo
-s update and show status of each repo
--c COMMAND run 'git COMMAND' in each repo
+-c COMMAND run 'git COMMAND' in each repo
-h show this help
-l list repos
--e edit repos in $EDITOR
+-e edit repos in \$EDITOR
EOF
}
diff --git a/bin/extra/myalscore.sh b/bin/extra/myalscore.sh
index ef68bcc..e2b4e25 100755
--- a/bin/extra/myalscore.sh
+++ b/bin/extra/myalscore.sh
@@ -4,4 +4,5 @@
query="$(printf '%s' "$*" | sed 's/\s/%20/g')"
curl -s "https://myanimelist.net/search/prefix.json?type=all&keyword=$query&v=1" \
-H 'Accept: application/json, text/javascript, */*; q=0.01' |
- jq -r '.categories[].items[] | [.payload.score, .name] | join(" ")'
+ jq -r '.categories[].items[] | "\(.payload.score)@\(.name)@\(.url)"' |
+ column -t -l 3 -s '@'
diff --git a/config/essentials/shell/aliases.sh b/config/essentials/shell/aliases.sh
index ddc605a..7ddd2f2 100644
--- a/config/essentials/shell/aliases.sh
+++ b/config/essentials/shell/aliases.sh
@@ -147,7 +147,6 @@ alias mdb='mariadb -u admin -ppass admindb'
alias mdbw='mariadb -h 0.0.0.0 -u padmin -pbulbizarre padmindb'
alias mdbwa='mariadb -h 10.3.50.5 -u padmin -pbulbizarre padmindb'
alias tmux='pgrep tmux && tmux attach || tmux new-session'
-alias wd='dict'
# ssh
alias sha='ssh-add'
@@ -184,7 +183,7 @@ alias kll='killall'
alias pi='ping 9.9.9.9 -c4'
alias sba='source env/bin/activate || source bin/activate'
-alias zsr='source ${ZDOTDIR:-~}/.zshrc && rehash'
+alias zsr='exec zsh'
alias rh='rehash'
alias wf='doas wipefs -a'
alias dmci="doas make clean install"
@@ -250,6 +249,7 @@ alias ehyb='vi ~/.config/hypr/binds.conf'
alias ewbj='vi ~/.config/waybar/config.jsonc'
alias ewbs='vi ~/.config/waybar/style.css'
alias cfd='vi config.def.h'
+alias dump='vi ~/notes/dump.md'
# /# quick cd jV}k:!sort -t "'" -k 2
alias cdl='cd ~/dl'
alias cdoc='cd ~/docs'
diff --git a/config/essentials/vis/visrc.lua b/config/essentials/vis/visrc.lua
index e35b436..9bc18f9 100644
--- a/config/essentials/vis/visrc.lua
+++ b/config/essentials/vis/visrc.lua
@@ -26,7 +26,6 @@ local format = require("format")
local fzfmru = require("fzf-mru")
fzfmru.fzfmru_path = 'grep "^' .. os.getenv("PWD") .. '" | fzf'
-
-- todo:
-- c-scope
-- c-tags
@@ -83,8 +82,12 @@ end, "Remove trailing whitespace")
--- MAPPINGS
-------------------------------------
-vis:map(m.NORMAL, "<C-p>", function() vis:command("fzf") end, "Open file with fzf")
-
+vis:map(m.NORMAL, " pf", function()
+ vis:command("fzf")
+end, "Open file with fzf")
+vis:map(m.NORMAL, " pr", function()
+ vis:command("fzfmru")
+end, "Open file with fzf")
vis:map(m.NORMAL, " r", function()
wrap_restore(vis.command, vis, "e $vis_filepath")
@@ -129,24 +132,17 @@ vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused a
"V:x/^(\\s*)(.+)$/ c/\\1>\\&2 printf '\\2: %s\\\\n' \"$\\2\"/<Enter><Escape>",
"Print variable"
)
- map_keys(
- m.NORMAL,
- ";v",
- "V:x/^(\\s*)(.+)$/ c/\\1\"$(\\2)\"/<Enter><Escape>",
- "Surround in variable"
- )
- map_keys(
- m.NORMAL,
- ";|",
- "V:x/\\| / c/|\n\t/<Enter><Escape>",
- "Wrap one-line multi pipe command"
- )
+ map_keys(m.NORMAL, ";v", 'V:x/^(\\s*)(.+)$/ c/\\1"$(\\2)"/<Enter><Escape>', "Surround in variable")
+ map_keys(m.NORMAL, ";|", "V:x/\\| / c/|\n\t/<Enter><Escape>", "Wrap one-line multi pipe command")
map_keys(
m.NORMAL,
";e",
- "V:x/^(\\s*)(.+)$/ c/\\1[ \"\\2\" ] || exit 1/<Enter><Escape>",
+ 'V:x/^(\\s*)(.+)$/ c/\\1[ "\\2" ] || exit 1/<Enter><Escape>',
"Condition exit if empty"
)
-
+ map_keys(m.NORMAL, ";sc", ":-/\\<case\\>/,/\\<esac\\>/<Enter>", "Expand to case")
+ map_keys(m.NORMAL, ";sw", ":-/\\<while/,/\\<done\\>/<Enter>", "Expand to while")
+ map_keys(m.NORMAL, ";sf", ":-/\\<for\\>/,/\\<done\\>/<Enter>", "Expand to for")
+ map_keys(m.NORMAL, ";si", ":-/\\<if\\>/,/\\<fi\\>/<Enter>", "Expand to if")
end
end)