A fully automatic install when put on .emacs.d
This commit is contained in:
parent
8c0110d884
commit
2121924cf1
|
@ -1,6 +1,6 @@
|
|||
OrgFiles/
|
||||
var/
|
||||
elpa/
|
||||
etc/
|
||||
*~
|
||||
.last-package-update-day
|
||||
init.el
|
235
Emacs.org
235
Emacs.org
|
@ -1,4 +1,4 @@
|
|||
#+title: Emacs From Scratch Configuration
|
||||
#+title: TastyPancakes Emacs configuration
|
||||
#+PROPERTY: header-args:emacs-lisp :tangle ./init.el :mkdirp yes
|
||||
|
||||
* Welcome!
|
||||
|
@ -11,8 +11,8 @@ The following variables are used to tweak some of the configuration pieces for u
|
|||
;; in Emacs and init.el will be generated automatically!
|
||||
|
||||
;; You will most likely need to adjust this font size for your system!
|
||||
(defvar efs/default-font-size 100)
|
||||
(defvar efs/default-variable-font-size 100)
|
||||
(defvar efs/default-font-size 200)
|
||||
(defvar efs/default-variable-font-size 200)
|
||||
|
||||
;; Make frame transparency overridable
|
||||
(defvar efs/frame-transparency '(90 . 90))
|
||||
|
@ -20,10 +20,6 @@ The following variables are used to tweak some of the configuration pieces for u
|
|||
;; Electric pair mode
|
||||
(electric-pair-mode 1)
|
||||
|
||||
;; Use gnu-ls for the BSD's
|
||||
(cond ((eq system-type 'berkeley-unix)
|
||||
(setq insert-directory-program "/usr/local/bin/gls")))
|
||||
|
||||
#+end_src
|
||||
|
||||
|
||||
|
@ -56,36 +52,47 @@ Emacs has a built in package manager but it doesn't make it easy to automaticall
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
;; Initialize package sources
|
||||
(require 'package)
|
||||
; list the packages you want
|
||||
(setq package-list '(package use-package auto-package-update
|
||||
exec-path-from-shell org-auto-tangle
|
||||
rtags cmake-ide))
|
||||
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("org" . "https://orgmode.org/elpa/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
|
||||
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
;; Initialize package sources
|
||||
(require 'package)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("org" . "https://orgmode.org/elpa/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
|
||||
|
||||
;; Initialize use-package on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'use-package))
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
(package-install-selected-packages)
|
||||
|
||||
;; Initialize exec-path-from-shell on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'exec-path-from-shell))
|
||||
; install the missing packages
|
||||
(dolist (package package-list)
|
||||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
|
||||
(require 'use-package)
|
||||
(setq use-package-always-ensure t)
|
||||
(require 'exec-path-from-shell)
|
||||
(require 'use-package)
|
||||
;; Initialize use-package on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'use-package))
|
||||
|
||||
;; load Linux PATH
|
||||
(when (memq window-system '(mac ns x))
|
||||
(exec-path-from-shell-initialize))
|
||||
;; if loaded as daemon
|
||||
(when (daemonp)
|
||||
(exec-path-from-shell-initialize))
|
||||
(require 'exec-path-from-shell)
|
||||
;; Initialize exec-path-from-shell on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'exec-path-from-shell))
|
||||
|
||||
;; load Linux PATH
|
||||
(when (memq window-system '(mac ns x))
|
||||
(exec-path-from-shell-initialize))
|
||||
;; if loaded as daemon
|
||||
(when (daemonp)
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
#+end_src
|
||||
|
||||
|
@ -98,14 +105,14 @@ You can also use =M-x auto-package-update-now= to update right now!
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
; (use-package auto-package-update
|
||||
; :custom
|
||||
; (auto-package-update-interval 7)
|
||||
; (auto-package-update-prompt-before-update t)
|
||||
; (auto-package-update-hide-results t)
|
||||
; :config
|
||||
; (auto-package-update-maybe)
|
||||
; (auto-package-update-at-time "09:00"))
|
||||
(use-package auto-package-update
|
||||
:custom
|
||||
(auto-package-update-interval 30)
|
||||
(auto-package-update-prompt-before-update t)
|
||||
(auto-package-update-hide-results t)
|
||||
:config
|
||||
(auto-package-update-maybe)
|
||||
(auto-package-update-at-time "09:00"))
|
||||
|
||||
#+end_src
|
||||
|
||||
|
@ -133,21 +140,29 @@ We use the [[https://github.com/emacscollective/no-littering/blob/master/no-litt
|
|||
* Wayland clipboard support
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
;;;; credit: yorickvP on Github
|
||||
;;(setq wl-copy-process nil)
|
||||
;;(defun wl-copy (text)
|
||||
;; (setq wl-copy-process (make-process :name "wl-copy"
|
||||
;; :buffer nil
|
||||
;; :command '("wl-copy" "-f" "-n")
|
||||
;; :connection-type 'pipe))
|
||||
;; (process-send-string wl-copy-process text)
|
||||
;; (process-send-eof wl-copy-process))
|
||||
;;(defun wl-paste ()
|
||||
;; (if (and wl-copy-process (process-live-p wl-copy-process))
|
||||
;; nil ; should return nil if we're the current paste owner
|
||||
;; (shell-command-to-string "wl-paste -n | tr -d \r")))
|
||||
;;(setq interprogram-cut-function 'wl-copy)
|
||||
;;(setq interprogram-paste-function 'wl-paste)
|
||||
|
||||
(cond
|
||||
((eq system-type 'gnu/linux)
|
||||
(progn
|
||||
(
|
||||
;; credit: yorickvP on Github
|
||||
(setq wl-copy-process nil)
|
||||
(defun wl-copy (text)
|
||||
(setq wl-copy-process (make-process :name "wl-copy"
|
||||
:buffer nil
|
||||
:command '("wl-copy" "-f" "-n")
|
||||
:connection-type 'pipe))
|
||||
(process-send-string wl-copy-process text)
|
||||
(process-send-eof wl-copy-process))
|
||||
(defun wl-paste ()
|
||||
(if (and wl-copy-process (process-live-p wl-copy-process))
|
||||
nil ; should return nil if we're the current paste owner
|
||||
(shell-command-to-string "wl-paste -n | tr -d \r")))
|
||||
(setq interprogram-cut-function 'wl-copy)
|
||||
(setq interprogram-paste-function 'wl-paste)
|
||||
|
||||
))))
|
||||
|
||||
#+end_src
|
||||
|
||||
* Basic UI Configuration
|
||||
|
@ -197,16 +212,37 @@ I am using the [[https://github.com/tonsky/FiraCode][Fira Code]] and [[https://f
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
||||
(cond
|
||||
((eq system-type 'windows-nt)
|
||||
(progn
|
||||
(message "Microsoft Windows")))
|
||||
((eq system-type 'darwin)
|
||||
(progn
|
||||
(
|
||||
(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||
|
||||
;; Set the fixed pitch face
|
||||
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
||||
;; Set the fixed pitch face
|
||||
(set-face-attribute 'fixed-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||
|
||||
;; Set the variable pitch face
|
||||
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
||||
;; Set the variable pitch face
|
||||
(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
|
||||
)))
|
||||
((eq system-type 'gnu/linux)
|
||||
(progn
|
||||
(
|
||||
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
||||
|
||||
;; Set the fixed pitch face
|
||||
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
||||
|
||||
;; Set the variable pitch face
|
||||
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
||||
|
||||
))))
|
||||
|
||||
#+end_src
|
||||
|
||||
|
||||
* Keybinding Configuration
|
||||
|
||||
This configuration uses [[https://evil.readthedocs.io/en/latest/index.html][evil-mode]] for a Vi-like modal editing experience. [[https://github.com/noctuid/general.el][general.el]] is used for easy keybinding configuration that integrates well with which-key. [[https://github.com/emacs-evil/evil-collection][evil-collection]] is used to automatically configure various Emacs modes with Vi-like keybindings for evil-mode.
|
||||
|
@ -254,6 +290,7 @@ This configuration uses [[https://evil.readthedocs.io/en/latest/index.html][evil
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
* UI Configuration
|
||||
|
||||
** Command Log Mode
|
||||
|
@ -267,6 +304,8 @@ This configuration uses [[https://evil.readthedocs.io/en/latest/index.html][evil
|
|||
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
** Color Theme
|
||||
|
||||
[[https://github.com/hlissner/emacs-doom-themes][doom-themes]] is a great set of themes with a lot of variety and support for many different Emacs modes. Taking a look at the [[https://github.com/hlissner/emacs-doom-themes/tree/screenshots][screenshots]] might help you decide which one you like best. You can also run =M-x counsel-load-theme= to choose between them easily.
|
||||
|
@ -278,6 +317,7 @@ This configuration uses [[https://evil.readthedocs.io/en/latest/index.html][evil
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
** Better Modeline
|
||||
|
||||
[[https://github.com/seagle0128/doom-modeline][doom-modeline]] is a very attractive and rich (yet still minimal) mode line configuration for Emacs. The default configuration is quite good but you can check out the [[https://github.com/seagle0128/doom-modeline#customize][configuration options]] for more things you can enable or disable.
|
||||
|
@ -294,6 +334,7 @@ This configuration uses [[https://evil.readthedocs.io/en/latest/index.html][evil
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
** Which Key
|
||||
|
||||
[[https://github.com/justbur/emacs-which-key][which-key]] is a useful UI panel that appears when you start pressing any key binding in Emacs to offer you all possible completions for the prefix. For example, if you press =C-c= (hold control and press the letter =c=), a panel will appear at the bottom of the frame displaying all of the bindings under that prefix and which command they run. This is very useful for learning the possible key bindings in the mode of your current buffer.
|
||||
|
@ -378,6 +419,7 @@ This Prescient configuration is optimized for use in System Crafters videos and
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
** Helpful Help Commands
|
||||
|
||||
[[https://github.com/Wilfred/helpful][Helpful]] adds a lot of very helpful (get it?) information to Emacs' =describe-= command buffers. For example, if you use =describe-function=, you will not only get the documentation about the function, you will also see the source code of the function and where it gets used in other places in the Emacs configuration. It is very useful for figuring out how things work in Emacs.
|
||||
|
@ -397,9 +439,10 @@ This Prescient configuration is optimized for use in System Crafters videos and
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
** Text Scaling
|
||||
|
||||
This is an example of using [[https://github.com/abo-abo/hydra][Hydra]] to design a transient key binding for quickly adjusting the scale of the text on screen. We define a hydra that is bound to =C-s t s= and, once activated, =j= and =k= increase and decrease the text scale. You can press any other key (or =f= specifically) to exit the transient key map.
|
||||
This is an example of using [[https://github.com/abo-abo/hydra][Hydra]] to design a transient key binding for quickly adjusting the scale of the text on screen. We define a hydra that is bound to =SPC t s= and, once activated, =j= and =k= increase and decrease the text scale. You can press any other key (or =f= specifically) to exit the transient key map.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
|
@ -417,6 +460,7 @@ This is an example of using [[https://github.com/abo-abo/hydra][Hydra]] to desig
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
* FlySpell Mode
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
@ -467,6 +511,25 @@ This is an example of using [[https://github.com/abo-abo/hydra][Hydra]] to desig
|
|||
|
||||
[[https://orgmode.org/][Org Mode]] is one of the hallmark features of Emacs. It is a rich document editor, project planner, task and time tracker, blogging engine, and literate coding utility all wrapped up in one package.
|
||||
|
||||
|
||||
** Auto-tangle Configuration Files
|
||||
|
||||
This snippet adds a hook to =org-mode= buffers so that =efs/org-babel-tangle-config= gets executed each time such a buffer gets saved. This function checks to see if the file being saved is the Emacs.org file you're looking at right now, and if so, automatically exports the configuration here to the associated output files.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
;; Automatically tangle our Emacs.org config file when we save it
|
||||
(defun efs/org-babel-tangle-config ()
|
||||
(when (string-equal (file-name-directory (buffer-file-name))
|
||||
(expand-file-name user-emacs-directory))
|
||||
;; Dynamic scoping to the rescue
|
||||
(let ((org-confirm-babel-evaluate nil))
|
||||
(org-babel-tangle))))
|
||||
|
||||
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))
|
||||
|
||||
#+end_src
|
||||
|
||||
** Better Font Faces
|
||||
|
||||
The =efs/org-font-setup= function configures various text faces to tweak the sizes of headings and use variable width fonts in most cases so that it looks more like we're editing a document in =org-mode=. We switch back to fixed width (monospace) fonts for code blocks and tables so that they display correctly.
|
||||
|
@ -488,7 +551,7 @@ The =efs/org-font-setup= function configures various text faces to tweak the siz
|
|||
(org-level-6 . 1.1)
|
||||
(org-level-7 . 1.1)
|
||||
(org-level-8 . 1.1)))
|
||||
(set-face-attribute (car face) nil :font "Comic Code" :weight 'regular :height (cdr face)))
|
||||
(set-face-attribute (car face) nil :font "BigBlueTermPlus Nerd Font" :weight 'regular :height (cdr face)))
|
||||
|
||||
;; Ensure that anything that should be fixed-pitch in Org files appears that way
|
||||
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
|
||||
|
@ -529,9 +592,9 @@ This section contains the basic configuration for =org-mode= plus the configurat
|
|||
(setq org-log-into-drawer t)
|
||||
|
||||
(setq org-agenda-files
|
||||
'("~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org"
|
||||
"~/Projects/Code/emacs-from-scratch/OrgFiles/Habits.org"
|
||||
"~/Projects/Code/emacs-from-scratch/OrgFiles/Birthdays.org"))
|
||||
'("~/.emacs.d/OrgFiles/Tasks.org"
|
||||
"~/.emacs.d/OrgFiles/Habits.org"
|
||||
"~/.emacs.d/OrgFiles/Birthdays.org"))
|
||||
|
||||
(require 'org-habit)
|
||||
(add-to-list 'org-modules 'org-habit)
|
||||
|
@ -612,28 +675,28 @@ This section contains the basic configuration for =org-mode= plus the configurat
|
|||
|
||||
(setq org-capture-templates
|
||||
`(("t" "Tasks / Projects")
|
||||
("tt" "Task" entry (file+olp "~/Projects/Code/emacs-from-scratch/OrgFiles/Tasks.org" "Inbox")
|
||||
("tt" "Task" entry (file+olp "~/.emacs.d/OrgFiles/Tasks.org" "Inbox")
|
||||
"* TODO %?\n %U\n %a\n %i" :empty-lines 1)
|
||||
|
||||
("j" "Journal Entries")
|
||||
("jj" "Journal" entry
|
||||
(file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org")
|
||||
(file+olp+datetree "~/.emacs.d/OrgFiles/Journal.org")
|
||||
"\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
|
||||
;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org")
|
||||
:clock-in :clock-resume
|
||||
:empty-lines 1)
|
||||
("jm" "Meeting" entry
|
||||
(file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org")
|
||||
(file+olp+datetree "~/.emacs.d/OrgFiles/Journal.org")
|
||||
"* %<%I:%M %p> - %a :meetings:\n\n%?\n\n"
|
||||
:clock-in :clock-resume
|
||||
:empty-lines 1)
|
||||
|
||||
("w" "Workflows")
|
||||
("we" "Checking Email" entry (file+olp+datetree "~/Projects/Code/emacs-from-scratch/OrgFiles/Journal.org")
|
||||
("we" "Checking Email" entry (file+olp+datetree "~/.emacs.d/OrgFiles/Journal.org")
|
||||
"* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1)
|
||||
|
||||
("m" "Metrics Capture")
|
||||
("mw" "Weight" table-line (file+headline "~/Projects/Code/emacs-from-scratch/OrgFiles/Metrics.org" "Weight")
|
||||
("mw" "Weight" table-line (file+headline "~/.emacs.d/OrgFiles/Metrics.org" "Weight")
|
||||
"| %U | %^{Weight} | %^{Notes} |" :kill-buffer t)))
|
||||
|
||||
(define-key global-map (kbd "C-c j")
|
||||
|
@ -711,23 +774,6 @@ You can add more =src= block templates below by copying one of the lines and cha
|
|||
#+end_src
|
||||
|
||||
|
||||
** Auto-tangle Configuration Files
|
||||
|
||||
This snippet adds a hook to =org-mode= buffers so that =efs/org-babel-tangle-config= gets executed each time such a buffer gets saved. This function checks to see if the file being saved is the Emacs.org file you're looking at right now, and if so, automatically exports the configuration here to the associated output files.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
;; Automatically tangle our Emacs.org config file when we save it
|
||||
(defun efs/org-babel-tangle-config ()
|
||||
(when (string-equal (file-name-directory (buffer-file-name))
|
||||
(expand-file-name user-emacs-directory))
|
||||
;; Dynamic scoping to the rescue
|
||||
(let ((org-confirm-babel-evaluate nil))
|
||||
(org-babel-tangle))))
|
||||
|
||||
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))
|
||||
|
||||
#+end_src
|
||||
|
||||
|
||||
* Development
|
||||
|
@ -792,6 +838,8 @@ This package is built on the [[https://github.com/Alexander-Miller/treemacs][tre
|
|||
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
**** lsp-ivy
|
||||
|
||||
[[https://github.com/emacs-lsp/lsp-ivy][lsp-ivy]] integrates Ivy with =lsp-mode= to make it easy to search for things by name in your code. When you run these commands, a prompt will appear in the minibuffer allowing you to type part of the name of a symbol in your code. Results will be populated in the minibuffer so that you can find what you're looking for and jump to that location in the code upon selecting the result.
|
||||
|
@ -808,6 +856,8 @@ Try these commands with =M-x=:
|
|||
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
*** Debugging with dap-mode
|
||||
|
||||
[[https://emacs-lsp.github.io/dap-mode/][dap-mode]] is an excellent package for bringing rich debugging capabilities to Emacs via the [[https://microsoft.github.io/debug-adapter-protocol/][Debug Adapter Protocol]]. You should check out the [[https://emacs-lsp.github.io/dap-mode/page/configuration/][configuration docs]] to learn how to configure the debugger for your language. Also make sure to check out the documentation for the debug adapter to see what configuration parameters are available to use for your debug templates!
|
||||
|
@ -834,6 +884,8 @@ Try these commands with =M-x=:
|
|||
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
|
||||
*** TypeScript
|
||||
|
||||
This is a basic configuration for the TypeScript language so that =.ts= files activate =typescript-mode= when opened. We're also adding a hook to =typescript-mode-hook= to call =lsp-deferred= so that we activate =lsp-mode= to get LSP features every time we edit TypeScript code.
|
||||
|
@ -988,9 +1040,9 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
|
|||
:config
|
||||
(setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite
|
||||
|
||||
;;(use-package auto-dictionary
|
||||
;; :ensure t
|
||||
;; :init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
|
||||
(use-package auto-dictionary
|
||||
:ensure t
|
||||
:init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
|
||||
|
||||
(use-package company-auctex
|
||||
:ensure t
|
||||
|
@ -1004,7 +1056,6 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
|
|||
(setq TeX-source-correlate-method 'synctex)
|
||||
(setq TeX-auto-save t)
|
||||
(setq TeX-parse-self t)
|
||||
;;(setq-default TeX-master "paper.tex")
|
||||
(setq-default TeX-master "0_front_matter.tex")
|
||||
(setq reftex-plug-into-AUCTeX t)
|
||||
(pdf-tools-install)
|
||||
|
@ -1012,7 +1063,7 @@ This will install the [[https://github.com/theia-ide/typescript-language-server]
|
|||
TeX-source-correlate-start-server t)
|
||||
;; Update PDF buffers after successful LaTeX runs
|
||||
(add-hook 'TeX-after-compilation-finished-functions
|
||||
'TeX-revert-document-buffer)
|
||||
#'TeX-revert-document-buffer)
|
||||
(add-hook 'LaTeX-mode-hook
|
||||
(lambda ()
|
||||
(reftex-mode t)
|
||||
|
@ -1395,11 +1446,13 @@ Dired is a built-in file manager for Emacs that does some pretty amazing things!
|
|||
|
||||
#+begin_src emacs-lisp
|
||||
|
||||
(setq insert-directory-program "gls" dired-use-ls-dired t)
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:commands (dired dired-jump)
|
||||
:bind (("C-x C-j" . dired-jump))
|
||||
:custom ((dired-listing-switches "-agho --group-directories-first"))
|
||||
;:custom ((dired-listing-switches "-agho"))
|
||||
:config
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"h" 'dired-single-up-directory
|
||||
|
|
|
@ -0,0 +1,892 @@
|
|||
;; NOTE: init.el is now generated from Emacs.org. Please edit that file
|
||||
;; in Emacs and init.el will be generated automatically!
|
||||
|
||||
;; You will most likely need to adjust this font size for your system!
|
||||
(defvar efs/default-font-size 200)
|
||||
(defvar efs/default-variable-font-size 200)
|
||||
|
||||
;; Make frame transparency overridable
|
||||
(defvar efs/frame-transparency '(90 . 90))
|
||||
|
||||
;; Electric pair mode
|
||||
(electric-pair-mode 1)
|
||||
|
||||
;; The default is 800 kilobytes. Measured in bytes.
|
||||
(setq gc-cons-threshold (* 50 1000 1000))
|
||||
|
||||
(defun efs/display-startup-time ()
|
||||
(message "Emacs loaded in %s with %d garbage collections."
|
||||
(format "%.2f seconds"
|
||||
(float-time
|
||||
(time-subtract after-init-time before-init-time)))
|
||||
gcs-done))
|
||||
|
||||
(add-hook 'emacs-startup-hook #'efs/display-startup-time)
|
||||
|
||||
; list the packages you want
|
||||
(setq package-list '(package use-package auto-package-update
|
||||
exec-path-from-shell org-auto-tangle
|
||||
rtags cmake-ide))
|
||||
|
||||
|
||||
;; Initialize package sources
|
||||
(require 'package)
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("org" . "https://orgmode.org/elpa/")
|
||||
("elpa" . "https://elpa.gnu.org/packages/")
|
||||
("nongnu" . "https://elpa.nongnu.org/nongnu/")))
|
||||
|
||||
(package-initialize)
|
||||
(unless package-archive-contents
|
||||
(package-refresh-contents))
|
||||
(package-install-selected-packages)
|
||||
|
||||
; install the missing packages
|
||||
(dolist (package package-list)
|
||||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
|
||||
(require 'use-package)
|
||||
;; Initialize use-package on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'use-package))
|
||||
|
||||
(require 'exec-path-from-shell)
|
||||
;; Initialize exec-path-from-shell on non-Linux platforms
|
||||
(unless (package-installed-p 'use-package)
|
||||
(package-install 'exec-path-from-shell))
|
||||
|
||||
;; load Linux PATH
|
||||
(when (memq window-system '(mac ns x))
|
||||
(exec-path-from-shell-initialize))
|
||||
;; if loaded as daemon
|
||||
(when (daemonp)
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
(use-package auto-package-update
|
||||
:custom
|
||||
(auto-package-update-interval 30)
|
||||
(auto-package-update-prompt-before-update t)
|
||||
(auto-package-update-hide-results t)
|
||||
:config
|
||||
(auto-package-update-maybe)
|
||||
(auto-package-update-at-time "09:00"))
|
||||
|
||||
;; NOTE: If you want to move everything out of the ~/.emacs.d folder
|
||||
;; reliably, set `user-emacs-directory` before loading no-littering!
|
||||
;(setq user-emacs-directory "~/.cache/emacs")
|
||||
|
||||
(use-package no-littering)
|
||||
|
||||
;; no-littering doesn't set this by default so we must place
|
||||
;; auto save files in the same path as it uses for sessions
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
|
||||
|
||||
(cond
|
||||
((eq system-type 'gnu/linux)
|
||||
(progn
|
||||
(
|
||||
;; credit: yorickvP on Github
|
||||
(setq wl-copy-process nil)
|
||||
(defun wl-copy (text)
|
||||
(setq wl-copy-process (make-process :name "wl-copy"
|
||||
:buffer nil
|
||||
:command '("wl-copy" "-f" "-n")
|
||||
:connection-type 'pipe))
|
||||
(process-send-string wl-copy-process text)
|
||||
(process-send-eof wl-copy-process))
|
||||
(defun wl-paste ()
|
||||
(if (and wl-copy-process (process-live-p wl-copy-process))
|
||||
nil ; should return nil if we're the current paste owner
|
||||
(shell-command-to-string "wl-paste -n | tr -d \r")))
|
||||
(setq interprogram-cut-function 'wl-copy)
|
||||
(setq interprogram-paste-function 'wl-paste)
|
||||
|
||||
))))
|
||||
|
||||
(setq inhibit-startup-message t)
|
||||
;;(setq default-directory "~/.emacs.d")
|
||||
|
||||
(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
|
||||
|
||||
;; Set up the visible bell
|
||||
(setq visible-bell t)
|
||||
|
||||
(column-number-mode)
|
||||
(global-display-line-numbers-mode t)
|
||||
|
||||
;; Set frame transparency
|
||||
(set-frame-parameter (selected-frame) 'alpha efs/frame-transparency)
|
||||
(add-to-list 'default-frame-alist `(alpha . ,efs/frame-transparency))
|
||||
(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
|
||||
(add-to-list 'default-frame-alist '(fullscreen . maximized))
|
||||
|
||||
;; Disable line numbers for some modes
|
||||
(dolist (mode '(org-mode-hook
|
||||
term-mode-hook
|
||||
shell-mode-hook
|
||||
treemacs-mode-hook
|
||||
eshell-mode-hook))
|
||||
(add-hook mode (lambda () (display-line-numbers-mode 0))))
|
||||
|
||||
(global-set-key (kbd "C-x l") 'load-file)
|
||||
|
||||
(cond
|
||||
((eq system-type 'windows-nt)
|
||||
(progn
|
||||
(message "Microsoft Windows")))
|
||||
((eq system-type 'darwin)
|
||||
(progn
|
||||
(
|
||||
(set-face-attribute 'default nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||
|
||||
;; Set the fixed pitch face
|
||||
(set-face-attribute 'fixed-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-font-size)
|
||||
|
||||
;; Set the variable pitch face
|
||||
(set-face-attribute 'variable-pitch nil :font "BigBlueTermPlus Nerd Font" :height efs/default-variable-font-size :weight 'regular)
|
||||
)))
|
||||
((eq system-type 'gnu/linux)
|
||||
(progn
|
||||
(
|
||||
(set-face-attribute 'default nil :font "Comic Code" :height efs/default-font-size)
|
||||
|
||||
;; Set the fixed pitch face
|
||||
(set-face-attribute 'fixed-pitch nil :font "Comic Code" :height efs/default-font-size)
|
||||
|
||||
;; Set the variable pitch face
|
||||
(set-face-attribute 'variable-pitch nil :font "Comic Code" :height efs/default-variable-font-size :weight 'regular)
|
||||
|
||||
))))
|
||||
|
||||
;; Make ESC quit prompts
|
||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||
|
||||
(use-package general
|
||||
:after evil
|
||||
:config
|
||||
(general-create-definer efs/leader-keys
|
||||
:keymaps '(normal insert visual emacs)
|
||||
:prefix "SPC"
|
||||
:global-prefix "C-SPC")
|
||||
|
||||
(efs/leader-keys
|
||||
"t" '(:ignore t :which-key "toggles")
|
||||
"tt" '(counsel-load-theme :which-key "choose theme")
|
||||
"fde" '(lambda () (interactive) (find-file (expand-file-name "~/.emacs.d/Emacs.org")))))
|
||||
|
||||
(use-package evil
|
||||
:init
|
||||
(setq evil-want-integration t)
|
||||
(setq evil-want-keybinding nil)
|
||||
(setq evil-want-C-u-scroll t)
|
||||
(setq evil-want-C-i-jump nil)
|
||||
:config
|
||||
(evil-mode 1)
|
||||
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
|
||||
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join)
|
||||
|
||||
;; Use visual line motions even outside of visual-line-mode buffers
|
||||
(evil-global-set-key 'motion "j" 'evil-next-visual-line)
|
||||
(evil-global-set-key 'motion "k" 'evil-previous-visual-line)
|
||||
|
||||
(evil-set-initial-state 'messages-buffer-mode 'normal)
|
||||
(evil-set-initial-state 'dashboard-mode 'normal))
|
||||
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:config
|
||||
(evil-collection-init))
|
||||
|
||||
(use-package command-log-mode
|
||||
:commands command-log-mode)
|
||||
|
||||
(use-package doom-themes
|
||||
:init (load-theme 'doom-palenight t))
|
||||
|
||||
(use-package all-the-icons)
|
||||
|
||||
(use-package doom-modeline
|
||||
:init (doom-modeline-mode 1)
|
||||
:custom ((doom-modeline-height 15)))
|
||||
|
||||
(use-package which-key
|
||||
:defer 0
|
||||
:diminish which-key-mode
|
||||
:config
|
||||
(which-key-mode)
|
||||
(setq which-key-idle-delay 1))
|
||||
|
||||
(use-package auto-minor-mode)
|
||||
|
||||
(use-package ivy
|
||||
:diminish
|
||||
:bind (("C-s" . swiper)
|
||||
:map ivy-minibuffer-map
|
||||
("TAB" . ivy-alt-done)
|
||||
("C-l" . ivy-alt-done)
|
||||
("C-j" . ivy-next-line)
|
||||
("C-k" . ivy-previous-line)
|
||||
:map ivy-switch-buffer-map
|
||||
("C-k" . ivy-previous-line)
|
||||
("C-l" . ivy-done)
|
||||
("C-d" . ivy-switch-buffer-kill)
|
||||
:map ivy-reverse-i-search-map
|
||||
("C-k" . ivy-previous-line)
|
||||
("C-d" . ivy-reverse-i-search-kill))
|
||||
:config
|
||||
(ivy-mode 1))
|
||||
|
||||
(use-package ivy-rich
|
||||
:after ivy
|
||||
:init
|
||||
(ivy-rich-mode 1))
|
||||
|
||||
(use-package counsel
|
||||
:bind (("C-M-j" . 'counsel-switch-buffer)
|
||||
:map minibuffer-local-map
|
||||
("C-r" . 'counsel-minibuffer-history))
|
||||
:custom
|
||||
(counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
|
||||
:config
|
||||
(counsel-mode 1))
|
||||
|
||||
(use-package ivy-prescient
|
||||
:after counsel
|
||||
:custom
|
||||
(ivy-prescient-enable-filtering nil)
|
||||
:config
|
||||
;; Uncomment the following line to have sorting remembered across sessions!
|
||||
;(prescient-persist-mode 1)
|
||||
(ivy-prescient-mode 1))
|
||||
|
||||
(use-package helpful
|
||||
:commands (helpful-callable helpful-variable helpful-command helpful-key)
|
||||
:custom
|
||||
(counsel-describe-function-function #'helpful-callable)
|
||||
(counsel-describe-variable-function #'helpful-variable)
|
||||
:bind
|
||||
([remap describe-function] . counsel-describe-function)
|
||||
([remap describe-command] . helpful-command)
|
||||
([remap describe-variable] . counsel-describe-variable)
|
||||
([remap describe-key] . helpful-key))
|
||||
|
||||
(use-package hydra
|
||||
:defer t)
|
||||
|
||||
(defhydra hydra-text-scale (:timeout 4)
|
||||
"scale text"
|
||||
("j" text-scale-increase "in")
|
||||
("k" text-scale-decrease "out")
|
||||
("f" nil "finished" :exit t))
|
||||
|
||||
(efs/leader-keys
|
||||
"ts" '(hydra-text-scale/body :which-key "scale text"))
|
||||
|
||||
(defun flyspell-on-for-buffer-type ()
|
||||
"Enable Flyspell appropriately for the major mode of the current buffer. Uses `flyspell-prog-mode' for modes derived from `prog-mode', so only strings and comments get checked. All other buffers get `flyspell-mode' to check all text. If flyspell is already enabled, does nothing."
|
||||
(interactive)
|
||||
(if (not (symbol-value flyspell-mode)) ; if not already on
|
||||
(progn
|
||||
(if (derived-mode-p 'prog-mode)
|
||||
(progn
|
||||
(message "Flyspell on (code)")
|
||||
(flyspell-prog-mode))
|
||||
;; else
|
||||
(progn
|
||||
(message "Flyspell on (text)")
|
||||
(flyspell-mode 1)))
|
||||
;; I tried putting (flyspell-buffer) here but it didn't seem to work
|
||||
)))
|
||||
|
||||
|
||||
(defun flyspell-toggle ()
|
||||
"Turn Flyspell on if it is off, or off if it is on. When turning on, it uses `flyspell-on-for-buffer-type' so code-vs-text is handled appropriately."
|
||||
(interactive)
|
||||
(if (symbol-value flyspell-mode)
|
||||
(progn ; flyspell is on, turn it off
|
||||
(message "Flyspell off")
|
||||
(flyspell-mode -1))
|
||||
; else - flyspell is off, turn it on
|
||||
(flyspell-on-for-buffer-type)))
|
||||
|
||||
|
||||
(defun fd-switch-dictionary()
|
||||
(interactive)
|
||||
(let* ((dic ispell-current-dictionary)
|
||||
(change (if (string= dic "en_GB") "es_MX" "en_GB")))
|
||||
(ispell-change-dictionary change)
|
||||
(message "Dictionary switched from %s to %s" dic change)
|
||||
))
|
||||
|
||||
(global-set-key (kbd "C-c f") 'flyspell-toggle)
|
||||
(add-hook 'find-file-hook 'flyspell-on-for-buffer-type)
|
||||
(global-set-key (kbd "C-c c") 'fd-switch-dictionary)
|
||||
|
||||
;; Automatically tangle our Emacs.org config file when we save it
|
||||
(defun efs/org-babel-tangle-config ()
|
||||
(when (string-equal (file-name-directory (buffer-file-name))
|
||||
(expand-file-name user-emacs-directory))
|
||||
;; Dynamic scoping to the rescue
|
||||
(let ((org-confirm-babel-evaluate nil))
|
||||
(org-babel-tangle))))
|
||||
|
||||
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'efs/org-babel-tangle-config)))
|
||||
|
||||
(defun efs/org-font-setup ()
|
||||
;; Replace list hyphen with dot
|
||||
(font-lock-add-keywords 'org-mode
|
||||
'(("^ *\\([-]\\) "
|
||||
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
|
||||
|
||||
;; Set faces for heading levels
|
||||
(dolist (face '((org-level-1 . 1.2)
|
||||
(org-level-2 . 1.1)
|
||||
(org-level-3 . 1.05)
|
||||
(org-level-4 . 1.0)
|
||||
(org-level-5 . 1.1)
|
||||
(org-level-6 . 1.1)
|
||||
(org-level-7 . 1.1)
|
||||
(org-level-8 . 1.1)))
|
||||
(set-face-attribute (car face) nil :font "BigBlueTermPlus Nerd Font" :weight 'regular :height (cdr face)))
|
||||
|
||||
;; Ensure that anything that should be fixed-pitch in Org files appears that way
|
||||
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-table nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-formula nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
|
||||
(set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
|
||||
(set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
|
||||
(set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'line-number nil :inherit 'fixed-pitch)
|
||||
(set-face-attribute 'line-number-current-line nil :inherit 'fixed-pitch))
|
||||
|
||||
(defun efs/org-mode-setup ()
|
||||
(org-indent-mode)
|
||||
(variable-pitch-mode 1)
|
||||
(visual-line-mode 1))
|
||||
|
||||
(use-package org
|
||||
:pin org
|
||||
:commands (org-capture org-agenda)
|
||||
:hook (org-mode . efs/org-mode-setup)
|
||||
:config
|
||||
(setq org-ellipsis " ▾")
|
||||
|
||||
(setq org-agenda-start-with-log-mode t)
|
||||
(setq org-log-done 'time)
|
||||
(setq org-log-into-drawer t)
|
||||
|
||||
(setq org-agenda-files
|
||||
'("~/.emacs.d/OrgFiles/Tasks.org"
|
||||
"~/.emacs.d/OrgFiles/Habits.org"
|
||||
"~/.emacs.d/OrgFiles/Birthdays.org"))
|
||||
|
||||
(require 'org-habit)
|
||||
(add-to-list 'org-modules 'org-habit)
|
||||
(setq org-habit-graph-column 60)
|
||||
|
||||
(setq org-todo-keywords
|
||||
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)")
|
||||
(sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)")))
|
||||
|
||||
(setq org-refile-targets
|
||||
'(("Archive.org" :maxlevel . 1)
|
||||
("Tasks.org" :maxlevel . 1)))
|
||||
|
||||
;; Save Org buffers after refiling!
|
||||
(advice-add 'org-refile :after 'org-save-all-org-buffers)
|
||||
|
||||
(setq org-tag-alist
|
||||
'((:startgroup)
|
||||
; Put mutually exclusive tags here
|
||||
(:endgroup)
|
||||
("@errand" . ?E)
|
||||
("@home" . ?H)
|
||||
("@work" . ?W)
|
||||
("agenda" . ?a)
|
||||
("planning" . ?p)
|
||||
("publish" . ?P)
|
||||
("batch" . ?b)
|
||||
("note" . ?n)
|
||||
("idea" . ?i)))
|
||||
|
||||
;; Configure custom agenda views
|
||||
(setq org-agenda-custom-commands
|
||||
'(("d" "Dashboard"
|
||||
((agenda "" ((org-deadline-warning-days 7)))
|
||||
(todo "NEXT"
|
||||
((org-agenda-overriding-header "Next Tasks")))
|
||||
(tags-todo "agenda/ACTIVE" ((org-agenda-overriding-header "Active Projects")))))
|
||||
|
||||
("n" "Next Tasks"
|
||||
((todo "NEXT"
|
||||
((org-agenda-overriding-header "Next Tasks")))))
|
||||
|
||||
("W" "Work Tasks" tags-todo "+work-email")
|
||||
|
||||
;; Low-effort next actions
|
||||
("e" tags-todo "+TODO=\"NEXT\"+Effort<15&+Effort>0"
|
||||
((org-agenda-overriding-header "Low Effort Tasks")
|
||||
(org-agenda-max-todos 20)
|
||||
(org-agenda-files org-agenda-files)))
|
||||
|
||||
("w" "Workflow Status"
|
||||
((todo "WAIT"
|
||||
((org-agenda-overriding-header "Waiting on External")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "REVIEW"
|
||||
((org-agenda-overriding-header "In Review")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "PLAN"
|
||||
((org-agenda-overriding-header "In Planning")
|
||||
(org-agenda-todo-list-sublevels nil)
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "BACKLOG"
|
||||
((org-agenda-overriding-header "Project Backlog")
|
||||
(org-agenda-todo-list-sublevels nil)
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "READY"
|
||||
((org-agenda-overriding-header "Ready for Work")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "ACTIVE"
|
||||
((org-agenda-overriding-header "Active Projects")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "COMPLETED"
|
||||
((org-agenda-overriding-header "Completed Projects")
|
||||
(org-agenda-files org-agenda-files)))
|
||||
(todo "CANC"
|
||||
((org-agenda-overriding-header "Cancelled Projects")
|
||||
(org-agenda-files org-agenda-files)))))))
|
||||
|
||||
(setq org-capture-templates
|
||||
`(("t" "Tasks / Projects")
|
||||
("tt" "Task" entry (file+olp "~/.emacs.d/OrgFiles/Tasks.org" "Inbox")
|
||||
"* TODO %?\n %U\n %a\n %i" :empty-lines 1)
|
||||
|
||||
("j" "Journal Entries")
|
||||
("jj" "Journal" entry
|
||||
(file+olp+datetree "~/.emacs.d/OrgFiles/Journal.org")
|
||||
"\n* %<%I:%M %p> - Journal :journal:\n\n%?\n\n"
|
||||
;; ,(dw/read-file-as-string "~/Notes/Templates/Daily.org")
|
||||
:clock-in :clock-resume
|
||||
:empty-lines 1)
|
||||
("jm" "Meeting" entry
|
||||
(file+olp+datetree "~/.emacs.d/OrgFiles/Journal.org")
|
||||
"* %<%I:%M %p> - %a :meetings:\n\n%?\n\n"
|
||||
:clock-in :clock-resume
|
||||
:empty-lines 1)
|
||||
|
||||
("w" "Workflows")
|
||||
("we" "Checking Email" entry (file+olp+datetree "~/.emacs.d/OrgFiles/Journal.org")
|
||||
"* Checking Email :email:\n\n%?" :clock-in :clock-resume :empty-lines 1)
|
||||
|
||||
("m" "Metrics Capture")
|
||||
("mw" "Weight" table-line (file+headline "~/.emacs.d/OrgFiles/Metrics.org" "Weight")
|
||||
"| %U | %^{Weight} | %^{Notes} |" :kill-buffer t)))
|
||||
|
||||
(define-key global-map (kbd "C-c j")
|
||||
(lambda () (interactive) (org-capture nil "jj")))
|
||||
|
||||
(efs/org-font-setup))
|
||||
|
||||
(use-package org-bullets
|
||||
:hook (org-mode . org-bullets-mode)
|
||||
:custom
|
||||
(org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
|
||||
|
||||
(defun efs/org-mode-visual-fill ()
|
||||
(setq visual-fill-column-width 100
|
||||
visual-fill-column-center-text t)
|
||||
(visual-fill-column-mode 1))
|
||||
|
||||
(use-package visual-fill-column
|
||||
:hook (org-mode . efs/org-mode-visual-fill))
|
||||
|
||||
(with-eval-after-load 'org
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'((emacs-lisp . t)
|
||||
(python . t)))
|
||||
|
||||
(push '("conf-unix" . conf-unix) org-src-lang-modes))
|
||||
|
||||
(with-eval-after-load 'org
|
||||
;; This is needed as of Org 9.2
|
||||
(require 'org-tempo)
|
||||
|
||||
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
|
||||
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
|
||||
(add-to-list 'org-structure-template-alist '("py" . "src python")))
|
||||
|
||||
(defun efs/lsp-mode-setup ()
|
||||
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
|
||||
(lsp-headerline-breadcrumb-mode))
|
||||
|
||||
(use-package lsp-mode
|
||||
:commands (lsp lsp-deferred)
|
||||
:hook (lsp-mode . efs/lsp-mode-setup)
|
||||
:init
|
||||
(setq lsp-keymap-prefix "C-c l") ;; Or 'C-l', 's-l'
|
||||
:config
|
||||
(lsp-enable-which-key-integration t))
|
||||
|
||||
(use-package lsp-ui
|
||||
:hook (lsp-mode . lsp-ui-mode)
|
||||
:custom
|
||||
(lsp-ui-doc-position 'bottom))
|
||||
|
||||
(use-package lsp-treemacs
|
||||
:after lsp)
|
||||
|
||||
(use-package lsp-ivy
|
||||
:after lsp)
|
||||
|
||||
(use-package dap-mode
|
||||
;; Uncomment the config below if you want all UI panes to be hidden by default!
|
||||
;; :custom
|
||||
;; (lsp-enable-dap-auto-configure nil)
|
||||
;; :config
|
||||
;; (dap-ui-mode 1)
|
||||
:commands dap-debug
|
||||
:config
|
||||
;; Set up Node debugging
|
||||
(require 'dap-node)
|
||||
(dap-node-setup) ;; Automatically installs Node debug adapter if needed
|
||||
|
||||
;; Bind `C-c l d` to `dap-hydra` for easy access
|
||||
(general-define-key
|
||||
:keymaps 'lsp-mode-map
|
||||
:prefix lsp-keymap-prefix
|
||||
"d" '(dap-hydra t :wk "debugger")))
|
||||
|
||||
(use-package typescript-mode
|
||||
:mode "\\.ts\\'"
|
||||
:hook (typescript-mode . lsp-deferred)
|
||||
:config
|
||||
(setq typescript-indent-level 2))
|
||||
|
||||
(setq inferior-lisp-program "/usr/bin/sbcl")
|
||||
|
||||
;; cmake-ide
|
||||
(require 'rtags) ;; optional, must have rtags installed
|
||||
(require 'cmake-ide)
|
||||
(cmake-ide-setup)
|
||||
|
||||
;; Irony mode
|
||||
(add-hook 'c++-mode-hook 'irony-mode)
|
||||
(add-hook 'c-mode-hook 'irony-mode)
|
||||
(add-hook 'objc-mode-hook 'irony-mode)
|
||||
|
||||
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
|
||||
|
||||
;; cpputils-cmake
|
||||
;;(add-hook 'c-mode-common-hook
|
||||
;; (lambda ()
|
||||
;; (if (derived-mode-p 'c-mode 'c++-mode)
|
||||
;; (cppcm-reload-all)
|
||||
;; )))
|
||||
;; OPTIONAL, somebody reported that they can use this package with Fortran
|
||||
;;(add-hook 'c90-mode-hook (lambda () (cppcm-reload-all)))
|
||||
;; OPTIONAL, avoid typing full path when starting gdb
|
||||
;;(global-set-key (kbd "C-c C-g")
|
||||
;;'(lambda ()(interactive) (gud-gdb (concat "gdb --fullname " (cppcm-get-exe-path-current-buffer)))))
|
||||
;; OPTIONAL, some users need specify extra flags forwarded to compiler
|
||||
;;(setq cppcm-extra-preprocss-flags-from-user '("-I/usr/src/linux/include" "-DNDEBUG"))
|
||||
|
||||
(use-package vterm
|
||||
:ensure t)
|
||||
;; Now run `M-x vterm` and make sure it works!
|
||||
|
||||
(use-package julia-snail
|
||||
:ensure t
|
||||
:hook (julia-mode . julia-snail-mode))
|
||||
|
||||
;;(require 'flymake)
|
||||
|
||||
;;(defun flymake-get-tex-args (file-name)
|
||||
;;(list "pdflatex"
|
||||
;;(list "-file-line-error" "-draftmode" "-interaction=nonstopmode" file-name)))
|
||||
|
||||
;;(add-hook 'LaTeX-mode-hook 'flymake-mode)
|
||||
|
||||
;;(defun turn-on-outline-minor-mode ()
|
||||
;;(outline-minor-mode 1))
|
||||
|
||||
;;(add-hook 'LaTeX-mode-hook 'turn-on-outline-minor-mode)
|
||||
;;(add-hook 'latex-mode-hook 'turn-on-outline-minor-mode)
|
||||
;;(setq outline-minor-mode-prefix "\C-c \C-o") ; Or something else
|
||||
|
||||
;;(require 'tex-site)
|
||||
;;(autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t)
|
||||
;;(autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil)
|
||||
;;(autoload 'reftex-citation "reftex-cite" "Make citation" nil)
|
||||
;;(autoload 'reftex-index-phrase-mode "reftex-index" "Phrase Mode" t)
|
||||
;;(add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
|
||||
;; (add-hook 'reftex-load-hook 'imenu-add-menubar-index)
|
||||
;;(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
|
||||
|
||||
;;(setq LaTeX-eqnarray-label "eq"
|
||||
;;LaTeX-equation-label "eq"
|
||||
;;LaTeX-figure-label "fig"
|
||||
;;LaTeX-table-label "tab"
|
||||
;;LaTeX-myChapter-label "chap"
|
||||
;;TeX-auto-save t
|
||||
;;TeX-newline-function 'reindent-then-newline-and-indent
|
||||
;;TeX-parse-self t
|
||||
;;TeX-style-path
|
||||
;;'("style/" "auto/"
|
||||
;;"/usr/share/emacs21/site-lisp/auctex/style/"
|
||||
;;"/var/lib/auctex/emacs21/"
|
||||
;;"/usr/local/share/emacs/site-lisp/auctex/style/")
|
||||
;;LaTeX-section-hook
|
||||
;;'(LaTeX-section-heading
|
||||
;;LaTeX-section-title
|
||||
;;LaTeX-section-toc
|
||||
;;LaTeX-section-section
|
||||
;;LaTeX-section-label))
|
||||
|
||||
|
||||
|
||||
;; Better configuration but rquires pdf-tools
|
||||
|
||||
(use-package pdf-tools
|
||||
:ensure t
|
||||
:config
|
||||
(pdf-tools-install)
|
||||
(setq-default pdf-view-display-size 'fit-page)
|
||||
(setq pdf-annot-activate-created-annotations t)
|
||||
(define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward)
|
||||
(define-key pdf-view-mode-map (kbd "C-r") 'isearch-backward)
|
||||
;(add-hook 'pdf-view-mode-hook (lambda ()
|
||||
; (bms/pdf-midnite-amber))) ; automatically turns on midnight-mode for pdfs
|
||||
(add-hook 'pdf-view-mode-hook 'pdf-tools-enable-minor-modes)
|
||||
)
|
||||
|
||||
(use-package auctex-latexmk
|
||||
:ensure t
|
||||
:config
|
||||
(auctex-latexmk-setup)
|
||||
(setq auctex-latexmk-inherit-TeX-PDF-mode t))
|
||||
|
||||
(use-package reftex
|
||||
:ensure t
|
||||
:defer t
|
||||
:config
|
||||
(setq reftex-cite-prompt-optional-args t)) ;; Prompt for empty optional arguments in cite
|
||||
|
||||
(use-package auto-dictionary
|
||||
:ensure t
|
||||
:init(add-hook 'flyspell-mode-hook (lambda () (auto-dictionary-mode 1))))
|
||||
|
||||
(use-package company-auctex
|
||||
:ensure t
|
||||
:init (company-auctex-init))
|
||||
|
||||
(use-package tex
|
||||
:ensure auctex
|
||||
:mode ("\\.tex\\'" . latex-mode)
|
||||
:config (progn
|
||||
(setq TeX-source-correlate-mode t)
|
||||
(setq TeX-source-correlate-method 'synctex)
|
||||
(setq TeX-auto-save t)
|
||||
(setq TeX-parse-self t)
|
||||
(setq-default TeX-master "0_front_matter.tex")
|
||||
(setq reftex-plug-into-AUCTeX t)
|
||||
(pdf-tools-install)
|
||||
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
|
||||
TeX-source-correlate-start-server t)
|
||||
;; Update PDF buffers after successful LaTeX runs
|
||||
(add-hook 'TeX-after-compilation-finished-functions
|
||||
#'TeX-revert-document-buffer)
|
||||
(add-hook 'LaTeX-mode-hook
|
||||
(lambda ()
|
||||
(reftex-mode t)
|
||||
;;(flyspell-mode t)
|
||||
))
|
||||
))
|
||||
|
||||
(use-package rustic
|
||||
:ensure t
|
||||
:bind (("<f6>" . rustic-format-buffer))
|
||||
:config
|
||||
(require 'lsp-rust)
|
||||
(setq lsp-rust-analyzer-completion-add-call-parenthesis nil)
|
||||
(setq rustic-analyzer-command '("/usr/local/bin/rust-analyzer"))
|
||||
(setq rustic-cargo-bin "/usr/share/cargo/bin/cargo"))
|
||||
|
||||
(add-hook 'rust-mode-hook
|
||||
(lambda () (setq indent-tabs-mode nil)))
|
||||
(setq rust-format-on-save t)
|
||||
(add-hook 'rust-mode-hook
|
||||
(lambda () (prettify-symbols-mode)))
|
||||
|
||||
(use-package python-mode
|
||||
:ensure t
|
||||
:hook (python-mode . lsp-deferred)
|
||||
:custom
|
||||
;; NOTE: Set these if Python 3 is called "python3" on your system!
|
||||
;; (python-shell-interpreter "python3")
|
||||
;; (dap-python-executable "python3")
|
||||
(dap-python-debugger 'debugpy)
|
||||
:config
|
||||
(require 'dap-python))
|
||||
|
||||
(use-package pyvenv
|
||||
:after python-mode
|
||||
:config
|
||||
(pyvenv-mode 1))
|
||||
|
||||
(use-package zig-mode
|
||||
:ensure t
|
||||
:config
|
||||
(require 'lsp-mode)
|
||||
(setq lsp-zig-zls-executable "/usr/local/bin/zls")
|
||||
(add-hook 'zig-mode-hook #'lsp-deferred))
|
||||
|
||||
(add-hook 'after-init-hook 'global-company-mode)
|
||||
|
||||
(use-package company
|
||||
:after lsp-mode
|
||||
:hook (lsp-mode . company-mode)
|
||||
:bind (:map company-active-map
|
||||
("<tab>" . company-complete-selection))
|
||||
(:map lsp-mode-map
|
||||
("<tab>" . company-indent-or-complete-common))
|
||||
:custom
|
||||
(company-minimum-prefix-length 1)
|
||||
(company-idle-delay 0.0))
|
||||
|
||||
(use-package company-box
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
||||
(use-package projectile
|
||||
:diminish projectile-mode
|
||||
:config (projectile-mode)
|
||||
:custom ((projectile-completion-system 'ivy))
|
||||
:bind-keymap
|
||||
("C-c p" . projectile-command-map)
|
||||
:init
|
||||
;; NOTE: Set this to the folder where you keep your Git repos!
|
||||
(when (file-directory-p "~/Projects/Code")
|
||||
(setq projectile-project-search-path '("~/Projects/Code")))
|
||||
(setq projectile-switch-project-action #'projectile-dired))
|
||||
|
||||
(use-package counsel-projectile
|
||||
:after projectile
|
||||
:config (counsel-projectile-mode))
|
||||
|
||||
(use-package magit
|
||||
:commands magit-status
|
||||
:custom
|
||||
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1))
|
||||
|
||||
;; NOTE: Make sure to configure a GitHub token before using this package!
|
||||
;; - https://magit.vc/manual/forge/Token-Creation.html#Token-Creation
|
||||
;; - https://magit.vc/manual/ghub/Getting-Started.html#Getting-Started
|
||||
(use-package forge
|
||||
:after magit)
|
||||
|
||||
(use-package evil-nerd-commenter
|
||||
:bind ("M-/" . evilnc-comment-or-uncomment-lines))
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
(use-package term
|
||||
:commands term
|
||||
:config
|
||||
(setq explicit-shell-file-name "bash") ;; Change this to zsh, etc
|
||||
;;(setq explicit-zsh-args '()) ;; Use 'explicit-<shell>-args for shell-specific args
|
||||
|
||||
;; Match the default Bash shell prompt. Update this if you have a custom prompt
|
||||
(setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *"))
|
||||
|
||||
(use-package eterm-256color
|
||||
:hook (term-mode . eterm-256color-mode))
|
||||
|
||||
(use-package vterm
|
||||
:commands vterm
|
||||
:config
|
||||
(setq term-prompt-regexp "^[^#$%>\n]*[#$%>] *") ;; Set this to match your custom shell prompt
|
||||
;;(setq vterm-shell "zsh") ;; Set this to customize the shell to launch
|
||||
(setq vterm-max-scrollback 10000))
|
||||
|
||||
(when (eq system-type 'windows-nt)
|
||||
(setq explicit-shell-file-name "powershell.exe")
|
||||
(setq explicit-powershell.exe-args '()))
|
||||
|
||||
(defun efs/configure-eshell ()
|
||||
;; Save command history when commands are entered
|
||||
(add-hook 'eshell-pre-command-hook 'eshell-save-some-history)
|
||||
|
||||
;; Truncate buffer for performance
|
||||
(add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)
|
||||
|
||||
;; Bind some useful keys for evil-mode
|
||||
(evil-define-key '(normal insert visual) eshell-mode-map (kbd "C-r") 'counsel-esh-history)
|
||||
(evil-define-key '(normal insert visual) eshell-mode-map (kbd "<home>") 'eshell-bol)
|
||||
(evil-normalize-keymaps)
|
||||
|
||||
(setq eshell-history-size 10000
|
||||
eshell-buffer-maximum-lines 10000
|
||||
eshell-hist-ignoredups t
|
||||
eshell-scroll-to-bottom-on-input t))
|
||||
|
||||
(use-package eshell-git-prompt
|
||||
:after eshell)
|
||||
|
||||
(use-package eshell
|
||||
:hook (eshell-first-time-mode . efs/configure-eshell)
|
||||
:config
|
||||
|
||||
(with-eval-after-load 'esh-opt
|
||||
(setq eshell-destroy-buffer-when-process-dies t)
|
||||
(setq eshell-visual-commands '("htop" "zsh" "vim")))
|
||||
|
||||
(eshell-git-prompt-use-theme 'powerline))
|
||||
|
||||
(setq insert-directory-program "gls" dired-use-ls-dired t)
|
||||
(use-package dired
|
||||
:ensure nil
|
||||
:commands (dired dired-jump)
|
||||
:bind (("C-x C-j" . dired-jump))
|
||||
:custom ((dired-listing-switches "-agho --group-directories-first"))
|
||||
;:custom ((dired-listing-switches "-agho"))
|
||||
:config
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"h" 'dired-single-up-directory
|
||||
"l" 'dired-single-buffer))
|
||||
|
||||
(use-package dired-single
|
||||
:commands (dired dired-jump))
|
||||
|
||||
(use-package all-the-icons-dired
|
||||
:hook (dired-mode . all-the-icons-dired-mode))
|
||||
|
||||
(use-package dired-open
|
||||
:commands (dired dired-jump)
|
||||
:config
|
||||
;; Doesn't work as expected!
|
||||
;;(add-to-list 'dired-open-functions #'dired-open-xdg t)
|
||||
(setq dired-open-extensions '(("png" . "feh")
|
||||
("mkv" . "mpv"))))
|
||||
|
||||
(use-package dired-hide-dotfiles
|
||||
:hook (dired-mode . dired-hide-dotfiles-mode)
|
||||
:config
|
||||
(evil-collection-define-key 'normal 'dired-mode-map
|
||||
"H" 'dired-hide-dotfiles-mode))
|
||||
|
||||
;; Make gc pauses faster by decreasing the threshold.
|
||||
(setq gc-cons-threshold (* 2 1000 1000))
|
Loading…
Reference in New Issue