From: Peng Li Date: Thu, 18 Jan 2018 10:17:24 +0000 (+0800) Subject: Emacs - remove unused code X-Git-Url: http://47.100.26.94:8080/?a=commitdiff_plain;h=09244749647bbdadfda424e6dc3042184cf109e7;p=dotfiles.git Emacs - remove unused code --- diff --git a/emacs.d/config.org b/emacs.d/config.org index d71d28b..eff76a7 100644 --- a/emacs.d/config.org +++ b/emacs.d/config.org @@ -1698,16 +1698,6 @@ Type =o= to go to the link (ace-link-setup-default)) #+END_SRC -** Smart Parens -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - ;; (use-package smartparens - ;; :ensure t - ;; :config - ;; (progn - ;; (require 'smartparens-config) - ;; (add-hook 'prog-mode-hook 'smartparens-mode))) -#+END_SRC - ** Ace-Windows [[https://github.com/abo-abo/ace-window][ace-window]] #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -1720,15 +1710,6 @@ Type =o= to go to the link (setq aw-keys '(?a ?s ?d ?f ?j ?k ?l))) #+END_SRC -** Which key -[[https://github.com/justbur/emacs-which-key][which-key]] show the key bindings -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - ;; (use-package which-key - ;; :ensure t - ;; :config - ;; (which-key-mode)) -#+END_SRC - ** View only for some directory When see function by =C-h f=, and visit the source code, I would like the buffer is read only. See [[http://emacs.stackexchange.com/questions/3676/how-to-enter-view-only-mode-when-browsing-emacs-source-code-from-help/3681#3681][here]] #+BEGIN_SRC emacs-lisp :tangle yes :results silent @@ -1802,12 +1783,6 @@ When see function by =C-h f=, and visit the source code, I would like the buffer (sd/delete-current-window)) #+END_SRC -** Demo It -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - (use-package org-tree-slide - :ensure t) -#+END_SRC - ** Presentation #+BEGIN_SRC emacs-lisp :tangle yes :results silent (use-package org-tree-slide @@ -1877,12 +1852,6 @@ Wiki [[http://stackoverflow.com/questions/3480173/show-keys-in-emacs-keymap-valu :features help-mode+) #+END_SRC -** goto-last-change -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - ;; (use-package goto-last-change - ;; :ensure t) -#+END_SRC - ** Ag install =ag=, =the-silver-searcher= by homebrew on mac #+BEGIN_SRC sh @@ -3254,90 +3223,90 @@ Most use =C-o C-o= to switch buffers; =C-o x, v= to split window; =C-o o= to del (winner-mode 1) (require 'utilities) - (defhydra sd/hydra-window (:color red :columns nil) - "C-o" - ;; windows switch - ("h" windmove-left nil :exit t) - ("j" windmove-down nil :exit t) - ("k" windmove-up nil :exit t) - ("l" windmove-right nil :exit t) - ("C-o" other-window nil :exit t) - ;; window resize - ("H" hydra-move-splitter-left nil) - ("J" hydra-move-splitter-down nil) - ("K" hydra-move-splitter-up nil) - ("L" hydra-move-splitter-right nil) - ;; windows split - ("v" (lambda () - (interactive) - (split-window-right) - (windmove-right)) - nil :exit t) - ("x" (lambda () - (interactive) - (split-window-below) - (windmove-down)) - nil :exit t) - ;; buffer / windows switch - ("o" sd/toggle-max-windows nil :exit t) - ("C-k" sd/delete-current-window nil :exit t) - ("C-d" (lambda () - (interactive) - (kill-buffer) - (sd/delete-current-window)) - nil :exit t) - - ;; ace-window - ;; ("'" other-window "other" :exit t) - ;; ("a" ace-window "ace") - ("s" ace-swap-window nil) - ("D" ace-delete-window nil :exit t) - ;; ("i" ace-maximize-window "ace-one" :exit t) - ;; Windows undo - redo - ("u" (progn (winner-undo) (setq this-command 'winner-undo)) nil) - ("r" (progn (winner-redo) (setq this-command 'winner-redo)) nil) - - ;; ibuffer, dired, eshell, bookmarks - ;; ("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 nil :exit t) - ;; ("C-t" projectile-persp-switch-project nil :exit t) - - ;; other special buffers - ("d" sd/project-or-dired-jump nil :exit t) - ("b" ibuffer nil :exit t) - ("t" multi-term nil :exit t) - ("e" sd/toggle-project-eshell nil :exit t) - ("m" bookmark-jump-other-window nil :exit t) - ("M" bookmark-set nil :exit t) - ("g" magit-status nil :exit t) - ;; ("p" paradox-list-packages nil :exit t) - - ;; quit - ("q" nil nil) - ("" nil nil) - ("C-h" windmove-left nil :exit t) - ("C-j" windmove-down nil :exit t) - ("C-k" windmove-up nil :exit t) - ("C-l" windmove-right nil :exit t) - ("C-;" nil nil :exit t) - ("n" nil nil :exit t) - ("[" nil nil :exit t) - ("]" nil nil :exit t) - ("f" nil nil)) - - (global-unset-key (kbd "C-o")) - (global-set-key (kbd "C-o") 'sd/hydra-window/body) - - (defun sd/project-or-dired-jump () - "If under project, jump to the root directory, otherwise - jump to dired of current file" - (interactive) - (if (projectile-project-p) - (projectile-dired) - (dired-jump))) + ;; (defhydra sd/hydra-window (:color red :columns nil) + ;; "C-o" + ;; ;; windows switch + ;; ("h" windmove-left nil :exit t) + ;; ("j" windmove-down nil :exit t) + ;; ("k" windmove-up nil :exit t) + ;; ("l" windmove-right nil :exit t) + ;; ("C-o" other-window nil :exit t) + ;; ;; window resize + ;; ("H" hydra-move-splitter-left nil) + ;; ("J" hydra-move-splitter-down nil) + ;; ("K" hydra-move-splitter-up nil) + ;; ("L" hydra-move-splitter-right nil) + ;; ;; windows split + ;; ("v" (lambda () + ;; (interactive) + ;; (split-window-right) + ;; (windmove-right)) + ;; nil :exit t) + ;; ("x" (lambda () + ;; (interactive) + ;; (split-window-below) + ;; (windmove-down)) + ;; nil :exit t) + ;; ;; buffer / windows switch + ;; ("o" sd/toggle-max-windows nil :exit t) + ;; ("C-k" sd/delete-current-window nil :exit t) + ;; ("C-d" (lambda () + ;; (interactive) + ;; (kill-buffer) + ;; (sd/delete-current-window)) + ;; nil :exit t) + + ;; ;; ace-window + ;; ;; ("'" other-window "other" :exit t) + ;; ;; ("a" ace-window "ace") + ;; ("s" ace-swap-window nil) + ;; ("D" ace-delete-window nil :exit t) + ;; ;; ("i" ace-maximize-window "ace-one" :exit t) + ;; ;; Windows undo - redo + ;; ("u" (progn (winner-undo) (setq this-command 'winner-undo)) nil) + ;; ("r" (progn (winner-redo) (setq this-command 'winner-redo)) nil) + + ;; ;; ibuffer, dired, eshell, bookmarks + ;; ;; ("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 nil :exit t) + ;; ;; ("C-t" projectile-persp-switch-project nil :exit t) + + ;; ;; other special buffers + ;; ("d" sd/project-or-dired-jump nil :exit t) + ;; ("b" ibuffer nil :exit t) + ;; ("t" multi-term nil :exit t) + ;; ("e" sd/toggle-project-eshell nil :exit t) + ;; ("m" bookmark-jump-other-window nil :exit t) + ;; ("M" bookmark-set nil :exit t) + ;; ("g" magit-status nil :exit t) + ;; ;; ("p" paradox-list-packages nil :exit t) + + ;; ;; quit + ;; ("q" nil nil) + ;; ("" nil nil) + ;; ("C-h" windmove-left nil :exit t) + ;; ("C-j" windmove-down nil :exit t) + ;; ("C-k" windmove-up nil :exit t) + ;; ("C-l" windmove-right nil :exit t) + ;; ("C-;" nil nil :exit t) + ;; ("n" nil nil :exit t) + ;; ("[" nil nil :exit t) + ;; ("]" nil nil :exit t) + ;; ("f" nil nil)) + + ;; (global-unset-key (kbd "C-o")) + ;; (global-set-key (kbd "C-o") 'sd/hydra-window/body) + + ;; (defun sd/project-or-dired-jump () + ;; "If under project, jump to the root directory, otherwise + ;; jump to dired of current file" + ;; (interactive) + ;; (if (projectile-project-p) + ;; (projectile-dired) + ;; (dired-jump))) #+END_SRC Kill the help window and buffer when quit. @@ -3373,24 +3342,7 @@ Kill the help window and buffer when quit. #+END_SRC ** Motion -- =C-M-= -[[https://www.masteringemacs.org/article/effective-editing-movement][effective-editing-movement]] -*** Command Arguments, numeric argumens -=C-u 4= same as =C-4=, =M-4= -*** Basic movement -moving by line / word / -=C-f=, =C-b=, =C-p=, =C-n=, =M-f=, =M-b= -=C-a=, =C-e= -=M-m= (move first non-whitespace on this line) -=M-}=, =M-{=, Move forward end of paragraph -=M-a=, =M-e=, beginning / end of sentence -=C-M-a=, =C-M-e=, move begining of defun -=C-x ]=, =C-x [=, forward/backward one page -=C-v=, =M-v=, =C-M-v=, =C-M-S-v= scroll down/up -=M-<=, =M->=, beginning/end of buffer -=M-r=, Repositiong point - -*** Moving by S-expression / List + *** Marks =C-= set marks toggle the region =C-u C-= Jump to the mark, repeated calls go further back the mark ring @@ -3452,15 +3404,6 @@ Here for movement, we can use register to save/jump position :ensure t) #+END_SRC -*** Bookmarks -As I would like use bookmakr for different buffer/files. to help to swith -different buffer/file quickly. this setting is in Windows/buffer node -=C-x r m= set a bookmarks -=C-x r l= list bookmarks -=C-x r b= jump to bookmarks - -*** Search -Search, replace and hightlight will in later paragraph *** =Avy= for easy motion #+BEGIN_SRC emacs-lisp :tangle yes :results silent (use-package avy @@ -3510,12 +3453,6 @@ Search, replace and hightlight will in later paragraph #+END_SRC ** Edit -*** basic editting -- cut, yank, =C-w=, =C-y= -- save, revert -- undo, redo - undo-tree -- select, expand-region -- spell check, flyspell *** Kill ring =helm-show-kill-ring= @@ -3788,6 +3725,7 @@ Here are some global key bindings for basic editting (global-set-key (kbd "s-f") 'projectile-find-file) (global-set-key (kbd "s-=") 'text-scale-increase) (global-set-key (kbd "s--") 'text-scale-decrease) + (global-unset-key (kbd "s-n")) #+END_SRC Refer [[https://github.com/fnwiya/dotfiles/blob/c9ca79f1b22c919d9f4c3a0f944ba8281255a594/setup/.emacs.d/loader-init/_90-kill-region-or-backward-kill-word.el][kill-region-or-backward-kill-word]] @@ -3853,23 +3791,3 @@ Use =ESC= to exit minibuffer. Also I map =Super-h= the same as =C-g= #+BEGIN_SRC emacs-lisp :tangle yes :results silent (org-babel-load-file "~/.emacs.d/emacs-evil.org") #+END_SRC -* Note -** Check if emacs is in terminal of graphic mode -Use =display-graphic-p= instead of =window-system= -[[info:elisp#Window%20Systems][Window Systems]] -** =Interactive= -** List operation -*** add a element to list -- ~add-to-list~ functions, append -- ~push~ macro -- ~(setcdr (last aa) (list element))~ -blog with modify list - -draw one line top of the windows -* test -This is a test. -#+BEGIN_SRC emacs-lisp :tangle yes :results silent - ;; test local mode line - ;; (add-to-list 'load-path "~/.emacs.d/elisp") - ;; (require 'my-mode-line) -#+END_SRC diff --git a/emacs.d/emacs-evil.org b/emacs.d/emacs-evil.org index fa298b6..6dd057c 100644 --- a/emacs.d/emacs-evil.org +++ b/emacs.d/emacs-evil.org @@ -148,11 +148,6 @@ There are three kinds key bindings (define-key map "\C-j" 'evil-window-down) (define-key map "\C-k" 'evil-window-up) (define-key map "\C-l" 'evil-window-right) - ;; (define-key map (kbd "C->") (lambda () (interactive) (evil-window-increase-width 3))) - ;; (define-key map (kbd "C-<") (lambda () (interactive) (evil-window-decrease-width 3))) - ;; (define-key map (kbd "C-+") (lambda () (interactive) (evil-window-increase-height 3))) - ;; (define-key map (kbd "C--") (lambda () (interactive) (evil-window-decrease-height 3))) - ;; (define-key map (kbd "C-=") (lambda () (interactive) (balance-windows))) ;; As ; has been defined as leader, so remap , to ; repeaat t/f (define-key map (kbd ",") 'evil-repeat-find-char)) (list evil-normal-state-map evil-motion-state-map))