Formatting
This commit is contained in:
parent
0eb00bf622
commit
fe2dad6c8d
@ -19,10 +19,12 @@ Requires:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(require 'json)
|
||||
#+END_SRC
|
||||
|
||||
* Default directory
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(cd "~")
|
||||
#+END_SRC
|
||||
|
||||
* Packages
|
||||
Use [[https://github.com/raxod502/straight.el][straight.el]] to manage packages:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -60,12 +62,14 @@ Solarized is the best color scheme, objectively speaking:
|
||||
(use-package solarized-theme)
|
||||
(require 'solarized-theme)
|
||||
#+END_SRC
|
||||
|
||||
* Customization File
|
||||
I don't want anything to write to my init.el, so save customizations in a separate file:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
||||
(load custom-file t)
|
||||
#+END_SRC
|
||||
|
||||
* Path
|
||||
`exec-path-from-shell` uses Bash to set MANPATH, PATH, and exec-path from those defined in the user's shell config. This won't work on Windows.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -188,6 +192,7 @@ Use the spacebar as a leader key in evil-mode's normal state and in various othe
|
||||
(with-eval-after-load 'pass
|
||||
(add-hook 'pass-mode-hook 'turn-off-evil-snipe-mode)))
|
||||
#+END_SRC
|
||||
|
||||
** Additional keybindings
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-def 'normal "zM" #'hs-hide-level :keymaps 'override)
|
||||
@ -244,6 +249,7 @@ Evil keybindings for magit!
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq transient-default-level 7)
|
||||
#+END_SRC
|
||||
|
||||
* with-editor
|
||||
A utility from the author of Magit to run shell commands using the current Emacs instance as $EDITOR.
|
||||
|
||||
@ -253,6 +259,7 @@ A utility from the author of Magit to run shell commands using the current Emacs
|
||||
(add-hook 'term-exec-hook #'with-editor-export-editor)
|
||||
(add-hook 'eshell-mode-hook #'with-editor-export-editor)
|
||||
#+END_SRC
|
||||
|
||||
* Password Store
|
||||
Interfacing with Pass, the "standard Unix password manager". This should also be loaded before `exec-path-from-shell`.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -332,6 +339,7 @@ Some helpful ELisp packages:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(general-def '(normal motion) emacs-lisp-mode "C-c C-c" #'eval-defun :keymaps 'override)
|
||||
#+END_SRC
|
||||
|
||||
** Load path
|
||||
For machine or user specific libraries:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -485,6 +493,7 @@ Convenience macro to run some code in a particular default-directory:
|
||||
(setq result
|
||||
(concat result (substring alnum i (1+ i))))))))
|
||||
#+END_SRC
|
||||
|
||||
** Persisting variables between session
|
||||
The idea behind this is pretty simple - variables get persisted in ~/.emacs.d/<persisted-vars-file> as a plist of (variable-name variable-value).
|
||||
|
||||
@ -609,15 +618,18 @@ Whenever the buffer changes, look up the major-mode to see if there is any code
|
||||
|
||||
(add-hook 'buffer-list-update-hook #'run-buffer-mode-hooks)
|
||||
#+END_SRC
|
||||
|
||||
** Aliases
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defalias 'doc 'describe-symbol)
|
||||
#+END_SRC
|
||||
|
||||
** Miscellaneous
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq warning-suppress-types
|
||||
'((undo discard-info)))
|
||||
#+END_SRC
|
||||
|
||||
* Dropbox
|
||||
I put lots of stuff in Dropbox, but the actual folder location differs on my different computers. This function resolves to the Dropbox directory:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -741,6 +753,7 @@ A function to kill all buffers except the current one from [[https://www.emacswi
|
||||
(leader-def-key "bm" #'kill-other-buffers)
|
||||
(leader-def-key "br" #'rename-buffer)
|
||||
#+END_SRC
|
||||
|
||||
** Frame commands
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(jdormit/define-prefix "F" "frame")
|
||||
@ -801,6 +814,7 @@ Emacs has a shell for every mood!
|
||||
(leader-def-key "ca" #'xref-find-apropos)
|
||||
(general-def 'normal "M-." #'xref-find-definitions)
|
||||
#+END_SRC
|
||||
|
||||
* xref
|
||||
After I select an xref reference, I want the xref buffer closed:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -809,6 +823,7 @@ After I select an xref reference, I want the xref buffer closed:
|
||||
(xref-goto-xref t))
|
||||
(general-def 'normal xref--xref-buffer-mode-map "RET" #'xref-goto-xref-and-quit :keymaps 'override)
|
||||
#+END_SRC
|
||||
|
||||
* Speedbar
|
||||
Speedbar is cool but having it open in a separate frame is annoying. This makes it open in a side window in the same frame:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -828,6 +843,7 @@ Speedbar is cool but having it open in a separate frame is annoying. This makes
|
||||
|
||||
(leader-def-key "S" #'switch-to-speedbar)
|
||||
#+END_SRC
|
||||
|
||||
* Whitespace Visualation
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq whitespace-line-column 80
|
||||
@ -1013,6 +1029,7 @@ The JSON multitool.
|
||||
(use-package jq-mode
|
||||
:commands (jq-mode jq-interactively))
|
||||
#+END_SRC
|
||||
|
||||
* Org Mode
|
||||
Notes, agenda, calendar, blogging, journaling, etc.
|
||||
|
||||
@ -1256,6 +1273,7 @@ Enable async source block execution. Note: this execute the contents of the sour
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq org-image-actual-width nil)
|
||||
#+END_SRC
|
||||
|
||||
** org-scratch
|
||||
It's very useful to open a new org buffer for a quick org-babel exploration.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1273,6 +1291,7 @@ It's very useful to open a new org buffer for a quick org-babel exploration.
|
||||
|
||||
(leader-def-key "os" #'org-scratch)
|
||||
#+END_SRC
|
||||
|
||||
** org-gcal
|
||||
Integrate Google calendar with org-mode:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1304,6 +1323,7 @@ Integrate Google calendar with org-mode:
|
||||
|
||||
(general-def '(normal motion) org-agenda-mode-map "gr" #'org-agenda-redo-and-fetch-gcal)
|
||||
#+END_SRC
|
||||
|
||||
* Projectile
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package projectile
|
||||
@ -1570,6 +1590,7 @@ A command to format JS via prettier:
|
||||
(with-eval-after-load 'lsp
|
||||
(add-hook 'typescript-mode-hook 'lsp)))
|
||||
#+END_SRC
|
||||
|
||||
* LSP Mode
|
||||
Emacs support for the Language Server Protocol
|
||||
|
||||
@ -1715,6 +1736,7 @@ Python but Lispy!
|
||||
(interactive)
|
||||
(run-lisp (expand-file-name "~/.virtualenvs/hy/bin/hy")))
|
||||
#+END_SRC
|
||||
|
||||
* Go
|
||||
Basic support:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1807,6 +1829,7 @@ Integrate with cljfmt, the Clojure code formatter:
|
||||
|
||||
(general-def clojure-mode-map "C-M-\\" #'cljfmt)
|
||||
#+END_SRC
|
||||
|
||||
* Scheme
|
||||
Tell emacs about file extensions which should activate scheme-mode:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1900,6 +1923,7 @@ LSP for PHP requires [[https://github.com/felixfbecker/php-language-server][php-
|
||||
(use-package yaml-mode
|
||||
:mode ("//.yml//'"))
|
||||
#+END_SRC
|
||||
|
||||
* Pharen
|
||||
[[https://pharen.org][Pharen]] is a Lisp that compiles to PHP. It looks a lot like Clojure.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1917,6 +1941,7 @@ Use LSP if [[https://github.com/mads-hartmann/bash-language-server][bash-languag
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(add-hook 'ruby-mode-hook #'lsp)
|
||||
#+END_SRC
|
||||
|
||||
* Rust
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package rust-mode
|
||||
@ -1932,6 +1957,7 @@ Use LSP if [[https://github.com/mads-hartmann/bash-language-server][bash-languag
|
||||
:config
|
||||
(add-hook 'rust-mode-hook #'cargo-minor-mode))
|
||||
#+END_SRC
|
||||
|
||||
* XML
|
||||
Set up hideshow for nXML mode:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -1962,6 +1988,7 @@ A function to format XML using tidy or xmllint if available, falling back to sgm
|
||||
(general-def nxml-mode-map "C-M-\\" #'xml-pretty-print)
|
||||
|
||||
#+END_SRC
|
||||
|
||||
* CSVs
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package csv-mode
|
||||
@ -3038,6 +3065,7 @@ An alternative minibuffer completion framework:
|
||||
|
||||
(leader-def-key "cs" #'lsp-ivy-workspace-symbol)
|
||||
#+END_SRC
|
||||
|
||||
* graphviz
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package graphviz-dot-mode
|
||||
@ -3276,11 +3304,13 @@ The Emacs Multi-Media System. For libtag to work, libtag must be installed on th
|
||||
(unless (file-remote-p default-directory)
|
||||
(direnv-update-directory-environment)))))
|
||||
#+END_SRC
|
||||
|
||||
* SQL
|
||||
Emacs has excellent built-in SQL support.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(leader-def-key "sP" #'sql-postgres)
|
||||
#+END_SRC
|
||||
|
||||
* GraphQL
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package graphql-mode
|
||||
@ -3342,12 +3372,14 @@ GraphQL environments:
|
||||
(local . ("http://localhost:7200/api/graphql" .
|
||||
,(password-store-get "lola-graphql-local-token")))))
|
||||
#+END_SRC
|
||||
|
||||
* Docker
|
||||
Syntax highlighting for Dockerfiles:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package dockerfile-mode
|
||||
:mode ("\\Dockerfile\\'"))
|
||||
#+END_SRC
|
||||
|
||||
* Kubernetes
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package kubernetes
|
||||
@ -3358,6 +3390,7 @@ Syntax highlighting for Dockerfiles:
|
||||
(add-to-list 'evil-emacs-state-modes 'kubernetes-overview-mode)
|
||||
(general-def kubernetes-overview-mode-map "SPC" leader-map))
|
||||
#+END_SRC
|
||||
|
||||
* AWS
|
||||
** S3
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3374,6 +3407,7 @@ Syntax highlighting for Dockerfiles:
|
||||
(format "Uploaded to %s" last-s3-url)
|
||||
"Failed to upload to s3, check *aws-s3* buffer for details")))))
|
||||
#+END_SRC
|
||||
|
||||
* Prodigy
|
||||
[[https://github.com/rejeep/prodigy.el][Prodigy]] gives Emacs a nice way to run services (web servers, etc.).
|
||||
|
||||
@ -3481,6 +3515,7 @@ And add the ability to inhibit all service output processing:
|
||||
(run-hook-with-args 'prodigy-process-on-output-hook service output))))
|
||||
(set-process-query-on-exit-flag process nil)))))
|
||||
#+END_SRC
|
||||
|
||||
* Lola
|
||||
Some functions to make my day job easier.
|
||||
|
||||
@ -3664,6 +3699,7 @@ Some functions to make my day job easier.
|
||||
(list "-a" (password-store-get "mabl-link-agent")
|
||||
"-n" "jdormit-macbook")))
|
||||
#+END_SRC
|
||||
|
||||
** Services (eShell)
|
||||
#+BEGIN_SRC emacs-lisp :lexical yes
|
||||
(defun run-service-in-eshell (name dir cmd &optional setup)
|
||||
@ -3775,12 +3811,14 @@ The aws-mfa command:
|
||||
|
||||
(leader-def-key "ao" #'op-copy-password)
|
||||
#+END_SRC
|
||||
|
||||
** Resetting DNSResponder
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun reset-dnsresponsder ()
|
||||
(interactive)
|
||||
(sudo-shell-command "killall -HUP mDNSResponder"))
|
||||
#+END_SRC
|
||||
|
||||
** Devpi
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defvar devpi-indices nil
|
||||
@ -3837,6 +3875,7 @@ The aws-mfa command:
|
||||
(cl-letf (((symbol-function 'devpi-upload) (make-process-fn "devpi" "upload")))
|
||||
(message (devpi-upload))))
|
||||
#+END_SRC
|
||||
|
||||
* StumpWM
|
||||
A handy keybinding to connect to the StumpWM SBCL process via SLIME:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3844,6 +3883,7 @@ A handy keybinding to connect to the StumpWM SBCL process via SLIME:
|
||||
(interactive)
|
||||
(slime-connect "127.0.0.1" 4004))
|
||||
#+END_SRC
|
||||
|
||||
* Emacs Network Client
|
||||
Emacs frontend for networkmanager.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3856,6 +3896,7 @@ Emacs frontend for networkmanager.
|
||||
(leader-def-key "an" #'enwc)
|
||||
:commands (enwc))
|
||||
#+END_SRC
|
||||
|
||||
* Deft
|
||||
A fuzzy-finder for notes.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3878,11 +3919,13 @@ A fuzzy-finder for notes.
|
||||
|
||||
(leader-def-key "D" #'deft)
|
||||
#+END_SRC
|
||||
|
||||
* Pollen
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package pollen-mode
|
||||
:mode ("\\.p\\'" "\\.pp\\'" "\\.pm\\'"))
|
||||
#+END_SRC
|
||||
|
||||
* Ngrok
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun ngrok (port &optional subdomain)
|
||||
@ -3898,6 +3941,7 @@ A fuzzy-finder for notes.
|
||||
(concat "ngrok http " (number-to-string port)))))
|
||||
(async-shell-command cmd buf)))
|
||||
#+END_SRC
|
||||
|
||||
* Make
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun make ()
|
||||
@ -3909,6 +3953,7 @@ A fuzzy-finder for notes.
|
||||
(async-shell-command "make"))
|
||||
(error "Not in a project"))))
|
||||
#+END_SRC
|
||||
|
||||
* Redis
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(defun redis-cli (&optional host port)
|
||||
@ -3930,6 +3975,7 @@ A fuzzy-finder for notes.
|
||||
(switch-to-buffer "*redis-cli*"))
|
||||
(error "Can't find redis-cli"))))
|
||||
#+END_SRC
|
||||
|
||||
* Restclient
|
||||
Explore APIs from within Emacs!
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3944,6 +3990,7 @@ Explore APIs from within Emacs!
|
||||
(use-package ob-restclient
|
||||
:after (restclient))
|
||||
#+END_SRC
|
||||
|
||||
* IMenu
|
||||
Get a nice IMenu sidebar:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3957,6 +4004,7 @@ Get a nice IMenu sidebar:
|
||||
(leader-def-key "\\" #'imenu-list-smart-toggle)
|
||||
(leader-def-key "m" #'imenu)
|
||||
#+END_SRC
|
||||
|
||||
* calfw-org
|
||||
A fancy calendar view:
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -3969,6 +4017,7 @@ A fancy calendar view:
|
||||
|
||||
(leader-def-key "oC" #'cfw:open-org-calendar)
|
||||
#+END_SRC
|
||||
|
||||
* hackernews
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(use-package hackernews
|
||||
@ -3979,6 +4028,7 @@ A fancy calendar view:
|
||||
('normal hackernews-mode-map "SPC" leader-map))
|
||||
(leader-def-key "ah" 'hackernews)
|
||||
#+END_SRC
|
||||
|
||||
* counsel-spotify
|
||||
Spotify in Emacs!
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
@ -4011,6 +4061,7 @@ Spotify in Emacs!
|
||||
(setq ispell-program-name "hunspell"
|
||||
ispell-really-hunspell t))
|
||||
#+END_SRC
|
||||
|
||||
* VTerm
|
||||
A better terminal emulator for Emacs. Replaces ansi-term, not EShell.
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
|
Loading…
Reference in New Issue
Block a user