diff options
-rw-r--r-- | .config/mc/ini | 5 | ||||
-rw-r--r-- | .config/shell/alias | 4 | ||||
-rw-r--r-- | .emacs.d/config.org | 337 | ||||
-rw-r--r-- | .emacs.d/early-init.el | 4 | ||||
-rw-r--r-- | .zshrc | 45 |
5 files changed, 265 insertions, 130 deletions
diff --git a/.config/mc/ini b/.config/mc/ini index 115ff36..b3a7bb1 100644 --- a/.config/mc/ini +++ b/.config/mc/ini @@ -90,7 +90,7 @@ fish_directory_timeout=900 [Layout] output_lines=0 -left_panel_size=40 +left_panel_size=160 top_panel_size=0 message_visible=true keybar_visible=false @@ -121,6 +121,7 @@ xterm-kitty= color_terminals= xterm-256color= +linux= [Panels] simple_swap=false @@ -161,6 +162,6 @@ ignore_dirs= [Panelize] Find *.orig after patching=find . -name \\*.orig -print -Find SUID and SGID programs=find . \\( \\( -perm -04000 -a -perm /011 \\) -o \\( -perm -02000 -a -perm /01 \\) \\) -print Find rejects after patching=find . -name \\*.rej -print Modified git files=git ls-files --modified +Find SUID and SGID programs=find . \\( \\( -perm -04000 -a -perm /011 \\) -o \\( -perm -02000 -a -perm /01 \\) \\) -print diff --git a/.config/shell/alias b/.config/shell/alias index c060c0e..f0adee5 100644 --- a/.config/shell/alias +++ b/.config/shell/alias @@ -1,3 +1,5 @@ alias gvc="ssh git@git.venomade.com" alias rgf='rg --files | rg' -alias ls='ls --color=auto' \ No newline at end of file +alias ls='ls --color=auto' +alias md='mkdir' +alias ec='emacsclient -nw' diff --git a/.emacs.d/config.org b/.emacs.d/config.org index 5b7f51e..070de5b 100644 --- a/.emacs.d/config.org +++ b/.emacs.d/config.org @@ -29,35 +29,38 @@ - [[#programming][Programming]] - [[#projects][Projects]] - [[#lsp][LSP]] + - [[#sidebar][Sidebar]] - [[#treesitter][TreeSitter]] - [[#languages][Languages]] - [[#company][Company]] - [[#cape][Cape]] + - [[#codeium][Codeium]] - [[#utilities][Utilities]] - [[#user-interface][User Interface]] - [[#add-nerd-icons][Add Nerd Icons]] - [[#fonts][Fonts]] - [[#theme][Theme]] - [[#niceties][Niceties]] - - [[#modern-looking-emacs][Modern Looking Emacs]] + - [[#zen-mode][Zen Mode]] * Straight Package Manager I'm using the Straight package manager instead of use-package because it is only available in Emacs 29 and above. #+begin_src emacs-lisp (defvar bootstrap-version) (let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 6)) + (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) + (bootstrap-version 6)) (unless (file-exists-p bootstrap-file) (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) + (url-retrieve-synchronously + "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage)) (setq straight-use-package-by-default t) + (setq package-native-compile t) #+end_src * Configs @@ -159,6 +162,11 @@ Quickly grep both my current project and the system include directory. #+end_src ** Fix Annoyances +*** Add Scroll Marginn +This adds a scroll margin at the top and bottom of 10 lines to make it easier to scroll through the buffer. +#+begin_src emacs-lisp + (setq scroll-margin 10) +#+end_src *** Disable Backups Living on the edge. #+begin_src emacs-lisp @@ -179,16 +187,40 @@ Fixing warnings is for nerds. This is basically necessary after more than 5 pack #+begin_src emacs-lisp (setq warning-minimum-level :emergency) #+end_src -*** Add Scroll Marginn -This adds a scroll margin at the top and bottom of 10 lines to make it easier to scroll through the buffer. +*** Local Bin +Add the local bin directory to PATH. #+begin_src emacs-lisp - (setq scroll-margin 10) + (setenv "PATH" (concat (concat + (concat (expand-file-name "~/.local/bin") ":") + (getenv "PATH")))) + + (setq exec-path (append exec-path (list (expand-file-name "~/.local/bin")))) #+end_src *** Save Place Go back to old position on file open. #+begin_src emacs-lisp (save-place-mode 1) #+end_src +*** COMMENT System Clipboard +Use system clipboard in terminal-mode. (Currently commented out due to using graphical-mode) +#+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 + :noquery t)) + (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 ** Keybindings *** Reload Emacs @@ -226,7 +258,7 @@ Add shortcuts to various Emacs functions. (keymap-global-set "C-c e b" 'eval-buffer) (keymap-global-set "C-c e r" 'eval-region) (keymap-global-set "C-c e s" 'eshell) - (keymap-global-set "C-c e t" 'ef-themes-load-random) + (keymap-global-set "C-c e t" 'theme-toggle) #+end_src *** Regex and Copy from Above Add shortcuts to entering a regex replace and copying a line from above. @@ -234,6 +266,11 @@ Add shortcuts to entering a regex replace and copying a line from above. (keymap-global-set "C-c r" 'replace-regexp) (keymap-global-set "C-c y a" 'copy-from-above-command) #+end_src +*** Reverse C-x o +Add a reversed C-x o to go to previous window. +#+begin_src emacs-lisp + (keymap-global-set "C-x O" 'previous-multiframe-window) +#+end_src *** Window Management Add shortcuts to scrolling and moving between windows. #+begin_src emacs-lisp @@ -408,7 +445,10 @@ Tools for the primary version control system. *** Magit A very extensive Git GUI for Emacs. #+begin_src emacs-lisp - (use-package magit) + (use-package magit + :after nerd-icons + :custom + (magit-format-file-function #'magit-format-file-nerd-icons)) #+end_src *** Magit Todos Show Todo list in Magit. @@ -459,11 +499,6 @@ Adds fuzzy completion to basic Emacs commands. (setq enable-recursive-minibuffers t) :config (ivy-mode 1)) - - ;; (use-package ivy-prescient - ;; :after counsel - ;; :config - ;; (ivy-prescient-mode 1)) #+end_src *** Ivy Rich Adds Icons to all the new fuzzy completed Emacs commands. @@ -524,11 +559,11 @@ Stylize Org Mode headers with Nerd Icons. (use-package org-bullets :config (setq org-bullets-bullet-list '( - "" - "" - "" - "" - ""))) + "•" + "•" + "◦" + "◦" + "◦"))) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) #+end_src @@ -673,21 +708,42 @@ Use language servers to provide info and completion. :init (setq lsp-completion-provider :none lsp-keymap-prefix "C-c l" - lsp-headerline-breadcrumb-enable nil) + lsp-headerline-breadcrumb-enable nil + lsp-modeline-code-actions-enable nil) :commands lsp lsp-deferred :config (lsp-enable-snippet t)) - ;; (lsp-enable-which-key-integration t)) - - ;; (use-package lsp-ui - ;; :commands lsp-ui-mode - ;; :hook (prog-mode . lsp-ui-mode) - ;; :config - ;; (keymap-global-set "C-c l d" 'lsp-ui-doc-show)) - ;; Instead: (keymap-global-set "C-c l d" 'lsp-describe-thing-at-point) #+end_src + +*** LSP Mode - Undo Tree compatibility +#+begin_src emacs-lisp + (with-eval-after-load 'lsp-mode + (defun my/lsp--should-ignore-file (filename) + (or (string-match-p "\\.emacs[-_.]backups?/" filename) + (string-match-p "\\.emacs[-_.]undo/" filename) + (string-match-p "/\\.emacs\\.d/undo/" filename) + (string-match-p "/\\.emacs\\.d/backups/" filename) + (string-match-p "/#.*#$" filename) + (string-match-p "/.*~$" filename) + (string-match-p "/.*\\.~undo-tree~$" filename))) + + (advice-add 'lsp--on-did-open :before + (lambda (&rest args) + (let ((file (lsp--uri-to-path (gethash "uri" (cl-first args))))) + (when (my/lsp--should-ignore-file file) + (cl-return-from lsp--on-did-open)))) + '((name . ignore-emacs-backup-open))) + + (advice-add 'lsp--on-did-save :before + (lambda (&rest args) + (let ((file (lsp--uri-to-path (gethash "uri" (cl-first args))))) + (when (my/lsp--should-ignore-file file) + (cl-return-from lsp--on-did-save)))) + '((name . ignore-emacs-backup-save)))) +#+end_src + *** YASnippet Autocomplete Snippets to write common code patterns faster. #+begin_src emacs-lisp @@ -718,6 +774,50 @@ Search documentation from within Emacs. (keymap-global-set "C-c d" 'devdocs-lookup)) #+end_src +** Sidebar +Project file sidebar for project wide visual grepping. +#+begin_src emacs-lisp + (use-package dired-sidebar + :init + (setq dired-sidebar-theme 'icons + dired-sidebar-use-term-integration t + dired-sidebar-width 30 + dired-sidebar-no-delete-other-windows t + dired-sidebar-should-follow-file t)) + + (defun open-project-sidebar () + "Toggle `dired-sidebar' at the project root." + (interactive) + (let ((default-directory (project-root (project-current t)))) + (dired-sidebar-toggle-sidebar))) + + (keymap-global-set "C-c p s" 'open-project-sidebar) + + (defun dired-sidebar-header-line () + "Set a minimal header line for dired-sidebar buffers." + (setq header-line-format + (propertize + (concat " " (file-name-nondirectory + (directory-file-name default-directory))) + 'face 'bold))) + + (add-hook 'dired-sidebar-mode-hook #'dired-sidebar-header-line) + + (defun dired-sidebar-clean-top-line () + "Hide the top directory line in `dired-sidebar` buffers." + (save-excursion + (goto-char (point-min)) + (when (looking-at "^ \\(/.*\\):.*$") + (let ((inhibit-read-only t)) + (delete-region (point) (progn (forward-line 1) (point))))))) + + (add-hook 'dired-sidebar-mode-hook #'dired-sidebar-clean-top-line) + + (add-hook 'dired-sidebar-mode-hook + (lambda () + (setq mode-line-format nil))) ;; disable modeline in sidebar +#+end_src + ** TreeSitter Use advanced highlighting by default. #+begin_src emacs-lisp @@ -754,13 +854,7 @@ The Classic. (add-hook 'find-file-hook 'insert-header-guards) #+end_src -*** COMMENT D -C Interop with a GC. -#+begin_src emacs-lisp - (use-package d-mode - :hook (d-mode . lsp)) -#+end_src -*** COMMENT Go +*** Go A simple C-like language with a GC. #+begin_src emacs-lisp (use-package go-mode @@ -795,16 +889,9 @@ Functionally Scottish. :hook (haskell-mode . lsp)) #+end_src -*** COMMENT LISP +*** LISP Programming for Programmers. #+begin_src emacs-lisp - ;; (use-package slime - ;; :init - ;; (slime-setup '(slime-fancy slime-quicklisp slime-asdf slime-mrepl)) - ;; :config - ;; (setq inferior-lisp-program "/usr/bin/sbcl") - ;; (add-hook 'slime-repl-mode-hook 'smartparens-mode)) - (use-package sly :config (setq inferior-lisp-program "ros -Q run" @@ -814,11 +901,8 @@ Programming for Programmers. (add-hook 'lisp-mode-hook (lambda () (define-key lisp-mode-map (kbd "C-c d") 'sly-documentation)))) - - ;; (with-eval-after-load 'sly - ;; (load (expand-file-name "~/.roswell/helper.el"))) #+end_src -*** COMMENT Lua +*** Lua A simple Python-like language with many implementations. #+begin_src emacs-lisp (straight-use-package @@ -859,10 +943,41 @@ Installed with OPAM (require 'dune) (require 'utop) #+end_src -*** COMMENT Vala -An OOP Language for C & GLib interop. +*** Typescript +#+begin_src emacs-lisp + (setenv "PATH" (concat (concat + (concat (expand-file-name "~/.bun/bin") ":") + (getenv "PATH")))) + + (setq exec-path (append exec-path (list (expand-file-name "~/.bun/bin")))) + + (add-hook 'typescript-ts-mode-hook 'lsp) + (add-hook 'tsx-ts-mode-hook 'lsp) + + (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) + (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) + (add-to-list 'auto-mode-alist '("\\.json\\'" . json-ts-mode)) + + ;; Tailwind + (use-package lsp-tailwindcss + :straight '(lsp-tailwindcss :type git :host github :repo "merrickluo/lsp-tailwindcss") + :init (setq lsp-tailwindcss-add-on-mode t) + :config + (dolist (tw-major-mode + '(css-mode + css-ts-mode + typescript-mode + typescript-ts-mode + tsx-ts-mode + js2-mode + js-ts-mode)) + (add-to-list 'lsp-tailwindcss-major-modes tw-major-mode))) +#+end_src +*** Zig +A systems language with emphasis on metaprogramming. #+begin_src emacs-lisp - (use-package vala-mode) + (use-package zig-mode + :hook (zig-mode . lsp)) #+end_src ** Company @@ -923,6 +1038,31 @@ Add non-lsp completions to the capf. (add-hook 'completion-at-point-functions #'yasnippet-capf)) #+end_src +** Codeium +#+begin_src emacs-lisp + (straight-use-package + '(codeium :type git :host github :repo "Exafunction/codeium.el")) + + (setq codeium-api-enabled + (lambda (api) + (memq api '(GetCompletions Heartbeat CancelRequest GetAuthToken RegisterUser auth-redirect AcceptCompletion)))) + + (defun my-codeium/document/text () + (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (min (+ (point) 1000) (point-max)))) + (defun my-codeium/document/cursor_offset () + (codeium-utf8-byte-length + (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (point)))) + (setq codeium/document/text 'my-codeium/document/text) + (setq codeium/document/cursor_offset 'my-codeium/document/cursor_offset) + + (defun my/codeium/completion () + "Decouple codeium from other completions" + (interactive) + (cape-interactive #'codeium-completion-at-point)) + + (keymap-global-set "C-c a" 'my/codeium/completion) +#+end_src + ** Utilities *** Flycheck Syntax checking for Emacs. @@ -936,6 +1076,13 @@ Syntax checking for Emacs. (flycheck-add-next-checker 'c/c++-gcc 'c/c++-cppcheck 'append) (setq flycheck-indication-mode nil) (set-face-attribute 'flycheck-warning nil :underline nil)) ;; Disable Warning Underline (NOT WORKING) + + (add-to-list 'display-buffer-alist + '("\\*Flycheck errors\\*" + (display-buffer-reuse-window + display-buffer-in-side-window) + (side . bottom) + (window-height . 0.2))) ;; Set flycheck error list to only take up the bottom 20% of the window #+end_src * User Interface @@ -961,7 +1108,7 @@ Set font for both Monospace and Proportional text. #+begin_src emacs-lisp (defvar fontconf '((font . "Aporetic Sans Mono") - (size . 13))) + (size . 11))) (set-face-attribute 'variable-pitch nil :font (cdr (assoc 'font fontconf)) @@ -1040,13 +1187,28 @@ Bind both scroling and +/- to zooming. ** Theme Set the theme to a nice dark one. #+begin_src emacs-lisp - (use-package ef-themes + (use-package kaolin-themes :config (set-window-margins nil 0)) (add-hook 'emacs-startup-hook (lambda () - (load-theme 'ef-bio t))) + (load-theme 'kaolin-light t))) + + (defun theme-toggle () + "Toggle between two Emacs themes: doom-one and doom-dracula." + (interactive) + (let ((theme-a 'kaolin-light) + (theme-b 'kaolin-dark)) + (cond + ((member theme-a custom-enabled-themes) + (disable-theme theme-a) + (load-theme theme-b t)) + ((member theme-b custom-enabled-themes) + (disable-theme theme-b) + (load-theme theme-a t)) + (t + (load-theme theme-a t))))) #+end_src ** Niceties @@ -1069,67 +1231,8 @@ Reduce fringe size to 1px. #+begin_src emacs-lisp (set-fringe-mode 1) #+end_src -*** Disable Background -In no-window mode, disable the background to fit in with terminal theme. -#+begin_src emacs-lisp - (defun on-after-init () - (unless (display-graphic-p (selected-frame)) - (set-face-background 'default "unspecified-bg" (selected-frame)))) - - (add-hook 'window-setup-hook 'on-after-init) -#+end_src - -** Modern Looking Emacs -*** Org Modern -Modern iconography and styling for Org-Mode. -#+begin_src emacs-lisp - (use-package org-modern) - - (modify-all-frames-parameters - '((right-divider-width . 40) - (internal-border-width . 40))) - (dolist (face '(window-divider - window-divider-first-pixel - window-divider-last-pixel)) - (face-spec-reset-face face) - (set-face-foreground face (face-attribute 'default :background))) - (set-face-background 'fringe (face-attribute 'default :background)) - - (setq org-pretty-entities t - org-auto-align-tags nil - org-tags-column 0 - org-catch-invisible-edits 'show-and-error - org-special-ctrl-a/e t - org-insert-heading-respect-content t) - - (add-hook 'org-mode-hook #'org-modern-mode) - (add-hook 'org-agenda-finalize-hook #'org-modern-agenda) -#+end_src -*** Spacious Padding -Adds padding around various elements. -#+begin_src emacs-lisp - (use-package spacious-padding) - - ;; These are the default values, but I keep them here for visibility. - (setq spacious-padding-widths - '( :internal-border-width 15 - :header-line-width 4 - :mode-line-width 6 - :tab-width 4 - :right-divider-width 30 - :scroll-bar-width 8 - :fringe-width 8)) - - ;; Read the doc string of `spacious-padding-subtle-mode-line' as it - ;; is very flexible and provides several examples. - (setq spacious-padding-subtle-mode-line - `( :mode-line-active 'default - :mode-line-inactive vertical-border)) - - (spacious-padding-mode 1) -#+end_src -*** Zen Mode +** Zen Mode Center the edtior with Olivetti for distraction-free editing. #+begin_src emacs-lisp (use-package olivetti diff --git a/.emacs.d/early-init.el b/.emacs.d/early-init.el new file mode 100644 index 0000000..b80a729 --- /dev/null +++ b/.emacs.d/early-init.el @@ -0,0 +1,4 @@ +(setq gc-cons-threshold 100000000) +(setq read-process-output-max (* 1024 1024)) +(setenv "LSP_USE_PLISTS" "true") +(setq-default lsp-use-plists t) diff --git a/.zshrc b/.zshrc index 6af87b4..8a2c18e 100644 --- a/.zshrc +++ b/.zshrc @@ -57,20 +57,22 @@ git_dirty() { } set_prompt() { - local user="${USER_COLOR}%n${RESET_COLOR}" - local venv="" - [[ -n "$VIRTUAL_ENV" ]] && venv="${VENV_COLOR}($(basename $VIRTUAL_ENV))${RESET_COLOR} " + if [ "$DEVBOX_SHELL_ENABLED" -ne 1 ]; then + local user="${USER_COLOR}%n${RESET_COLOR}" + local venv="" + [[ -n "$VIRTUAL_ENV" ]] && venv="${VENV_COLOR}($(basename $VIRTUAL_ENV))${RESET_COLOR} " - local path="${DIR_COLOR}$(shorten_path)${RESET_COLOR}" - local git_info="" - local branch="$(git_branch)" + local path="${DIR_COLOR}$(shorten_path)${RESET_COLOR}" + local git_info="" + local branch="$(git_branch)" - if [[ -n "$branch" ]]; then - git_info=" %F{white}on%f ${GIT_COLOR}${branch}${RESET_COLOR}${GIT_DIRTY_COLOR}$(git_dirty)${RESET_COLOR}" - fi + if [[ -n "$branch" ]]; then + git_info=" %F{white}on%f ${GIT_COLOR}${branch}${RESET_COLOR}${GIT_DIRTY_COLOR}$(git_dirty)${RESET_COLOR}" + fi - PROMPT="${user} %F{white}in%f ${venv}${path}${git_info} + PROMPT="${user} %F{white}in%f ${venv}${path}${git_info} ${PROMPT_SYMBOL_COLOR}λ${RESET_COLOR} " + fi } autoload -Uz add-zsh-hook @@ -84,3 +86,26 @@ source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # OPAM for OCaml [[ ! -r '/home/venomade/.opam/opam-init/init.zsh' ]] || source '/home/venomade/.opam/opam-init/init.zsh' > /dev/null 2> /dev/null +# bun completions +[ -s "/home/venomade/.bun/_bun" ] && source "/home/venomade/.bun/_bun" + +# bun +# export BUN_INSTALL="$HOME/.bun" +# export PATH="$BUN_INSTALL/bin:$PATH" + +# Devbox +eval "$(devbox global shellenv)" + +# Function to run emacs based on the presence of devbox.json +run_emacs() { + if [[ $# -eq 0 ]]; then + if [[ -f "devbox.json" ]]; then + devbox run emacs &>/dev/null & + else + emacs + fi + else + command emacs "$@" + fi +} +alias emacs='run_emacs' |