Browse Source

Add dashboard to Emacs config

master
Riyyi 5 years ago
parent
commit
5896033a61
  1. 52
      .emacs.d/config.org

52
.emacs.d/config.org

@ -326,6 +326,22 @@ Irony requires M-x =irony-install-server=.
*** Prettify *** Prettify
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package dashboard
:custom
(initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
(dashboard-banner-logo-title "GNU Emacs master race!")
(dashboard-center-content t)
(dashboard-set-file-icons t)
(dashboard-set-footer nil)
(dashboard-set-heading-icons t)
(dashboard-show-shortcuts t)
(dashboard-startup-banner 'logo)
(dashboard-items '((projects . 10)
(bookmarks . 5)
(recents . 5)))
:hook (dashboard-mode . (lambda (&rest _) (display-line-numbers-mode 0)))
:config (dashboard-setup-startup-hook))
(use-package rainbow-mode (use-package rainbow-mode
:defer t :defer t
:init (add-hook 'prog-mode-hook 'rainbow-mode)) :init (add-hook 'prog-mode-hook 'rainbow-mode))
@ -590,6 +606,21 @@ Functions that use package functionality.
emacs-lisp-mode)) "OrgMode") emacs-lisp-mode)) "OrgMode")
(t "User")))) (t "User"))))
(defun dashboard-goto-bookmarks ()
"Go to bookmarks."
(interactive)
(funcall (local-key-binding "m")))
(defun dashboard-goto-projects ()
"Go to projects."
(interactive)
(funcall (local-key-binding "p")))
(defun dashboard-goto-recent-files ()
"Go to recent files."
(interactive)
(funcall (local-key-binding "r")))
(defun neotree-toggle-in-project-root () (defun neotree-toggle-in-project-root ()
"Toggle Neotree in project root." "Toggle Neotree in project root."
(interactive) (interactive)
@ -703,9 +734,6 @@ Disable spacebar in evil motion.
** Package ** Package
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
;; Avy
(global-set-key (kbd "M-s") 'avy-goto-char-timer)
;; Buffers ;; Buffers
(global-set-key (kbd "M-h") 'centaur-tabs-backward-tab) (global-set-key (kbd "M-h") 'centaur-tabs-backward-tab)
(global-set-key (kbd "M-l") 'centaur-tabs-forward-tab) (global-set-key (kbd "M-l") 'centaur-tabs-forward-tab)
@ -736,10 +764,11 @@ Disable spacebar in evil motion.
;(define-key evil-motion-state-map (kbd "C-w") 'kill-this-buffer) ; @Todo test this with nil ;(define-key evil-motion-state-map (kbd "C-w") 'kill-this-buffer) ; @Todo test this with nil
;https://github.com/noctuid/evil-guide#global-keybindings-and-evil-states ;https://github.com/noctuid/evil-guide#global-keybindings-and-evil-states
;; Neotree
(with-eval-after-load 'evil-states (with-eval-after-load 'evil-states
(general-define-key (general-define-key
:keymaps 'evil-normal-state-map :keymaps 'evil-normal-state-map
;; Neotree
"C-n" 'neotree-toggle-in-project-root) "C-n" 'neotree-toggle-in-project-root)
(general-define-key (general-define-key
@ -758,11 +787,18 @@ Disable spacebar in evil motion.
"C" 'neotree-change-root "C" 'neotree-change-root
"H" 'neotree-hidden-file-toggle "H" 'neotree-hidden-file-toggle
"q" 'neotree-hide "q" 'neotree-hide
)) )
;; Smex ;; Dashboard
(global-set-key (kbd "M-x") 'smex) (general-define-key
(global-set-key (kbd "M-X") 'smex-major-mode-commands) :states 'normal
:keymaps 'dashboard-mode-map
[down-mouse-1] 'widget-button-click
"g" 'dashboard-refresh-buffer
"m" 'dashboard-goto-bookmarks
"p" 'dashboard-goto-projects
"r" 'dashboard-goto-recent-files
))
#+END_SRC #+END_SRC
** Leader ** Leader

Loading…
Cancel
Save