fix #77
This commit is contained in:
parent
766fd11dad
commit
b2aeb26473
2 changed files with 6 additions and 38 deletions
|
@ -278,6 +278,10 @@ Of course modules can and will be more complex, since a good module checks if
|
|||
command for providing item list is available on user's machine, and supports
|
||||
various settings inside it. Feel free to look how existing modules are made.
|
||||
|
||||
### External modules
|
||||
Support for [yank-ring.kak][25] was externalized to separate plugin
|
||||
[fzf-yank-ring.kak][24]
|
||||
|
||||
[1]: https://img.shields.io/github/release/andreyorst/fzf.kak.svg
|
||||
[2]: https://github.com/andreyorst/fzf.kak/releases
|
||||
[3]: https://img.shields.io/github/release-date/andreyorst/fzf.kak.svg
|
||||
|
@ -301,3 +305,5 @@ various settings inside it. Feel free to look how existing modules are made.
|
|||
[21]: rc/modules/sk-grep.kak
|
||||
[22]: rc/modules/fzf-search.kak
|
||||
[23]: #configuration
|
||||
[24]: https://gitlab.com/losnappas/fzf-yank-ring.kak
|
||||
[25]: https://github.com/alexherbo2/yank-ring.kak
|
||||
|
|
|
@ -1,38 +0,0 @@
|
|||
# ╭─────────────╥───────────────────────╮
|
||||
# │ Authors: ║ File: │
|
||||
# │ Andrey Orst ║ fzf-yank-ring.kak │
|
||||
# │ losnappas ║ │
|
||||
# ╞═════════════╩═══════════════════════╡
|
||||
# │ Module for selecting items in yank │
|
||||
# │ ring for fzf.kak plugin │
|
||||
# ╞═════════════════════════════════════╡
|
||||
# │ GitHub.com/andreyorst/fzf.kak │
|
||||
# │ GitHub.com/alexherbo2/yank-ring.kak │
|
||||
# ╰─────────────────────────────────────╯
|
||||
|
||||
hook global ModuleLoaded fzf %§
|
||||
|
||||
# this will fail if yank-ring.kak isn't installed
|
||||
hook global -once WinCreate .* %{ try %{
|
||||
set-option -add global yank_ring_history
|
||||
map global fzf -docstring "open yank-ring" 'y' '<esc>: fzf-yank-ring<ret>'
|
||||
}}
|
||||
|
||||
define-command -hidden fzf-yank-ring %{ evaluate-commands %sh{
|
||||
yanks=$(mktemp ${TMPDIR:-/tmp}/kak-fzf-yanks.XXXXXX)
|
||||
eval "set -- $kak_quoted_opt_yank_ring_history"
|
||||
while [ $# -gt 0 ]; do
|
||||
item=$(printf "%s" "$1" | sed "s/^'//;s/'$//;s/''/'/g" | awk 1 ORS='')
|
||||
printf "%s\n" "$item" >> $yanks
|
||||
shift
|
||||
done
|
||||
|
||||
message="Swap between items in yank-ring."
|
||||
printf "%s\n" "fzf -kak-cmd %{fzf-yank-ring-set-dquote} -items-cmd %{cat $yanks} -preview -preview-cmd %{--preview 'printf \"%s\\\n\" {} | sed \"s//\\\n/g\"'}"
|
||||
}}
|
||||
|
||||
define-command -hidden fzf-yank-ring-set-dquote -params 1 %{
|
||||
set-register dquote %sh{ printf "%s\n" "$1" | sed "s//\n/g" }
|
||||
}
|
||||
|
||||
§
|
Loading…
Reference in a new issue