Misc changes to emacs config

This commit is contained in:
Oystein Kristoffer Tveit 2021-08-25 10:24:16 +02:00
parent d0f03ff3c0
commit 621b02a10a
1 changed files with 215 additions and 235 deletions

View File

@ -10,7 +10,7 @@
* Use-package * Use-package
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(setq user-emacs-directory (substitute-in-file-name "$HOME/.emacs.d")) ; (setq user-emacs-directory (substitute-in-file-name "$HOME/.emacs.d"))
(require 'package) (require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
@ -36,7 +36,6 @@
:states 'motion :states 'motion
:prefix "SPC" :prefix "SPC"
:non-normal-prefix "C-SPC")) :non-normal-prefix "C-SPC"))
;:non-normal-prefix "SPC"))
#+END_SRC #+END_SRC
Base keys Base keys
@ -48,7 +47,7 @@ p - project management
w - multiple cursors w - multiple cursors
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(leader-key (leader-key
"" nil "" nil
"c" (general-simulate-key "C-c" :which-key "C-c") "c" (general-simulate-key "C-c" :which-key "C-c")
"u" (general-simulate-key "C-u" :which-key "C-u") "u" (general-simulate-key "C-u" :which-key "C-u")
@ -156,7 +155,7 @@ Put backup files in emacs.d/temp
** Evil mode ** Evil mode
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
(use-package evil (use-package evil
:demand t :demand t
:init :init
(setq evil-want-integration t) (setq evil-want-integration t)
@ -175,6 +174,7 @@ Put backup files in emacs.d/temp
("C-j" . evil-window-down) ("C-j" . evil-window-down)
("C-k" . evil-window-up) ("C-k" . evil-window-up)
("C-l" . evil-window-right) ("C-l" . evil-window-right)
:map evil-insert-state-map :map evil-insert-state-map
("C-g" . evil-normal-state) ("C-g" . evil-normal-state)
("C-h" . evil-delete-backward-char-and-join)) ("C-h" . evil-delete-backward-char-and-join))
@ -213,22 +213,16 @@ Put backup files in emacs.d/temp
Evil escape mode Evil escape mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package evil-escape ;; (use-package evil-escape
:after (evil company) ;; :after (evil company)
:diminish evil-escape-mode ;; :diminish evil-escape-mode
:init ;; :init
(with-eval-after-load 'company ;; (with-eval-after-load 'company
(add-hook 'evil-normal-state-entry-hook #'company-cancel)) ;; (add-hook 'evil-normal-state-entry-hook #'company-cancel))
;; (use-package lsp-python-ms ;; (setq evil-escape-key-sequence "jk"
;; :init (setq ;; evil-escape-unordered-key-sequence t)
;; ; (lsp-python-ms-auto-install-server t) ;; :config
;; lsp-python-ms-executable (executable-find "mspyls")) ;; (evil-escape-mode))
;; ; :hook (python-mode . (lambda () (require 'lsp-python-ms) (lsp))))
;; :hook (python-mode . lsp))
(setq evil-escape-key-sequence "jk"
evil-escape-unordered-key-sequence t)
:config
(evil-escape-mode))
#+END_SRC #+END_SRC
** Ivy ** Ivy
@ -241,10 +235,6 @@ Evil escape mode
("M-j" . ivy-next-line) ("M-j" . ivy-next-line)
("M-k" . ivy-previous-line) ("M-k" . ivy-previous-line)
("M-l" . ivy-alt-done))) ("M-l" . ivy-alt-done)))
;; :general (leader-key
;; "ij" 'ivy-next-line
;; "ik" 'ivy-previous-line))
#+END_SRC #+END_SRC
Ivy-rich adds extra columns to a few of the Counsel commands to provide more information about each item. Ivy-rich adds extra columns to a few of the Counsel commands to provide more information about each item.
@ -283,7 +273,9 @@ Ivy-rich adds extra columns to a few of the Counsel commands to provide more inf
"oe" '(org-edit-src-code :which-key "Edit SRC") "oe" '(org-edit-src-code :which-key "Edit SRC")
; Insert ; Insert
"io" '(:ignore t :which-key "org") "io" '(:ignore t :which-key "org")
"ios" 'org-insert-structure-template)) "ios" 'org-insert-structure-template)
:config
(setq org-src-tab-acts-natively nil))
#+END_SRC #+END_SRC
Improved version of org-bullets Improved version of org-bullets
@ -345,30 +337,30 @@ Evil bindings for org mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq dotfiles '( (setq dotfiles '(
("Emacs" . "~/.emacs.d/config.org") ("Emacs" . (concat user-emacs-directory "/config.org"))
("Xmonad" . "~/.xmonad/xmonad.hs") ("Xmonad" . "$HOME/.xmonad/xmonad.hs")
("Xmobar" . "~/.config/xmobar/xmobarrc") ("Xmobar" . "$XDG_CONFIG_HOME/xmobar/xmobarrc")
("Awesome" . "~/.config/awesome/rc.lua") ("Awesome" . "$XDG_CONFIG_HOME/awesome/rc.lua")
("Stalonetray" . "~/.stalonetrayrc") ("Stalonetray" . "$HOME/.stalonetrayrc")
("Termite" . "~/.config/termite/config") ("Termite" . "$XDG_CONFIG_HOME/termite/config")
("Kitty" . "~/.config/kitty/kitty.conf") ("Kitty" . "$XDG_CONFIG_HOME/kitty/kitty.conf")
("Mpd" . "~/.config/mpd/mpd.conf") ("Mpd" . "$XDG_CONFIG_HOME/mpd/mpd.conf")
("Ncmpcpp" . "~/.ncmpcpp/config") ("Ncmpcpp" . "$HOME/.ncmpcpp/config")
("Nnn" . "~/.config/nnn/") ("Nnn" . "$XDG_CONFIG_HOME/nnn/")
("TeX-ntnu" . "~/texmf/tex/latex/local/ntnu.sty") ("TeX-ntnu" . "$HOME/texmf/tex/latex/local/ntnu.sty")
("Tmux" . "~/.tmux.conf") ("Tmux" . "$XDG_CONFIG_HOME/tmux/tmux.conf")
("Todo" . "~/.todo") ("Todo" . "$HOME/.todo")
("Qutebrowser" . "~/.config/qutebrowser/config.py") ("Qutebrowser" . "$XDG_CONFIG_HOME/qutebrowser/config.py")
("Vim" . "~/.config/nvim/init.vim") ("Vim" . "$XDG_CONFIG_HOME/nvim/init.lua")
("Zsh" . "~/.zshrc") ("Zsh" . "$XDG_CONFIG_HOME/zsh/.zshrc")
("Config-selector" . "~/.scripts/rofi/config-selector") ("Config-selector" . "$HOME/.scripts/rofi/config-selector")
("Configfiles" . "~/.scripts/rofi/configfiles"))) ("Configfiles" . "$HOME/.scripts/rofi/configfiles")))
(defun find-config-file () (defun find-config-file ()
"Chooses a config-file from dotfiles and opens it in a new buffer" "Chooses a config-file from dotfiles and opens it in a new buffer"
(interactive) (interactive)
(ivy-read "Config: " dotfiles (ivy-read "Config: " dotfiles
:action (lambda (confpair) (find-file (cdr confpair))))) :action (lambda (confpair) (find-file (substitute-in-file-name (eval (cdr confpair)))))))
(leader-key "fc" '(find-config-file :which-key "find config file")) (leader-key "fc" '(find-config-file :which-key "find config file"))
#+END_SRC #+END_SRC
@ -400,7 +392,32 @@ For every other theme, use load-theme
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package monokai-theme (use-package monokai-theme
:config :config
(load-theme 'monokai t)) (setq monokai-user-variable-pitch t)
(progn
(defvar after-load-theme-hook nil
"Hook run after a color theme is loaded using `load-theme'.")
(defadvice load-theme (after run-after-load-theme-hook activate)
"Run `after-load-theme-hook'."
(run-hooks 'after-load-theme-hook))
(defun customize-monokai ()
"Customize monokai theme"
(if (member 'monokai custom-enabled-themes)
(custom-theme-set-faces
'monokai
'(py-object-reference-face ((t (:foreground "#FFA500"))))
'(py-decorators-face ((t (:foreground "#FFA500"))))
'(py-variable-name-face ((t (:foreground "#FFA500"))))
'(py-exception-name-face ((:foreground "#FFA500")))
'(py-class-name-face ((:foreground "#FFA500")))
'(py-pseudo-keyword-face ((:foreground "#FFA500")))
'(py-builtins-face ((:foreground "#FFA500"))))))
(add-hook 'after-load-theme-hook 'customize-monokai)))
(load-theme 'monokai t)
#+END_SRC #+END_SRC
** Centaur-tabs ** Centaur-tabs
@ -588,10 +605,10 @@ For every other theme, use load-theme
;; Whether display the gnus notifications. ;; Whether display the gnus notifications.
(setq doom-modeline-gnus t) (setq doom-modeline-gnus t)
;; Wheter gnus should automatically be updated and how often (set to 0 or smaller than 0 to disable) ;; Whether gnus should automatically be updated and how often (set to 0 or smaller than 0 to disable)
(setq doom-modeline-gnus-timer 2) (setq doom-modeline-gnus-timer 2)
;; Wheter groups should be excludede when gnus automatically being updated. ;; Whether groups should be excludede when gnus automatically being updated.
(setq doom-modeline-gnus-excluded-groups '("dummy.group")) (setq doom-modeline-gnus-excluded-groups '("dummy.group"))
;; Whether display the IRC notifications. It requires `circe' or `erc' package. ;; Whether display the IRC notifications. It requires `circe' or `erc' package.
@ -665,8 +682,8 @@ In order for this to work, the [[https://github.com/tonsky/FiraCode/issues/211#i
(setq dashboard-set-file-icons t) (setq dashboard-set-file-icons t)
(setq dashboard-image-banner-max-height (/ (frame-pixel-height) 3)) (setq dashboard-image-banner-max-height (/ (frame-pixel-height) 3))
(setq dashboard-startup-banner "~/.emacs.d/logo.svg") (setq dashboard-startup-banner (concat user-emacs-directory "/logo.svg"))
; (setq dashboard-startup-banner "~/.emacs.d/logo.svg") ; (setq dashboard-startup-banner (concat user-emacs-directory "/logo.svg"))
(setq dashboard-center-content t) (setq dashboard-center-content t)
(setq dashboard-items '((recents . 10) (setq dashboard-items '((recents . 10)
(projects . 5) (projects . 5)
@ -934,7 +951,9 @@ Nice looking completions
(use-package projectile (use-package projectile
:init :init
(setq projectile-project-search-path '("~/git/" (setq projectile-project-search-path '("~/git/"
"~/git/temp/")) "~/git/temp/"
"~/git/appkom/"
"~/git/pvv/"))
(setq projectile-switch-project-action #'projectile-dired) (setq projectile-switch-project-action #'projectile-dired)
:custom ((projectile-completion-system 'ivy)) :custom ((projectile-completion-system 'ivy))
@ -1087,11 +1106,6 @@ https://emacs.stackexchange.com/questions/10431/get-company-to-show-suggestions-
#+END_SRC #+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package evil-magit
:after (magit evil))
#+END_SRC
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package git-gutter (use-package git-gutter
:init :init
@ -1099,62 +1113,15 @@ https://emacs.stackexchange.com/questions/10431/get-company-to-show-suggestions-
#+END_SRC #+END_SRC
* Langugages * Langugages
** Agda
(after! agda2-mode
(set-lookup-handlers! 'agda2-mode
:definition #'agda2-goto-definition-keyboard)
(map! :map agda2-mode-map
:localleader
"?" #'agda2-show-goals
"." #'agda2-goal-and-context-and-inferred
"," #'agda2-goal-and-context
"=" #'agda2-show-constraints
"SPC" #'agda2-give
"a" #'agda2-auto-maybe-all
"b" #'agda2-previous-goal
"c" #'agda2-make-case
"d" #'agda2-infer-type-maybe-toplevel
"e" #'agda2-show-context
"f" #'agda2-next-goal
"gG" #'agda2-go-back
"h" #'agda2-helper-function-type
"l" #'agda2-load
"n" #'agda2-compute-normalised-maybe-toplevel
"p" #'agda2-module-contents-maybe-toplevel
"r" #'agda2-refine
"s" #'agda2-solveAll
"t" #'agda2-goal-type
"w" #'agda2-why-in-scope-maybe-toplevel
(:prefix "x"
"c" #'agda2-compile
"d" #'agda2-remove-annotations
"h" #'agda2-display-implicit-arguments
"q" #'agda2-quit
"r" #'agda2-restart)))
** C/C++ ** C/C++
** Clojure
** Coq
** Dart / Flutter ** Dart / Flutter
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package dart-mode (use-package dart-mode
:mode "\\.dart\\'") :mode "\\.dart\\'")
#+END_SRC
** Elixir (use-package lsp-dart
:hook 'dart-mode-hook)
Major mode for elixir
#+BEGIN_SRC emacs-lisp
; (use-package elixir-mode)
#+END_SRC
Several tools for navigation, formatting, compilation, docs and completion
#+BEGIN_SRC emacs-lisp
; (use-package alchemist)
#+END_SRC #+END_SRC
** Elm ** Elm
@ -1267,25 +1234,6 @@ It requires the hindent executable
flycheck-haskell? flycheck-haskell?
ghc ? ghc ?
** Idris
#+BEGIN_SRC emacs-lisp
;; (use-package idris-mode
;; :hook (idris-mode-hook . turn-on-idris-simple-indent)
;; :general (leader-key idris-mode-map
;; "m." 'idris-pop-to-repl
;; "mr" 'idris-load-file
;; "md" 'idris-docs-at-point
;; "mt" 'idris-type-at-point
;; "md" 'idris-add-clause
;; "ml" 'idris-make-lemma
;; "mc" 'idris-case-split
;; "mw" 'idris-make-with-block
;; "mm" 'idris-add-missing
;; "mp" 'idris-proof-search
;; "mh" 'idris-docs-at-point))
#+END_SRC
** Java ** Java
Java LSP using the Eclipse JDT Language server Java LSP using the Eclipse JDT Language server
@ -1395,6 +1343,7 @@ js2-mode
js-doc js-doc
js2-refactor js2-refactor
npm.el npm.el
** Json ** Json
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -1699,17 +1648,46 @@ To be installed from the arch community repos: python-language-server
("or" . "") ("or" . "")
("pi" . "π")))) ("pi" . "π"))))
(add-hook 'python-mode-hook 'prettify-symbols-mode) ;; (add-hook 'python-mode-hook 'prettify-symbols-mode)
(add-hook 'python-mode-hook 'prettify-python) ;; (add-hook 'python-mode-hook 'prettify-python)
#+END_SRC #+END_SRC
** Rust ** Rust
rust-mode
#+BEGIN_SRC emacs-lisp
(use-package rustic
:bind (:map rustic-mode-map
("M-j" . lsp-ui-imenu)
("M-?" . lsp-find-references)
("C-c C-c l" . flycheck-list-errors)
("C-c C-c a" . lsp-execute-code-action)
("C-c C-c r" . lsp-rename)
("C-c C-c q" . lsp-workspace-restart)
("C-c C-c Q" . lsp-workspace-shutdown)
("C-c C-c s" . lsp-rust-analyzer-status))
:config
;; uncomment for less flashiness
;; (setq lsp-eldoc-hook nil)
;; (setq lsp-enable-symbol-highlighting nil)
;; (setq lsp-signature-auto-activate nil)
;; comment to disable rustfmt on save
(setq rustic-format-on-save t)
(add-hook 'rustic-mode-hook 'rk/rustic-mode-hook))
(defun rk/rustic-mode-hook ()
;; so that run C-c C-c C-r works without having to confirm, but don't try to
;; save rust buffers that are not file visiting. Once
;; https://github.com/brotzeit/rustic/issues/253 has been resolved this should
;; no longer be necessary.
(when buffer-file-name
(setq-local buffer-save-without-query t)))
#+END_SRC
flycheck-rust flycheck-rust
cargo.el - Cargo support for Emacs. cargo.el - Cargo support for Emacs.
** Scala
** Shellscripts ** Shellscripts
** Yaml ** Yaml
** Web-dev ** Web-dev
@ -1996,6 +1974,8 @@ https://protesilaos.com/
https://writequit.org/denver-emacs/presentations/2017-04-11-ivy.html https://writequit.org/denver-emacs/presentations/2017-04-11-ivy.html
https://robert.kra.hn/posts/2021-02-07_rust-with-emacs/
** Configs ** Configs
*** Quinoa42 *** Quinoa42