emacs - toggle window maximum
[dotfiles.git] / emacs.d / config.org
index cc72e83..ff8d4ab 100644 (file)
@@ -2259,6 +2259,14 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (winner-mode 1)
 
+  (defun sd/toggle-max-windows ()
+    "Set maximize current if there are multiple windows, if only
+  one window, window undo"
+    (interactive)
+    (if (equal  (length (window-list)) 1)
+        (winner-undo)
+      (delete-other-windows)))
+
   (defhydra sd/hydra-window (:color red :columns nil)
     "window"
     ("h" windmove-left nil :exit t)
@@ -2279,7 +2287,8 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del
            (split-window-below)
            (windmove-down))
      "horz" :exit t)
-    ("o" delete-other-windows "one" :exit t)
+    ;; ("o" delete-other-windows "one" :exit t)
+    ("o" sd/toggle-max-windows "one" :exit t)
     ("C-o" ido-switch-buffer "buf" :exit t)
     ("C-k" sd/delete-current-window "del" :exit t)
     ("'" other-window "other" :exit t)
@@ -2361,16 +2370,28 @@ Stolen [[https://www.masteringemacs.org/article/fixing-mark-commands-transient-m
   ;; (define-key global-map [remap exchange-point-and-mark] 'exchange-point-and-mark-no-activate)
 #+END_SRC
 
-Show the mark ring using =helm-mark-ring=
+Show the mark ring using =helm-mark-ring=, also mapping =M-`= to quit minibuffer. so that =M-`= can 
+toggle the mark ring. the best way is add a new action and mapping to =helm-source-mark-ring=,  but 
+since there is no map such as =helm-mark-ring=map=, so I cannot binding a key to the quit action.
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  ;; (defun sd/helm-quit-mark-ring (key)
+  ;;   "exit"
+  ;;   (keyboard-quit))
+
+  ;; (helm-add-action-to-source "Exit helm" 'sd/helm-quit-mark-ring helm-source-mark-ring 1)
   (global-set-key (kbd "M-`") #'helm-mark-ring)
+
+  (define-key minibuffer-local-map (kbd "M-`") 'keyboard-escape-quit)
 #+END_SRC
 
 =M-h= marks the next paragraph
 =C-x h= marks the whole buffer
 =C-M-h= marks the next defun
 =C-x C-p= marks the next page
-**** TODO Mapping toggle mark ring=
+**** DONE Mapping toggle mark ring=
+:LOGBOOK:
+- State "DONE"       from "TODO"       [2016-07-22 Fri 23:18]
+:END:
 *** Registers
 Registers can save text, position, rectangles, file and configuration and other things.
 Here for movement, we can use register to save/jump position
@@ -2409,33 +2430,26 @@ Search, replace and hightlight will in later paragraph
   (global-set-key (kbd "C-M-w") 'avy-goto-char-timer)
   (global-set-key (kbd "C-M-l") 'avy-goto-char-in-line)
 
-  ;; will delete above 
-  (global-set-key (kbd "M-g j") 'avy-goto-line-below)
-  (global-set-key (kbd "M-g k") 'avy-goto-line-above)
-  (global-set-key (kbd "M-g w") 'avy-goto-word-1-below)
-  (global-set-key (kbd "M-g b") 'avy-goto-word-1-above)
-  (global-set-key (kbd "M-g e") 'avy-goto-word-0)
-  (global-set-key (kbd "M-g f") 'avy-goto-char-timer)
-  (global-set-key (kbd "M-g c") 'avy-goto-char-in-line)
-
-  ;; M-g TAB              move-to-column
-  ;; M-g ESC              Prefix Command
-  ;; M-g c                goto-char
-  ;; M-g g                goto-line
-  ;; M-g n                next-error
-  ;; M-g p                previous-error
-
-  ;; M-g M-g              goto-line
-  ;; M-g M-n              next-error
-  ;; M-g M-p              previous-error
+  ;; ;; will delete above 
+  ;; (global-set-key (kbd "M-g j") 'avy-goto-line-below)
+  ;; (global-set-key (kbd "M-g k") 'avy-goto-line-above)
+  ;; (global-set-key (kbd "M-g w") 'avy-goto-word-1-below)
+  ;; (global-set-key (kbd "M-g b") 'avy-goto-word-1-above)
+  ;; (global-set-key (kbd "M-g e") 'avy-goto-word-0)
+  ;; (global-set-key (kbd "M-g f") 'avy-goto-char-timer)
+  ;; (global-set-key (kbd "M-g c") 'avy-goto-char-in-line)
 #+END_SRC
 
 *** =Imenu= goto tag
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
-  ;; (global-unset-key (kbd "C-M-i"))
-  ;; (global-set-key (kbd "C-M-i") #'counsel-imenu)
-  (global-set-key (kbd "M-i") #'counsel-imenu)
+  ;; (global-set-key (kbd "M-i") #'counsel-imenu)
+  (global-set-key (kbd "M-i") #'imenu)
+
+  ;; (global-set-key (kbd "M-l") 'goto-line)
+#+END_SRC
 
+*** Go-to line
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (global-set-key (kbd "M-l") 'goto-line)
 #+END_SRC
 
@@ -2446,10 +2460,6 @@ Search, replace and hightlight will in later paragraph
 =M-c=, toggle case sensitivity
 =M-n=, =M-p=, history
 **** tagss
-**** got-to-line
-
-
-
 ** Edit
 - cut, yank, =C-w=, =C-y=
 - save, revert
@@ -2524,6 +2534,15 @@ stolen from [[https://github.com/mariolong/emacs.d/blob/f6a061594ef1b5d1f4750e9d
                                          (insert (format "%s" (with-ivy-window (thing-at-point 'symbol)))))))
 #+END_SRC
 
+* Dictionary
+#+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (use-package bing-dict
+    :ensure t
+    :commands (bing-dict-brief)
+    :config
+    (global-set-key (kbd "s-d") 'bing-dict-brief))
+#+END_SRC
+
 * TODO Temp directory for cached/history/temp files
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (use-package recentf