Kevin Mok
5 years ago
11 changed files with 201 additions and 29 deletions
-
61aliases/key_aliases.tmpl
-
7aliases/key_dirs.tmpl
-
1aliases/key_files.tmpl
-
3dot_Xresources.tmpl
-
46dot_config/fish/completions/buku.fish
-
6dot_config/fish/config.fish.tmpl
-
12dot_config/fish/functions/buku-fzf.fish
-
7dot_config/fish/functions/sudo.fish
-
18dot_config/i3/config.tmpl
-
19dot_vimrc.tmpl
-
50scripts/executable_dmenu-history
@ -0,0 +1,46 @@ |
|||||
|
# |
||||
|
# Fish completion definition for Buku. |
||||
|
# |
||||
|
# Author: |
||||
|
# Arun Prakash Jana <engineerarun@gmail.com> |
||||
|
# |
||||
|
complete -c buku -s a -l add -r --description 'add bookmark' |
||||
|
complete -c buku -l ai --description 'auto-import bookmarks' |
||||
|
complete -c buku -s c -l comment --description 'comment on bookmark' |
||||
|
complete -c buku -l cached -r --description 'visit Wayback Machine cached version' |
||||
|
complete -c buku -l colors -r --description 'set output colors in 5-letter string' |
||||
|
complete -c buku -s d -l delete --description 'delete bookmark' |
||||
|
complete -c buku -l deep --description 'search matching substrings' |
||||
|
complete -c buku -s e -l export -r --description 'export bookmarks' |
||||
|
complete -c buku -l expand -r --description 'expand a tny.im shortened URL' |
||||
|
complete -c buku -s f -l format -r --description 'limit fields in print and JSON output' |
||||
|
complete -c buku -s h -l help --description 'show help' |
||||
|
complete -c buku -s i -l import -r --description 'import bookmarks' |
||||
|
complete -c buku -l immutable -r --description 'disable title update from web' |
||||
|
complete -c buku -s j -l json --description 'show JSON output for print and search' |
||||
|
complete -c buku -s k -l unlock --description 'decrypt database' |
||||
|
complete -c buku -s l -l lock --description 'encrypt database' |
||||
|
complete -c buku -s n -l count -r --description 'results per page' |
||||
|
complete -c buku -l nc --description 'disable color output' |
||||
|
complete -c buku -l np --description 'non-interactive mode' |
||||
|
complete -c buku -s o -l open --description 'open bookmarks in browser' |
||||
|
complete -c buku -l oa --description 'browse all search results immediately' |
||||
|
complete -c buku -s p -l print --description 'show bookmark details' |
||||
|
complete -c buku -s r -l sreg -r --description 'match a regular expression' |
||||
|
complete -c buku -l replace -r --description 'replace a tag' |
||||
|
complete -c buku -s s -l sany -r --description 'match any keyword' |
||||
|
complete -c buku -s S -l sall -r --description 'match all keywords' |
||||
|
complete -c buku -l shorten -r --description 'shorten a URL using tny.im' |
||||
|
complete -c buku -l suggest --description 'show a list of similar tags' |
||||
|
complete -c buku -s t -l stag --description 'search by tag or show tags' |
||||
|
complete -c buku -l tacit --description 'reduce verbosity' |
||||
|
complete -c buku -l tag --description 'set tags, use + to append, - to remove' |
||||
|
complete -c buku -l threads -r --description 'max connections for full refresh' |
||||
|
complete -c buku -l title --description 'set custom title' |
||||
|
complete -c buku -s u -l update --description 'update bookmark' |
||||
|
complete -c buku -l url -r --description 'set url' |
||||
|
complete -c buku -s V --description 'check latest upstream release' |
||||
|
complete -c buku -s v -l version --description 'show program version' |
||||
|
complete -c buku -s w -l write --description 'open editor' |
||||
|
complete -c buku -s x -l exclude -r --description 'exclude keywords' |
||||
|
complete -c buku -s z -l debug --description 'enable debugging mode' |
@ -0,0 +1,12 @@ |
|||||
|
function buku-fzf |
||||
|
# buku -p -f 5 | awk -F '\t' 'BEGIN { OFS=FS }; { $2=substr($2, 1, 90); print }' | column -t -s (printf '\t') | fzf --multi | awk '{ print $1 }' |
||||
|
if test $argv[1] = "fq" |
||||
|
set ids (buku -t fq -f4 | awk -F '\t' 'BEGIN { OFS=FS }; { sub(/https?:\/\/(www\.)?/, "", $2); $2=substr($2, 1, 45); $3=substr($3, 1, 50); print }' | column -t -s (printf '\t') | fzf --multi --tiebreak end | awk '{ print $1 }') |
||||
|
else |
||||
|
set ids (buku -p -f4 | awk -F '\t' 'BEGIN { OFS=FS }; { sub(/https?:\/\/(www\.)?/, "", $2); $2=substr($2, 1, 45); $3=substr($3, 1, 45); print }' | column -t -s (printf '\t') | fzf --multi --tiebreak end | awk '{ print $1 }') |
||||
|
end |
||||
|
|
||||
|
for id in $ids |
||||
|
buku -o $id |
||||
|
end |
||||
|
end |
@ -0,0 +1,7 @@ |
|||||
|
function sudo |
||||
|
if test "$argv" = !! |
||||
|
eval command sudo $history[1] |
||||
|
else |
||||
|
command sudo $argv |
||||
|
end |
||||
|
end |
@ -0,0 +1,50 @@ |
|||||
|
#!/bin/sh |
||||
|
|
||||
|
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} |
||||
|
if [ -d "$cachedir" ]; then |
||||
|
cache=$cachedir/dmenu_run |
||||
|
historyfile=$cachedir/dmenu_history |
||||
|
else # if no xdg dir, fall back to dotfiles in ~ |
||||
|
cache=$HOME/.dmenu_cache |
||||
|
historyfile=$HOME/.dmenu_history |
||||
|
fi |
||||
|
|
||||
|
IFS=: |
||||
|
if stest -dqr -n "$cache" $PATH; then |
||||
|
stest -flx $PATH | sort -u > "$cache" |
||||
|
fi |
||||
|
unset IFS |
||||
|
|
||||
|
awk -v histfile=$historyfile ' |
||||
|
BEGIN { |
||||
|
while( (getline < histfile) > 0 ) { |
||||
|
sub("^[0-9]+\t","") |
||||
|
print |
||||
|
x[$0]=1 |
||||
|
} |
||||
|
} !x[$0]++ ' "$cache" \ |
||||
|
| dmenu "$@" \ |
||||
|
| awk -v histfile=$historyfile ' |
||||
|
BEGIN { |
||||
|
FS=OFS="\t" |
||||
|
while ( (getline < histfile) > 0 ) { |
||||
|
count=$1 |
||||
|
sub("^[0-9]+\t","") |
||||
|
fname=$0 |
||||
|
history[fname]=count |
||||
|
} |
||||
|
close(histfile) |
||||
|
} |
||||
|
|
||||
|
{ |
||||
|
history[$0]++ |
||||
|
print |
||||
|
} |
||||
|
|
||||
|
END { |
||||
|
if(!NR) exit |
||||
|
for (f in history) |
||||
|
print history[f],f | "sort -t '\t' -k1rn >" histfile |
||||
|
} |
||||
|
' \ |
||||
|
| while read cmd; do ${SHELL:-"/bin/sh"} -c "$cmd" & done |
Write
Preview
Loading…
Cancel
Save
Reference in new issue