;; misc operation for toggle some style
;; such as toggle line number
;; windows layout restore / maximum
-;;
-(defhydra hydra-helm (global-map "M-c")
- "Helm"
- ("j" helm-mini "helm-mini")
- ("q" nil "quit"))
-;;* Examples
-;;** Example 1: text scale
-
(defhydra hydra-zoom (global-map "<f2>")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
+;; Misc commands
+(defhydra hydra-misc (:exit t)
+ "Misc commancs"
+ ("p" (lambda ()
+ (interactive)
+ (if (buffer-exists "*Packages*")
+ (switch-to-buffer "*Packages*")
+ (package-list-packages)))
+ "list-package" :color red)
+ ("e" eval-buffer "eval-buffer" :color red))
+
+(defun buffer-exists (bufname) (not (eq nil (get-buffer bufname))))
+(global-set-key (kbd "M-c") 'hydra-misc/body)
+
+(global-set-key
+; (kbd "C-M-o")
+ (kbd "M-o")
+ (defhydra hydra-window ()
+ "window"
+ ("h" windmove-left)
+ ("j" windmove-down)
+ ("l" windmove-right)
+ ("k" windmove-up)
+ ("v" (lambda ()
+ (interactive)
+ (split-window-right)
+ (windmove-right))
+ "vert")
+ ("s" (lambda ()
+ (interactive)
+ (split-window-below)
+ (windmove-down))
+ "horz")
+ ("o" delete-other-windows "one" :color blue)
+ ("a" ace-window "ace")
+ ("w" ace-swap-window "swap")
+ ("d" ace-delete-window "del")
+ ("i" ace-maximize-window "ace-one" :color blue)
+ ("b" ido-switch-buffer "buf")
+ ("u" (progn (winner-undo) (setq this-command 'winner-undo)) "undo")
+ ("q" nil "cancel")))
+
+;(defun pl-last-winner ()
+
+
+;;(defhydra hydra-launcher (:color blue :columns 2)
+;; "Launch"
+;; ("h" man "man")
+;; ("r" (browse-url "http://www.reddit.com/r/emacs/") "reddit")
+;; ("w" (browse-url "http://www.emacswiki.org/") "emacswiki")
+;; ("s" shell "shell")
+;; ("q" nil "cancel"))
+
+;; define C-space start mark
;;** Example 2: move window splitter
-;;** Example 4: toggle rarely used modes
-
- (defvar whitespace-mode nil)
- (global-set-key
- (kbd "C-c C-v")
- (defhydra hydra-toggle-simple (:color blue)
- "toggle"
- ("a" abbrev-mode "abbrev")
- ("d" toggle-debug-on-error "debug")
- ("f" auto-fill-mode "fill")
- ("t" toggle-truncate-lines "truncate")
- ("w" whitespace-mode "whitespace")
- ("q" nil "cancel")))
-
;;** Example 5: mini-vi
(set-cursor-color "#ffffff"))
- (global-set-key
- (kbd "C-z")
- (defhydra hydra-vi (:pre hydra-vi/pre :post hydra-vi/post :color amaranth)
- "vi"
- ("l" forward-char)
- ("h" backward-char)
- ("j" next-line)
- ("k" previous-line)
- ("m" set-mark-command "mark")
- ("a" move-beginning-of-line "beg")
- ("e" move-end-of-line "end")
- ("d" delete-region "del" :color blue)
- ("y" kill-ring-save "yank" :color blue)
- ("q" nil "quit")))
-
+; (global-set-key
+; (kbd "C-z")
+; (defhydra hydra-vi (:pre hydra-vi/pre :post hydra-vi/post :color amaranth)
+; "vi"
+; ("l" forward-char)
+; ("h" backward-char)
+; ("j" next-line)
+; ("k" previous-line)
+; ("m" set-mark-command "mark")
+; ("a" move-beginning-of-line "beg")
+; ("e" move-end-of-line "end")
+; ("d" delete-region "del" :color blue)
+; ("y" kill-ring-save "yank" :color blue)
+; ("q" nil "quit")))
+(setq hydra-lv nil)
;;** Example 6: selective global bind
(goto-char mk))))
(provide 'init-hydra)
+
+
+;;** Example 4: toggle rarely used modes
+
+; (defvar whitespace-mode nil)
+; (global-set-key
+; (kbd "C-c C-v")
+; (defhydra hydra-toggle-simple (:color blue)
+; "toggle"
+; ("a" abbrev-mode "abbrev")
+; ("d" toggle-debug-on-error "debug")
+; ("f" auto-fill-mode "fill")
+; ("t" toggle-truncate-lines "truncate")
+; ("w" whitespace-mode "whitespace")
+; ("q" nil "cancel")))