emacs - tidy up the code
[dotfiles.git] / emacs.d / config.org
index 059eb3d..2322cf8 100644 (file)
@@ -574,15 +574,17 @@ Fix the issue in mode line when showing triangle
 
 set height in mode line
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
+  (defconst sd/mode-line-font-heigh 100
+    "Defaulet the fontsize on mode line.")
+
   (with-eval-after-load "powerline"
-    (if window-system
-        (progn 
-          (let* ((base-font-size (face-attribute 'default :height)))
-            ;; 100/140;0.8
-            (set-variable 'powerline-height (/ base-font-size 10))
-            (set-variable 'powerline-text-scale-factor (/ (float 100) base-font-size)))
-          (set-face-attribute 'mode-line nil :height 100)
-          (set-face-attribute 'mode-line-inactive nil :height 100))))
+    (when (display-graphic-p)
+      (set-face-attribute 'mode-line-inactive nil :height sd/mode-line-font-heigh)
+      (set-face-attribute 'mode-line nil :height sd/mode-line-font-heigh)
+      (let* ((base-font-size (face-attribute 'default :height)))
+        ;; 100/140;0.8
+        (set-variable 'powerline-height (/ base-font-size 10))
+        (set-variable 'powerline-text-scale-factor (/ (float sd/mode-line-font-heigh) base-font-size)))))
 #+END_SRC
 
 * IDO & SMEX
@@ -667,7 +669,7 @@ Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for
     :ensure t
     :defer t
     :init
-    ;; (global-set-key (kbd "M-x") 'counsel-M-x)
+    (global-set-key (kbd "M-x") 'counsel-M-x)
     (global-set-key (kbd "C-h f") 'counsel-describe-function)
     (global-set-key (kbd "C-h v") 'counsel-describe-variable)
     ;; (set-face-attribute 'ivy-current-match nil :background "Orange" :foreground "black")
@@ -1708,17 +1710,18 @@ Fix one elscreen issue when startup emacs https://github.com/knu/elscreen/issues
     :init
     (setq elscreen-tab-display-control nil)
     :config
-    (elscreen-start)
+    ;; (elscreen-start)
     (set-face-attribute 'elscreen-tab-current-screen-face nil :foreground "black" :background "yellow")
     (set-face-attribute 'elscreen-tab-other-screen-face nil :foreground "black" :background "disabledControlTextColor" :underline nil)
     ;; (global-unset-key (kbd)); M-TAB switch screen
-    (global-set-key (kbd "s-`") '(lambda () (interactive) (elscreen-goto 0)))
-    (dotimes (i 8)
-      (global-set-key (kbd (concat "s-" (number-to-string (+ i 1))))
-                      `(lambda () (interactive) (elscreen-goto ,(+ i 1)))))
-    (global-set-key (kbd "s-t") 'elscreen-create)
-    (global-set-key (kbd "s-n") 'elscreen-next)
-    (global-set-key (kbd "s-p") 'elscreen-previous))
+    ;; (global-set-key (kbd "s-`") '(lambda () (interactive) (elscreen-goto 0)))
+    ;; (dotimes (i 8)
+    ;;   (global-set-key (kbd (concat "s-" (number-to-string (+ i 1))))
+    ;;                   `(lambda () (interactive) (elscreen-goto ,(+ i 1)))))
+    ;; (global-set-key (kbd "s-t") 'elscreen-create)
+    ;; (global-set-key (kbd "s-n") 'elscreen-next)
+    ;; (global-set-key (kbd "s-p") 'elscreen-previous)
+    )
 #+END_SRC
 
 * Dired
@@ -1965,7 +1968,7 @@ here on Mac, just use "open" commands to pen =.pdf=,  =.html= and image files
     (define-key company-active-map [tab] #'company-complete-selection)
     (global-company-mode)
     ;; magig-commit is text-modeh
-    (setq company-global-modes '(not org-mode magit-status-mode text-mode eshell-mode)))
+    (setq company-global-modes '(not org-mode magit-status-mode text-mode eshell-mode gfm-mode markdown-mode)))
 
   (use-package company-statistics
     :ensure t
@@ -3016,6 +3019,7 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del
     ;; ("C-i" other-window nil :exit t)
     ("C-b" ido-switch-buffer nil :exit t)
     ("C-f" projectile-find-file nil :exit t)
+    ("C-r" ivy-recentf nil :exit t)
     ("C-p" persp-switch :exit t)
     ("C-t" projectile-persp-switch-project nil :exit t)
 
@@ -3489,7 +3493,20 @@ Refer [[https://github.com/fnwiya/dotfiles/blob/c9ca79f1b22c919d9f4c3a0f944ba828
 ** perspeen
 #+BEGIN_SRC emacs-lisp :tangle yes :results silent
   (el-get-bundle seudut/perspeen
-    :features perspeen)
+    :features perspeen
+    ;; (perspeen-mode)
+    )
+  ;; super-i to switch to ith workspace
+
+  (defmacro sd/define-keys (map key func &rest args)
+    "A macro to define multi keys "
+    `(define-key ,map ,key (lambda () (interactive) (,func ,@args))))
+
+
+  (with-eval-after-load "perspeen"
+    (dotimes (ii 9)
+      (sd/define-keys perspeen-mode-map (kbd (concat "s-" (number-to-string (+ ii 1))))
+                           perspeen-goto-ws (+ ii 1))))
 #+END_SRC
 * TODO todolist
 ** Rucket