-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvimsel
More file actions
executable file
·24 lines (21 loc) · 868 Bytes
/
Copy pathvimsel
File metadata and controls
executable file
·24 lines (21 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# vimsel - a simpler [vim-anywhere][1]
#
# TODO:
#
# * vim-anywhere also uses a temporary file to copy the contents of Vim's buffer to the
# clipboard, but we can probably just use an autocommand instead [4].
# * Don't yank the final newline.
# * Should we use `xclip` or `xsel`? See [5].
# * Maybe we don't need an actual file here.
f=$(mktemp) &&
xsel -o > "$f" &&
xterm -name vimsel -e "stty -ixon; vim +'set ft=markdown' \"$f\"" &&
xsel --clipboard < "$f"
# [1]: https://github.com/cknadler/vim-anywhere
# [2]: https://github.com/hrantzsch/vimclip
# [3]: https://redd.it/98jq2p "vimclip: poor man's vim-anywhere"
# [4]: https://reddit.com/comments/98jq2p/e4gjdhn
# [5]: https://askubuntu.com/q/705620 "xclip vs. xsel"
# [6]: https://github.com/cknadler/vim-anywhere/pull/88/files
# [7]: https://github.com/cknadler/vim-anywhere/issues/94