blob: 3673119d3ff3111d50dc8097371a2559da79369b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/sh
set -eu
DB="$HOME/.local/share/cheat-sheets/vim-power.tsv"
[ -f "$DB" ] || exit 1
choice="$(
cat "$DB" |
rofi -dmenu -i -p 'Vim power ›'
)"
[ -n "${choice:-}" ] || exit 0
# First column = keystrokes
keys="$(printf '%s' "$choice" | cut -f1)"
# Clipboard (Wayland/X11)
if command -v wl-copy >/dev/null 2>&1; then
printf '%s' "$keys" | wl-copy
elif command -v xclip >/dev/null 2>&1; then
printf '%s' "$keys" | xclip -selection clipboard
else
printf '%s\n' "$keys"
fi
|