X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d_2%2Fconfig.org;h=75eecae16ac2095965fce88de633d308cb9d51e5;hb=b402f6af1d2971c9b6a472027e9fe37364f3342c;hp=e1c9f8c5ee82ab5a7e17838d59d40761559222c5;hpb=7a61db417646acfebe92d8fe62bce3b0a8733ac9;p=dotfiles.git diff --git a/emacs.d_2/config.org b/emacs.d_2/config.org index e1c9f8c..75eecae 100644 --- a/emacs.d_2/config.org +++ b/emacs.d_2/config.org @@ -268,6 +268,16 @@ improve color for org-mode #+END_SRC +** Rainbow-delimiter + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package rainbow-delimiters + :ensure t + :init + (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) + +#+END_SRC * Org-mode Settings ** Org-mode Basic setting @@ -434,6 +444,7 @@ Install MacTex-basic and some tex packages (setq TeX-master t))) #+END_SRC + * Magit [[https://github.com/magit/magit][Magit]] is a very cool git interface on Emacs. @@ -531,7 +542,8 @@ Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for (use-package ido-exit-target :ensure t :init - (define-key ido-common-completion-map (kbd "C-j") #'ido-exit-target-other-window)) + (define-key ido-common-completion-map (kbd "C-j") #'ido-exit-target-split-window-right) + (define-key ido-common-completion-map (kbd "C-l") #'ido-exit-target-split-window-below)) #+END_SRC @@ -566,6 +578,51 @@ Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g= #+END_SRC +** =Ctrl= key bindings + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + ;; + + ;; C-h help + ;; C-j newline and indent + ;; C-k kill line + ;; C-l recenter-top-bottom + ;; (global-set-key (kbd "C-;") 'ido-switch-buffer) + ;; C-; + ;; C-' + ;; C-ret + + ;; C-n next-line + ;; C-m + ;; C-, + ;; C-. + ;; C-/ + + ;; C-y + ;; C-u + ;; C-i + ;; C-o + ;; C-p + ;; C-[ + ;; C-] + ;; C-\ + + ;; C-= + ;; C-- + ;; C-0 + ;; C-9 + ;; C-8 + ;; C-7 + + ;; C-Space + + + + + + + +#+END_SRC ** =Super= bindings for file, buffer and windows @@ -575,13 +632,15 @@ Some global bindings on =Super=, on Mac, it is =Command= (global-set-key (kbd "s-h") 'keyboard-quit) (global-set-key (kbd "s-j") 'ido-switch-buffer) + (global-set-key (kbd "s-k") 'ido-find-file) ;; s-k --> kill-this-buffer - (global-set-key (kbd "s-k") (lambda () + (global-set-key (kbd "s-l") (lambda () (interactive) (if (> (length (window-list)) 1) (delete-window) (message "Only one Windows now!")))) ;; s-l --> goto-line + (global-set-key (kbd "s-;") 'swiper) ;; s-; --> ;; s-' --> 'next-multiframe-window (global-set-key (kbd "") 'toggle-frame-fullscreen) @@ -662,20 +721,133 @@ I use the prefix =M-s= for searching in buffers (define-key keymap (car binding) (cdr binding))) (global-set-key key keymap)) - (global-set-key (kbd "M-s M-s") 'isearch-forward-regexp) - (global-set-key (kbd "M-s M-r") 'isearch-backward-regexp) + (define-key minibuffer-local-map "\M-s" nil) + (global-set-key (kbd "M-s s") 'isearch-forward-regexp) (define-key isearch-mode-map "\M-s" 'isearch-repeat-forward) + (global-set-key (kbd "M-s r") 'isearch-backward-regexp) (define-key isearch-mode-map "\M-r" 'isearch-repeat-backward) + (global-set-key (kbd "s-/") 'isearch-forward-regexp) + (define-key isearch-mode-map (kbd "s-/") 'isearch-repeat-forward) + (define-key isearch-mode-map (kbd "C-n") 'isearch-repeat-forward) + + + (set-face-background 'ido-first-match "white") + + ;; M-s o --> occur + ;; M-s s --> isearch-forward-regexp + ;; M-s r --> isearch-backward-regexp + ;; M-s w --> isearch-forward-word + ;; M-s . --> isearch-forward-symbol-at-point + ;; M-s _ --> isearch-forward-symbol + + ;; highlight bindings + ;; M-s h . --> highlight-symbol-at-point + ;; M-s h r --> highlight-regexp + ;; M-s h u --> unhighlight-regexp + ;; M-s h l --> highlight-lines-match-regexp + ;; M-s h p --> highlight-phrase + ;; M-s h f --> hi-lock-find-patterns + + ;; ;; (global-set-key (kbd "M-s M-r") 'isearch-backward-regexp) + ;; + ;; M-c + ;; M-r + ;; M-t + ;; M-u, #+END_SRC +Occur search key bindings +#+BEGIN_SRC emacs-lisp :tangle yes :results silent -* Misc Settings + (define-key occur-mode-map (kbd "C-n") + (lambda () + (interactive) + (occur-next) + (occur-mode-goto-occurrence-other-window) + (recenter) + (other-window 1))) + + (define-key occur-mode-map (kbd "C-p") + (lambda () + (interactive) + (occur-prev) + (occur-mode-goto-occurrence-other-window) + (recenter) + (other-window 1))) + +#+END_SRC + + +** =M-o= as prefix key for windows + +** =M-g= as prefix key for launcher + +** others + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + + ;; C-' undefined + ;; C-. undefined +#+END_SRC +* Eshell + +Eshell alias + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (defalias 'e 'ido-find-file) + (defalias 'ff 'ido-find-file) + (defalias 'ee 'ido-find-file-other-window) + +#+END_SRC + +Quickly start eshll in split window below, refer [[http://www.howardism.org/Technical/Emacs/eshell-fun.html][eshell-here]] + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (defun eshell-x () + (insert "exit") + (eshell-send-input) + (delete-window)) + + (defun eshell-here () + "Opens up a new shell in the directory associated with the + current buffer's file. The eshell is renamed to match that + directory to make multiple eshell windows easier." + (interactive) + (let* ((parent (if (buffer-file-name) + (file-name-directory (buffer-file-name)) + default-directory)) + (height (/ (window-total-height) 3)) + (name (car (last (split-string parent "/" t)))) + (eshell-name (concat "*eshell: " name "*"))) + (split-window-vertically (- height)) + (other-window 1) + (if (get-buffer eshell-name) + (progn + (message "buffer exist") + (switch-to-buffer eshell-name)) + (progn + (eshell "new") + (rename-buffer eshell-name) + + (insert (concat "ls")) + (eshell-send-input))))) + + (global-set-key (kbd "M-`") (lambda () + (interactive) + (eshell-here))) + +#+END_SRC + +* Misc Settings ** [[https://github.com/abo-abo/hydra][Hydra]] @@ -763,9 +935,7 @@ Refer [[https://github.com/abo-abo/hydra/blob/master/hydra-examples.el][hydra-ex (split-window-below) (windmove-down)) "horz") - ;; ("o" delete-other-windows "one" :exit t) - ;; Todo define o to triggle delete others windows and restore windows layout - ("o" triggle-windows-max-size "maximize" :exit t) + ("o" delete-other-windows "one" :exit t) ("a" ace-window "ace") ("s" ace-swap-window "swap") ("d" ace-delete-window "ace-one" :exit t) @@ -986,6 +1156,46 @@ Play Go in Emacs, gnugo xpm refert [[https://github.com/okanotor/dotemacs/blob/f #+END_SRC +** undo-tree + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package undo-tree + :ensure t + :config + (global-undo-tree-mode 1)) + +#+END_SRC + +** swiper + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package swiper + :ensure t) + + + (ivy-mode 1) + (setq ivy-use-virtual-buffers t) + (global-set-key "\C-s" 'swiper) + (global-set-key (kbd "C-c C-r") 'ivy-resume) + (global-set-key (kbd "") 'ivy-resume) + ;; (global-set-key (kbd "M-x") 'counsel-M-x) + ;; (global-set-key (kbd "C-x C-f") 'counsel-find-file) + (global-set-key (kbd " f") 'counsel-describe-function) + (global-set-key (kbd " v") 'counsel-describe-variable) + (global-set-key (kbd " l") 'counsel-load-library) + (global-set-key (kbd " i") 'counsel-info-lookup-symbol) + (global-set-key (kbd " u") 'counsel-unicode-char) + (global-set-key (kbd "C-c g") 'counsel-git) + (global-set-key (kbd "C-c j") 'counsel-git-grep) + (global-set-key (kbd "C-c k") 'counsel-ag) + (global-set-key (kbd "C-x l") 'counsel-locate) + (global-set-key (kbd "C-S-o") 'counsel-rhythmbox) + ;; (define-key read-expression-map (kbd "C-r") 'counsel-expression-history) + +#+END_SRC + * Programming ** Languages @@ -1001,6 +1211,8 @@ Play Go in Emacs, gnugo xpm refert [[https://github.com/okanotor/dotemacs/blob/f :diminish color-identifiers-mode) + (global-prettify-symbols-mode t) + #+END_SRC **** Lispy Mode @@ -1186,7 +1398,18 @@ company mode #+END_SRC +[[https://github.com/company-mode/company-statistics][company-statistics]] + +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + + (use-package company-statistics + :ensure t + :config + (company-statistics-mode)) + +#+END_SRC + * Todo - change M-o to trigger to delete other windows and restore previous config -- +