mirror of
https://github.com/vale981/dotfiles
synced 2025-03-05 09:31:43 -05:00
emacs updates
This commit is contained in:
parent
fed2431b67
commit
8a29e88b3c
1 changed files with 142 additions and 83 deletions
|
@ -47,7 +47,7 @@ Taken from https://github.com/Atman50/emacs-config.
|
|||
*** Tune GC
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(defun my-minibuffer-setup-hook ()
|
||||
(setq gc-cons-threshold most-positive-fixnum))
|
||||
(setq gc-cons-threshold (* 100 1024 1024)))
|
||||
|
||||
(defun my-minibuffer-exit-hook ()
|
||||
(setq gc-cons-threshold 800000))
|
||||
|
@ -468,71 +468,72 @@ Use abbrev for greek input.
|
|||
*** LSP
|
||||
Support for the =Language Server Protocol=.
|
||||
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||
(use-package lsp-ui)
|
||||
(use-package lsp-treemacs)
|
||||
(use-package lsp-mode
|
||||
:after (lsp-ui elixir-mode)
|
||||
:config
|
||||
(setq lsp-prefer-flymake nil)
|
||||
(setq
|
||||
lsp-headerline-breadcrumb-enable nil
|
||||
lsp-idle-delay 0
|
||||
lsp-ui-doc-enable nil
|
||||
lsp-ui-doc-use-childframe t
|
||||
lsp-ui-doc-position 'top
|
||||
lsp-ui-doc-include-signature t
|
||||
lsp-ui-sideline-enable t
|
||||
lsp-ui-flycheck-enable t
|
||||
lsp-ui-flycheck-list-position 'right
|
||||
lsp-ui-flycheck-live-reporting t
|
||||
lsp-ui-peek-enable t
|
||||
lsp-ui-peek-list-width 60
|
||||
lsp-ui-peek-peek-height 25
|
||||
lsp-enable-semantic-highlighting t
|
||||
lsp-enable-symbol-highlighting nil
|
||||
lsp-modeline-code-actions-segments '(count icon))
|
||||
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
|
||||
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)
|
||||
(setq lsp-clients-elixir-server-executable "/home/hiro/src/elixir-ls/release/language_server.sh")
|
||||
:hook ((elixir-mode . lsp)
|
||||
(lsp-mode . lsp-ui-mode)))
|
||||
(use-package dap-mode
|
||||
:config
|
||||
(require 'dap-lldb)
|
||||
(require 'dap-lldb)
|
||||
(use-package lsp-ui)
|
||||
(use-package lsp-treemacs)
|
||||
(use-package lsp-mode
|
||||
:after (lsp-ui elixir-mode)
|
||||
:config
|
||||
(setq lsp-prefer-flymake nil)
|
||||
(setq
|
||||
lsp-headerline-breadcrumb-enable nil
|
||||
lsp-idle-delay 0.1
|
||||
lsp-ui-doc-enable nil
|
||||
lsp-ui-doc-use-childframe t
|
||||
lsp-ui-doc-position 'top
|
||||
lsp-ui-doc-include-signature t
|
||||
lsp-ui-sideline-enable t
|
||||
lsp-ui-flycheck-enable t
|
||||
lsp-ui-flycheck-list-position 'right
|
||||
lsp-ui-flycheck-live-reporting t
|
||||
lsp-ui-peek-enable t
|
||||
lsp-ui-peek-list-width 60
|
||||
lsp-ui-peek-peek-height 25
|
||||
lsp-enable-semantic-highlighting t
|
||||
lsp-enable-symbol-highlighting nil
|
||||
lsp-modeline-code-actions-segments '(count icon)
|
||||
lsp-clients-clangd-args '("--background-index" "-j=8" "--clang-tidy"))
|
||||
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
|
||||
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)
|
||||
(setq lsp-clients-elixir-server-executable "/home/hiro/src/elixir-ls/release/language_server.sh")
|
||||
:hook ((elixir-mode . lsp)
|
||||
(lsp-mode . lsp-ui-mode)))
|
||||
(use-package dap-mode
|
||||
:config
|
||||
(require 'dap-lldb)
|
||||
(require 'dap-lldb)
|
||||
|
||||
(add-hook 'dap-stopped-hook
|
||||
(lambda (arg) (call-interactively #'dap-hydra)))
|
||||
(setq dap-auto-configure-features
|
||||
'(sessions locals controls tooltip))
|
||||
:hook ((c-mode c++-mode) .
|
||||
(lambda ()
|
||||
(require 'dap-lldb))))
|
||||
(add-hook 'dap-stopped-hook
|
||||
(lambda (arg) (call-interactively #'dap-hydra)))
|
||||
(setq dap-auto-configure-features
|
||||
'(sessions locals controls tooltip))
|
||||
:hook ((c-mode c++-mode) .
|
||||
(lambda ()
|
||||
(require 'dap-lldb))))
|
||||
|
||||
(define-minor-mode +dap-running-session-mode
|
||||
"A mode for adding keybindings to running sessions"
|
||||
nil
|
||||
nil
|
||||
(make-sparse-keymap)
|
||||
;; The following code adds to the dap-terminated-hook
|
||||
;; so that this minor mode will be deactivated when the debugger finishes
|
||||
(when +dap-running-session-mode
|
||||
(let ((session-at-creation (dap--cur-active-session-or-die)))
|
||||
(add-hook 'dap-terminated-hook
|
||||
(lambda (session)
|
||||
(when (eq session session-at-creation)
|
||||
(+dap-running-session-mode -1)))))))
|
||||
(define-minor-mode +dap-running-session-mode
|
||||
"A mode for adding keybindings to running sessions"
|
||||
nil
|
||||
nil
|
||||
(make-sparse-keymap)
|
||||
;; The following code adds to the dap-terminated-hook
|
||||
;; so that this minor mode will be deactivated when the debugger finishes
|
||||
(when +dap-running-session-mode
|
||||
(let ((session-at-creation (dap--cur-active-session-or-die)))
|
||||
(add-hook 'dap-terminated-hook
|
||||
(lambda (session)
|
||||
(when (eq session session-at-creation)
|
||||
(+dap-running-session-mode -1)))))))
|
||||
|
||||
;; Activate this minor mode when dap is initialized
|
||||
(add-hook 'dap-session-created-hook '+dap-running-session-mode)
|
||||
;; Activate this minor mode when dap is initialized
|
||||
(add-hook 'dap-session-created-hook '+dap-running-session-mode)
|
||||
|
||||
;; Activate this minor mode when hitting a breakpoint in another file
|
||||
(add-hook 'dap-stopped-hook '+dap-running-session-mode)
|
||||
;; Activate this minor mode when hitting a breakpoint in another file
|
||||
(add-hook 'dap-stopped-hook '+dap-running-session-mode)
|
||||
|
||||
;; Activate this minor mode when stepping into code in another file
|
||||
(add-hook 'dap-stack-frame-changed-hook (lambda (session)
|
||||
(when (dap--session-running session)
|
||||
(+dap-running-session-mode 1))))
|
||||
;; Activate this minor mode when stepping into code in another file
|
||||
(add-hook 'dap-stack-frame-changed-hook (lambda (session)
|
||||
(when (dap--session-running session)
|
||||
(+dap-running-session-mode 1))))
|
||||
|
||||
#+END_SRC
|
||||
|
||||
|
@ -560,7 +561,7 @@ Support for the =Language Server Protocol=.
|
|||
("<return>" . company-complete-selection))
|
||||
:config
|
||||
(setq company-show-numbers t)
|
||||
(setq company-idle-delay .5)
|
||||
(setq company-idle-delay .1)
|
||||
(setq company-minimum-prefix-length 1)
|
||||
;(company-tng-configure-default)
|
||||
(add-to-list 'company-backends 'company-capf)
|
||||
|
@ -986,6 +987,21 @@ Org tree slide is a presentation tool for org mode.
|
|||
(setq org-map-continue-from (org-element-property :begin (org-element-at-point))))
|
||||
"/DONE" 'tree))
|
||||
#+end_src
|
||||
**** Screenshots
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package org-download)
|
||||
(use-package org-attach-screenshot
|
||||
:bind ("<f6> s" . org-attach-screenshot)
|
||||
:config
|
||||
(setq org-attach-screenshot-dirfunction
|
||||
(lambda ()
|
||||
(progn (cl-assert (buffer-file-name))
|
||||
(concat (file-name-sans-extension (buffer-file-name))
|
||||
"-att")))
|
||||
org-attach-screenshot-command-line "gnome-screenshot -a -f %f")
|
||||
|
||||
(setq org-attach-screenshot-command-line "xfce4-screenshooter -r -s %f"))
|
||||
#+end_src
|
||||
|
||||
*** Git
|
||||
**** Magit
|
||||
|
@ -1043,16 +1059,22 @@ Make mini-buffers and search nicer.
|
|||
*** LaTeX
|
||||
Enable electric braces for math mode: ~\( \)~
|
||||
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||
(setq LaTeX-electric-left-right-brace t)
|
||||
(defun my-auctex-init ()
|
||||
(turn-off-smartparens-mode)
|
||||
(auto-fill-mode)
|
||||
(latex-math-mode)
|
||||
(turn-on-reftex)
|
||||
(flyspell-mode 1))
|
||||
(add-hook 'LaTeX-mode-hook 'my-auctex-init)
|
||||
(setq LaTeX-electric-left-right-brace t)
|
||||
(defun my-auctex-init ()
|
||||
(auto-fill-mode)
|
||||
(latex-math-mode)
|
||||
(turn-on-reftex)
|
||||
(flyspell-mode 1))
|
||||
(add-hook 'LaTeX-mode-hook 'my-auctex-init)
|
||||
#+END_SRC
|
||||
|
||||
Configure AucTeX.
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(setq TeX-auto-save t)
|
||||
(setq TeX-parse-self t)
|
||||
(setq-default TeX-master nil)
|
||||
#+end_src
|
||||
|
||||
**** RefTeX
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(setq reftex-plug-into-auctex t)
|
||||
|
@ -1188,7 +1210,9 @@ Nice html and css snippets.
|
|||
Syntax checking and linting.
|
||||
#+BEGIN_SRC emacs-lisp :tangle yes
|
||||
(use-package flycheck
|
||||
:config (setq flycheck-check-syntax-automatically '(save mode-enable))
|
||||
:config
|
||||
(setq flycheck-check-syntax-automatically '(save mode-enable idle-change))
|
||||
(setq flycheck-idle-change-delay 2)
|
||||
:hook ((after-init . global-flycheck-mode)))
|
||||
(use-package avy-flycheck)
|
||||
#+END_SRC
|
||||
|
@ -1265,17 +1289,17 @@ Set up ~lsp~, ~ccls~.
|
|||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package modern-cpp-font-lock
|
||||
:hook (c++-mode . modern-c++-font-lock-mode))
|
||||
(use-package ccls
|
||||
:ensure t
|
||||
:config
|
||||
(setq ccls-executable "ccls")
|
||||
(setq lsp-prefer-flymake nil)
|
||||
(setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-cppcheck c/c++-gcc))
|
||||
(setq ccls-sem-highlight-method 'overlay)
|
||||
;; (ccls-use-default-rainbow-sem-highlight)
|
||||
(set-buffer-multibyte nil) ;TODO: Better fix!
|
||||
:hook ((c-mode c++-mode objc-mode) .
|
||||
(lambda () (require 'ccls) (lsp))))
|
||||
;; (use-package ccls
|
||||
;; :ensure t
|
||||
;; :config
|
||||
;; (setq ccls-executable "ccls")
|
||||
;; (setq lsp-prefer-flymake nil)
|
||||
;; (setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-cppcheck c/c++-gcc))
|
||||
;; (setq ccls-sem-highlight-method 'overlay)
|
||||
;; ;; (ccls-use-default-rainbow-sem-highlight)
|
||||
;; (set-buffer-multibyte nil) ;TODO: Better fix!
|
||||
;; :hook ((c-mode c++-mode objc-mode) .
|
||||
;; (lambda () (require 'ccls) (lsp))))
|
||||
#+end_src
|
||||
|
||||
Automatically insert Include-Guards.
|
||||
|
@ -1369,8 +1393,43 @@ Debugging yay!
|
|||
|
||||
** Applications
|
||||
*** Anki
|
||||
Stolen from https://yiufung.net/post/anki-org/.
|
||||
#+begin_src emacs-lisp :tangle yes
|
||||
(use-package anki-editor)
|
||||
(use-package anki-editor
|
||||
:after org
|
||||
:bind (:map org-mode-map
|
||||
("<f12>" . anki-editor-cloze-region-auto-incr)
|
||||
("<f11>" . anki-editor-cloze-region-dont-incr)
|
||||
("<f10>" . anki-editor-reset-cloze-number)
|
||||
("<f9>" . anki-editor-push-tree))
|
||||
:hook (org-capture-after-finalize . anki-editor-reset-cloze-number) ; Reset cloze-number after each capture.
|
||||
:config
|
||||
(setq anki-editor-create-decks t ;; Allow anki-editor to create a new deck if it doesn't exist
|
||||
anki-editor-org-tags-as-anki-tags t)
|
||||
|
||||
(defun anki-editor-cloze-region-auto-incr (&optional arg)
|
||||
"Cloze region without hint and increase card number."
|
||||
(interactive)
|
||||
(anki-editor-cloze-region my-anki-editor-cloze-number "")
|
||||
(setq my-anki-editor-cloze-number (1+ my-anki-editor-cloze-number))
|
||||
(forward-sexp))
|
||||
(defun anki-editor-cloze-region-dont-incr (&optional arg)
|
||||
"Cloze region without hint using the previous card number."
|
||||
(interactive)
|
||||
(anki-editor-cloze-region (1- my-anki-editor-cloze-number) "")
|
||||
(forward-sexp))
|
||||
(defun anki-editor-reset-cloze-number (&optional arg)
|
||||
"Reset cloze number to ARG or 1"
|
||||
(interactive)
|
||||
(setq my-anki-editor-cloze-number (or arg 1)))
|
||||
(defun anki-editor-push-tree ()
|
||||
"Push all notes under a tree."
|
||||
(interactive)
|
||||
(anki-editor-push-notes)
|
||||
(anki-editor-reset-cloze-number))
|
||||
;; Initialize
|
||||
(anki-editor-reset-cloze-number)
|
||||
)
|
||||
#+end_src
|
||||
|
||||
** Custom Scripts
|
||||
|
|
Loading…
Add table
Reference in a new issue