;;; init-terminal-kbd.el --- keybindings -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (defun open-init-file() "Open user's init.el file in ~/.emacs.d ." (interactive) (find-file "~/.emacs.d/init.el")) (defun duplicate-and-move-to-next-line() "Duplicate current line and move to next line." (interactive) (progn (duplicate-line) (next-line))) ;; scratch buffer (if *is-mac* (general-def "C-c " 'scratch-buffer) (general-def "C-c " 'scratch-buffer)) ;; god-mode (general-def god-local-mode-map "i" 'god-mode-all "" 'god-mode-all "[" 'backward-paragraph "]" 'forward-paragraph "." 'repeat "y" 'yank "C-c C-" 'scratch-buffer "z" 'avy-goto-char "'" 'avy-goto-word-1 "" 'open-init-file) ;; global map with C-c prefix (general-def :prefix "C-c" "e" 'er/expand-region "k" 'comment-line "f r" 'recentf "i" 'imenu) ;; global map (general-def ;; god-mode "" 'god-mode-all "M-i" 'god-mode-all ;; buffer, file, and window "" 'open-init-file "M-[" 'previous-buffer "M-]" 'next-buffer "C-x C-b" 'ibuffer-other-window "C-x K" 'crux-kill-other-buffers "C-x C-b" 'ibuffer-other-window ;; edit "M-c" 'capitalize-dwim "M-u" 'upcase-dwim "M-l" 'downcase-dwim "C-," 'duplicate-and-move-to-next-line "C-k" 'crux-smart-kill-line "C-" 'crux-kill-line-backwards "C-a" 'crux-move-beginning-of-line "M-y" 'yank-from-kill-ring "C-c DEL" 'hungry-delete-backward "C-c C-DEL" 'hungry-delete-forward "M-P" 'drag-stuff-up "M-N" 'drag-stuff-down ;; undo "C-/" 'undo-fu-only-undo "C-?" 'undo-fu-only-redo ;; navigate "M-p" 'backward-paragraph "M-n" 'forward-paragraph ;; window "M-" 'shrink-window-horizontally "M-" 'enlarge-window-horizontally "M-" 'shrink-window "M-" 'enlarge-window "M-o" 'other-window) ;; save-some-buffer时diff更改 (add-to-list 'save-some-buffers-action-alist (list "d" (lambda (buffer) (diff-buffer-with-file (buffer-file-name buffer))) "show diff between the buffer and its file")) (provide 'init-terminal-kbd) ;;; init-terminal-kbd.el ends here