Add keybindings and reorganise
Also, `(format +onsave)` is changed to just `format` since `+onsave` really messes with VC systems.
This commit is contained in:
parent
8b6039d43a
commit
473bf1cfa8
|
@ -4,8 +4,7 @@ Execute ~doom sync~ after modifying this file to tangle it to ~config.el~.
|
|||
|
||||
The following block of comments is from the default configuration.
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Place your private configuration here! Remember, you do not need to run 'doom
|
||||
|
@ -67,34 +66,29 @@ change ~org-directory~. It must be set before org loads!
|
|||
|
||||
** Key Bindings
|
||||
|
||||
Modifications to the default key bindings
|
||||
Modifications to the default key bindings to mimic spacemacs
|
||||
|
||||
- ~SPC SPC~ is mapped to ~M-x~ (~#'execute-extended-command~)
|
||||
- ~SPC !~ is mapped to ~M-!~ (~#'shell-command~)
|
||||
- ~SPC :~ is mapped to ~M-:~ (~#'eval-expression~)
|
||||
- ~,~ is mapped to the local (major mode) leader ~,~
|
||||
- ~SPC b 0~ deletes the current buffer and window like Spacemacs ~SPC b x~
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(setq doom-localleader-key ",") ; Spacemacs like comma major mode
|
||||
(map! :leader ; "SPC b 0" kills window and buffer
|
||||
:desc "Kill buffer and window"
|
||||
"b 0" #'kill-buffer-and-window)
|
||||
(map! :leader ; "SPC :" executes command
|
||||
:desc "Execute shell command"
|
||||
"!" #'shell-command)
|
||||
(map! :leader ; "SPC SPC" becomes M-x
|
||||
:desc "Execute extended command (emacs M-x)"
|
||||
"SPC" #'execute-extended-command)
|
||||
(map! :leader ; "SPC :" becomes M-:
|
||||
:desc "Evaluate expression (emacs M-:)"
|
||||
":" #'eval-expression)
|
||||
(after! magit
|
||||
(map! :localleader
|
||||
(:map git-commit-mode-map
|
||||
"c" #'with-editor-finish)
|
||||
(:map git-commit-mode-map
|
||||
"q" #'with-editor-cancel)
|
||||
))
|
||||
(after! org
|
||||
(map! :localleader
|
||||
(:map org-mode-map
|
||||
"X" #'org-latex-preview)
|
||||
))
|
||||
(setq doom-localleader-key ",")
|
||||
(map! :leader
|
||||
:desc "Execute shell command"
|
||||
"!" #'shell-command)
|
||||
(map! :leader
|
||||
:desc "Execute extended command (emacs M-x)"
|
||||
"SPC" #'execute-extended-command)
|
||||
(map! :leader
|
||||
:desc "Evaluate expression (emacs M-:)"
|
||||
":" #'eval-expression)
|
||||
(map! :leader
|
||||
:desc "Kill buffer and window"
|
||||
"b 0" #'kill-buffer-and-window)
|
||||
(map! :nvi "C" nil) ; remove this one weird binding
|
||||
#+end_src
|
||||
|
||||
** Font settings
|
||||
|
@ -164,8 +158,6 @@ available. You can either set ~doom-theme~ or manually load a theme with the
|
|||
(setq +doom-dashboard-ascii-banner-fn #'sun-position-banner)
|
||||
#+end_src
|
||||
|
||||
* Display and Indentation Styles
|
||||
|
||||
** Line numbers
|
||||
|
||||
This determines the style of line numbers in effect. If set to ~nil~, line
|
||||
|
@ -176,6 +168,24 @@ numbers are disabled. For relative line numbers, set this to ~relative~.
|
|||
(global-display-line-numbers-mode)
|
||||
#+end_src
|
||||
|
||||
* Package-specific Settings
|
||||
|
||||
** Smart Tabs
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! smart-tabs-mode
|
||||
:config
|
||||
(print! "Configuring smart-tabs-mode")
|
||||
(smart-tabs-insinuate
|
||||
'c 'c++
|
||||
'java
|
||||
'javascript))
|
||||
(setq-default
|
||||
indent-tabs-mode t
|
||||
indent-line-function 'tab-to-tab-stop
|
||||
tab-width 2)
|
||||
#+end_src
|
||||
|
||||
** Whitespace mode
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
@ -194,7 +204,7 @@ numbers are disabled. For relative line numbers, set this to ~relative~.
|
|||
)
|
||||
#+end_src
|
||||
|
||||
** Indentation Style Hooks
|
||||
Indentation Style Hooks
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(defun custom/common-program-hook ()
|
||||
|
@ -227,26 +237,65 @@ numbers are disabled. For relative line numbers, set this to ~relative~.
|
|||
(add-hook 'lisp-data-mode-hook #'custom/lisp-family-hook)
|
||||
#+end_src
|
||||
|
||||
* Package-specific Settings
|
||||
|
||||
** Smart Tabs
|
||||
** Org
|
||||
|
||||
Rather than using a common prefix ~, i~ like Spacemacs to consolidate all
|
||||
insertion operations, we put them in different categories. Some keybindings are
|
||||
removed.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(use-package! smart-tabs-mode
|
||||
:config
|
||||
(print! "Configuring smart-tabs-mode")
|
||||
(smart-tabs-insinuate
|
||||
'c 'c++
|
||||
'java
|
||||
'javascript))
|
||||
(setq-default
|
||||
indent-tabs-mode t
|
||||
indent-line-function 'tab-to-tab-stop
|
||||
tab-width 2)
|
||||
(map! :after org
|
||||
:localleader
|
||||
:map org-mode-map
|
||||
:desc "LaTeX Preview" "X" #'org-latex-preview
|
||||
"h" nil
|
||||
"i" nil
|
||||
"@" nil
|
||||
"q" nil
|
||||
"o" nil
|
||||
(:prefix ("b". "Table")
|
||||
:desc "Edit formulae" "F" #'org-table-edit-formulas
|
||||
:desc "Eval formula" "f" #'org-table-eval-formula
|
||||
(:prefix ("m" . "Move")
|
||||
:desc "Move row up" "K" #'org-table-move-row-up
|
||||
:desc "Move row down" "J" #'org-table-move-row-down
|
||||
:desc "Move column left" "H" #'org-table-move-column-left
|
||||
:desc "Move column right" "L" #'org-table-move-column-right
|
||||
:desc "Move cell up" "k" #'org-table-move-cell-up
|
||||
:desc "Move cell down" "j" #'org-table-move-cell-down
|
||||
:desc "Move cell left" "h" #'org-table-move-cell-left
|
||||
:desc "Move cell right" "l" #'org-table-move-cell-right
|
||||
)
|
||||
)
|
||||
(:prefix ("h" . "Headings")
|
||||
:desc "Consult heading" "." #'consult-org-heading
|
||||
:desc "Insert heading" "h" #'org-insert-heading
|
||||
:desc "Insert todo heading" "t" #'org-insert-todo-heading
|
||||
:desc "Insert subheading" "i" #'org-insert-subheading
|
||||
:desc "Insert todo subheading" "t" #'org-insert-todo-subheading
|
||||
:desc "Previous visible heading" "[" #'org-previous-visible-heading
|
||||
:desc "Next visible heading" "]" #'org-next-visible-heading
|
||||
)
|
||||
(:prefix ("o" . "Tags/Properties")
|
||||
:desc "Set tags command" "t" #'org-set-tags-command
|
||||
:desc "Set property" "s" #'org-set-property
|
||||
:desc "Delete property" "d" #'org-delete-property
|
||||
:desc "Property action" "a" #'org-property-action
|
||||
)
|
||||
(:prefix ("i" . "Insert")
|
||||
:desc "Link/Image" "l" #'org-insert-link
|
||||
:desc "Item" "i" #'org-toggle-item
|
||||
:desc "Citation" "c" #'org-cite-insert
|
||||
:desc "Footnote" "f" #'org-footnote-new
|
||||
)
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Format
|
||||
|
||||
Note that ~onsave~ was intentionally turned off because it messes with version control systems.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(after! format
|
||||
(print! "Configuring (after! format ...)")
|
||||
|
@ -258,7 +307,6 @@ numbers are disabled. For relative line numbers, set this to ~relative~.
|
|||
latex-mode
|
||||
bibtex-mode
|
||||
))
|
||||
|
||||
#+end_src
|
||||
|
||||
** Spell
|
||||
|
@ -267,7 +315,6 @@ numbers are disabled. For relative line numbers, set this to ~relative~.
|
|||
(after! flyspell
|
||||
(print! "Configuring (after! flyspell ...)")
|
||||
(setq flyspell-default-dictionary "english"))
|
||||
|
||||
#+end_src
|
||||
|
||||
** LSP
|
||||
|
@ -283,7 +330,6 @@ since it clutters the header-line.
|
|||
lsp-headerline-breadcrumb-enable-symbol-numbers nil
|
||||
lsp-headerline-breadcrumb-segments '(symbols)
|
||||
))
|
||||
|
||||
#+end_src
|
||||
|
||||
** LilyPond
|
||||
|
@ -298,7 +344,6 @@ Add the necessary hooks for LilyPond mode.
|
|||
:config
|
||||
(add-hook 'LilyPond-mode-hook #'custom/common-program-hook)
|
||||
)
|
||||
|
||||
#+end_src
|
||||
|
||||
** LaTeX
|
||||
|
@ -322,19 +367,56 @@ The target indentation style of ~LaTeX~ is as follows:
|
|||
\end{enumerate}
|
||||
#+end_src
|
||||
|
||||
For some reason the keymap binding has to use ~LaTeX-mode-map~ or ~TeX-mode-map~
|
||||
instead of ~latex-mode-map~. Also some original keybindings are removed so they
|
||||
can be displayed correctly in prompts. See e.g. ~tex-buf.el~ for an example.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(after! latex
|
||||
(print! "Configuring (after! latex ...)")
|
||||
(add-hook 'tex-mode-hook #'custom/common-program-hook)
|
||||
(add-hook 'LaTeX-mode-hook #'custom/common-program-hook)
|
||||
(setq-default TeX-electric-sub-and-superscript nil))
|
||||
(setq-default TeX-electric-sub-and-superscript nil)
|
||||
(local-unset-key "C-c C-l")
|
||||
(local-unset-key "C-c `")
|
||||
)
|
||||
(map! :after latex
|
||||
:localleader
|
||||
:map TeX-mode-map
|
||||
:desc "View Compilation Log" "l" #'TeX-recenter-output-buffer
|
||||
:desc "Next Error" "e" #'TeX-next-error
|
||||
:desc "Close Environment" "]" #'LaTeX-close-environment
|
||||
(:prefix ("f" . "Fold")
|
||||
:desc "Fold Mode" "f" #'TeX-fold-mode
|
||||
:desc "Environment" "e" #'TeX-fold-env
|
||||
:desc "Buffer" "b" #'TeX-fold-buffer
|
||||
:desc "Region" "r" #'TeX-fold-region
|
||||
:desc "Paragraph" "p" #'TeX-fold-paragraph
|
||||
:desc "Dwim" "d" #'TeX-fold-dwim)
|
||||
)
|
||||
(map! :after latex
|
||||
:map TeX-mode-map
|
||||
"C-c C-l" nil
|
||||
"C-c `" nil
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Magit
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(map! :after magit
|
||||
:localleader
|
||||
:map git-commit-mode-map
|
||||
:desc "Finish" "c" #'with-editor-finish
|
||||
:desc "Cancel" "q" #'with-editor-cancel
|
||||
)
|
||||
#+end_src
|
||||
|
||||
* Package Loading
|
||||
|
||||
These packages are loaded into ~packages.el~. The following comments are provided by default.
|
||||
|
||||
#+begin_src emacs-lisp :tangle no
|
||||
#+begin_src emacs-lisp :tangle packages.el
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; $DOOMDIR/packages.el
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
(evil +everywhere); come to the dark side, we have cookies
|
||||
file-templates ; auto-snippets for empty files
|
||||
fold ; (nigh) universal code folding
|
||||
(format +onsave) ; automated prettiness
|
||||
format ; automated prettiness
|
||||
;;god ; run Emacs commands without modifier keys
|
||||
;;lispy ; vim for lisp, for people who don't like vim
|
||||
multiple-cursors ; editing in many places at once
|
||||
|
|
Loading…
Reference in New Issue