Improved emacs configuration

This commit is contained in:
2024-04-15 14:19:16 -06:00
parent b151eabb82
commit 19181c9f42
4 changed files with 59 additions and 27 deletions

View File

@@ -82,9 +82,9 @@
{ {
"index": 12, "index": 12,
"name": "code", "name": "code",
"exec": "code", "exec": "emacsclient",
"systemd": false, "args": ["-nc"],
"program_name": "vscode" "program_name": "emacsclient"
}, },
{ {
"index": 13, "index": 13,

View File

@@ -48,8 +48,10 @@ precmd_vcs_info() {
# whether this file is sourced multiple times, we don't end up with duplicate # whether this file is sourced multiple times, we don't end up with duplicate
# entries which will slow down the prompt. # entries which will slow down the prompt.
precmd_functions=() precmd_functions=()
precmd_functions+=(precmd_vcs_info precmd_pyenv_info _reset_window_name) if ! [[ ${TERM} == "dumb" ]]; then
setopt prompt_subst precmd_functions+=(precmd_vcs_info precmd_pyenv_info _reset_window_name)
setopt prompt_subst
fi
eval $(awk '{print "OS_" $0}' /etc/os-release) eval $(awk '{print "OS_" $0}' /etc/os-release)
eval $(awk '{print "MACHINE_" $0}' /etc/machine-info) eval $(awk '{print "MACHINE_" $0}' /etc/machine-info)
@@ -123,7 +125,7 @@ fi
if [[ ${TERM} == "dumb" ]]; then if [[ ${TERM} == "dumb" ]]; then
# Dumb terminal needs a dumb prompt, otherwise things like # Dumb terminal needs a dumb prompt, otherwise things like
# emacs TRAMP break # emacs TRAMP break
PROMPT='$ ' PROMPT='[%~] $ '
else else
PROMPT="${prompt_line1} PROMPT="${prompt_line1}
${prompt_line2} ${prompt_line2}

View File

@@ -1,8 +1,9 @@
# This file activates certain plugins which are not a part of oh-my-zsh if ! [[ $TERM == "dumb" ]]; then
# Don't load if running in dumb terminal, they don't work properly
source $HOME/.local/lib/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source $HOME/.local/lib/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $HOME/.local/lib/zsh/zsh-history-substring-search/zsh-history-substring-search.zsh
source $HOME/.local/lib/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh bindkey '^P' history-substring-search-up
source $HOME/.local/lib/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh bindkey '^N' history-substring-search-down
source $HOME/.local/lib/zsh/zsh-history-substring-search/zsh-history-substring-search.zsh fi
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down

View File

@@ -114,7 +114,17 @@ Indent using tabs, render with tab-width of 2.
(when (memq window-system '(mac ns x)) (when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))) (exec-path-from-shell-initialize)))
#+END_SRC #+END_SRC
** Execute command to buffer
#+BEGIN_SRC emacs-lisp
(defun shell-command-capture-output (command)
(interactive "sShell command: ")
;; run shell command
(with-output-to-temp-buffer "*Shell Command Output*"
(shell-command command "*Shell Command Output*")
(pop-to-buffer "*Shell Command Output*")
;; make buffer read-only
(read-only-mode)))
#+END_SRC
* Theming * Theming
** Highlight current line ** Highlight current line
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@@ -302,6 +312,25 @@ Indent using tabs, render with tab-width of 2.
;; Enable completion ;; Enable completion
(add-hook 'prog-mode-hook 'copilot-mode) (add-hook 'prog-mode-hook 'copilot-mode)
#+END_SRC #+END_SRC
** Tree-Sitter
#+BEGIN_SRC emacs-lisp
(setq treesit-language-source-alist
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
(cmake "https://github.com/uyha/tree-sitter-cmake")
(css "https://github.com/tree-sitter/tree-sitter-css")
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
(go "https://github.com/tree-sitter/tree-sitter-go")
(html "https://github.com/tree-sitter/tree-sitter-html")
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
(json "https://github.com/tree-sitter/tree-sitter-json")
(make "https://github.com/alemuller/tree-sitter-make")
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
(python "https://github.com/tree-sitter/tree-sitter-python")
(toml "https://github.com/tree-sitter/tree-sitter-toml")
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))
#+END_SRC
** Git ** Git
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package magit :ensure t) (use-package magit :ensure t)
@@ -499,21 +528,21 @@ After installing the ~rust-analyzer~ program, the following can be used:
#+END_SRC #+END_SRC
* Obsidian * Obsidian
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package obsidian ;; (use-package obsidian
:ensure t ;; :ensure t
:demand t ;; :demand t
:config ;; :config
(obsidian-specify-path "~/PersonalDocuments/Personal/TTRPG Vault") ;; (obsidian-specify-path "~/PersonalDocuments/Personal/TTRPG Vault")
(global-obsidian-mode t) ;; (global-obsidian-mode t)
:custom ;; :custom
:bind (:map obsidian-mode-map ;; :bind (:map obsidian-mode-map
("C-c C-o" . obsidian-follow-link-at-point) ;; ("C-c C-o" . obsidian-follow-link-at-point)
("C-c C-b" . obsidian-backlink-jump) ;; ("C-c C-b" . obsidian-backlink-jump)
("C-c C-l" . obsidian-insert-wikilink))) ;; ("C-c C-l" . obsidian-insert-wikilink)))
#+END_SRC #+END_SRC
* TRAMP Customization * TRAMP Customization
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:")) ;; (add-to-list 'tramp-default-proxies-alist '(nil "\\`root\\'" "/ssh:%h:"))
(add-to-list 'tramp-default-proxies-alist (quote ((,(regexp-quote (system-name)) "\\`root\\'" nil)))) ;; (add-to-list 'tramp-default-proxies-alist (quote ((,(regexp-quote (system-name)) "\\`root\\'" nil))))
#+END_SRC #+END_SRC