2021-12-17 23:02:45 -05:00
|
|
|
;; No thanks
|
|
|
|
(setq inhibit-startup-message t) ; Disable startup message
|
|
|
|
(scroll-bar-mode -1) ; Disable visible scrollbar
|
|
|
|
(tool-bar-mode -1) ; Disable the toolbar
|
|
|
|
(tooltip-mode -1) ; Disable tooltips
|
|
|
|
(set-fringe-mode 10) ; Give some breathing room
|
|
|
|
(menu-bar-mode -1) ; Disable the menu bar
|
|
|
|
(setq-default custom-file null-device) ; Write customizations not in this file to the null device (AKA stop littering in my init.el)
|
|
|
|
|
|
|
|
;; Visible bell
|
|
|
|
(setq visible-bell t)
|
|
|
|
|
|
|
|
; Font
|
|
|
|
(set-face-attribute 'default nil :font "Hack" :height 120)
|
|
|
|
|
|
|
|
;; Make ESC quit prompts
|
|
|
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
|
|
|
|
;; paren/bracket pairs
|
|
|
|
(show-paren-mode t)
|
|
|
|
(setq-default show-paren-style 'parenthesis)
|
|
|
|
(electric-pair-mode 1)
|
|
|
|
|
|
|
|
;; Profile emacs startup
|
|
|
|
(add-hook 'emacs-startup-hook
|
|
|
|
(lambda ()
|
|
|
|
(message "*** Emacs loaded in %s with %d garbage collections."
|
|
|
|
(format "%.2f seconds"
|
|
|
|
(float-time
|
|
|
|
(time-subtract after-init-time before-init-time)))
|
|
|
|
gcs-done)))
|
|
|
|
|
|
|
|
;; Change the user-emacs-directory to keep ~/.emacs.d clean
|
|
|
|
(setq user-emacs-directory (expand-file-name "~/.cache/emacs/")
|
|
|
|
url-history-file (expand-file-name "url/history" user-emacs-directory))
|
|
|
|
|
|
|
|
;; No annoying Windows errors
|
|
|
|
(set-default-coding-systems 'utf-8)
|
|
|
|
|
|
|
|
;; Improved scrolling
|
|
|
|
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;; one line at a time
|
|
|
|
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
|
|
|
|
(setq mouse-wheel-follow-mouse 't) ;; scroll window under mouse
|
|
|
|
(setq scroll-step 1) ;; keyboard scroll one line at a time
|
|
|
|
|
|
|
|
;; Tabs
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
(setq-default tab-width 4)
|
|
|
|
(setq indent-line-function 'insert-tab)
|
|
|
|
|
|
|
|
;;Line numbers
|
|
|
|
(setq column-number-mode t)
|
|
|
|
(dolist (mode '(text-mode-hook
|
|
|
|
prog-mode-hook
|
|
|
|
conf-mode-hook))
|
|
|
|
(add-hook mode (lambda () (display-line-numbers-mode 1))))
|
|
|
|
|
|
|
|
;; Show vertical line at column 80 to keep code clean in prog-mode
|
|
|
|
(setq-default fill-column 80)
|
|
|
|
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
|
|
|
|
|
|
|
|
; Override some modes which derive from the above
|
|
|
|
(dolist (mode '(org-mode-hook))
|
|
|
|
(add-hook mode (lambda () (display-line-numbers-mode 0))))
|
|
|
|
|
|
|
|
;; Initialize package sources
|
|
|
|
(require 'package)
|
|
|
|
|
|
|
|
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
|
|
|
("org" . "https://orgmode.org/elpa/")
|
|
|
|
("elpa" . "https://elpa.gnu.org/packages/")))
|
|
|
|
|
|
|
|
(package-initialize)
|
|
|
|
(unless package-archive-contents
|
|
|
|
(package-refresh-contents))
|
|
|
|
|
|
|
|
;; Initialize use-package on non-Linux platforms
|
|
|
|
(unless (package-installed-p 'use-package)
|
|
|
|
(package-install 'use-package))
|
|
|
|
|
|
|
|
(require 'use-package)
|
|
|
|
(setq use-package-always-ensure t)
|
|
|
|
|
|
|
|
;;; Packages
|
|
|
|
|
|
|
|
;; Theme
|
2022-01-19 16:11:29 -05:00
|
|
|
(setq custom-safe-themes t)
|
|
|
|
|
2022-01-20 22:08:37 -05:00
|
|
|
;(use-package darktooth-theme
|
|
|
|
; :config
|
|
|
|
; (load-theme `darktooth t))
|
|
|
|
|
|
|
|
(use-package zenburn-theme
|
2022-01-19 16:11:29 -05:00
|
|
|
:config
|
2022-01-20 22:08:37 -05:00
|
|
|
(load-theme `zenburn t))
|
2022-01-20 16:09:19 -05:00
|
|
|
|
|
|
|
;; (use-package ample-theme
|
|
|
|
;; :config
|
|
|
|
;; (load-theme `ample-flat t))
|
2021-12-17 23:02:45 -05:00
|
|
|
|
2022-01-20 11:07:30 -05:00
|
|
|
;; (use-package base16-theme
|
|
|
|
;; :ensure t
|
|
|
|
;; :config
|
|
|
|
;; (load-theme 'gruvbox-dark-soft t))
|
2021-12-17 23:02:45 -05:00
|
|
|
|
2022-01-20 12:16:49 -05:00
|
|
|
;; Help distinguish between work from others like sidebars and terminal
|
2021-12-17 23:02:45 -05:00
|
|
|
(use-package solaire-mode
|
|
|
|
:diminish
|
|
|
|
:init
|
2022-01-19 16:11:29 -05:00
|
|
|
(solaire-global-mode t))
|
2021-12-17 23:02:45 -05:00
|
|
|
|
|
|
|
;; Icons
|
|
|
|
(use-package all-the-icons)
|
|
|
|
|
|
|
|
;; Modeline
|
2022-01-20 16:09:19 -05:00
|
|
|
|
|
|
|
;; (use-package simple-modeline
|
|
|
|
;; :hook (after-init . simple-modeline-mode))
|
|
|
|
|
2021-12-17 23:02:45 -05:00
|
|
|
(use-package minions
|
2022-01-20 16:09:19 -05:00
|
|
|
:hook (doom-modeline-mode . minions-mode)
|
|
|
|
(simple-modeline-mode . minions-mode))
|
2021-12-17 23:02:45 -05:00
|
|
|
|
|
|
|
(use-package doom-modeline
|
|
|
|
:init (doom-modeline-mode)
|
|
|
|
:custom
|
|
|
|
(doom-modeline-height 30)
|
2022-01-21 12:17:04 -05:00
|
|
|
(doom-modeline-bar-width .75)
|
2021-12-17 23:02:45 -05:00
|
|
|
(doom-modeline-window-width-limit fill-column)
|
|
|
|
(doom-modeline-lsp t)
|
|
|
|
(doom-modeline-minor-modes t)
|
|
|
|
(doom-modeline-persp-name nil)
|
|
|
|
(doom-modeline-buffer-file-name-style 'truncate-upto-project)
|
|
|
|
(doom-modeline-major-mode-icon t)
|
|
|
|
(doom-modeline-major-mode-color-icon t)
|
|
|
|
(doom-modeline-enable-word-count t)
|
|
|
|
(doom-modeline-env-version t)
|
|
|
|
(doom-modeline-env-load-string "..."))
|
|
|
|
|
|
|
|
;; Don't remind me about some minor modes
|
|
|
|
(use-package diminish)
|
|
|
|
|
|
|
|
;; Automatically set paths to the new user-emacs-directory
|
|
|
|
(use-package no-littering)
|
|
|
|
|
|
|
|
;; Automatically clean whitespace
|
|
|
|
(use-package ws-butler
|
|
|
|
:diminish
|
|
|
|
:hook ((text-mode . ws-butler-mode)
|
|
|
|
(prog-mode . ws-butler-mode)))
|
|
|
|
|
|
|
|
;; Overview of keybindings available based on prefix keys
|
|
|
|
(use-package which-key
|
|
|
|
:init (which-key-mode)
|
|
|
|
:config
|
|
|
|
(setq which-key-idle-delay 0.3))
|
|
|
|
|
|
|
|
;; Navigation: Ivy/Counsel/Swiper
|
|
|
|
(use-package ivy
|
|
|
|
:init
|
|
|
|
(ivy-mode 1)
|
|
|
|
:config
|
|
|
|
(setq ivy-use-virtual-buffers t)
|
|
|
|
(setq ivy-wrap t)
|
|
|
|
(setq ivy-count-format "(%d/%d) ")
|
|
|
|
(setq enable-recursive-minibuffers t))
|
|
|
|
|
|
|
|
(use-package ivy-rich
|
|
|
|
:after ivy
|
|
|
|
:hook (counsel-mode . ivy-rich-mode)
|
|
|
|
:config
|
|
|
|
(setq ivy-rich-parse-remote-buffer nil))
|
|
|
|
|
|
|
|
(use-package counsel
|
|
|
|
:after ivy
|
|
|
|
:config
|
|
|
|
(counsel-mode 1)
|
|
|
|
(setq ivy-initial-inputs-alist nil))
|
|
|
|
|
|
|
|
(use-package swiper
|
|
|
|
:after ivy
|
|
|
|
:bind (("C-s" . swiper)))
|
|
|
|
|
|
|
|
(use-package treemacs
|
|
|
|
:defer t
|
|
|
|
:bind
|
|
|
|
(:map global-map
|
|
|
|
("M-0" . treemacs-select-window)
|
|
|
|
("C-x t 1" . treemacs-delete-other-windows)
|
|
|
|
("C-x t t" . treemacs)
|
|
|
|
("C-x t B" . treemacs-bookmark)
|
|
|
|
("C-x t C-t" . treemacs-find-file)
|
|
|
|
("C-x t M-t" . treemacs-find-tag)))
|
|
|
|
|
|
|
|
(use-package lsp-treemacs
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(lsp-treemacs-sync-mode 1))
|
|
|
|
|
|
|
|
;; Git
|
|
|
|
(use-package magit
|
|
|
|
:bind ("C-M-;" . magit-status)
|
|
|
|
:commands (magit-status magit-get-current-branch)
|
|
|
|
:custom
|
|
|
|
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
|
|
|
|
|
|
|
|
;; LSP & debugging
|
|
|
|
|
|
|
|
(use-package lsp-mode
|
|
|
|
:init
|
|
|
|
(setq lsp-keymap-prefix "C-c l")
|
|
|
|
:commands (lsp lsp-deferred)
|
|
|
|
:hook
|
|
|
|
((c-mode . lsp)
|
|
|
|
(c++-mode . lsp)
|
|
|
|
(java-mode . lsp)
|
|
|
|
(python-mode . lsp)
|
|
|
|
(rust-mode . lsp)
|
|
|
|
(tex-mode . lsp)
|
|
|
|
(latex-mode . lsp)
|
|
|
|
(zig-mode . lsp)
|
|
|
|
(lsp-mode . lsp-enable-which-key-integration))
|
|
|
|
:config
|
2022-01-20 16:09:19 -05:00
|
|
|
(setq lsp-prefer-flymake nil)) ;prefer lsp-ui (flycheck) to flymake
|
2021-12-17 23:02:45 -05:00
|
|
|
; :bind
|
|
|
|
; (:map lsp-mode-map
|
|
|
|
; ("TAB" . completion-at-point)))
|
|
|
|
|
|
|
|
(use-package lsp-ui
|
|
|
|
:requires lsp-mode flycheck
|
|
|
|
:hook (lsp-mode . lsp-ui-mode)
|
|
|
|
:commands lsp-ui-mode
|
|
|
|
:config
|
|
|
|
(setq lsp-ui-doc-enable t)
|
|
|
|
(setq lsp-ui-doc-use-childframe t)
|
|
|
|
(setq lsp-ui-doc-position 'bottom-and-right)
|
|
|
|
(setq lsp-ui-doc-include-signature t)
|
|
|
|
(setq lsp-ui-sideline-enable t)
|
|
|
|
(setq lsp-ui-sideline-show-hover nil)
|
|
|
|
(setq lsp-ui-flycheck-enable t)
|
|
|
|
(setq lsp-ui-flycheck-list-position 'right)
|
|
|
|
(setq lsp-ui-flycheck-live-reporting t)
|
|
|
|
(setq lsp-ui-peek-enable t)
|
|
|
|
(setq lsp-ui-peek-list-width 60)
|
|
|
|
(setq lsp-ui-peek-peek-height 25)
|
|
|
|
(lsp-ui-doc-show))
|
|
|
|
|
|
|
|
(use-package dap-mode
|
2022-02-10 21:50:26 -05:00
|
|
|
:after lsp-mode
|
|
|
|
:commands dap-debug
|
|
|
|
:hook ((python-mode . dap-ui-mode)
|
|
|
|
(python-mode . dap-mode))
|
2021-12-17 23:02:45 -05:00
|
|
|
:config
|
2022-02-25 14:54:20 -05:00
|
|
|
;(dap-ui-mode 1)
|
|
|
|
;(dap-tooltip-mode 1)
|
2022-02-10 21:50:26 -05:00
|
|
|
(eval-when-compile
|
|
|
|
(require 'cl-lib))
|
2022-03-02 14:56:12 -05:00
|
|
|
(require 'dap-python))
|
2021-12-17 23:02:45 -05:00
|
|
|
|
|
|
|
(use-package company
|
|
|
|
:config
|
|
|
|
(global-company-mode 1)
|
|
|
|
:custom
|
|
|
|
(company-idle-delay 0)
|
|
|
|
(company-minimum-prefix-length 1)
|
|
|
|
(company-tooltip-align-annotations t)
|
|
|
|
:bind
|
|
|
|
(:map company-active-map
|
|
|
|
("RET" . nil)
|
|
|
|
("[return]" . nil)
|
|
|
|
("TAB" . company-complete-selection)
|
|
|
|
("<tab>" . company-complete-selection)
|
|
|
|
("C-n" . company-select-next)
|
|
|
|
("C-p" . company-select-previous)))
|
|
|
|
|
|
|
|
;; Full terminal applications within Emacs
|
|
|
|
(use-package vterm
|
|
|
|
:commands vterm
|
|
|
|
:config
|
|
|
|
(setq vterm-max-scrollback 10000))
|
|
|
|
|
|
|
|
;;; Languages
|
|
|
|
|
|
|
|
;; C/C++
|
|
|
|
(setq-default c-default-style "k&r")
|
|
|
|
(setq-default c-basic-offset 2)
|
|
|
|
|
|
|
|
;(use-package ccls
|
|
|
|
; :hook ((c-mode c++-mode objc-mode cuda-mode) .
|
|
|
|
; (lambda () (require 'ccls) (lsp))))
|
|
|
|
|
|
|
|
;(use-package modern-cpp-font-lock
|
|
|
|
; :config
|
|
|
|
; (modern-c++-font-lock-global-mode))
|
|
|
|
|
|
|
|
;; Java
|
|
|
|
|
|
|
|
;(use-package lsp-java)
|
|
|
|
|
|
|
|
;; LaTeX
|
|
|
|
|
|
|
|
(use-package lsp-latex)
|
|
|
|
|
|
|
|
(setq lsp-tex-server 'digestif)
|
|
|
|
|
|
|
|
;; Python
|
2022-03-02 14:56:12 -05:00
|
|
|
|
|
|
|
(setq dap-python-debugger 'debugpy)
|
2022-02-25 14:54:20 -05:00
|
|
|
|
2021-12-17 23:02:45 -05:00
|
|
|
(use-package lsp-pyright
|
|
|
|
:hook (python-mode . (lambda ()
|
|
|
|
(require 'lsp-pyright)
|
|
|
|
(lsp)))) ; or lsp-deferred
|
|
|
|
|
2022-01-25 23:18:49 -05:00
|
|
|
(use-package numpydoc
|
|
|
|
:bind (:map python-mode-map
|
2022-01-25 23:34:54 -05:00
|
|
|
("C-c C-n" . numpydoc-generate))
|
|
|
|
:config
|
|
|
|
(setq numpydoc-insert-examples-block nil))
|
2021-12-17 23:19:27 -05:00
|
|
|
|
2021-12-17 23:02:45 -05:00
|
|
|
;; Rust
|
|
|
|
|
|
|
|
;(use-package rust-mode)
|
|
|
|
|
|
|
|
;; Zig
|
|
|
|
|
|
|
|
;(use-package zig-mode
|
|
|
|
; :custom (zig-format-on-save nil)
|
|
|
|
; :config
|
|
|
|
; (add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
|
|
|
|
; (make-lsp-client
|
|
|
|
; :new-connection (lsp-stdio-connection "/usr/bin/zls")
|
|
|
|
; :major-modes '(zig-mode)
|
|
|
|
; :server-id 'zls))
|
|
|
|
|
|
|
|
;; Syntax checking
|
|
|
|
(use-package flycheck
|
|
|
|
:hook (lsp-mode . flycheck-mode))
|
|
|
|
|
|
|
|
;; Templating
|
|
|
|
(use-package yasnippet
|
|
|
|
:bind
|
|
|
|
("C-c y s" . yas-insert-snippet)
|
|
|
|
("C-c y v" . yas-visit-snippet-file)
|
|
|
|
:config
|
|
|
|
(add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")
|
|
|
|
(yas-reload-all)
|
|
|
|
(yas-global-mode))
|
|
|
|
|
|
|
|
(use-package yasnippet-snippets)
|
|
|
|
;;; End init.el
|