ReverseFlux

hydra

Feb 3rd, 2017
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.59 KB | None | 0 0
  1. (defhydra hydra-zoom (global-map "<f2>")
  2. "zoom"
  3. ("<kp-add>" text-scale-increase "in")
  4. ("+" text-scale-increase "in")
  5. ("-" text-scale-decrease "out")
  6. ("<kp-subtract>" text-scale-decrease "out")
  7. ("0" (text-scale-set 0) "reset")
  8. ("<kp-0>" (text-scale-set 0) "reset"))
  9.  
  10. (global-set-key (kbd "<C-wheel-up>") 'text-scale-increase)
  11. (global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease)
  12.  
  13. (defhydra hydra-buffer-menu (:color pink
  14. :hint nil)
  15. "
  16. ^Mark^ ^Unmark^ ^Actions^ ^Search
  17. ^^^^^^^^-----------------------------------------------------------------
  18. _m_: mark _u_: unmark _x_: execute _R_: re-isearch
  19. _s_: save _U_: unmark up _b_: bury _I_: isearch
  20. _d_: delete ^ ^ _g_: refresh _O_: multi-occur
  21. _D_: delete up ^ ^ _T_: files only: % -28`Buffer-menu-files-only
  22. _~_: modified
  23. "
  24. ("m" Buffer-menu-mark)
  25. ("u" Buffer-menu-unmark)
  26. ("U" Buffer-menu-backup-unmark)
  27. ("d" Buffer-menu-delete)
  28. ("D" Buffer-menu-delete-backwards)
  29. ("s" Buffer-menu-save)
  30. ("~" Buffer-menu-not-modified)
  31. ("x" Buffer-menu-execute)
  32. ("b" Buffer-menu-bury)
  33. ("g" revert-buffer)
  34. ("T" Buffer-menu-toggle-files-only)
  35. ("O" Buffer-menu-multi-occur :color blue)
  36. ("I" Buffer-menu-isearch-buffers :color blue)
  37. ("R" Buffer-menu-isearch-buffers-regexp :color blue)
  38. ("c" nil "cancel")
  39. ("v" Buffer-menu-select "select" :color blue)
  40. ("o" Buffer-menu-other-window "other-window" :color blue)
  41. ("q" quit-window "quit" :color blue))
  42.  
  43. (define-key Buffer-menu-mode-map "." 'hydra-buffer-menu/body)
  44.  
  45. (defun occur-dwim ()
  46. "Call `occur' with a sane default, chosen as the thing under point or selected region"
  47. (interactive)
  48. (push (if (region-active-p)
  49. (buffer-substring-no-properties
  50. (region-beginning)
  51. (region-end))
  52. (let ((sym (thing-at-point 'symbol)))
  53. (when (stringp sym)
  54. (regexp-quote sym))))
  55. regexp-history)
  56. (call-interactively 'occur))
  57.  
  58. ;; Keeps focus on *Occur* window, even when when target is visited via RETURN key.
  59. ;; See hydra-occur-dwim for more options.
  60. (defadvice occur-mode-goto-occurrence (after occur-mode-goto-occurrence-advice activate)
  61. (other-window 1)
  62. (hydra-occur-dwim/body))
  63.  
  64. ;; Focus on *Occur* window right away.
  65. (add-hook 'occur-hook (lambda () (other-window 1)))
  66.  
  67. (defun reattach-occur ()
  68. (if (get-buffer "*Occur*")
  69. (switch-to-buffer-other-window "*Occur*")
  70. (hydra-occur-dwim/body) ))
  71.  
  72. ;; Used in conjunction with occur-mode-goto-occurrence-advice this helps keep
  73. ;; focus on the *Occur* window and hides upon request in case needed later.
  74. (defhydra hydra-occur-dwim ()
  75. "Occur mode"
  76. ("o" occur-dwim "Start occur-dwim" :color red)
  77. ("j" occur-next "Next" :color red)
  78. ("k" occur-prev "Prev":color red)
  79. ("h" delete-window "Hide" :color blue)
  80. ("r" (reattach-occur) "Re-attach" :color red))
  81.  
  82. (global-set-key (kbd "C-x o") 'hydra-occur-dwim/body)
  83.  
  84. (use-package pdf-tools
  85. :ensure t
  86. :config
  87. (pdf-tools-install)
  88. (setq-default pdf-view-display-size 'fit-page)
  89. (bind-keys :map pdf-view-mode-map
  90. ("\\" . hydra-pdftools/body)
  91. ("<s-spc>" . pdf-view-scroll-down-or-next-page)
  92. ("g" . pdf-view-first-page)
  93. ("G" . pdf-view-last-page)
  94. ("l" . image-forward-hscroll)
  95. ("h" . image-backward-hscroll)
  96. ("j" . pdf-view-next-page)
  97. ("k" . pdf-view-previous-page)
  98. ("e" . pdf-view-goto-page)
  99. ("u" . pdf-view-revert-buffer)
  100. ("al" . pdf-annot-list-annotations)
  101. ("ad" . pdf-annot-delete)
  102. ("aa" . pdf-annot-attachment-dired)
  103. ("am" . pdf-annot-add-markup-annotation)
  104. ("at" . pdf-annot-add-text-annotation)
  105. ("y" . pdf-view-kill-ring-save)
  106. ("i" . pdf-misc-display-metadata)
  107. ("s" . pdf-occur)
  108. ("b" . pdf-view-set-slice-from-bounding-box)
  109. ("r" . pdf-view-reset-slice))
  110. (use-package org-pdfview
  111. :ensure t))
  112.  
  113. (defhydra hydra-pdftools (:color blue :hint nil)
  114. "
  115. ╭───────────┐
  116. Move History Scale/Fit Annotations Search/Link Do │ PDF Tools │
  117. ╭──────────────────────────────────────────────────────────────────┴───────────╯
  118. ^^_g_^^ _B_ ^↧^ _+_ ^ ^ [_al_] list [_s_] search [_u_] revert buffer
  119. ^^^↑^^^ ^↑^ _H_ ^↑^ ↦ _W_ ↤ [_am_] markup [_o_] outline [_i_] info
  120. ^^_p_^^ ^ ^ ^↥^ _0_ ^ ^ [_at_] text [_F_] link [_d_] dark mode
  121. ^^^↑^^^ ^↓^ ╭─^─^─┐ ^↓^ ╭─^ ^─┐ [_ad_] delete [_f_] search link
  122. _h_ ←pag_e_→ _l_ _N_ │ _P_ │ _-_ _b_ [_aa_] dired
  123. ^^^↓^^^ ^ ^ ╰─^─^─╯ ^ ^ ╰─^ ^─╯ [_y_] yank
  124. ^^_n_^^ ^ ^ _r_eset slice box
  125. ^^^↓^^^
  126. ^^_G_^^
  127. --------------------------------------------------------------------------------
  128. "
  129. ("\\" hydra-master/body "back")
  130. ("<ESC>" nil "quit")
  131. ("al" pdf-annot-list-annotations)
  132. ("ad" pdf-annot-delete)
  133. ("aa" pdf-annot-attachment-dired)
  134. ("am" pdf-annot-add-markup-annotation)
  135. ("at" pdf-annot-add-text-annotation)
  136. ("y" pdf-view-kill-ring-save)
  137. ("+" pdf-view-enlarge :color red)
  138. ("-" pdf-view-shrink :color red)
  139. ("0" pdf-view-scale-reset)
  140. ("H" pdf-view-fit-height-to-window)
  141. ("W" pdf-view-fit-width-to-window)
  142. ("P" pdf-view-fit-page-to-window)
  143. ("n" pdf-view-next-page-command :color red)
  144. ("p" pdf-view-previous-page-command :color red)
  145. ("d" pdf-view-dark-minor-mode)
  146. ("b" pdf-view-set-slice-from-bounding-box)
  147. ("r" pdf-view-reset-slice)
  148. ("g" pdf-view-first-page)
  149. ("G" pdf-view-last-page)
  150. ("e" pdf-view-goto-page)
  151. ("o" pdf-outline)
  152. ("s" pdf-occur)
  153. ("i" pdf-misc-display-metadata)
  154. ("u" pdf-view-revert-buffer)
  155. ("F" pdf-links-action-perfom)
  156. ("f" pdf-links-isearch-link)
  157. ("B" pdf-history-backward :color red)
  158. ("N" pdf-history-forward :color red)
  159. ("l" image-forward-hscroll :color red)
  160. ("h" image-backward-hscroll :color red))
Advertisement
Add Comment
Please, Sign In to add comment