Browse Source

Add find-file emacs.d

master
Riyyi 4 years ago
parent
commit
bab1fcf243
  1. 48
      .emacs.d/config.org

48
.emacs.d/config.org

@ -927,19 +927,26 @@ Set UTF-8 encoding as default.
Functions that only use built-in Emacs functionality. Functions that only use built-in Emacs functionality.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun config-visit () (defun display-startup-echo-area-message ()
"Config edit." "Hide default startup message."
(message nil))
(defun dot/config-visit ()
"Edit config file."
(interactive) (interactive)
(find-file (concat dot-emacs-dir "/config.org"))) (find-file (concat dot-emacs-dir "/config.org")))
(defun config-reload () (defun dot/config-reload ()
"Config reload." "Reload config file."
(interactive) (interactive)
(org-babel-load-file (concat dot-emacs-dir "/config.org"))) (org-babel-load-file (concat dot-emacs-dir "/config.org")))
(defun display-startup-echo-area-message () (defun dot/find-file-emacsd ()
"Hide default startup message." "Find a file under `dot-emacs-dir', recursively."
(message nil)) (interactive)
(let ((files (mapcar 'abbreviate-file-name
(directory-files-recursively dot-emacs-dir ""))))
(find-file (completing-read "Find file (emacs.d): " files nil t))))
(defun dot/indent-buffer () (defun dot/indent-buffer ()
"Indent each nonblank line in the buffer." "Indent each nonblank line in the buffer."
@ -964,7 +971,7 @@ Functions that only use built-in Emacs functionality.
"Use `completing-read' to open a recent file." "Use `completing-read' to open a recent file."
(interactive) (interactive)
(let ((files (mapcar 'abbreviate-file-name recentf-list))) (let ((files (mapcar 'abbreviate-file-name recentf-list)))
(find-file (completing-read "Find recent file: " files nil t)))) (find-file (completing-read "Find file (recent): " files nil t))))
(defun dot/reload-theme () (defun dot/reload-theme ()
"Reload custom theme." "Reload custom theme."
@ -1456,12 +1463,10 @@ General.el ~leader key binds.
"b <left>" '(previous-buffer :which-key "Previous buffer") "b <left>" '(previous-buffer :which-key "Previous buffer")
"b <right>" '(next-buffer :which-key "Next buffer") "b <right>" '(next-buffer :which-key "Next buffer")
;; Comments / config ;; Comments
"c" '(:ignore t :which-key "comment/config") "c" '(:ignore t :which-key "comment/config")
"c c" '(evilnc-comment-or-uncomment-lines :which-key "Toggle comment") "c c" '(evilnc-comment-or-uncomment-lines :which-key "Toggle comment")
"c p" '(evilnc-comment-or-uncomment-paragraphs :which-key "Toggle comment paragraph") "c p" '(evilnc-comment-or-uncomment-paragraphs :which-key "Toggle comment paragraph")
"c r" '(config-reload :which-key "Config reload")
"c v" '(config-visit :which-key "Config visit")
"c y" '(evilnc-comment-and-kill-ring-save :which-key "Comment and copy") "c y" '(evilnc-comment-and-kill-ring-save :which-key "Comment and copy")
;; Elisp ;; Elisp
@ -1472,14 +1477,19 @@ General.el ~leader key binds.
"e t" '(dot/reload-theme :which-key "Reload theme") "e t" '(dot/reload-theme :which-key "Reload theme")
;; File ;; File
"f" '(:ignore t :which-key "file") "f" '(:ignore t :which-key "file")
"f f" '(find-file-in-project-root :which-key "Find file") "f e" '(:ignore t :which-key "emacs")
"f r" '(dot/recentf-open-files :which-key "Recent files") "f e c" '(dot/config-visit :which-key "Config visit")
"f R" '(rename-file-and-buffer :which-key "Rename file") "f e f" '(dot/find-file-emacsd :which-key "Find file emacs.d")
"f s" '(basic-save-buffer :which-key "Save file") "f e r" '(dot/config-reload :which-key "Config reload")
"f S" '(write-file :which-key "Save file as...") "f d" '(dired :which-key "Find directory")
"f u" '(dot/sudo-find-file :which-key "Sudo find file") "f f" '(find-file-in-project-root :which-key "Find file")
"f U" '(dot/sudo-this-file :which-key "Sudo this file") "f r" '(dot/recentf-open-files :which-key "Recent files")
"f R" '(rename-file-and-buffer :which-key "Rename file")
"f s" '(basic-save-buffer :which-key "Save file")
"f S" '(write-file :which-key "Save file as...")
"f u" '(dot/sudo-find-file :which-key "Sudo find file")
"f U" '(dot/sudo-this-file :which-key "Sudo this file")
;; Help ;; Help
"h" '(:keymap help-map :which-key "help") "h" '(:keymap help-map :which-key "help")

Loading…
Cancel
Save