commit 27cde8f3aa5a6f6be32c4bd53ed83963465427dc
parent 95d7418f89b173a404ff844198f2b4042e982f93
Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Fri, 6 Sep 2019 10:40:27 +0200
Merge branch 'master' of gitlab.com:admesg/dotfiles
Diffstat:
3 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc
@@ -63,6 +63,8 @@ alt + Return
$TERMINAL -e tmux
alt + shift + Return
$TERMINAL
+alt + d
+ $TERMINAL -e tmux new-session '$EDITOR ~/doc/journal/journal.tex'
alt + e
$TERMINAL -e tmux new-session $EDITOR
alt + w
@@ -70,7 +72,8 @@ alt + w
alt + shift + w
tor-browser
alt + b
- $TERMINAL -e board ~/doc
+ $TERMINAL -e vis ~/doc/todo.md
+ #$TERMINAL -e board ~/doc
alt + n
$TERMINAL -e $FILE
alt + m
diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua
@@ -73,15 +73,6 @@ vis.events.subscribe(vis.events.INIT, function()
vis:map(vis.modes.NORMAL, leader..'CS', ':e ~/.config/vis/plugins/snippets.lua<Enter>')
vis:map(vis.modes.NORMAL, leader..'d', ':< date<Enter>')
vis:map(vis.modes.NORMAL, leader..'e', ':fzf true<Enter>')
- vis:map(vis.modes.NORMAL, leader..'f', function()
- vis:command(':w')
- vis:command(':!fmt -s -w 80 $vis_filepath > /tmp/fmttmp && '..
- 'mv /tmp/fmttmp $vis_filepath')
- -- vis:command(':!PARINIT=\'rTbgqR B=.,?_A_a Q=_s>|\' '..
- -- 'cat $vis_filepath | par > /tmp/fmttmp && '..
- -- 'mv /tmp/fmttmp $vis_filepath')
- vis:command(':e')
- end)
vis:map(vis.modes.NORMAL, leader..'ga', ':!git add "$vis_filepath"<Enter>')
vis:map(vis.modes.NORMAL, leader..'gc', ':!git commit -v -S<Enter>')
vis:map(vis.modes.NORMAL, leader..'gp', ':!git push<Enter>')
diff --git a/.local/bin/define b/.local/bin/define
@@ -1,5 +1,7 @@
#!/bin/sh
set -e
+history_file=~/.cache/define.hist
+history_length=20
show_help() {
echo "usage: ${0##*/} [OPTIONS] TERM[S]"
@@ -11,8 +13,26 @@ show_help() {
echo " -h, --help show this message"
}
+prepare_history_file() {
+ mkdir -p "$(dirname "$history_file")"
+ [ ! -f "$history_file" ] && touch "$history_file" || :
+}
+
+trim_history_file() {
+ if [ "$(wc -l "$history_file"|awk '{print $1}')" -ge $history_length ]; then
+ tail -n $history_length "$history_file" > "${history_file}.tmp" && \
+ mv "${history_file}.tmp" "${history_file}"
+ fi
+}
+
+add_to_history() {
+ echo "$1" >> "$history_file"
+}
+
define() {
+ add_to_history "$1"
curl --silent dict://dict.org/d:"$1"
+ trim_history_file
}
remove_comm_msgs() {
@@ -52,9 +72,12 @@ while :; do
shift
done
+prepare_history_file
+
if [ "$gui" = 1 ]; then
- word=$(xclip -o | dmenu_themed -i -p "Dictionary lookup:") || exit 1
- notify-send "define: $word" "$(define "$word" | remove_comm_msgs)"
+ suggestions="$(xclip -o || :; cat "$history_file")"
+ word=$(echo "$suggestions" | dmenu_themed -i -p "Dictionary lookup:") || exit 1
+ notify-send -t 10000 "define: $word" "$(define "$word" | remove_comm_msgs)"
exit 0
else
[ $# -lt 1 ] && (show_help && exit 1)