Advertisement
pharmokan

snippet auto hot key + fzf script

Oct 5th, 2019
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. if [ $# -eq 0 ]
  4. then
  5. setopt localoptions noglobsubst noposixbuiltins pipefail 2> /dev/null
  6. find /c/z/snippets -printf "%f\n" | fzf | xargs /c/Program\ Files/AutoHotkey/AutoHotkey.exe /c/z/bin/s.ahk get $@
  7. else
  8. str2="${@:1}"
  9. str=$(echo "$str2" | sed 's/ /\-/g')
  10. /c/Program\ Files/AutoHotkey/AutoHotkey.exe /c/z/bin/s.ahk set $str.txt
  11. fi
  12.  
  13. #=================#
  14. #s.ahk
  15. Gosub, %1%
  16. Return
  17.  
  18. get:
  19. fileread, clipboard, C:\z\snippets\%2%
  20. ;minimizes terminal after setting file
  21. send {LAlt Down}{BackSpace}{LAlt Up}
  22. ;WinMinimize, A
  23. Return
  24.  
  25. set:
  26. Fileappend, %clipboard%, C:\z\snippets\%2%
  27. ;minimizes terminal after setting file
  28. send {LAlt Down}{BackSpace}{LAlt Up}
  29. ;WinMinimize, A
  30. Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement