X-Git-Url: http://47.100.26.94:8080/?a=blobdiff_plain;f=emacs.d%2Fconfig.org;h=7d3586b9e53fadd55d07c6ddb67a107f719a49c2;hb=964ddb78963074320041fa42aaf328f28dc1ef1a;hp=5e9f80edcfe14c45302cffcd2825ddb9b4111737;hpb=2e576f37c52a0d60c0dc41ea057df68a22bd6828;p=dotfiles.git diff --git a/emacs.d/config.org b/emacs.d/config.org index 5e9f80e..7d3586b 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -86,12 +86,6 @@ Set the emacs load path ;; (desktop-save-mode t) #+END_SRC -*** Save minibuffer history -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - (savehist-mode 1) - (setq history-length 1000) -#+END_SRC - *** temp folder Make a temp directory for all cache/history files #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -102,6 +96,18 @@ Make a temp directory for all cache/history files (mkdir sd-temp-directory)) #+END_SRC +*** Save minibuffer history +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (setq savehist-file (concat sd-temp-directory "history")) + (setq history-length 1000) + (setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring)) + (savehist-mode 1) + + ;; set temp file path for recentf and auto-save + (setq recentf-save-file (concat sd-temp-directory "recentf")) + (setq auto-save-list-file-prefix (concat sd-temp-directory "auto-save-list/.saves-")) +#+END_SRC + * Package Management Tools ** Use-package @@ -557,8 +563,8 @@ set height in mode line (use-package smex :ensure t :init - (smex-initialize) (setq smex-save-file (concat sd-temp-directory "smex-items")) + (smex-initialize) :bind ("M-x" . smex) ("M-X" . smex-major-mode-commands)) @@ -599,10 +605,14 @@ Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for :init (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)) + (global-set-key (kbd "C-h v") 'counsel-describe-variable) + ;; (set-face-attribute 'ivy-current-match nil :background "Orange" :foreground "black") + (define-key read-expression-map (kbd "C-r") 'counsel-expression-history) + (global-set-key (kbd "C-c C-r") 'ivy-resume)) + + ;; (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 "C-x C-f") 'counsel-find-file) ;; (global-set-key (kbd " l") 'counsel-load-library) @@ -613,7 +623,6 @@ Use [[https://github.com/DarwinAwardWinner/ido-ubiquitous][ido-ubiquitous]] for ;; (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) ;; (set-face-attribute ;; 'ivy-current-match nil @@ -1311,8 +1320,8 @@ We can use [[https://www.gnu.org/software/emms/quickstart.html][Emms]] for multi (use-package emms :ensure t :init - (setq emms-source-file-default-directory "~/Music/") (setq emms-directory (concat sd-temp-directory "emms")) + (setq emms-source-file-default-directory "~/Music/") :config (emms-standard) (emms-default-players) @@ -1942,7 +1951,7 @@ Use =gnuplot= on =Org-mode= file, see [[http://orgmode.org/worg/org-contrib/babe :commands (bing-dict-brief)) #+END_SRC -* NEXT Key Bindings +* Key Bindings Here are some global key bindings for basic editting ** Esc in minibuffer Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g= @@ -2267,13 +2276,6 @@ Search, replace and hightlight will in later paragraph (global-set-key (kbd "M-l") 'goto-line) #+END_SRC -*** Movement effective -**** isearch -=C-s=, =C-r= -=C-w=, put the word into search minibuffer, =M-y= -=M-c=, toggle case sensitivity -=M-n=, =M-p=, history -**** tagss ** Edit *** basic editting - cut, yank, =C-w=, =C-y= @@ -2369,8 +2371,14 @@ Make flyspell enabled for org-mode, see [[http://emacs.stackexchange.com/questio set the isearch history size, the default is only =16= #+BEGIN_SRC emacs-lisp :tangle yes :results silent (setq history-length 5000) - (set-variable regexp-search-ring-max 1000) - (set-variable search-ring-max 1000) + (setq regexp-search-ring-max 1000) + (setq search-ring-max 1000) + + ;; when search a word or a symbol , also add the word into regexp-search-ring + (defadvice isearch-update-ring (after sd/isearch-update-ring (string &optional regexp) activate) + "Add search-ring to regexp-search-ring" + (unless regexp + (add-to-history 'regexp-search-ring string regexp-search-ring-max))) #+END_SRC *** =M-s= prefix @@ -2434,8 +2442,6 @@ use the prefix =M-s= for searching in buffers (global-set-key (kbd "s-\\") 'highlight-symbol-query-replace) #+END_SRC -*** replace -*** hightlight *** Occur Occur search key bindings #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -2488,6 +2494,45 @@ stolen from [[https://github.com/mariolong/emacs.d/blob/f6a061594ef1b5d1f4750e9d (insert (format "%s" (with-ivy-window (thing-at-point 'symbol))))))) #+END_SRC +** TODO Expand region map +#+BEGIN_SRC emacs-lisp :tangle yes :results silent + (defhydra sd/expand-selected (:color red :columns nil + :post (deactivate-mark)) + "Selected" + ;; select + ("e" er/expand-region "+") + ("c" er/contract-region "-") + ;; ("\"" er/mark-inside-quotes "inside \"") + ;; ("a\"" er/mark-outside-quotes "inside \"") + ;; exchange + ("x" exchange-point-and-mark "exchange") + ("o" exchange-point-and-mark "exchange") + ;; exit + ("d" kill-region "delete" :exit t) + ("i" kill-region "delete" :exit t) + ("y" kill-ring-save "yank" :exit t) + ("q" nil "quit" :exit t)) + + (global-set-key (kbd "C-=") (lambda () + (interactive) + (er/mark-word) + (sd/expand-selected/body))) + + ;; er/mark-word + ;; er/mark-symbol + ;; er/mark-symbol-with-prefix + ;; er/mark-next-accessor + ;; er/mark-method-call + ;; er/mark-inside-quotes + ;; er/mark-outside-quotes + ;; er/mark-inside-pairs + ;; er/mark-outside-pairs + ;; er/mark-comment + ;; er/mark-url + ;; er/mark-email + ;; er/mark-defun +#+END_SRC + * TODO Convert ASCII to key ** map =function-key-map= [[http://academic.evergreen.edu/projects/biophysics/technotes/program/ascii_ctrl.htm][ascii_ctrl]] new file =C-x C-f C-f= @@ -2501,35 +2546,6 @@ new file =C-x C-f C-f= * TODO jump last change point * TODO emms mode-line -* TODO Temp directory for cached/history/temp files -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package recentf - :init - (setq recentf-save-file (concat sd-temp-directory "recentf"))) - - ;; (use-package projectile - ;; :init - ;; (setq projectile-cache-file (concat sd-temp-directory "projectile.cache"))) - - ;; (use-package ido - ;; :init - ;; (setq ido-save-directory-list-file (concat sd-temp-directory "ido.last"))) - - (use-package savehist - :init - (setq savehist-file (concat sd-temp-directory "history"))) - - ;; (use-package emms - ;; :init - ;; (setq emms-directory (concat sd-temp-directory "emms"))) - - (setq auto-save-list-file-prefix (concat sd-temp-directory "auto-save-list/.saves-")) - - ;; use-package smex - ;; :init - ;; (setq smex-save-file (concat sd-temp-directory "smex-items")) -#+END_SRC - * =C-u C-h a= search funtions =apropos-command=