ff 525 B

123456789101112131415161718192021222324252627
  1. #!/bin/sh --
  2. set -ue
  3. # deps:
  4. # vim
  5. # bat
  6. # sk (skim)
  7. # rg (ripgrep)
  8. # shellcheck disable=2016
  9. cmd='"${EDITOR:-vim}" -c "normal $(printf %d {2})Gzz" -- {1}'
  10. interactive=
  11. [ "${1:-}" ] || interactive=-i
  12. SHELL=/bin/sh exec sk ${interactive} \
  13. --ansi \
  14. --reverse \
  15. --height=30 \
  16. --delimiter=: \
  17. --cmd-prompt='rg: ' \
  18. --cmd-query="${*:-}" \
  19. --preview-window='+{2}-/2' \
  20. --bind="enter:execute[${cmd}]" \
  21. --preview='bat -H {2} -n --color=always -- {1}' \
  22. --cmd="rg --color=always --no-binary --no-ignore -n {}"