Improved emacs configuration

This commit is contained in:
Ezri Brimhall 2024-04-15 14:19:16 -06:00
parent b151eabb82
commit 19181c9f42
Signed by: ezri
GPG Key ID: 058A78E5680C6F24
4 changed files with 59 additions and 27 deletions

View File

@ -82,9 +82,9 @@
{
"index": 12,
"name": "code",
"exec": "code",
"systemd": false,
"program_name": "vscode"
"exec": "emacsclient",
"args": ["-nc"],
"program_name": "emacsclient"
},
{
"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
# entries which will slow down the prompt.
precmd_functions=()
precmd_functions+=(precmd_vcs_info precmd_pyenv_info _reset_window_name)
setopt prompt_subst
if ! [[ ${TERM} == "dumb" ]]; then
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 "MACHINE_" $0}' /etc/machine-info)
@ -123,7 +125,7 @@ fi
if [[ ${TERM} == "dumb" ]]; then
# Dumb terminal needs a dumb prompt, otherwise things like
# emacs TRAMP break
PROMPT='$ '
PROMPT='[%~] $ '
else
PROMPT="${prompt_line1}
${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
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
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
bindkey '^P' history-substring-search-up
bindkey '^N' history-substring-search-down
fi

View File

@ -114,7 +114,17 @@ Indent using tabs, render with tab-width of 2.
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize)))
#+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
** Highlight current line
#+BEGIN_SRC emacs-lisp
@ -302,6 +312,25 @@ Indent using tabs, render with tab-width of 2.
;; Enable completion
(add-hook 'prog-mode-hook 'copilot-mode)
#+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
#+BEGIN_SRC emacs-lisp
(use-package magit :ensure t)
@ -499,21 +528,21 @@ After installing the ~rust-analyzer~ program, the following can be used:
#+END_SRC
* Obsidian
#+BEGIN_SRC emacs-lisp
(use-package obsidian
:ensure t
:demand t
:config
(obsidian-specify-path "~/PersonalDocuments/Personal/TTRPG Vault")
(global-obsidian-mode t)
:custom
:bind (:map obsidian-mode-map
("C-c C-o" . obsidian-follow-link-at-point)
("C-c C-b" . obsidian-backlink-jump)
("C-c C-l" . obsidian-insert-wikilink)))
;; (use-package obsidian
;; :ensure t
;; :demand t
;; :config
;; (obsidian-specify-path "~/PersonalDocuments/Personal/TTRPG Vault")
;; (global-obsidian-mode t)
;; :custom
;; :bind (:map obsidian-mode-map
;; ("C-c C-o" . obsidian-follow-link-at-point)
;; ("C-c C-b" . obsidian-backlink-jump)
;; ("C-c C-l" . obsidian-insert-wikilink)))
#+END_SRC
* TRAMP Customization
#+BEGIN_SRC emacs-lisp
(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 '(nil "\\`root\\'" "/ssh:%h:"))
;; (add-to-list 'tramp-default-proxies-alist (quote ((,(regexp-quote (system-name)) "\\`root\\'" nil))))
#+END_SRC