;; (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
(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
(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))
: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 "<f6>") 'ivy-resume)
;; ;; (global-set-key (kbd "C-x C-f") 'counsel-find-file)
;; (global-set-key (kbd "<f1> l") 'counsel-load-library)
;; (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
(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)
: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=
(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=
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
(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
(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=
* 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=