diff options
88 files changed, 6304 insertions, 1446 deletions
diff --git a/.config/mc/hotlist b/.config/mc/hotlist deleted file mode 100644 index 47b50be..0000000 --- a/.config/mc/hotlist +++ /dev/null @@ -1,2 +0,0 @@ -ENTRY "/home/venomade/.build/suckless" URL "/home/venomade/.build/suckless" -ENTRY "/home/venomade/Documents" URL "/home/venomade/Documents" diff --git a/.config/mc/hotlist.bak b/.config/mc/hotlist.bak deleted file mode 100644 index 4dbffb7..0000000 --- a/.config/mc/hotlist.bak +++ /dev/null @@ -1 +0,0 @@ -ENTRY "/home/venomade/.build/suckless" URL "/home/venomade/.build/suckless" diff --git a/.config/mc/ini b/.config/mc/ini deleted file mode 100644 index 115ff36..0000000 --- a/.config/mc/ini +++ /dev/null @@ -1,166 +0,0 @@ -[Midnight-Commander] -verbose=true -shell_patterns=true -auto_save_setup=true -preallocate_space=false -auto_menu=false -use_internal_view=false -use_internal_edit=false -clear_before_exec=true -confirm_delete=true -confirm_overwrite=true -confirm_execute=false -confirm_history_cleanup=true -confirm_exit=false -confirm_directory_hotlist_delete=false -confirm_view_dir=false -safe_delete=false -safe_overwrite=false -use_8th_bit_as_meta=false -mouse_move_pages_viewer=true -mouse_close_dialog=false -fast_refresh=false -drop_menus=false -wrap_mode=true -old_esc_mode=true -cd_symlinks=true -show_all_if_ambiguous=false -alternate_plus_minus=false -only_leading_plus_minus=true -show_output_starts_shell=false -xtree_mode=false -file_op_compute_totals=true -classic_progressbar=true -use_netrc=true -ftpfs_always_use_proxy=false -ftpfs_use_passive_connections=true -ftpfs_use_passive_connections_over_proxy=false -ftpfs_use_unix_list_options=true -ftpfs_first_cd_then_ls=true -ignore_ftp_chattr_errors=true -editor_fill_tabs_with_spaces=false -editor_return_does_auto_indent=true -editor_backspace_through_tabs=false -editor_fake_half_tabs=true -editor_option_save_position=true -editor_option_auto_para_formatting=false -editor_option_typewriter_wrap=false -editor_edit_confirm_save=true -editor_syntax_highlighting=true -editor_persistent_selections=true -editor_drop_selection_on_copy=true -editor_cursor_beyond_eol=false -editor_cursor_after_inserted_block=false -editor_visible_tabs=true -editor_visible_spaces=true -editor_line_state=false -editor_simple_statusbar=false -editor_check_new_line=false -editor_show_right_margin=false -editor_group_undo=false -editor_state_full_filename=false -editor_ask_filename_before_edit=false -nice_rotating_dash=true -shadows=true -mcview_remember_file_position=false -auto_fill_mkdir_name=true -copymove_persistent_attr=true -pause_after_run=1 -mouse_repeat_rate=100 -double_click_speed=250 -old_esc_mode_timeout=1000000 -max_dirt_limit=10 -num_history_items_recorded=60 -vfs_timeout=60 -ftpfs_directory_timeout=900 -ftpfs_retry_seconds=30 -shell_directory_timeout=900 -editor_tab_spacing=8 -editor_word_wrap_line_length=72 -editor_option_save_mode=0 -editor_backup_extension=~ -editor_filesize_threshold=64M -editor_stop_format_chars=-+*\\,.;:&> -mcview_eof= -skin=seasons-winter16M -filepos_max_saved_entries=1024 - -use_file_to_guess_type=true -fish_directory_timeout=900 - -[Layout] -output_lines=0 -left_panel_size=40 -top_panel_size=0 -message_visible=true -keybar_visible=false -xterm_title=true -command_prompt=true -menubar_visible=false -free_space=false -horizontal_split=false -vertical_equal=true -horizontal_equal=true - -[Misc] -timeformat_recent=%b %e %H:%M -timeformat_old=%b %e %Y -ftp_proxy_host=gate -ftpfs_password=anonymous@ -display_codepage=UTF-8 -source_codepage=Other_8_bit -autodetect_codeset= -clipboard_store= -clipboard_paste= - -spell_language=en - -[Colors] -base_color= -xterm-kitty= -color_terminals= - -xterm-256color= - -[Panels] -simple_swap=false -show_mini_info=true -kilobyte_si=false -mix_all_files=false -show_backups=true -show_dot_files=true -fast_reload=false -fast_reload_msg_shown=false -mark_moves_down=true -reverse_files_only=true -auto_save_setup_panels=false -navigate_with_arrows=false -panel_scroll_pages=true -panel_scroll_center=false -mouse_move_pages=true -filetype_mode=true -permission_mode=false -torben_fj_mode=false -quick_search_mode=0 -select_flags=6 - -[FindFile] -file_case_sens=true -file_shell_pattern=true -file_find_recurs=true -follow_symlinks=false -file_skip_hidden=false -file_all_charsets=false -content_case_sens=true -content_regexp=false -content_first_hit=false -content_whole_words=false -content_all_charsets=false -ignore_dirs_enable=true -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 diff --git a/.config/mc/panels.ini b/.config/mc/panels.ini deleted file mode 100644 index d22858b..0000000 --- a/.config/mc/panels.ini +++ /dev/null @@ -1,37 +0,0 @@ -[New Left Panel] -display=listing -reverse=false -case_sensitive=true -exec_first=false -sort_order=name -list_mode=full -brief_cols=2 -user_format=half type name | size | perm -user_status0=half type name | size | perm -user_status1=half type name | size | perm -user_status2=half type name | size | perm -user_status3=half type name | size | perm -user_mini_status=false -filter_flags=7 -list_format=full - -[New Right Panel] -display=listing -reverse=false -case_sensitive=true -exec_first=false -sort_order=name -list_mode=full -brief_cols=2 -user_format=half type name | size | perm -user_status0=half type name | size | perm -user_status1=half type name | size | perm -user_status2=half type name | size | perm -user_status3=half type name | size | perm -user_mini_status=false -filter_flags=7 -list_format=full - -[Dirs] -current_is_left=true -other_dir=/home/venomade/.build/suckless/patches/st diff --git a/.config/shell/alias b/.config/shell/alias deleted file mode 100644 index c060c0e..0000000 --- a/.config/shell/alias +++ /dev/null @@ -1,3 +0,0 @@ -alias gvc="ssh git@git.venomade.com" -alias rgf='rg --files | rg' -alias ls='ls --color=auto' \ No newline at end of file diff --git a/.config/shell/vars b/.config/shell/vars deleted file mode 100644 index 11f8faa..0000000 --- a/.config/shell/vars +++ /dev/null @@ -1,3 +0,0 @@ -export PATH="$PATH:$HOME/.local/bin" - -export EDITOR=mg \ No newline at end of file diff --git a/.emacs.d/config.org b/.emacs.d/config.org deleted file mode 100644 index 5b7f51e..0000000 --- a/.emacs.d/config.org +++ /dev/null @@ -1,1138 +0,0 @@ -#+title: Emacs Config -#+author: Venomade - -* Contents :toc_2: -- [[#straight-package-manager][Straight Package Manager]] -- [[#configs][Configs]] - - [[#custom-functions][Custom Functions]] - - [[#fix-annoyances][Fix Annoyances]] - - [[#keybindings][Keybindings]] - - [[#setup-line-numbers][Setup Line Numbers]] -- [[#general][General]] - - [[#avy][Avy]] - - [[#colors][Colors]] - - [[#dired][Dired]] - - [[#eshell][EShell]] - - [[#git][Git]] - - [[#move-text][Move Text]] - - [[#ivy-counsel][Ivy (Counsel)]] - - [[#simple-modeline][Simple Modeline]] - - [[#smart-parentheses-pairing][Smart Parentheses Pairing]] - - [[#undo-tree][Undo Tree]] -- [[#org-mode][Org Mode]] - - [[#table-of-contents][Table of Contents]] - - [[#bullet-headers][Bullet Headers]] - - [[#org-agenda][Org Agenda]] - - [[#org-babel][Org Babel]] - - [[#org-tempo][Org Tempo]] - - [[#styling][Styling]] -- [[#programming][Programming]] - - [[#projects][Projects]] - - [[#lsp][LSP]] - - [[#treesitter][TreeSitter]] - - [[#languages][Languages]] - - [[#company][Company]] - - [[#cape][Cape]] - - [[#utilities][Utilities]] -- [[#user-interface][User Interface]] - - [[#add-nerd-icons][Add Nerd Icons]] - - [[#fonts][Fonts]] - - [[#theme][Theme]] - - [[#niceties][Niceties]] - - [[#modern-looking-emacs][Modern Looking Emacs]] - -* 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)) - (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))) - (load bootstrap-file nil 'nomessage)) - - (setq straight-use-package-by-default t) -#+end_src - -* Configs -** Custom Functions -*** Cursor follow on split -This is so that action can be taken as soon as a split takes place, to either close/move the window or perform an action inside of it. -#+begin_src emacs-lisp - (defun split-and-follow-horizontally() - (interactive) - (split-window-below) - (balance-windows) - (other-window 1)) - - (defun split-and-follow-vertically() - (interactive) - (split-window-right) - (balance-windows) - (other-window 1)) -#+end_src -*** Duplicate Line -Duplicates the current line to the line below. -#+begin_src emacs-lisp - (defun duplicate-line () - (interactive) - (let ((column (- (point) (point-at-bol))) - (line (let ((s (thing-at-point 'line t))) - (if s (string-remove-suffix "\n" s) "")))) - (move-end-of-line 1) - (newline) - (insert line) - (move-beginning-of-line 1) - (forward-char column))) - - (keymap-global-set "C-c y d" 'duplicate-line) -#+end_src -*** Open Line above and below -Vim's o and S-o implemented for Emacs bindings. -#+begin_src emacs-lisp - (defun vi-open-line-above () - (interactive) - (unless (bolp) - (beginning-of-line)) - (newline) - (forward-line -1) - (indent-according-to-mode)) - - (defun vi-open-line-below () - (interactive) - (unless (eolp) - (end-of-line)) - (newline-and-indent)) - - (keymap-global-set "C-c O" 'vi-open-line-below) - (keymap-global-set "C-c o" 'vi-open-line-above) -#+end_src -*** C-a to indentation -Have c-a move the cursor to the start after indentation unless already there. -#+begin_src emacs-lisp - (defun smart-beginning-of-line () - (interactive) - (let ((initial-point (point))) - (back-to-indentation) - (when (eq initial-point (point)) - (move-beginning-of-line 1)))) - - (defun setup-prog-mode-c-a () - (local-set-key (kbd "C-a") 'smart-beginning-of-line)) - - (add-hook 'prog-mode-hook 'setup-prog-mode-c-a) -#+end_src -*** Automatically Cull Whitespace -Remove trailing whitespaces when saving in prog-modes. -#+begin_src emacs-lisp - (defun prog-nuke-trailing-whitespace () - (when (derived-mode-p 'prog-mode) - (delete-trailing-whitespace))) - - (add-hook 'before-save-hook 'prog-nuke-trailing-whitespace) -#+end_src -*** Quick Grep -Quickly grep both my current project and the system include directory. -#+begin_src emacs-lisp - (defun grep-symbol-at-point () - (interactive) - (let ((symbol (thing-at-point 'symbol))) - (if symbol - (counsel-rg (concat symbol)) - (message "No symbol at point.")))) - - (defun grep-symbol-in-include-at-point () - (interactive) - (let ((symbol (thing-at-point 'symbol))) - (if symbol - (counsel-rg (concat symbol) "/usr/include/") - (message "No symbol at point.")))) - - (global-set-key (kbd "C-c g") 'grep-symbol-at-point) - (global-set-key (kbd "C-c G") 'grep-symbol-in-include-at-point) -#+end_src - -** Fix Annoyances -*** Disable Backups -Living on the edge. -#+begin_src emacs-lisp - (setq backup-directory-alist - `(("." . ,(concat user-emacs-directory "backups")))) - (setq auto-save-file-name-transforms - `(("." ,(concat user-emacs-directory "autosaves/") t))) - (setq lock-file-name-transforms - `(("." ,(concat user-emacs-directory "lock") t))) -#+end_src -*** Disable Bell -Only flash, no sound, it gets annoying. -#+begin_src emacs-lisp - (setq ring-bell-function 'ignore) -#+end_src -*** Hide Warnings -Fixing warnings is for nerds. This is basically necessary after more than 5 packages. -#+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. -#+begin_src emacs-lisp - (setq scroll-margin 10) -#+end_src -*** Save Place -Go back to old position on file open. -#+begin_src emacs-lisp - (save-place-mode 1) -#+end_src - -** Keybindings -*** Reload Emacs -Reload Emacs by sourcing the init.el file. -#+begin_src emacs-lisp - (keymap-global-set "C-c e c" (lambda () (interactive) (load-file "~/.emacs.d/init.el"))) -#+end_src -*** Open Common Files -Open the TODO, Bookmarks and Notes from synced Documents and the config file with simple shortcuts. -#+begin_src emacs-lisp - (keymap-global-set "C-c f c" (lambda () (interactive) (find-file "~/.emacs.d/config.org"))) - (keymap-global-set "C-c f t" (lambda () (interactive) (find-file "~/Documents/TODO.org"))) - (keymap-global-set "C-c f b" (lambda () (interactive) (find-file "~/Documents/Bookmarks.org"))) - (keymap-global-set "C-c f n" (lambda () (interactive) (find-file "~/Documents/Notes.org"))) - (keymap-global-set "C-c f i" (lambda () (interactive) (find-file "~/Documents/Ideas.org"))) -#+end_src -*** Switch and Revert Buffers -Add shortcuts to switch buffers and to revert buffer. -#+begin_src emacs-lisp - (keymap-global-set "C-x C-b" 'ibuffer) - (keymap-global-set "C-c b p" 'previous-buffer) - (keymap-global-set "C-c b n" 'next-buffer) - (keymap-global-set "C-c b r" 'revert-buffer) -#+end_src -*** Compile Mode -Add shortcuts to build in compile-mode. -#+begin_src emacs-lisp - (setq compilation-scroll-output t) - (keymap-global-set "C-c m c" 'compile) - (keymap-global-set "C-c m r" 'recompile) -#+end_src -*** Emacs -Add shortcuts to various Emacs functions. -#+begin_src emacs-lisp - (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) -#+end_src -*** Regex and Copy from Above -Add shortcuts to entering a regex replace and copying a line from above. -#+begin_src emacs-lisp - (keymap-global-set "C-c r" 'replace-regexp) - (keymap-global-set "C-c y a" 'copy-from-above-command) -#+end_src -*** Window Management -Add shortcuts to scrolling and moving between windows. -#+begin_src emacs-lisp - (keymap-global-set "C-c v" 'scroll-other-window) - (keymap-global-set "C-c V" 'scroll-other-window-down) - - (keymap-global-set "C-c w n" 'other-window) - (keymap-global-set "C-c w f" 'other-window) - (keymap-global-set "C-c w p" (lambda () (interactive) (other-window -1))) - (keymap-global-set "C-c w b" (lambda () (interactive) (other-window -1))) -#+end_src - -** Setup Line Numbers -*** Always show line numbers -Show line numbers and highlight the current line. -#+begin_src emacs-lisp - (add-hook 'prog-mode-hook 'display-line-numbers-mode) - (global-visual-line-mode t) - (add-hook 'prog-mode-hook (lambda () (visual-line-mode -1))) - (setq-default truncate-lines t) - (global-hl-line-mode 1) -#+end_src -*** Generally use spaces instead of tabs -Generally, as in everywhere but Go. -#+begin_src emacs-lisp - (setq-default indent-tabs-mode nil) - (setq tab-width 2) - (setq tab-stop-list (number-sequence 2 100 2)) -#+end_src -*** Highlight Column -Highlight a column at 120 chars to respect GNOME style. -#+begin_src emacs-lisp - (setq-default display-fill-column-indicator-column 120) - (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode) -#+end_src - -* General -** Avy -Keybind superfast cursor movement to "C-q". -#+begin_src emacs-lisp - (use-package avy - :config - (setq avy-keys '(?a ?r ?s ?t ?n ?e ?i ?o) - avy-all-windows nil) - (bind-key* "C-q" 'avy-goto-char)) -#+end_src - -** Colors -*** Highlight Todo -Highlight TODO items so they can be reviewed later. -#+begin_src emacs-lisp - (use-package hl-todo - :hook ((org-mode . hl-todo-mode) - (prog-mode . hl-todo-mode)) - - :config - (setq hl-todo-highlight-punctuation ":" - hl-todo-highlight-faces - `(("TODO" warning bold) - ("FIXME" error bold) - ("HACK" font-lock-constant-face bold) - ("REVIEW" font-lock-doc-face bold) - ("NOTE" success bold) - ("DEPRECATED" font-lock-doc-face bold)))) -#+end_src -*** Rainbow Delimiters -Makes different brackets and other delimeters levels different colors so they can be quickly distinguished. -#+begin_src emacs-lisp - (use-package rainbow-delimiters - :hook (prog-mode . rainbow-delimiters-mode)) -#+end_src - -** Dired -A powerful built-in file manager. -#+begin_src emacs-lisp - (setq dired-listing-switches "-lh") -#+end_src - -** EShell -A built in posix shell. -#+begin_src emacs-lisp - ;; Define custom faces for the prompt. These inherit from standard faces so they - ;; automatically adapt to your current theme. - (defface eshell-prompt-user-face - '((t (:inherit font-lock-keyword-face))) - "Face for the username in the eshell prompt." - :group 'eshell-prompt) - - (defface eshell-prompt-venv-face - '((t (:inherit font-lock-string-face))) - "Face for the virtualenv name in the eshell prompt." - :group 'eshell-prompt) - - (defface eshell-prompt-dir-face - '((t (:inherit dired-directory))) - "Face for the directory path in the eshell prompt." - :group 'eshell-prompt) - - (defface eshell-prompt-git-face - '((t (:inherit magit-tag))) - "Face for the git branch in the eshell prompt." - :group 'eshell-prompt) - - (defface eshell-prompt-git-dirty-face - '((t (:inherit eshell-prompt-git-face))) - "Face for the git dirty status in the eshell prompt." - :group 'eshell-prompt) - - (defface eshell-prompt-symbol-face - '((t (:inherit font-lock-builtin-face))) - "Face for the prompt symbol (e.g. λ) in the eshell prompt." - :group 'eshell-prompt) - - ;; A helper function to abbreviate long directory names. - (defun my-abbreviate-dir (dir) - "Abbreviate DIR to show only the first and the last two components. - For example, \"~/Projects/Learning/C/GeneticsProject/TsodingGenetics\" becomes - \"~/.../GeneticsProject/TsodingGenetics\"." - (let* ((abbrev (abbreviate-file-name dir)) - (components (split-string abbrev "/" t)) ; t omits empty strings - (num-components (length components))) - (if (>= num-components 4) - (concat (car components) "/.../" - (mapconcat #'identity (last components 2) "/")) - abbrev))) - - ;; These are the same helper functions for git information you had. - (defun my-prompt-git-branch () - "Return the current git branch or short commit hash, if available." - (when (and (executable-find "git") - (locate-dominating-file default-directory ".git")) - (with-temp-buffer - (let ((ret (call-process "git" nil t nil "symbolic-ref" "--short" "HEAD"))) - (if (zerop ret) - (string-trim (buffer-string)) - (when (zerop (call-process "git" nil t nil "rev-parse" "--short" "HEAD")) - (string-trim (buffer-string)))))))) - - (defun my-prompt-git-dirty () - "Return a dirty flag (✗ if dirty, ✓ if clean) for the git repository." - (when (my-prompt-git-branch) - (with-temp-buffer - (call-process "git" nil t nil "status" "--porcelain") - (if (> (buffer-size) 0) "✗" "✓")))) - - ;; Finally, build the prompt itself. - (defun eshell-prompt () - "Custom eshell prompt with theme-derived colors and shortened directory path." - (let* ((user (propertize (user-login-name) 'face 'eshell-prompt-user-face)) - (venv (when-let ((venv (getenv "VIRTUAL_ENV"))) - (concat (propertize "(" 'face 'eshell-prompt-venv-face) - (propertize (file-name-nondirectory venv) 'face 'eshell-prompt-venv-face) - (propertize ")" 'face 'eshell-prompt-venv-face)))) - (path (propertize (my-abbreviate-dir (eshell/pwd)) 'face 'eshell-prompt-dir-face)) - (git-branch (my-prompt-git-branch)) - (git-info (when git-branch - (concat " " (propertize "on" 'face 'font-lock-number-face) " " - (propertize git-branch 'face 'eshell-prompt-git-face) - (propertize (my-prompt-git-dirty) 'face 'eshell-prompt-git-dirty-face)))) - (prompt (concat user " " (propertize "in" 'face 'font-lock-number-face) " " - (if venv (concat venv " ") "") - path git-info "\n" - (propertize "λ" 'face 'eshell-prompt-symbol-face) " "))) - prompt)) - - ;; Tell eshell to use our prompt function. - (setq eshell-prompt-function 'eshell-prompt) - (setq eshell-prompt-regexp "^[^λ\n]*λ ") -#+end_src -** Git -Tools for the primary version control system. -*** Magit -A very extensive Git GUI for Emacs. -#+begin_src emacs-lisp - (use-package magit) -#+end_src -*** Magit Todos -Show Todo list in Magit. -#+begin_src emacs-lisp - (use-package magit-todos - :after magit - :config (magit-todos-mode 1)) -#+end_src -*** Magit Forge -Work with Git Forges from within Emacs. -#+begin_src emacs-lisp - (use-package forge - :after magit - :config - (setq auth-sources '("~/.authinfo"))) -#+end_src - -** Move Text -Move text up and down with simple keybindings. -#+begin_src emacs-lisp - (use-package move-text - :config - (keymap-global-set "M-p" 'move-text-up) - (keymap-global-set "M-n" 'move-text-down)) -#+end_src - -** Ivy (Counsel) -*** Counsel -Adds better fuzzy completion to many Emacs commands. -#+begin_src emacs-lisp - (use-package counsel - :after ivy - :config - (counsel-mode 1) - (keymap-global-set "C-c f r" 'counsel-buffer-or-recentf) - (keymap-global-set "C-c f f" 'counsel-fzf) - (keymap-global-set "C-c f g" 'counsel-rg) - (keymap-global-set "C-c f l" 'counsel-locate) - (keymap-global-set "C-c s" 'swiper)) -#+end_src -*** Ivy -Adds fuzzy completion to basic Emacs commands. -#+begin_src emacs-lisp - (use-package ivy - :custom - (setq ivy-use-virtual-buffers t) - (setq ivy-count-format "(%d/%d) ") - (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. -#+begin_src emacs-lisp - (use-package ivy-rich - :after ivy - :init (ivy-rich-mode 1) - :custom - (ivy-virtual-abbreviate 'full - ivy-rich-switch-buffer-align-virtual-buffer t - ivy-rich-path-style 'abbrev)) -#+end_src - -** Simple Modeline -Make the modeline simple by hiding modes. -#+begin_src emacs-lisp - (setq-default mode-line-format (delq 'mode-line-modes mode-line-format) - display-time-24hr-format t - display-time-default-load-average nil) - (display-battery-mode 1) - (display-time-mode 1) -#+end_src - -** Smart Parentheses Pairing -Automatically deals with parentheses in pairs. -#+begin_src emacs-lisp - (use-package smartparens - :hook (prog-mode text-mode markdown-mode) - :config - (require 'smartparens-config) - (sp-use-paredit-bindings)) -#+end_src - -** Undo Tree -Makes undo history like a Git commit tree, very powerful. -#+begin_src emacs-lisp - (use-package undo-tree - :config - (setq undo-tree-history-directory-alist - `(("." . ,(concat user-emacs-directory "undo")))) - (global-undo-tree-mode 1)) -#+end_src - -* Org Mode -** Table of Contents -Automatically generate a table of contents for an Org file. -#+begin_src emacs-lisp - (use-package toc-org - :commands toc-org-enable - :init (add-hook 'org-mode-hook 'toc-org-enable) - :config (setq org-src-window-setup 'current-window)) - (add-hook 'org-mode-hook 'org-indent-mode) -#+end_src - -** Bullet Headers -Stylize Org Mode headers with Nerd Icons. -#+begin_src emacs-lisp - (use-package org-bullets - :config - (setq org-bullets-bullet-list '( - "" - "" - "" - "" - ""))) - (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) -#+end_src - -** Org Agenda -Manage a Todo list, a Calendar, and other organization tools with Org. -#+begin_src emacs-lisp - (setq org-agenda-files '("~/Documents/Org/agenda.org")) - (setq org-fancy-priorities-list '("[A]" "[B]" "[C]") - org-priority-faces - '((?A :foreground "#ff6c6b" :weight bold) - (?B :foreground "#ffff91" :weight bold) - (?C :foreground "#aaffaa" :weight bold))) - (setq org-agenda-custom-commands - '(("v" "View Agenda" - ((tags "PRIORITY=\"A\"" - ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "HIGH PRIORITY:"))) - (tags "PRIORITY=\"B\"" - ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "Medium Priority:"))) - (tags "PRIORITY=\"C\"" - ((org-agenda-skip-function '(org-agenda-skip-entry-if 'todo 'done)) - (org-agenda-overriding-header "low priority:"))) - (agenda "") - (alltodo ""))))) -#+end_src - -** Org Babel -Setup literate progamming in Org Mode. -*** Config -Don't ask for conformation when evaluating source blocks. -#+begin_src emacs-lisp - (setq org-confirm-babel-evaluate nil) -#+end_src -*** Load Languages -#+begin_src emacs-lisp - (org-babel-do-load-languages - 'org-babel-load-languages - '((python . t) - (lua . t))) -#+end_src - -** Org Tempo -This provides shorthands for Org functions. -#+begin_src emacs-lisp - (require 'org-tempo) -#+end_src - -** Styling -Hide markers for bold, italic and other types of text styling. -#+begin_src emacs-lisp - (setq org-hide-emphasis-markers t) -#+end_src - -* Programming -** Projects -Manage Project folders from within Emacs. -*** Project.el -Use project.el and set shortcuts with prefix "C-c p". -#+begin_src emacs-lisp - (require 'project) - - (keymap-global-set "C-c p b" 'project-list-buffers) - (keymap-global-set "C-c p c" 'project-compile) - (keymap-global-set "C-c p e" 'project-dired) - (keymap-global-set "C-c p f" 'project-find-file) - (keymap-global-set "C-c f p" 'project-find-file) - (keymap-global-set "C-c p g" 'project-find-regexp) - (keymap-global-set "C-c p o" 'project-find-dir) - (keymap-global-set "C-c p p" 'project-switch-project) -#+end_src -*** Disproject -Magit like interface ontop of project.el. -#+begin_src emacs-lisp - (use-package disproject - ;; Replace `project-prefix-map' with `disproject-dispatch'. - :bind ( :map ctl-x-map - ("p" . disproject-dispatch))) -#+end_src -*** Run Project -Run the current project. -#+begin_src emacs-lisp - (require 'project) - - (defvar-local project-binary-name nil) - (defvar-local project-binary-args nil) - (defvar-local project-debugger "gf2") - - (defun get-project-binary-info () - (let* ((project (project-current t)) - (project-root (project-root project)) - (binary-name (or project-binary-name - (downcase - (file-name-nondirectory (directory-file-name project-root))))) - (binary-path (expand-file-name binary-name project-root)) - (args (or project-binary-args ""))) - (list binary-path args))) - - (defun run-project-binary () - (interactive) - (let* ((binary-info (get-project-binary-info)) - (binary-path (nth 0 binary-info)) - (args (nth 1 binary-info)) - (original-compile-command compile-command)) - (if (file-executable-p binary-path) - (progn - (setq compile-command (concat binary-path " " args)) - (unwind-protect - (compile compile-command) - (setq compile-command original-compile-command))) - (error "Binary '%s' not found or not executable in project root" binary-path)))) - - (defun debug-project-binary () - (interactive) - (let* ((binary-info (get-project-binary-info)) - (binary-path (nth 0 binary-info)) - (args (nth 1 binary-info)) - (debugger (or project-debugger "gdb")) - (debug-command (concat debugger " --args " binary-path " " args)) - (original-compile-command compile-command)) - (if (file-executable-p binary-path) - (progn - (setq compile-command debug-command) - (unwind-protect - (compile compile-command) - (setq compile-command original-compile-command))) - (error "Binary '%s' not found or not executable in project root" binary-path)))) - - ;; Mark 'project-binary-name' and 'project-binary-args' as safe for dir-locals. - (put 'project-binary-name 'safe-local-variable #'stringp) - (put 'project-binary-args 'safe-local-variable #'stringp) - - (keymap-global-set "C-c p r" 'run-project-binary) - (keymap-global-set "C-c p d" 'debug-project-binary) -#+end_src - -** LSP -*** LSP Mode -Use language servers to provide info and completion. -#+begin_src emacs-lisp - (use-package lsp-mode - :init - (setq lsp-completion-provider :none - lsp-keymap-prefix "C-c l" - lsp-headerline-breadcrumb-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 -*** YASnippet -Autocomplete Snippets to write common code patterns faster. -#+begin_src emacs-lisp - (use-package yasnippet - :config - (setq yas-snippet-dirs '("~/Documents/snippets")) - (yas-global-mode 1) - (keymap-global-set "M-<tab>" 'yas-next-field-or-maybe-expand) - (keymap-global-set "C-'" 'yas-expand)) - - (straight-use-package - '(yasnippet-capf :type git :host github :repo "elken/yasnippet-capf")) - - (use-package yasnippet-treesitter-shim - :straight (:host github :repo "fbrosda/yasnippet-treesitter-shim" - :files ("snippets/*")) - :no-require t - :config - (add-to-list 'yas-snippet-dirs - (straight--build-dir "yasnippet-treesitter-shim"))) -#+end_src - -*** DevDocs -Search documentation from within Emacs. -#+begin_src emacs-lisp - (use-package devdocs - :config - (keymap-global-set "C-c d" 'devdocs-lookup)) -#+end_src - -** TreeSitter -Use advanced highlighting by default. -#+begin_src emacs-lisp - (require 'treesit) - (use-package treesit-auto - :config - (global-treesit-auto-mode)) - (setq major-mode-remap-alist (treesit-auto--build-major-mode-remap-alist)) -#+end_src - -** Languages -*** C -The Classic. -#+begin_src emacs-lisp - (add-hook 'c-mode-hook #'lsp) - (add-hook 'c-ts-mode-hook #'lsp) - - ;; Use GNU Style in LSP-Mode for C - (with-eval-after-load 'lsp-clangd - (setq lsp-clients-clangd-args '("--header-insertion-decorators=0" "--fallback-style=GNU"))) - - ;; Automatically write header guards - (defun insert-header-guards () - (when (and (buffer-file-name) - (string-match "\\.h\\'" (buffer-file-name))) - (let* ((filename (file-name-nondirectory (buffer-file-name))) - (guard (upcase (replace-regexp-in-string "[^a-zA-Z0-9]" "_" filename)))) - (when (zerop (buffer-size)) ; Only insert if the file is empty - (insert (format "#ifndef %s\n#define %s\n\n\n$0\n\n#endif // %s\n" - guard guard guard)) - (goto-char (point-min)) - (search-forward "$0") - (delete-char -3))))) - - (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 -A simple C-like language with a GC. -#+begin_src emacs-lisp - (use-package go-mode - :config - (setenv "PATH" (concat (concat - (concat (expand-file-name "/usr/local/go/bin") ":") - (getenv "PATH")))) - (setenv "PATH" (concat (concat - (concat (expand-file-name "~/.go/bin") ":") - (getenv "PATH")))) - - (setq exec-path (append exec-path (list (expand-file-name "/usr/local/go/bin")))) - (setq exec-path (append exec-path (list (expand-file-name "~/.go/bin")))) - (add-hook 'go-mode-hook - (lambda () - (setq tab-width 4))) - :hook - (go-mode . lsp)) -#+end_src -*** Haskell -Functionally Scottish. -#+begin_src emacs-lisp - (use-package haskell-mode - :config - (setenv "PATH" (concat (concat - (concat (expand-file-name "~/.ghcup/bin") ":") - (getenv "PATH")))) - - (setq exec-path (append exec-path (list (expand-file-name "~/.ghcup/bin"))))) - - (use-package lsp-haskell - :hook - (haskell-mode . lsp)) -#+end_src -*** COMMENT 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" - browse-url-browser-function '(("hyperspec" . eww-browse-url) ("." . browse-url-default-browser))) - (add-hook 'sly-mrepl-mode-hook 'smartparens-mode) - (add-hook 'sly-mrepl-mode-hook 'company-mode) - (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 -A simple Python-like language with many implementations. -#+begin_src emacs-lisp - (straight-use-package - '(lua-mode :type git :host github :repo "immerrr/lua-mode")) - (add-hook 'lua-mode-hook #'lsp) - - (setq lua-indent-nested-block-content-align nil) - (setq lua-indent-close-paren-align nil) - - (defun lua-at-most-one-indent (old-function &rest arguments) - (let ((old-res (apply old-function arguments))) - (if (> old-res lua-indent-level) lua-indent-level old-res))) - - (advice-add #'lua-calculate-indentation-block-modifier - :around #'lua-at-most-one-indent) - - (setq lua-indent-level 2) - (setq lua-electric-flag nil) - (defun lua-abbrev-mode-off () (abbrev-mode 0)) - (add-hook 'lua-mode-hook 'lua-abbrev-mode-off) - (setq save-abbrevs nil) ;; is this still needed? -#+end_src -*** OCaml -Installed with OPAM -#+begin_src emacs-lisp - (setenv "PATH" (concat (concat - (concat (expand-file-name "~/.opam/default/bin") ":") - (getenv "PATH")))) - - (setq exec-path (append exec-path (list (expand-file-name "~/.opam/default/bin")))) - - (use-package tuareg - :hook - (tuareg-mode . lsp)) - - (add-to-list 'load-path "/home/venomade/.opam/default/share/emacs/site-lisp") - (require 'ocp-indent) - (require 'dune) - (require 'utop) -#+end_src -*** COMMENT Vala -An OOP Language for C & GLib interop. -#+begin_src emacs-lisp - (use-package vala-mode) -#+end_src - -** Company -A powerful auto-completion utility. -#+begin_src emacs-lisp - (use-package company - :config - (define-key company-active-map (kbd "RET") nil) - (define-key company-active-map (kbd "<return>") nil) - (define-key company-active-map (kbd "C-m") nil) - - ;; TAB indents or selects a completion - (define-key company-active-map (kbd "TAB") #'company-complete-selection) - (define-key company-active-map (kbd "<tab>") #'company-complete-selection) - - ;; Use C-p and C-n to navigate the completion list - (define-key company-active-map (kbd "C-p") #'company-select-previous) - (define-key company-active-map (kbd "C-n") #'company-select-next) - - ;; Restore normal tab behavior outside company-mode completions - (define-key company-mode-map (kbd "TAB") #'indent-for-tab-command) - (define-key company-mode-map (kbd "<tab>") #'indent-for-tab-command) - - ;; Disable Autocomplete - (setq company-idle-delay 0) - - ;; Disable Case Sensitivity - (setq completion-ignore-case t) - - ;; Bind M-/ to company-complete - (define-key global-map (kbd "M-/") 'company-complete) - (define-key global-map (kbd "M-?") 'dabbrev-expand) - :hook - (prog-mode . company-mode)) - - (use-package company-quickhelp - :config - (company-quickhelp-mode 1) - (setq company-quickhelp-delay 0.5) - (setq company-quickhelp-color-background (face-attribute 'company-tooltip :background)) - (add-hook 'enable-theme-functions - (lambda (_) - (setq company-quickhelp-color-background (face-attribute 'company-tooltip :background))))) - -#+end_src - -** Cape -Add non-lsp completions to the capf. -#+begin_src emacs-lisp - (use-package cape - :ensure t - :config - (keymap-global-set "C-c c" 'cape-prefix-map) - (setq dabbrev-case-fold-search t) - ;;(add-hook 'completion-at-point-functions #'cape-dabbrev) ;; TODO: Check if this is slowing down comments? - (add-hook 'completion-at-point-functions #'cape-file) - (add-hook 'completion-at-point-functions #'cape-elisp-block) - (add-hook 'completion-at-point-functions #'yasnippet-capf)) -#+end_src - -** Utilities -*** Flycheck -Syntax checking for Emacs. -#+begin_src emacs-lisp - (use-package flycheck - :defer t - :init (global-flycheck-mode 1) - :config - (setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)) - (setq-default flycheck-cppcheck-args "--enable=all") - (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) -#+end_src - -* User Interface -** Add Nerd Icons -Use Icons from Nerd Font to add a little modern spice to Emacs. -#+begin_src emacs-lisp - (use-package nerd-icons - :if (display-graphic-p)) - - (use-package nerd-icons-dired - :hook - (dired-mode . nerd-icons-dired-mode)) - - (use-package nerd-icons-ivy-rich - :init (nerd-icons-ivy-rich-mode 1)) - - (setq welcome-dashboard-use-nerd-icons t) -#+end_src - -** Fonts -*** Set Font -Set font for both Monospace and Proportional text. -#+begin_src emacs-lisp - (defvar fontconf - '((font . "Aporetic Sans Mono") - (size . 13))) - - (set-face-attribute 'variable-pitch nil - :font (cdr (assoc 'font fontconf)) - :height (* (cdr (assoc 'size fontconf)) 10) - :weight 'regular) - - (set-face-attribute 'fixed-pitch nil - :font (cdr (assoc 'font fontconf)) - :height (* (cdr (assoc 'size fontconf)) 10) - :weight 'regular) - - (set-face-attribute 'default nil - :font (cdr (assoc 'font fontconf)) - :height (* (cdr (assoc 'size fontconf)) 10) - :weight 'regular) - - - (add-to-list 'default-frame-alist - `(font . ,(concat (cdr (assoc 'font fontconf)) "-" (number-to-string (cdr (assoc 'size fontconf)))))) - - (set-face-attribute 'font-lock-comment-face nil - :slant 'italic) - - (set-face-attribute 'font-lock-keyword-face nil - :slant 'italic) - - ;;(set-frame-font "-misc-fixed-medium-r-normal--18-120-100-100-c-90-iso10646-1" t t) -#+end_src -*** Ligatures -Make ligature symbols out of common function symbols. -#+begin_src emacs-lisp - (dolist (char/ligature-re - `((?- . ,(rx (or (or "-->" "-<<" "->>" "-|" "-~" "-<" "->") (+ "-")))) - (?/ . ,(rx (or (or "/==" "/=" "/>" "/**" "/*") (+ "/")))) - (?* . ,(rx (or (or "*>" "*/") (+ "*")))) - (?< . ,(rx (or (or "<<=" "<<-" "<|||" "<==>" "<!--" "<=>" "<||" "<|>" "<-<" - "<==" "<=<" "<-|" "<~>" "<=|" "<~~" "<$>" "<+>" "</>" - "<*>" "<->" "<=" "<|" "<:" "<>" "<$" "<-" "<~" "<+" - "</" "<*") - (+ "<")))) - (?: . ,(rx (or (or ":?>" "::=" ":>" ":<" ":?" ":=") (+ ":")))) - (?= . ,(rx (or (or "=>>" "==>" "=/=" "=!=" "=>" "=:=") (+ "=")))) - (?! . ,(rx (or (or "!==" "!=") (+ "!")))) - (?> . ,(rx (or (or ">>-" ">>=" ">=>" ">]" ">:" ">-" ">=") (+ ">")))) - (?& . ,(rx (+ "&"))) - (?| . ,(rx (or (or "|->" "|||>" "||>" "|=>" "||-" "||=" "|-" "|>" - "|]" "|}" "|=") - (+ "|")))) - (?. . ,(rx (or (or ".?" ".=" ".-" "..<") (+ ".")))) - (?+ . ,(rx (or "+>" (+ "+")))) - (?\[ . ,(rx (or "[<" "[|"))) - (?\{ . ,(rx "{|")) - (?\? . ,(rx (or (or "?." "?=" "?:") (+ "?")))) - (?# . ,(rx (or (or "#_(" "#[" "#{" "#=" "#!" "#:" "#_" "#?" "#(") - (+ "#")))) - (?\; . ,(rx (+ ";"))) - (?_ . ,(rx (or "_|_" "__"))) - (?~ . ,(rx (or "~~>" "~~" "~>" "~-" "~@"))) - (?$ . ,(rx "$>")) - (?^ . ,(rx "^=")) - (?\] . ,(rx "]#")))) - (let ((char (car char/ligature-re)) - (ligature-re (cdr char/ligature-re))) - (set-char-table-range composition-function-table char - `([,ligature-re 0 font-shape-gstring])))) -#+end_src -*** Font Zooming -Bind both scroling and +/- to zooming. -#+begin_src emacs-lisp - (global-set-key (kbd "C-=") 'text-scale-increase) - (global-set-key (kbd "C--") 'text-scale-decrease) - (global-set-key (kbd "<C-wheel-up>") 'text-scale-increase) - (global-set-key (kbd "<C-wheel-down>") 'text-scale-decrease) -#+end_src - -** Theme -Set the theme to a nice dark one. -#+begin_src emacs-lisp - (use-package ef-themes - :config - (set-window-margins nil 0)) - - (add-hook 'emacs-startup-hook - (lambda () - (load-theme 'ef-bio t))) -#+end_src - -** Niceties -*** Disable Extra GUI Features -Disable GUI features to simplify frames. -#+begin_src emacs-lisp - (menu-bar-mode -1) - (tool-bar-mode -1) - (scroll-bar-mode -1) - (setq inhibit-startup-screen t) -#+end_src -*** No Scroll Jump -Scroll line by line instead of jumping multiple. -#+begin_src emacs-lisp - (setq scroll-conservatively 100) - (setq scroll-step 1) -#+end_src -*** Small Fringes -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 -Center the edtior with Olivetti for distraction-free editing. -#+begin_src emacs-lisp - (use-package olivetti - :config - (keymap-global-set "C-c z" 'olivetti-mode)) -#+end_src diff --git a/.ghci b/.ghci deleted file mode 100644 index 31f559e..0000000 --- a/.ghci +++ /dev/null @@ -1 +0,0 @@ -:set prompt "λ " diff --git a/.gitconfig b/.gitconfig deleted file mode 100644 index 8a59d3e..0000000 --- a/.gitconfig +++ /dev/null @@ -1,3 +0,0 @@ -[user] - name = venomade - email = venomade@venomade.com diff --git a/.mg b/.mg deleted file mode 100644 index 480ec1b..0000000 --- a/.mg +++ /dev/null @@ -1 +0,0 @@ -backup-to-home-directory diff --git a/.stow-local-ignore b/.stow-local-ignore deleted file mode 100644 index 35cdaf3..0000000 --- a/.stow-local-ignore +++ /dev/null @@ -1,2 +0,0 @@ -.git -README.md diff --git a/.xsessionrc b/.xsessionrc deleted file mode 100644 index c923b63..0000000 --- a/.xsessionrc +++ /dev/null @@ -1,2 +0,0 @@ -export QT_QPA_PLATFORMTHEME=gtk2 -export QT_STYLE_OVERRIDE=gtk2 diff --git a/.zshrc b/.zshrc deleted file mode 100644 index 6af87b4..0000000 --- a/.zshrc +++ /dev/null @@ -1,86 +0,0 @@ -# Venomade's zshrc - -# source global variables and aliases -[ -f "$HOME/.config/shell/alias" ] && source "$HOME/.config/shell/alias" -[ -f "$HOME/.config/shell/vars" ] && source "$HOME/.config/shell/vars" - -# load modules -zmodload zsh/complist -autoload -U compinit && compinit -autoload -U colors && colors - -# completion -zstyle ':completion:*' menu select -zstyle ':completion:*' special-dirs true -zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} ma=0\;33 - -# options -setopt append_history inc_append_history share_history -setopt auto_menu menu_complete -setopt auto_param_slash -setopt no_case_glob no_case_match -setopt globdots -setopt extended_glob - -# history -HISTCONTROL=ignoreboth - - -# prompt -USER_COLOR="%F{magenta}" -VENV_COLOR="%F{yellow}" -DIR_COLOR="%F{green}" -GIT_COLOR="%F{blue}" -GIT_DIRTY_COLOR="%F{red}" -PROMPT_SYMBOL_COLOR="%F{yellow}" -RESET_COLOR="%f" - -shorten_path() { - local path="${PWD/#$HOME/~}" - local parts=("${(@s:/:)path}") - - if (( ${#parts} > 3 )); then - echo "${parts[1]}/.../${parts[-2]}/${parts[-1]}" - else - echo "$path" - fi -} - -git_branch() { - local branch - branch=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null) - [[ -n "$branch" ]] && echo "$branch" -} - -git_dirty() { - [[ -n "$(git status --porcelain 2>/dev/null)" ]] && echo "✗" || echo "✓" -} - -set_prompt() { - 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)" - - 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_SYMBOL_COLOR}λ${RESET_COLOR} " -} - -autoload -Uz add-zsh-hook -add-zsh-hook precmd set_prompt - -# plugins -source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - -# GHCUP for Haskell -[ -f "/home/venomade/.ghcup/env" ] && . "/home/venomade/.ghcup/env" # ghcup-env - -# OPAM for OCaml -[[ ! -r '/home/venomade/.opam/opam-init/init.zsh' ]] || source '/home/venomade/.opam/opam-init/init.zsh' > /dev/null 2> /dev/null diff --git a/README.md b/README.md index 7a22cbf..5fc3be5 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Venomade's Dotfiles -These are my dotfiles managed with [GNU Stow](https://www.gnu.org/software/stow/). +These are my dotfiles managed with [Home Manager](https://nixos.wiki/wiki/Home_Manager). diff --git a/config/alacritty/alacritty.toml b/config/alacritty/alacritty.toml new file mode 100644 index 0000000..cb32c5f --- /dev/null +++ b/config/alacritty/alacritty.toml @@ -0,0 +1,23 @@ +[general] +import = ['~/.config/alacritty/modus-vivendi.toml'] + +[window] +padding = { x = 6, y = 6 } +dynamic_padding = true +title = 'Terminal' + +[font] +normal = { family = 'AporeticSansMonoNerdFont', style = 'Regular' } +size = 12 + +[selection] +save_to_clipboard = true + +[cursor] +style = { shape = 'Beam', blinking = 'On'} + +[terminal] +shell = '/home/venomade/.nix-profile/bin/zsh' + +[hints] +alphabet = 'neiotsradhwyfupl' diff --git a/config/alacritty/modus-vivendi.toml b/config/alacritty/modus-vivendi.toml new file mode 100644 index 0000000..20d13c1 --- /dev/null +++ b/config/alacritty/modus-vivendi.toml @@ -0,0 +1,28 @@ +# Colors Modus-Vivendi +[colors.normal] +black = '#1e1e1e' +red = '#ff5f59' +green = '#44bc44' +yellow = '#d0bc00' +blue = '#2fafff' +magenta = '#feacd0' +cyan = '#00d3d0' +white = '#ffffff' +[colors.bright] +black = '#535353' +red = '#ff7f9f' +green = '#00c06f' +yellow = '#dfaf7a' +blue = '#00bcff' +magenta = '#b6a0ff' +cyan = '#6ae4b9' +white = '#989898' +[colors.cursor] +cursor = '#ffffff' +text = '#000000' +[colors.primary] +background = '#000000' +foreground = '#ffffff' +[colors.selection] +background = '#5a5a5a' +text = '#ffffff' diff --git a/config/bat/config b/config/bat/config new file mode 100644 index 0000000..b7de378 --- /dev/null +++ b/config/bat/config @@ -0,0 +1 @@ +--theme="Catppuccin Mocha" diff --git a/config/bat/themes/modus_vivendi.tmTheme b/config/bat/themes/modus_vivendi.tmTheme new file mode 100644 index 0000000..15d2429 --- /dev/null +++ b/config/bat/themes/modus_vivendi.tmTheme @@ -0,0 +1,439 @@ +<!-- Modus Themes for Bat --> +<!-- Auto generated with https://github.com/miikanissi/modus-themes.nvim/blob/master/lua/modus-themes/extras/bat.lua --> + +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>name</key> + <string>modus_vivendi</string> + <key>settings</key> + <array> + <dict> + <key>settings</key> + <dict> + <key>background</key> + <string>#000000</string> + <key>caret</key> + <string>#989898</string> + <key>foreground</key> + <string>#ffffff</string> + <key>invisibles</key> + <string>#989898</string> + <key>lineHighlight</key> + <string>#2f3849</string> + <key>selection</key> + <string>#7030af</string> + <key>findHighlight</key> + <string>#7a6100</string> + <key>selectionBorder</key> + <string>#646464</string> + <key>gutterForeground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Comment</string> + <key>scope</key> + <string>comment</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>italic</string> + <key>foreground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>String</string> + <key>scope</key> + <string>string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Number</string> + <key>scope</key> + <string>constant.numeric</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#82b0ec</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Built-in constant</string> + <key>scope</key> + <string>constant.language</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#6ae4b9</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>User-defined constant</string> + <key>scope</key> + <string>constant.character, constant.other</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#ffffff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Variable</string> + <key>scope</key> + <string>variable</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Ruby's @variable</string> + <key>scope</key> + <string>variable.other.readwrite.instance</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>String interpolation</string> + <key>scope</key> + <string>constant.character.escaped, constant.character.escape, string source, string source.ruby</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d2b580</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Keyword</string> + <key>scope</key> + <string>keyword</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>italic</string> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Storage</string> + <key>scope</key> + <string>storage</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Storage type</string> + <key>scope</key> + <string>storage.type</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Class name</string> + <key>scope</key> + <string>entity.name.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Inherited class</string> + <key>scope</key> + <string>entity.other.inherited-class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function name</string> + <key>scope</key> + <string>entity.name.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#feacd0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function argument</string> + <key>scope</key> + <string>variable.parameter</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Tag name</string> + <key>scope</key> + <string>entity.name.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Tag attribute</string> + <key>scope</key> + <string>entity.other.attribute-name</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library function</string> + <key>scope</key> + <string>support.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#feacd0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library constant</string> + <key>scope</key> + <string>support.constant</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#6ae4b9</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library class/type</string> + <key>scope</key> + <string>support.type, support.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#6ae4b9</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library variable</string> + <key>scope</key> + <string>support.other.variable</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Invalid</string> + <key>scope</key> + <string>invalid</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Invalid deprecated</string> + <key>scope</key> + <string>invalid.deprecated</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON String</string> + <key>scope</key> + <string>meta.structure.dictionary.json string.quoted.double.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.header</string> + <key>scope</key> + <string>meta.diff, meta.diff.header</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#feacd0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.deleted</string> + <key>scope</key> + <string>markup.deleted</string> + <key>settings</key> + <dict> + <key>background</key> + <string>#4f1119</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.inserted</string> + <key>scope</key> + <string>markup.inserted</string> + <key>settings</key> + <dict> + <key>background</key> + <string>#00381f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.changed</string> + <key>scope</key> + <string>markup.changed</string> + <key>settings</key> + <dict> + <key>background</key> + <string>#363300</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>constant.numeric.line-number.find-in-files - match</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#82b0ec</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>entity.name.filename</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#2fafff</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>message.error</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>bold</string> + <key>foreground</key> + <string>#ff7f9f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON Punctuation</string> + <key>scope</key> + <string>punctuation.definition.string.begin.json - meta.structure.dictionary.value.json, punctuation.definition.string.end.json - meta.structure.dictionary.value.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#ffffff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON Structure</string> + <key>scope</key> + <string>meta.structure.dictionary.json string.quoted.double.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON String</string> + <key>scope</key> + <string>meta.structure.dictionary.value.json string.quoted.double.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Escape Characters</string> + <key>scope</key> + <string>constant.character.escape</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d2b580</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions</string> + <key>scope</key> + <string>string.regexp</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00c06f</string> + </dict> + </dict> + </array> + <key>uuid</key> + <string>09CE9B40-0137-442C-8512-7CEAFC78C153</string> + <key>colorSpaceName</key> + <string>sRGB</string> + <key>semanticClass</key> + <string>Modus Vivendi</string> + </dict> +</plist> diff --git a/config/emacs/.gitignore b/config/emacs/.gitignore new file mode 100644 index 0000000..1980dcd --- /dev/null +++ b/config/emacs/.gitignore @@ -0,0 +1,62 @@ +/url/cache +/.emacs.desktop +/auto-save-list +/network-security.data +/.session +/session.* +/custom.el +*.elc +CVS +.svn +*~ +.cvsignore +.*.lock +/tramp +/TODO +/.org-id-locations +cookies +/newsticker +\#* +/tree-sitter +/elpa +/elpa-* +site-lisp/package/ +/swank +/.mc-lists.el +/var +/.sqli_history +/frame-restore-parameters +/.achievements +/.bookmarks.el +/history +/helm-adaptive-history +/thumbs/ +/emms/ +/.smex-items +/image-dired/ +/eshell +/.cask/ +/.sx/ +/org-clock-save.el +/ditaa*.jar +/ido.last +/recentf +/viper +/projectile-bookmarks.eld +/anaconda-mode/ +/.historian +/.uptimes.el +/rake.cache +/plantuml.jar +/magithub +.cache/ +/forge-database.sqlite +/transient +/.lsp-session-v1 +/smex-items +/eln-cache/ +/projects +/forge-*.sqlite +/projectile.cache +config.el +places diff --git a/config/emacs/config.org b/config/emacs/config.org new file mode 100644 index 0000000..02c7bd0 --- /dev/null +++ b/config/emacs/config.org @@ -0,0 +1,1738 @@ +#+TITLE: My Emacs Config +#+AUTHOR: Venomade + +This is my Emacs config. There are many like it, but this one is mine. According to my archive, it has been rewritten 10+ times since I wrote the first iteration in 2022. My general philosophy for this config is to not use external packages where the built in functionality is enough and any external packages used should follow the Emacs philosophy and design style and not duplicate functionality as much as reasonably possible. In this vein I use *Eglot* and *Corfu* instead of *LSP-Mode* and *Company* as an example of this philosophy. Not all code written in this configuration is my own, though most of it is, with the rest being made up of other people's configs, stack overflow snippets and code from various blog sites from other Emacs users including [[https://xenodium.com][Xenodium]], [[http://www.xahlee.info/][Xah Lee]] and [[https://systemcrafters.net/][System Crafters]]. + +* Table of Contents +:PROPERTIES: +:TOC: :include all :ignore this :depth 2 +:END: +:CONTENTS: +- [[#bootstrap][Bootstrap]] + - [[#package-manager][Package Manager]] + - [[#native-compilation][Native Compilation]] + - [[#garbage-collection][Garbage Collection]] + - [[#shell-path][Shell Path]] + - [[#custom-file][Custom File]] + - [[#file-hygiene][File Hygiene]] + - [[#suppress-noise][Suppress Noise]] + - [[#macos][MacOS]] +- [[#appearance][Appearance]] + - [[#theme][Theme]] + - [[#font-configuration][Font Configuration]] + - [[#mode-line][Mode Line]] + - [[#icons][Icons]] + - [[#highlight-changes][Highlight Changes]] + - [[#highlight-keywords][Highlight Keywords]] + - [[#highlight-and-dim-parentheses][Highlight and Dim Parentheses]] + - [[#pretty-symbols][Pretty Symbols]] + - [[#window-focus-flash][Window Focus Flash]] +- [[#ui-behaviour][UI Behaviour]] + - [[#frame-and-window][Frame and Window]] + - [[#line-numbers][Line Numbers]] + - [[#scrolling][Scrolling]] + - [[#line-wrapping][Line Wrapping]] + - [[#keybinding-help][Keybinding Help]] + - [[#compilation][Compilation]] + - [[#zen-mode][Zen Mode]] +- [[#editing-behaviour][Editing Behaviour]] + - [[#indentation][Indentation]] + - [[#smart-line-beginning][Smart Line Beginning]] + - [[#open-line][Open Line]] + - [[#replace-selection][Replace Selection]] + - [[#trailing-whitespace][Trailing Whitespace]] + - [[#move-lines][Move Lines]] + - [[#delimiter-pairing][Delimiter Pairing]] + - [[#undo-history][Undo History]] + - [[#short-answers][Short Answers]] + - [[#quit-confirmation][Quit Confirmation]] +- [[#session-and-navigation][Session and Navigation]] + - [[#recent-files][Recent Files]] + - [[#save-position][Save Position]] + - [[#minibuffer-history][Minibuffer History]] + - [[#dired][Dired]] + - [[#buffer-list][Buffer List]] + - [[#project-management][Project Management]] + - [[#eshell][EShell]] + - [[#info-pages][Info Pages]] +- [[#completion-and-lsp][Completion and LSP]] + - [[#completion-style][Completion Style]] + - [[#minibuffer-completion][Minibuffer Completion]] + - [[#completion-annotations][Completion Annotations]] + - [[#consult][Consult]] + - [[#in-buffer-completion][In-Buffer Completion]] + - [[#snippets][Snippets]] + - [[#completion-extensions][Completion Extensions]] + - [[#lsp-client][LSP Client]] + - [[#lsp-booster][LSP Booster]] + - [[#lsp-transient-menu][LSP Transient Menu]] + - [[#documentation-popups][Documentation Popups]] + - [[#diagnostics][Diagnostics]] +- [[#org-mode][Org Mode]] + - [[#core-configuration][Core Configuration]] + - [[#heading-bullets][Heading Bullets]] + - [[#org-tempo-snippets][Org Tempo Snippets]] + - [[#link-behaviour][Link Behaviour]] + - [[#tables-of-contents][Tables of Contents]] + - [[#disable-auto-indent][Disable Auto-Indent]] +- [[#language-support][Language Support]] + - [[#lua][Lua]] + - [[#nix][Nix]] + - [[#cc][C/C++]] + - [[#emacs-lisp][Emacs Lisp]] + - [[#common-lisp][Common Lisp]] + - [[#fennel][Fennel]] + - [[#markdown-notes][Markdown Notes]] +- [[#keybindings][Keybindings]] +:END: + +* Bootstrap +:PROPERTIES: +:CUSTOM_ID: bootstrap +:END: +** Package Manager +:PROPERTIES: +:CUSTOM_ID: package-manager +:END: +Setup =use-package= and [[https://melpa.org/][Melpa]], the community Emacs package repository. +#+begin_src emacs-lisp + (require 'package) + (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) + (package-initialize) +#+end_src + +** Native Compilation +:PROPERTIES: +:CUSTOM_ID: native-compilation +:END: +Setup Native Compilation if available. +#+begin_src emacs-lisp + (if (native-comp-available-p) + (setq package-native-compile t)) +#+end_src + +** Garbage Collection +:PROPERTIES: +:CUSTOM_ID: garbage-collection +:END: +Improve Emacs' garbage collection by increasing the garbage size and collecting when idle. +*Packages*: =gcmh= by [[https://web.archive.org/web/20250808164421/https://akrl.sdf.org/][Andrea Corallo]] +#+begin_src emacs-lisp + (use-package gcmh + :ensure t + :hook (after-init . gcmh-mode) + :config + (setq gcmh-high-cons-threshold (* 128 1024 1024) ; 128MB + gcmh-idle-delay 10 + gcmh-verbose nil)) +#+end_src + +** Shell Path +:PROPERTIES: +:CUSTOM_ID: shell-path +:END: +Append to the =exec-path= variable paths that are set in the =zsh= shell. +#+begin_src emacs-lisp + (use-package exec-path-from-shell + :ensure t + :config + (setq exec-path-from-shell-shell-name "/bin/zsh" + exec-path-from-shell-arguments '("-l" "-i" "-c")) + (when (memq window-system '(mac ns x)) + (exec-path-from-shell-initialize))) +#+end_src + +** Custom File +:PROPERTIES: +:CUSTOM_ID: custom-file +:END: +Use a =custom.el= file instead of the =init.el= to store uncommitable, device-local changes. +#+begin_src emacs-lisp + (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) + + (when (file-exists-p custom-file) + (load custom-file)) +#+end_src + +** File Hygiene +:PROPERTIES: +:CUSTOM_ID: file-hygiene +:END: +Store backups, autosaves and lockfiles in the =.emacs.d= directory. +#+begin_src emacs-lisp + (let* ((backup-dir (expand-file-name "backups/" user-emacs-directory)) + (autosave-dir (expand-file-name "autosaves/" user-emacs-directory)) + (lock-dir (expand-file-name "lock/" user-emacs-directory))) + (make-directory backup-dir t) + (make-directory autosave-dir t) + (make-directory lock-dir t) + + (setq backup-directory-alist `((".*" . ,(directory-file-name backup-dir))) + auto-save-file-name-transforms `((".*" ,(directory-file-name autosave-dir) t)) + lock-file-name-transforms `((".*" ,(directory-file-name lock-dir) t)))) +#+end_src + +** Suppress Noise +:PROPERTIES: +:CUSTOM_ID: suppress-noise +:END: +Don't show =*Warnings*= and =*Compile-Log*= buffers in a window. +#+begin_src emacs-lisp + (add-to-list 'display-buffer-alist + '("\\`\\*\\(Warnings\\|Compile-Log\\)\\*\\'" + (display-buffer-no-window) + (allow-no-window . t))) +#+end_src + +** MacOS +:PROPERTIES: +:CUSTOM_ID: macos +:END: +Settings specific for use on MacOS. +*** Disable Command Key +:PROPERTIES: +:CUSTOM_ID: disable-command-key +:END: +Disable the command key on MacOS. +#+begin_src emacs-lisp + (setq mac-command-modifier nil) +#+end_src + +*** Matching Titlebar +:PROPERTIES: +:CUSTOM_ID: matching-titlebar +:END: +Match the titlebar to the current theme on MacOS. +*Packages*: =ns-auto-titlebar= by [[https://github.com/purcell/ns-auto-titlebar][Steve Purcell]] +#+begin_src emacs-lisp + (use-package ns-auto-titlebar + :ensure t + :config + (when (eq system-type 'darwin) (ns-auto-titlebar-mode))) +#+end_src + +*** Block Pop-Ups +:PROPERTIES: +:CUSTOM_ID: block-pop-ups +:END: +Don't open files opened from an external source in a new frame on MacOS. +#+begin_src emacs-lisp + (setq ns-pop-up-frames nil) +#+end_src + +* Appearance +:PROPERTIES: +:CUSTOM_ID: appearance +:END: +** Theme +:PROPERTIES: +:CUSTOM_ID: theme +:END: +Use the =ef-dream= for a comfortable readable experience . +*Packages*: =ef-themes= by [[https://protesilaos.com/emacs/ef-themes][Protesilaos]] +#+begin_src emacs-lisp + (use-package ef-themes + :ensure t + :config + (ef-themes-take-over-modus-themes-mode 1)) + + (setq modus-themes-italic-constructs t + modus-themes-bold-constructs t) + + (load-theme 'ef-dream t) +#+end_src + +** Font Configuration +:PROPERTIES: +:CUSTOM_ID: font-configuration +:END: +Setup both =monospace= and =variable-pitch= fonts along with their sizes in =org-mode=. +#+begin_src emacs-lisp + (defun font-setup (&optional frame) + (with-selected-frame (or frame (selected-frame)) + + (let* ((fontconf '((fixed-font . "MonofurNerdFont") + (variable-font . "MonofurNerdFont") + (size . 13))) + (fixed-font (cdr (assoc 'fixed-font fontconf))) + (variable-font (cdr (assoc 'variable-font fontconf))) + (pt-size (cdr (assoc 'size fontconf))) + (height (* pt-size 10)) + (frame-font (concat fixed-font "-" (number-to-string pt-size)))) + ; Fixed-width faces + (dolist (face '(default fixed-pitch)) + (set-face-attribute face nil + :font fixed-font + :height height + :weight 'regular)) + ; Variable-pitch face + (set-face-attribute 'variable-pitch nil + :font variable-font + :height height + :weight 'regular) + + ; Syntax styling + (set-face-attribute 'font-lock-comment-face nil :slant 'italic) + (set-face-attribute 'font-lock-keyword-face nil :slant 'italic) + + ; Frame font + (add-to-list 'default-frame-alist `(font . ,frame-font))) + + + (let* ((variable-tuple + (cond ((x-list-fonts "Google Sans") '(:font "Google Sans")) + ((x-family-fonts "Sans Serif") '(:family "Sans Serif")) + (nil (warn "Cannot find a Sans Serif Font. Install Google Sans.")))) + (base-font-color (face-foreground 'default nil 'default)) + (headline `(:inherit default :weight bold :foreground ,base-font-color))) + + ; TODO: Split these up + (custom-theme-set-faces + 'user + `(org-level-8 ((t (,@headline ,@variable-tuple)))) + `(org-level-7 ((t (,@headline ,@variable-tuple)))) + `(org-level-6 ((t (,@headline ,@variable-tuple)))) + `(org-level-5 ((t (,@headline ,@variable-tuple)))) + `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.0)))) + `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.2)))) + `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.4)))) + `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.6)))) + `(org-document-title ((t (,@headline ,@variable-tuple :height 1.8 :underline nil)))))))) + (if (daemonp) + (add-hook 'after-make-frame-functions #'font-setup) + (font-setup)) + + ; Theme the fonts and styles for various org elements + (custom-theme-set-faces + 'user + '(org-block ((t (:inherit fixed-pitch)))) + '(org-code ((t (:inherit (shadow fixed-pitch))))) + '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch))))) + '(org-indent ((t (:inherit (org-hide fixed-pitch))))) + '(org-link ((t (:foreground "#89b4fa" :underline t)))) + '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) + '(org-property-value ((t (:inherit fixed-pitch))) t) + '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))) + '(org-table ((t (:inherit fixed-pitch)))) + '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) + '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) +#+end_src + +** Mode Line +:PROPERTIES: +:CUSTOM_ID: mode-line +:END: +Use a much more readable modeline compared to the default. +*Packages*: =doom-modeline= from [[https://seagle0128.github.io/doom-modeline/][Centaur Emacs]] +#+begin_src emacs-lisp + (use-package doom-modeline + :ensure t + :hook (after-init . doom-modeline-mode) + :config + (setq doom-modeline-icon t + doom-modeline-height 0 ; minimum + doom-modeline-bar-width 0 ; disabled + doom-modeline-project-detection 'project ; use project.el + doom-modeline-buffer-state-icon nil + doom-modeline-highlight-modified-buffer-name nil + doom-modeline-percent-position nil + line-number-mode nil + doom-modeline-buffer-encoding nil + doom-modeline-time-live-icon nil + doom-modeline-time-icon nil + display-time-default-load-average nil + display-time-format "%a %d %b | %R" + helm-ag-show-status-function nil)) ;HACK: Doom Modeline checks for this even though I don't use helm +#+end_src + +** Icons +:PROPERTIES: +:CUSTOM_ID: icons +:END: +Make use of the [[https://www.nerdfonts.com/][Nerd Fonts]] to show icons in Emacs. +*Packages*: =nerd-icons=, =nerd-icons-dired= and =nerd-icons-completion= by [[https://github.com/rainstormstudio/nerd-icons.el][Daniel Ding]] and =nerd-icons-ibuffer= from [[https://github.com/seagle0128/nerd-icons-ibuffer][Centaur Emacs]] +#+begin_src emacs-lisp + (use-package nerd-icons + :ensure t + :if (display-graphic-p)) + + (use-package nerd-icons-dired + :ensure t + :after nerd-icons + :hook + (dired-mode . nerd-icons-dired-mode)) + + (use-package nerd-icons-completion + :ensure t + :after nerd-icons + :hook + (after-init . nerd-icons-completion-mode)) + + (use-package nerd-icons-ibuffer + :ensure t + :after nerd-icons + :hook (ibuffer-mode . nerd-icons-ibuffer-mode)) +#+end_src + +** COMMENT Padding and Spacing +:PROPERTIES: +:CUSTOM_ID: padding-and-spacing +:END: +Spacious user interface elements with custom widths and colours. +*Packages*: =spacious-padding= by [[https://protesilaos.com/emacs/spacious-padding][Protesilaos]] +#+begin_src emacs-lisp + (use-package spacious-padding + :ensure t + :hook (after-init . spacious-padding-mode) + :config + (setq spacious-padding-widths + '( :internal-border-width 8 + :header-line-width 4 + :mode-line-width 6 + :custom-button-width 3 + :tab-width 4 + :right-divider-width 30 + :scroll-bar-width 8 + :fringe-width 0)) + (setq spacious-padding-subtle-frame-lines + '( :mode-line-active spacious-padding-line-active + :mode-line-inactive spacious-padding-line-inactive + :header-line-active spacious-padding-line-active + :header-line-inactive spacious-padding-line-inactive))) +#+end_src + +** Highlight Changes +:PROPERTIES: +:CUSTOM_ID: highlight-changes +:END: +Temporarily highlight modified regions to help the visual transition when making large changes via =undo= or =kill-region=. +*Packages*: =goggles= by [[https://github.com/minad/goggles][Daniel Mendler]] +#+begin_src emacs-lisp + (use-package goggles + :ensure t + :hook ((prog-mode text-mode) . goggles-mode) + :config + (setq-default goggles-pulse t)) +#+end_src + +** Highlight Keywords +:PROPERTIES: +:CUSTOM_ID: highlight-keywords +:END: +Highlight actionable keywords such as =TODO=, =FIXME= and =ERROR=. +*Packages*: =hl-todo= by [[https://github.com/tarsius/hl-todo][Jonas Bernoulli]] +#+begin_src emacs-lisp + (use-package hl-todo + :ensure t + :hook ((org-mode . hl-todo-mode) + (prog-mode . hl-todo-mode)) + :config + (add-to-list 'hl-todo-keyword-faces '("ERROR" . "#8c5353"))) +#+end_src + +** COMMENT Rainbow Delimiters +Colour brackets and other delimiters to improve visual grepping of scope while programming. +*Packages*: =rainbow-delimiters= by [[https://github.com/Fanael/rainbow-delimiters][Fanael Linithien]] +#+begin_src emacs-lisp + (use-package rainbow-delimiters + :ensure t + :hook (prog-mode . rainbow-delimiters-mode)) +#+end_src + +** Highlight and Dim Parentheses +:PROPERTIES: +:CUSTOM_ID: highlight-and-dim-parentheses +:END: +For =lisp= modes, highlight parentheses that are local to the current point with decreasing brightness the less local they are, and set all parentheses to be dim in these modes by default. +*Packages*: =highlight-parentheses= by [[https://sr.ht/~tsdh/highlight-parentheses.el/][Tassilo Horn]] +#+begin_src emacs-lisp + (use-package highlight-parentheses + :ensure t + :custom + (hl-paren-colors '("white" "#cccccc" "#999999" "#666666" "#444444")) + (hl-paren-background-colors '(nil nil nil nil nil)) + :config + (set-face-attribute 'hl-paren-face nil :weight 'bold)) + + (defface dim-parens-face + '((t :foreground "#666666")) + "Face for dimmed parentheses.") + + (defun dim-parens--enable () + (font-lock-add-keywords + nil + '(("[()]" 0 'dim-parens-face t)) + 'append) + (font-lock-flush) + (highlight-parentheses-mode 1)) + + (defun dim-parens--disable () + (font-lock-remove-keywords + nil + '(("[()]" 0 'dim-parens-face t))) + (font-lock-flush) + (highlight-parentheses-mode -1)) + + (define-minor-mode dim-parens-mode + "Dim all parens, highlighting the enclosing pair at point." + :lighter " DimP" + (if dim-parens-mode + (dim-parens--enable) + (dim-parens--disable))) +#+end_src + +** Pretty Symbols +:PROPERTIES: +:CUSTOM_ID: pretty-symbols +:END: +Shorten symbols into their single character equivalent. +#+begin_src emacs-lisp + (global-prettify-symbols-mode 1) +#+end_src + +** Window Focus Flash +:PROPERTIES: +:CUSTOM_ID: window-focus-flash +:END: +Flash between windows when switching to make obvious which window is active. +*Packages*: =winpulse= by [[https://xenodium.com/introducing-winpulse][Álvaro Ramírez (Xenodium)]] +#+begin_src emacs-lisp + (use-package winpulse + :vc (:url "https://github.com/xenodium/winpulse" + :rev :newest) + :config + (winpulse-mode +1)) +#+end_src + +* UI Behaviour +:PROPERTIES: +:CUSTOM_ID: ui-behaviour +:END: +** Frame and Window +:PROPERTIES: +:CUSTOM_ID: frame-and-window +:END: +*** Resize GUI +:PROPERTIES: +:CUSTOM_ID: resize-gui +:END: +Allow any size to be set for the Emacs GUI. +#+begin_src emacs-lisp + (setq frame-resize-pixelwise t) +#+end_src + +*** Focus Frames +:PROPERTIES: +:CUSTOM_ID: focus-frames +:END: +Focus new frames when they're created. +#+begin_src emacs-lisp + (add-hook 'after-make-frame-functions + (lambda (f) + (select-frame-set-input-focus f))) +#+end_src + +*** Disable Default Annoyances +:PROPERTIES: +:CUSTOM_ID: disable-default-annoyances +:END: +Disable the Bell and other unwanted GUI features. +#+begin_src emacs-lisp + (setq ring-bell-function 'ignore) + + (tool-bar-mode -1) + (scroll-bar-mode -1) + (menu-bar-mode -1) +#+end_src + +** Line Numbers +:PROPERTIES: +:CUSTOM_ID: line-numbers +:END: +Configure line numbers display width and resizing, and display them from startup unless in =fundamental-mode= or =text-mode=. +#+begin_src emacs-lisp + (setq display-line-numbers-width-start t + display-line-numbers-width 4 + display-line-numbers-grow-only t) + + (add-hook 'emacs-startup-hook #'global-display-line-numbers-mode) + + (dolist (hk '(fundamental-mode-hook text-mode-hook Info-mode-hook)) + (add-hook hk (lambda () (display-line-numbers-mode -1)))) +#+end_src + +** Scrolling +:PROPERTIES: +:CUSTOM_ID: scrolling +:END: +Add a scroll margin and improve scrolling. +#+begin_src emacs-lisp + (setq scroll-margin 10 + scroll-conservatively 100 + scroll-step 1) +#+end_src + +** Line Wrapping +:PROPERTIES: +:CUSTOM_ID: line-wrapping +:END: +Set the default to not wrap long lines but truncate with spaces. Enable it explicitly in =text-mode=. +#+begin_src emacs-lisp + (setq-default truncate-lines t) + + (set-display-table-slot standard-display-table 'truncation 32) + + (add-hook 'text-mode-hook 'visual-line-mode) +#+end_src + +** Keybinding Help +:PROPERTIES: +:CUSTOM_ID: keybinding-help +:END: +Enable =which-key= on startup. +#+begin_src emacs-lisp + (add-hook 'emacs-startup-hook #'which-key-mode) +#+end_src + +** Compilation +:PROPERTIES: +:CUSTOM_ID: compilation +:END: +Configure =compile-mode= by colourising it, having it scroll on compilation output and allow files and projects to set their own compile-commands. +#+begin_src emacs-lisp + (require 'ansi-color) + + (defun colorize-compilation-buffer () + (ansi-color-apply-on-region compilation-filter-start (point))) + (add-hook 'compilation-filter-hook 'colorize-compilation-buffer) + + (setq compilation-scroll-output t) + + (put 'compile-command 'safe-local-variable #'stringp) +#+end_src + +** Zen Mode +:PROPERTIES: +:CUSTOM_ID: zen-mode +:END: +Centre the buffer and disable line numbers for a calmer writing experience. +*Packages*: =olivetti= by [[https://github.com/rnkn/olivetti][Paul W. Rankin]] +#+begin_src emacs-lisp + (use-package olivetti + :ensure t + :config + ; TODO: Disable line numbers, probably in the line numbers section, but probably try and link the sections somehow + (setq olivetti-minimum-body-width 100)) +#+end_src + +* Editing Behaviour +:PROPERTIES: +:CUSTOM_ID: editing-behaviour +:END: +** Indentation +:PROPERTIES: +:CUSTOM_ID: indentation +:END: +Indent code with 2 spaces by default. +#+begin_src emacs-lisp + (setq-default indent-tabs-mode nil + tab-width 2 + tab-stop-list (number-sequence 2 100 2) + c-basic-offset 2) +#+end_src + +** Smart Line Beginning +:PROPERTIES: +:CUSTOM_ID: smart-line-beginning +:END: +Override the built-in =beginning-of-line= function to give respect to context when making the movement. +#+begin_src emacs-lisp + (progn + (defun smart-beginning-of-line () + "Move the cursor to the beginning of text on the line." + (interactive) + (let ((initial-point (point))) + (back-to-indentation) + (when (eq initial-point (point)) + (move-beginning-of-line 1)))) + (defun setup-prog-mode-c-a () + (local-set-key (kbd "C-a") 'smart-beginning-of-line)) + (add-hook 'prog-mode-hook 'setup-prog-mode-c-a) + (add-hook 'conf-mode-hook 'setup-prog-mode-c-a)) +#+end_src + +** Open Line +:PROPERTIES: +:CUSTOM_ID: open-line +:END: +Functions to match vi's '=o=' and '=O=' motions, this helps to bypass whatever function is called on the =Return= key. +#+begin_src emacs-lisp + (cl-labels + ((vi-open-line-above () + "Open line above the current line." + (interactive) + (unless (bolp) (beginning-of-line)) + (newline) + (forward-line -1) + (indent-according-to-mode)) + (vi-open-line-below () + "Open line below the current line." + (interactive) + (unless (eolp) (end-of-line)) + (newline-and-indent))) + ; TODO: Move to keybindings section + (define-key (current-global-map) (kbd "C-c o") #'vi-open-line-above) + (define-key (current-global-map) (kbd "C-c O") #'vi-open-line-below) + (which-key-add-key-based-replacements "C-c o" "open-line-above") + (which-key-add-key-based-replacements "C-c O" "open-line-below")) +#+end_src + +** Replace Selection +:PROPERTIES: +:CUSTOM_ID: replace-selection +:END: +Overwrite selection when typing while a selection is active. +#+begin_src emacs-lisp + (use-package delsel + :hook (after-init . delete-selection-mode)) +#+end_src + +** Trailing Whitespace +:PROPERTIES: +:CUSTOM_ID: trailing-whitespace +:END: +Clean up trailing whitespace on save. +#+begin_src emacs-lisp + (progn + (defun prog-nuke-trailing-whitespace () + "Removes trailing whitespace at the end of the line." + (when (or (derived-mode-p 'prog-mode) (derived-mode-p 'conf-mode)) + (delete-trailing-whitespace))) + (add-hook 'before-save-hook 'prog-nuke-trailing-whitespace)) +#+end_src + +** Move Lines +:PROPERTIES: +:CUSTOM_ID: move-lines +:END: +Move text up and down with a single keybind. +*Packages*: =move-text= by [[https://github.com/emacsfodder/move-text][Jason Milkins at Emacs Fodder]] +#+begin_src emacs-lisp + (use-package move-text + :ensure t + :config + (defun indent-region-advice (&rest ignored) + (let ((deactivate deactivate-mark)) + (if (region-active-p) + (indent-region (region-beginning) (region-end)) + (indent-region (line-beginning-position) (line-end-position))) + (setq deactivate-mark deactivate))) + + (advice-add 'move-text-up :after 'indent-region-advice) + (advice-add 'move-text-down :after 'indent-region-advice)) +#+end_src + +** Delimiter Pairing +:PROPERTIES: +:CUSTOM_ID: delimiter-pairing +:END: +Insert matching delimiters using the keybindings from =paredit=. +*Packages*: =smartparens= by [[https://github.com/Fuco1/smartparens][Matus Goljer]] +#+begin_src emacs-lisp + (use-package smartparens + :ensure t + :hook (prog-mode text-mode markdown-mode comint-mode) + :config + (require 'smartparens-config) + (sp-use-paredit-bindings)) +#+end_src + +** Undo History +:PROPERTIES: +:CUSTOM_ID: undo-history +:END: +Make the undo history persistent between sessions and create multi-branch undo history. +*Packages*: =undo-tree= by [[https://www.dr-qubit.org/undo-tree.html][Tony 'qubit' Cubitt]] +#+begin_src emacs-lisp + (use-package undo-tree + :ensure t + :init + (global-undo-tree-mode 1) + :config + (setq undo-tree-auto-save-history t + undo-tree-history-directory-alist `(("." . ,(expand-file-name ".cache" user-emacs-directory))))) +#+end_src + +** Short Answers +:PROPERTIES: +:CUSTOM_ID: short-answers +:END: +Use =y= / =n= and other similar shortenings for dialogue responses. +#+begin_src emacs-lisp + (setopt use-short-answers t) +#+end_src + +** Quit Confirmation +:PROPERTIES: +:CUSTOM_ID: quit-confirmation +:END: +Ask for confirmation on =C-x C-c= before quitting using custom quit messages from the DOOM games and DOOM Emacs. +#+begin_src emacs-lisp + (setq quit-messages + `(; from DOOM 1 + ,(format "I wouldn't leave if I were you. %s is much worse." + (if (featurep 'windows-nt) "DOS" "UNIX")) + "Ya know, next time you come in here I'm gonna toast ya." + "Go ahead and leave. See if I care." + "Are you sure you want to quit this great editor?" + ; from DOOM 2 + "Get outta here and go back to your boring programs." + "Just leave. When you come back, I'll be waiting with a bat." + "You're lucky I don't smack you for thinking about leaving. " + ; from DOOM Emacs + "(setq nothing t everything 'permitted)" + "Emacs will remember that." + "Emacs, Emacs never changes." + "Hey! Hey, M-x listen!" + "Wake up, Mr. Stallman. Wake up and smell the ashes." + "You are *not* prepared!" + "Please don't go. The drones need you. They look up to you.")) + + (defun random-quit-message () + "Return a randomly chosen quit message from `quit-messages'." + (nth (random (length quit-messages)) quit-messages)) + + (defun message-confirm-kill-emacs (&rest _) + "Prompt the user with a random message before quitting. + Returns t to allow kill if the user answers yes; nil otherwise." + (let* ((msg (random-quit-message)) + (prompt (format "%s Really quit Emacs? " msg))) + (yes-or-no-p (propertize prompt 'face '(italic default))))) + + (setq confirm-kill-emacs #'message-confirm-kill-emacs) +#+end_src + +* Session and Navigation +:PROPERTIES: +:CUSTOM_ID: session-and-navigation +:END: + +** Recent Files +:PROPERTIES: +:CUSTOM_ID: recent-files +:END: +Keep track of recently accessed files with =recentf=. +#+begin_src emacs-lisp + (add-hook 'emacs-startup-hook #'recentf-mode) +#+end_src + +** Save Position +:PROPERTIES: +:CUSTOM_ID: save-position +:END: +Save the location of the cursor in files between sessions. +#+begin_src emacs-lisp + (add-hook 'emacs-startup-hook #'save-place-mode) +#+end_src + +** Minibuffer History +:PROPERTIES: +:CUSTOM_ID: minibuffer-history +:END: +Save the minibuffer history between sessions. +#+begin_src emacs-lisp + (use-package savehist + :hook (after-init . savehist-mode)) +#+end_src + +** Dired +:PROPERTIES: +:CUSTOM_ID: dired +:END: +Configure =dired-mode= so that directories are always copied and deleted recursively, target's for functions are intuited and all files are listed and display human readable metadata. Allow recursive expansion with =TAB= to easily travel directories. +*Packages*: =dired-subtree= by [[https://github.com/Fuco1/dired-hacks/blob/master/dired-subtree.el][Matus Goljer]] +#+begin_src emacs-lisp + (use-package dired + :commands (dired) + :hook + ((dired-mode . dired-hide-details-mode) + (dired-mode . hl-line-mode)) + :config + (setq dired-recursive-copies 'always + dired-recursive-deletes 'always + dired-dwim-target t + dired-listing-switches "-lah")) + + (use-package dired-subtree + :ensure t + :after dired + :bind + (:map dired-mode-map + ("TAB" . (lambda () (interactive) (dired-subtree-toggle) (revert-buffer))) + ("<backtab>" . dired-subtree-remove)) + :config + (setq dired-subtree-use-backgrounds nil)) +#+end_src + +** Buffer List +:PROPERTIES: +:CUSTOM_ID: buffer-list +:END: +Group =project.el= projects together in the =ibuffer=. +*Packages*: =ibuffer-project= by [[https://github.com/muffinmad/emacs-ibuffer-project][Andrii Kolomoiets]] +#+begin_src emacs-lisp + (use-package ibuffer-project + :ensure t + :after project + :config + (add-hook + 'ibuffer-hook + (lambda () + (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups)) + (unless (eq ibuffer-sorting-mode 'project-file-relative) + (ibuffer-do-sort-by-project-file-relative))))) +#+end_src + +** Project Management +:PROPERTIES: +:CUSTOM_ID: project-management +:END: +A transient menu interface for =project.el=. +*Packages*: =disproject= by [[https://github.com/aurtzy/disproject][aurtzy]] +#+begin_src emacs-lisp + (use-package disproject + :ensure t + :after project) +#+end_src + +** EShell +:PROPERTIES: +:CUSTOM_ID: eshell +:END: +Setup the =eshell= prompt to be both visually appealing and useful. +#+begin_src emacs-lisp + (progn ; TODO: Fix this, as is likely completely broken (No Colour) + (dolist (spec + '((eshell-prompt-user-face font-lock-keyword-face "Face for the username in the eshell prompt.") + (eshell-prompt-venv-face font-lock-string-face "Face for the virtualenv name in the eshell prompt.") + (eshell-prompt-dir-face dired-directory "Face for the directory path in the eshell prompt.") + (eshell-prompt-git-face magit-tag "Face for the git branch in the eshell prompt.") + (eshell-prompt-git-dirty-face eshell-prompt-git-face "Face for the git dirty status in the eshell prompt.") + (eshell-prompt-symbol-face font-lock-builtin-face "Face for the prompt symbol in the eshell prompt."))) + (cl-destructuring-bind (name inherit doc) spec + (defface name + `((t (:inherit ,inherit))) + doc + :group 'eshell-prompt))) + + (defun eshell-abbreviate-dir (dir) + "Abbreviate directory to show only the first and the last two components." + (let* ((abbrev (abbreviate-file-name dir)) + (components (split-string abbrev "/" t)) + (num-components (length components))) + (if (>= num-components 4) + (concat (car components) "/.../" + (mapconcat #'identity (last components 2) "/")) + abbrev))) + + (defun eshell-prompt-git-branch () + "Return the current git branch or short commit hash, if available." + (when (and (executable-find "git") + (locate-dominating-file default-directory ".git")) + (with-temp-buffer + (let ((ret (call-process "git" nil t nil "symbolic-ref" "--short" "HEAD"))) + (if (zerop ret) + (string-trim (buffer-string)) + (when (zerop (call-process "git" nil t nil "rev-parse" "--short" "HEAD")) + (string-trim (buffer-string)))))))) + + (defun eshell-prompt-git-dirty () + "Return a dirty flag (✗ if dirty, ✓ if clean) for the git repository." + (when (eshell-prompt-git-branch) + (with-temp-buffer + (call-process "git" nil t nil "status" "--porcelain") + (if (> (buffer-size) 0) "✗" "✓")))) + + (defun eshell-prompt () + "Custom eshell prompt." + (let* ((user (propertize (user-login-name) 'face 'eshell-prompt-user-face)) + (venv (when-let ((venv (getenv "VIRTUAL_ENV"))) + (concat (propertize "(" 'face 'eshell-prompt-venv-face) + (propertize (file-name-nondirectory venv) 'face 'eshell-prompt-venv-face) + (propertize ")" 'face 'eshell-prompt-venv-face)))) + (path (propertize (eshell-abbreviate-dir (eshell/pwd)) 'face 'eshell-prompt-dir-face)) + (git-branch (eshell-prompt-git-branch)) + (git-info (when git-branch + (concat " " (propertize "on" 'face 'font-lock-number-face) " " + (propertize git-branch 'face 'eshell-prompt-git-face) + (propertize (eshell-prompt-git-dirty) 'face 'eshell-prompt-git-dirty-face)))) + (prompt (concat user " " (propertize "in" 'face 'font-lock-number-face) " " + (if venv (concat venv " ") "") + path git-info "\n" + (propertize "λ" 'face 'eshell-prompt-symbol-face) " "))) + prompt)) + + (setq eshell-prompt-function 'eshell-prompt + eshell-prompt-regexp "^[^λ\n]*λ ")) +#+end_src + +** Info Pages +:PROPERTIES: +:CUSTOM_ID: info-pages +:END: +Configuration for =Info-mode= to set the location for local info files. +#+begin_src emacs-lisp + (add-to-list 'Info-directory-list (expand-file-name "~/Documents/Info/")) +#+end_src + +* Completion and LSP +:PROPERTIES: +:CUSTOM_ID: completion-and-lsp +:END: +** Completion Style +:PROPERTIES: +:CUSTOM_ID: completion-style +:END: +Make completion matching much more powerful. +*Packages*: =orderless= by [[https://github.com/oantolin/orderless][Omar Antolín Camarena]] +#+begin_src emacs-lisp + (use-package orderless + :ensure t + :config + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles . (partial-completion))) + (eglot (styles . (orderless)))))) +#+end_src + +** Minibuffer Completion +:PROPERTIES: +:CUSTOM_ID: minibuffer-completion +:END: +Enable powerful minibuffer completion with fuzzy finding. +*Packages*: =vertico= by [[https://github.com/minad/vertico][Daniel Mendler]] +#+begin_src emacs-lisp + (use-package vertico + :ensure t + :hook (after-init . vertico-mode) + :bind (:map vertico-map + ("DEL" . vertico-directory-delete-char))) +#+end_src + +** Completion Annotations +:PROPERTIES: +:CUSTOM_ID: completion-annotations +:END: +Give completions annotations to describe what a function does. +*Packages*: =marginalia= by [[https://github.com/minad/marginalia][Daniel Mendler]] +#+begin_src emacs-lisp + (use-package marginalia + :ensure t + :after vertico consult nerd-icons + :hook + ((emacs-startup . marginalia-mode) + (marginalia-mode . nerd-icons-completion-marginalia-setup))) +#+end_src + +** Consult +:PROPERTIES: +:CUSTOM_ID: consult +:END: +These packages provide replacements for built-in emacs functions that have support for completion. +*Packages*: =consult= by [[https://github.com/minad/consult][Daniel Mendler]] and =affe= also by [[https://github.com/minad/affe][Daniel Mendler]] +#+begin_src emacs-lisp + (use-package consult + :ensure t) + + (use-package affe + :ensure t + :after consult) +#+end_src + +** In-Buffer Completion +:PROPERTIES: +:CUSTOM_ID: in-buffer-completion +:END: +Lightweight completion popup package for an improved auto-completion experience along with Nerd Font icons for symbol representation. +*Packages*: =corfu= by [[https://github.com/minad/corfu][Daniel Mendler]] and =nerd-icons-corfu= by [[https://github.com/LuigiPiucco/nerd-icons-corfu][Luigi Sartor Piucco]] +#+begin_src emacs-lisp + (use-package corfu + :ensure t + :hook (prog-mode eshell-mode markdown-mode comint-mode) + :bind (:map corfu-map + ("TAB" . corfu-insert) + ("<tab>" . corfu-insert) + ("RET" . nil) + ("C-n" . corfu-next) + ("C-p" . corfu-previous) + ("C-g" . corfu-quit)) + :config + (setq corfu-cycle t + corfu-auto t + corfu-auto-delay 0.2 + corfu-preselect 'first + corfu-quit-at-boundary t + corfu-quit-no-match t + corfu-scroll-margin 5 + corfu-tab-always-indent 'complete + corfu-preview-current nil + corfu-min-width 20 + corfu-popupinfo-delay '(1.25 . 0.5) + corfu-on-exact-match nil) + (corfu-popupinfo-mode 1) + (with-eval-after-load 'savehist + (corfu-history-mode 1) + (add-to-list 'savehist-additional-variables 'corfu-history))) + + (use-package nerd-icons-corfu + :ensure t + :after nerd-icons corfu + :config + (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) +#+end_src + +** Snippets +:PROPERTIES: +:CUSTOM_ID: snippets +:END: +Snippet expansion with powerful multi-stage completion along with a collection of common snippets. +*Packages*: =yasnippet= by [[https://joaotavora.github.io/yasnippet/][João Távora]] and =yasnippet-snippets= by [[https://github.com/AndreaCrotti/yasnippet-snippets][Andrea Crotti]] +#+begin_src emacs-lisp + (use-package yasnippet + :ensure t + :hook (prog-mode . yas-minor-mode) + :config + (yas-reload-all)) + + (use-package yasnippet-snippets + :after yasnippet + :ensure t) +#+end_src + +** Completion Extensions +:PROPERTIES: +:CUSTOM_ID: completion-extensions +:END: +Use =cape= to provide =completion-at-point= extensions. +*Packages*: =cape= by [[https://github.com/minad/cape][Daniel Mendler]] +#+begin_src emacs-lisp + (use-package cape + :ensure t + :config + ; TODO find out what the wrap buster actually does (caching or whatever) + (advice-add 'eglot-completion-at-point :around #'cape-wrap-buster)) +#+end_src + +*** YASnippet Capf +:PROPERTIES: +:CUSTOM_ID: yasnippet-capf +:END: +Display =yasnippet= in completions. +*Packages*: =yasnippet-capf= by [[https://github.com/elken/yasnippet-capf][Ellis Kenyő]] +#+begin_src emacs-lisp + (use-package yasnippet-capf + :ensure t + :after cape) +#+end_src + +*** Eglot and YASnippet - Together At Last! +:PROPERTIES: +:CUSTOM_ID: eglot-and-yasnippet---together-at-last +:END: +Combine =eglot= and =yasnippet= into a combined completion function. +#+begin_src emacs-lisp + (defun eglot-capf-with-yasnippet () + (setq-local completion-at-point-functions + (list + (cape-capf-super + #'eglot-completion-at-point + #'yasnippet-capf)))) + (with-eval-after-load 'eglot + (add-hook 'eglot-managed-mode-hook #'eglot-capf-with-yasnippet)) +#+end_src + +** LSP Client +:PROPERTIES: +:CUSTOM_ID: lsp-client +:END: +Use =eglot= as a lightweight interface for LSP servers to enable smart completion, diagnostics and much more within Emacs. +*Packages*: =eglot= by [[https://joaotavora.github.io/eglot/][João Távora]] +#+begin_src emacs-lisp + (use-package eglot + :ensure t + :after cape + :config + ; Disable progress indicator in the modeline + (setq eglot-report-progress nil + eglot-extend-to-xref t)) +#+end_src + +*** Consult Integration +:PROPERTIES: +:CUSTOM_ID: consult-integration +:END: +Jump to workspace symbols from the LSP with a consult interface. +*Packages*: =consult-eglot= by [[https://github.com/mohkale/consult-eglot][Mohsin Kaleem]] +#+begin_src emacs-lisp + (use-package consult-eglot + :ensure t + :after consult eglot) +#+end_src + + +** LSP Booster +:PROPERTIES: +:CUSTOM_ID: lsp-booster +:END: +Use a rust-powered booster to communicate more efficiently between Emacs and the LSP server. The booster can be downloaded from [[https://github.com/blahgeek/emacs-lsp-booster][Yikai Zhao]]. +*Packages*: =eglot-booster= by [[https://github.com/jdtsmith/eglot-booster][JD Smith]] +#+begin_src emacs-lisp + (use-package eglot-booster + :vc (:url "https://github.com/jdtsmith/eglot-booster.git") + :ensure t + :after eglot + :config + ; Use emacs-30's built in JSON handler + (setq eglot-booster-io-only t) + (eglot-booster-mode)) + #+end_src + + +** LSP Transient Menu +:PROPERTIES: +:CUSTOM_ID: lsp-transient-menu +:END: +A menu for =eglot= and related functions for easy access. +#+begin_src emacs-lisp + (require 'transient) + (transient-define-prefix eglot-transient () + "Transient menu for Eglot." + [["Server" + ("c" "Reconnect" eglot-reconnect) + ("C" "Shutdown" eglot-shutdown) + ("I" "Server Info" eglot-show-workspace-configuration)] + ["Navigation" + ("g" "Go to Definition" xref-find-definitions) + ("d" "Describe Thing at Point" eldoc-box-help-at-point) + ("D" "Go to Declaration" eglot-find-declaration) + ("i" "Go to Implementation" eglot-find-implementation) + ("f" "Find References" xref-find-references) + ("t" "Type Definition" eglot-find-typeDefinition) + ("s" "Search Symbols" + (lambda () + (interactive) + (if (eq major-mode 'java-mode) + (call-interactively 'consult-eglot-jdt-symbols) + (call-interactively 'consult-eglot-symbols))))] + ["Code Actions" + ("a" "Code Actions" eglot-code-actions) + ("q" "Quick Fix" eglot-code-action-quickfix) + ("=" "Format Buffer" eglot-format-buffer) + ("o" "Organize Imports" eglot-code-action-organize-imports) + ("r" "Rename Symbol" eglot-rename)] + ["Diagnostics" + ("l" "List Diagnostics" flycheck-list-errors) + ("L" "Project Diagnostics" flymake-show-project-diagnostics)]] + (interactive) + (transient-setup 'eglot-transient)) +#+end_src + +** Documentation Popups +:PROPERTIES: +:CUSTOM_ID: documentation-popups +:END: +View documentation with =eldoc= in a popup, correctly syntax highlighted in =markdown= and limited to only use =eglot= when available. +*Packages*: =eldoc-box= by [[https://github.com/casouri/eldoc-box][Yuan Fu]] and =markdown-mode= by [[https://jblevins.org/projects/markdown-mode/][Jason Blevins]] +#+begin_src emacs-lisp + (use-package markdown-mode + :ensure t) + + (use-package eldoc-box + :ensure t) + ; Follow markdown links inside eldoc boxes on selection + (defun markdown-follow-help-or-link-at-point-advice (orig-fun &rest args) + "Prefer to use the help-echo property as `browse-url' target." + (let* ((event-win (posn-window (event-start last-input-event))) + (help-echo (with-selected-frame (window-frame event-win) + (with-current-buffer (window-buffer event-win) + (get-text-property (point) 'help-echo)))) + (help-is-url (url-type (url-generic-parse-url help-echo)))) + (message "if %s (browse-url %S)" help-is-url help-echo) + (if help-is-url + (browse-url help-echo) + (apply orig-fun args)))) + (advice-add 'markdown-follow-link-at-point :around #'markdown-follow-help-or-link-at-point-advice) + + (add-hook 'eglot-managed-mode-hook + (lambda () + (setq-local eldoc-documentation-functions + (list #'eglot-hover-eldoc-function)))) +#+end_src + +** Diagnostics +:PROPERTIES: +:CUSTOM_ID: diagnostics +:END: +Display diagnostics such as Information, Warnings and Errors within the relevant text buffer and in a separate combined buffer. +*Packages*: =flycheck= by [[https://www.flycheck.org/en/latest/][Bozhidar Batsov and the Flycheck Maintainers]] and =flycheck-eglot= by [[https://github.com/flycheck/flycheck-eglot][Sergey Firsov and the Flycheck Maintainers]] +#+begin_src emacs-lisp + (use-package flycheck + :ensure t + :config + (global-flycheck-mode 1)) + + (use-package flycheck-eglot + :ensure t + :after (flycheck eglot) + :custom (flycheck-eglot-exclusive nil) + :config + (global-flycheck-eglot-mode 1)) +#+end_src + +* Org Mode +:PROPERTIES: +:CUSTOM_ID: org-mode +:END: +** Core Configuration +:PROPERTIES: +:CUSTOM_ID: core-configuration +:END: +Configuration for =org-mode= for code blocks and cleaner looks. +#+begin_src emacs-lisp + ; Open source blocks in the current window + (setq org-src-window-setup 'current-window + ; Don't confirm when evaluating a code block + org-confirm-babel-evaluate nil + ; Make org documents more seamless by hiding markup + org-hide-emphasis-markers t) + + ; Enable a non-monospace font for org documents + (add-hook 'org-mode-hook 'variable-pitch-mode) + ; Enable line wrapping for org documents + (add-hook 'org-mode-hook 'visual-line-mode) +#+end_src + +** Heading Bullets +:PROPERTIES: +:CUSTOM_ID: heading-bullets +:END: +Make the header =*= look like varying bullet points. +*Packages*: =org-superstar= by [[https://github.com/integral-dw/org-superstar-mode][D. Williams]] +#+begin_src emacs-lisp + (use-package org-superstar + :ensure t + :hook (org-mode . org-superstar-mode) + :custom + (org-superstar-remove-leading-stars t) + (org-superstar-headline-bullets-list + '("•" "•" "•" "•" "•"))) +#+end_src + +** Org Tempo Snippets +:PROPERTIES: +:CUSTOM_ID: org-tempo-snippets +:END: +Quick snippets for common org templates. +#+begin_src emacs-lisp + (require 'org-tempo) +#+end_src + +** Link Behaviour +:PROPERTIES: +:CUSTOM_ID: link-behaviour +:END: +Open =org-mode= links in the current window. +#+begin_src emacs-lisp + (setq org-link-frame-setup + '((file . find-file) + (wl . wl-other-frame) + (vm . vm-visit-folder-other-frame) + (gnus . gnus))) +#+end_src + +** Tables of Contents +:PROPERTIES: +:CUSTOM_ID: tables-of-contents +:END: +Generate and update indexes automatically in Org documents. +#+begin_src emacs-lisp + (use-package org-make-toc + :ensure t + :hook org-mode + :custom + (org-make-toc-insert-custom-ids t)) +#+end_src + +** Disable Auto-Indent +:PROPERTIES: +:CUSTOM_ID: disable-auto-indent +:END: +Disable automatic indentation when editing org documents. +#+begin_src emacs-lisp + (add-hook 'org-mode-hook (lambda () (electric-indent-local-mode -1))) +#+end_src + +* Language Support +:PROPERTIES: +:CUSTOM_ID: language-support +:END: +** Lua +:PROPERTIES: +:CUSTOM_ID: lua +:END: +*Packages*: =lua-mode= by [[https://immerrr.github.io/lua-mode/][immerrr]] +#+begin_src emacs-lisp + (use-package lua-mode + :ensure t + :hook eglot-ensure + :config + ; Use a 2 space indent level for formatting + (setq lua-indent-level 2 + ; Use lua 5.4 for documentation + lua-documentation-url "https://www.lua.org/manual/5.4/manual.html")) + + ;; Settings for lua_ls + (add-hook 'lua-mode-hook + (lambda () + (setq-local eglot-workspace-configuration + `(:Lua + (:codeLens (:enable :json-false) + + :completion (:enable t + :callSnippet "Replace" + :autoRequire :json-false + :showWord "Disable" + :postfix "@") + + :diagnostics (:enable t + :disable ["lowercase-global" + "spell-check"] + :severity (:undefined-field "Warning" + :undefined-global "Warning")) + + :format (:enable t) + + :hint (:enable t + :paramName "Disable" + :paramType :json-false) + + :hover (:enable t) + + :runtime (:version "Lua 5.4" + :path ["?.lua" + "?/init.lua" + "./stubs/?.lua" + "./stubs/?/init.lua"]) + + :semantic (:enable :json-false) + + :workspace (:library [,(concat (getenv "HOME") "/.luarocks/share/lua/5.4") + "./stubs"])))))) + + ; TODO Try fix this only for lua-mode as that is where the bug is + (setq eglot-ignored-server-capabilities + '(:documentOnTypeFormattingProvider)) +#+end_src + +** Nix +:PROPERTIES: +:CUSTOM_ID: nix +:END: +*Packages*: =nix-mode= by [[https://github.com/NixOS/nix-mode][The NixOS Maintainers]] +#+begin_src emacs-lisp + (use-package nix-mode + :ensure t + :mode "\\.nix\\'" + :hook eglot-ensure + :config + (add-to-list 'eglot-server-programs '(nix-mode . ("nil")))) +#+end_src + +** C/C++ +:PROPERTIES: +:CUSTOM_ID: cc +:END: +*Packages*: =rmsbolt= by [[https://gitlab.com/jgkamat/rmsbolt][Kay Kamat]] +#+begin_src emacs-lisp + (add-hook 'c++-mode-hook #'eglot-ensure) + (add-hook 'c-mode-hook #'eglot-ensure) + + (setq c-default-style "linux" + c-basic-offset 2) + + (use-package rmsbolt + :ensure t + :custom + (rmsbolt-asm-format nil)) + + (setq gdb-many-windows t + gdb-show-main t) +#+end_src + +** Emacs Lisp +:PROPERTIES: +:CUSTOM_ID: emacs-lisp +:END: +#+begin_src emacs-lisp + (add-hook 'emacs-lisp-mode-hook #'dim-parens-mode) + (add-hook 'emacs-lisp-mode-hook (lambda () (local-set-key (kbd "M-p") #'ignore) + (local-set-key (kbd "M-n") #'ignore))) + + ;; (defun mycommand + ;; (when (and (this-predicate) + ;; (that-predicate)) + ;; (do-something) + ;; (do-some-more) + ;; (a-third-thing))) +#+end_src + +** Common Lisp +:PROPERTIES: +:CUSTOM_ID: common-lisp +:END: +*Packages*: =sly= by [[https://github.com/joaotavora/sly][João Távora]] +#+begin_src emacs-lisp + (use-package sly + :ensure t + :hook ((lisp-mode . dim-parens-mode)) + :bind (:map lisp-mode-map + ("M-p" . ignore) + ("M-n" . ignore)) + :custom + (inferior-lisp-program "ros -Q run")) + + (require 'transient) + (transient-define-prefix lisp-transient () + "Transient menu for Sly." + [["REPL" + ("c" "Connect" sly) + ("C" "Shutdown" sly-quit-lisp) + ("I" "Sly Info" sly-info)] + ["Navigation" + ("g" "Go to Definition" sly-edit-definition) + ("d" "Describe Thing at Point" sly-describe-symbol) + ("f" "Find References" sly-who-references) + ("i" "Inspect Evaluation" sly-inspect) + ("h" "Hyperspec Lookup" hyperspec-lookup) ] + ["Code Actions" + ("a" "Code Actions" eglot-code-actions) + ("q" "Quick Fix" eglot-code-action-quickfix) + ("=" "Format Buffer" eglot-format-buffer) + ("o" "Organize Imports" eglot-code-action-organize-imports) + ("r" "Rename Symbol" eglot-rename) ]] + (interactive) + (transient-setup 'lisp-transient)) +#+end_src + +** Fennel +:PROPERTIES: +:CUSTOM_ID: fennel +:END: +*Packages*: =fennel-mode= by [[https://git.sr.ht/~technomancy/fennel-mode][Phil Hagelberg]] +#+begin_src emacs-lisp + (use-package fennel-mode + :ensure t + :hook ((fennel-mode . fennel-proto-repl-minor-mode) + (fennel-mode . dim-parens-mode) + (fennel-mode . eglot-ensure) + (fennel-repl-mode . dim-parens-mode)) + :bind (:map fennel-mode-map + ("M-p" . ignore) + ("M-n" . ignore))) + + (defun fennel-capf-after-eglot () + (when (derived-mode-p 'fennel-mode) + (setq-local completion-at-point-functions + '(fennel-proto-repl-complete fennel-complete tags-completion-at-point-function)))) + + (add-hook 'eglot-managed-mode-hook #'fennel-capf-after-eglot t) + + (add-hook 'fennel-mode-hook + (lambda () + (push '("lambda" . 955) prettify-symbols-alist))) + + (require 'transient) + (transient-define-prefix fennel-transient () + "Transient menu for Fennel." + [["Server" + ("c" "Reconnect" eglot-reconnect) + ("C" "Shutdown" eglot-shutdown)] + ["Navigation" + ("g" "Go to Definition" xref-find-definitions) + ("d" "Describe Thing at Point" eldoc-box-help-at-point) + ("D" "Print Documentation" fennel-show-documentation) + ("f" "Find References" xref-find-references)] + ["Code Actions" + ("a" "Code Actions" eglot-code-actions) + ("q" "Quick Fix" eglot-code-action-quickfix) + ("=" "Format with fnlfmt" fennel-format) + ("o" "Organize Imports" eglot-code-action-organize-imports) + ("r" "Rename Symbol" eglot-rename)] + ["Diagnostics" + ("l" "List Diagnostics" flycheck-list-errors) + ("L" "Project Diagnostics" flymake-show-project-diagnostics)] + ["REPL" + ("z" "Start Proto REPL" fennel-proto-repl) + ("b" "Eval Buffer" fennel-proto-repl-eval-buffer)]] + (interactive) + (transient-setup 'fennel-transient)) +#+end_src + +** Markdown Notes +:PROPERTIES: +:CUSTOM_ID: markdown-notes +:END: +*Packages*: =zk4e= by [[https://codeberg.org/mcookly/zk-emacs][Maximilian Cook]] and =tomlparse= by [[https://github.com/johannes-mueller/tomlparse.el][Johannes Mueller]] +#+begin_src emacs-lisp + (use-package tomlparse + :ensure t) + + (use-package zk4e + :ensure t + :after tomlparse + :hook (markdown-mode . eglot-ensure) + :vc ( :url "https://codeberg.org/mcookly/zk4e" + :branch "main" + :rev :newest) + :config + (setq zk4e-notebook-directories '(("Notes" . "~/Documents/Notes"))) + (zk4e-select-notebook "Notes") + (add-hook 'zk4e-edit-hook 'zk4e-maybe-name-buffer) + (add-to-list 'eglot-server-programs + '(markdown-mode . ("zk" "lsp")))) +#+end_src + +** COMMENT Markdown Notes (Denote) +*Packages*: =denote=, =denote-org= and =consult-denote= by [[https://protesilaos.com/emacs/denote][Protesilaos]] and =denote-menu= by [[https://www.scss.tcd.ie/~sulimanm/posts/denote-menu.html][Mohamed Suliman]] +#+begin_src emacs-lisp + (use-package denote + :ensure t + :hook (dired-mode . denote-dired-mode) + :config + (setq denote-directory (expand-file-name "~/Documents/Denotes/")) + (denote-rename-buffer-mode 1)) + + (use-package consult-denote + :ensure t + :config + (consult-denote-mode 1)) + + ; TODO: Denote Explore https://lucidmanager.org/productivity/denote-explore/ + + (use-package denote-menu + :ensure t + :config + (add-hook 'denote-menu-mode-hook (lambda () (display-line-numbers-mode -1)))) + + (use-package denote-org + :ensure t) +#+end_src + +* COMMENT Testing +:PROPERTIES: +:CUSTOM_ID: testing +:END: +#+begin_src emacs-lisp +#+end_src + +* Keybindings +:PROPERTIES: +:CUSTOM_ID: keybindings +:END: +This section contains one large =emacs-lisp= block that contains all the custom keybindings for easy reference and modification. +#+begin_src emacs-lisp + (require 'bind-key) + ;; Buffer Begin and End + (bind-key* "C-," 'beginning-of-buffer) + (bind-key* "C-." 'end-of-buffer) + + ;; Regex find and replace + (keymap-global-set "C-c r" 'replace-regexp) + + ;; Recent files + (keymap-global-set "C-x C-r" 'recentf-open) + (which-key-add-key-based-replacements "C-x C-r" "recent-files") + + ;; Compile Mode + (keymap-global-set "C-c m c" 'compile) + (keymap-global-set "C-c m r" 'recompile) + (keymap-global-set "C-c m g" 'rmsbolt) + (which-key-add-key-based-replacements "C-c m" "make") + + ;; Move text up and down + (keymap-global-set "M-p" 'move-text-up) + (keymap-global-set "M-n" 'move-text-down) + + ;; Zen Mode + (keymap-global-set "C-c z" 'olivetti-mode) + + ;; IBuffer + (keymap-global-set "C-x C-b" 'ibuffer) + + ;; Project management + (keymap-set ctl-x-map "p" 'disproject-dispatch) + + ;; Search lines + (keymap-global-set "C-c s" 'consult-line) + (which-key-add-key-based-replacements "C-c s" "search-lines") + + ;; Go to line + (keymap-global-set "M-g M-g" 'consult-goto-line) + (keymap-global-set "M-g g" 'consult-goto-line) + (keymap-global-set "C-c g" 'consult-goto-line) + (which-key-add-key-based-replacements "C-c g" "goto-line") + + ;; Find Files + (keymap-global-set "C-c f f" 'affe-find) + (keymap-global-set "C-c f g" 'affe-grep) + (keymap-global-set "C-c f ." (lambda () (interactive) (affe-find default-directory))) + (which-key-add-key-based-replacements "C-c f ." "affe-find-cwd") + (keymap-global-set "C-c f c" (lambda () (interactive) (find-file "~/.config/emacs/config.org"))) + (which-key-add-key-based-replacements "C-c f c" "find-config") + (keymap-global-set "C-c f t" (lambda () (interactive) (find-file "~/Documents/Notes/TODO.md"))) + (which-key-add-key-based-replacements "C-c f t" "find-todo") + (which-key-add-key-based-replacements "C-c f" "find-file") + + ;; Denote + ;; (keymap-global-set "C-c n n" 'denote) + ;; (keymap-global-set "C-c n N" 'denote-type) + ;; (keymap-global-set "C-c n r" 'denote-rename-file) + ;; (keymap-global-set "C-c n l f" 'denote-link) + ;; (keymap-global-set "C-c n l h" 'denote-org-link-to-heading) + ;; (keymap-global-set "C-c n b" 'denote-backlinks) + ;; (keymap-global-set "C-c n g" 'denote-grep) + ;; (keymap-global-set "C-c n f" 'consult-denote-find) + ;; (keymap-global-set "C-c n d" 'list-denotes) + ;; (which-key-add-key-based-replacements "C-c n" "denotes") + + ;; ZK Notes + (keymap-global-set "C-c n a" 'zk4e-alias) + (keymap-global-set "C-c n e" 'zk4e-edit) + (keymap-global-set "C-c n d" (lambda () (interactive) (zk4e-new "Diario"))) + (which-key-add-key-based-replacements "C-c n d" "zk4e-diario") + (which-key-add-key-based-replacements "C-c n" "zk4e") + + ;; Modus Themes + (keymap-global-set "C-c v t" 'modus-themes-toggle) + (keymap-global-set "C-c v s" 'modus-themes-select) + (which-key-add-key-based-replacements "C-c v" "vivendi-theme") + + ;; Yasnippet + (keymap-global-set "C-c y n" 'yas-new-snippet) + (keymap-global-set "C-c y v" 'yas-visit-snippet-file) + (keymap-global-set "C-c y i" 'yas-insert-snippet) + (which-key-add-key-based-replacements "C-c y" "yasnippets") + + ;; Eglot + (define-key eglot-mode-map (kbd "C-c l") + (lambda () + (interactive) + (cond ((eq major-mode 'fennel-mode) (call-interactively #'fennel-transient)) + (t (call-interactively #'eglot-transient))))) + + ;; Sly + ; INFO: Can't use sly-mode-map because that doesn't get loaded till later on + (define-key lisp-mode-map (kbd "C-c l") (lambda () + (interactive) + (call-interactively #'lisp-transient))) +#+end_src diff --git a/config/emacs/early-init.el b/config/emacs/early-init.el new file mode 100644 index 0000000..8ba547e --- /dev/null +++ b/config/emacs/early-init.el @@ -0,0 +1,9 @@ +;; GC Perfomance Tweaks from DOOM Emacs +(setq gc-cons-threshold most-positive-fixnum + gc-cons-percentage 1.0) +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold (* 128 1024 1024) ;; 128MB + gc-cons-percentage 1.0))) + +(setenv "LSP_USE_PLISTS" "true") diff --git a/.emacs.d/init.el b/config/emacs/init.el index e11d303..e11d303 100644 --- a/.emacs.d/init.el +++ b/config/emacs/init.el diff --git a/config/eza/theme.yml b/config/eza/theme.yml new file mode 100644 index 0000000..f74a128 --- /dev/null +++ b/config/eza/theme.yml @@ -0,0 +1,147 @@ +# Modus Themes for eza +# Auto generated with https://github.com/miikanissi/modus-themes.nvim/blob/master/lua/modus-themes/extras/eza.lua +colourful: true + +# base colors +define: &bg_main "#000000" +define: &bg_dim = "#1e1e1e" +define: &bg_alt = "#0f0f0f" +define: &fg_main = "#ffffff" +define: &fg_dim = "#989898" +define: &fg_alt = "#c6daff" +define: &border = "#646464" +define: &border_highlight = "#C4C4C4" + +# foreground colors +define: &red "#ff5f59" +define: &red_warmer "#ff6b55" +define: &red_cooler "#ff7f9f" +define: &red_faint "#ff9580" +define: &green "#44bc44" +define: &green_warmer "#70b900" +define: &green_cooler "#00c06f" +define: &green_faint "#88ca9f" +define: &yellow "#d0bc00" +define: &yellow_warmer "#fec43f" +define: &yellow_cooler "#dfaf7a" +define: &yellow_faint "#d2b580" +define: &blue "#2fafff" +define: &blue_warmer "#79a8ff" +define: &blue_cooler "#00bcff" +define: &blue_faint "#82b0ec" +define: &magenta "#feacd0" +define: &magenta_warmer "#f78fe7" +define: &magenta_cooler "#b6a0ff" +define: &magenta_faint "#caa6df" +define: &cyan "#00d3d0" +define: &cyan_warmer "#4ae2f0" +define: &cyan_cooler "#6ae4b9" +define: &cyan_faint "#9ac8e0" +define: &rust "#db7b5f" +define: &gold "#c0965b" +define: &olive "#9cbd6f" +define: &slate "#76afbf" +define: &indigo "#9099d9" +define: &maroon "#cf7fa7" +define: &pink "#d09dc0" + +filekinds: + normal: {foreground: *fg_main} + directory: {foreground: *blue_warmer} + symlink: {foreground: *blue} + pipe: {foreground: *fg_dim} + block_device: {foreground: *magenta_cooler} + char_device: {foreground: *yellow_warmer} + socket: {foreground: *magenta} + special: {foreground: *pink} + executable: {foreground: *green} + mount_point: {foreground: *cyan} + +perms: + user_read: {foreground: *fg_dim} + user_write: {foreground: *red} + user_execute_file: {foreground: *green} + user_execute_other: {foreground: *green} + group_read: {foreground: *fg_dim} + group_write: {foreground: *red} + group_execute: {foreground: *green} + other_read: {foreground: *fg_dim} + other_write: {foreground: *red} + other_execute: {foreground: *green} + special_user_file: {foreground: *magenta_cooler} + special_other: {foreground: *red} + attribute: {foreground: *pink} + +size: + major: {foreground: *fg_dim} + minor: {foreground: *blue_warmer} + number_byte: {foreground: *pink} + number_kilo: {foreground: *rust} + number_mega: {foreground: *blue_warmer} + number_giga: {foreground: *magenta_cooler} + number_huge: {foreground: *magenta} + unit_byte: {foreground: *pink} + unit_kilo: {foreground: *rust} + unit_mega: {foreground: *blue_warmer} + unit_giga: {foreground: *magenta_cooler} + unit_huge: {foreground: *magenta} + +users: + user_you: {foreground: *yellow_warmer} + user_root: {foreground: *red} + user_other: {foreground: *magenta_cooler} + group_yours: {foreground: *pink} + group_other: {foreground: *fg_dim} + group_root: {foreground: *red} + +links: + normal: {foreground: *blue} + multi_link_file: {foreground: *cyan} + +git: + new: {foreground: *green} + modified: {foreground: *yellow_warmer} + deleted: {foreground: *red} + renamed: {foreground: *cyan} + typechange: {foreground: *magenta_cooler} + ignored: {foreground: *pink} + conflicted: {foreground: *magenta} + +git_repo: + branch_main: {foreground: *fg_dim} + branch_other: {foreground: *magenta_cooler} + git_clean: {foreground: *green} + git_dirty: {foreground: *red} + +security_context: + colon: {foreground: *fg_dim} + user: {foreground: *blue_warmer} + role: {foreground: *magenta_cooler} + typ: {foreground: *pink} + range: {foreground: *magenta_cooler} + +file_type: + image: {foreground: *yellow_warmer} + video: {foreground: *magenta} + music: {foreground: *blue_warmer} + lossless: {foreground: *cyan} + crypto: {foreground: *pink} + document: {foreground: *fg_dim} + compressed: {foreground: *magenta_cooler} + temp: {foreground: *yellow_warmer} + compiled: {foreground: *cyan} + build: {foreground: *pink} + source: {foreground: *green} + +punctuation: {foreground: *pink} +date: {foreground: *cyan} +inode: {foreground: *fg_dim} +blocks: {foreground: *pink} +header: {foreground: *fg_dim} +octal: {foreground: *blue_warmer} +flags: {foreground: *magenta_cooler} + +symlink_path: {foreground: *blue} +control_char: {foreground: *cyan} +broken_symlink: {foreground: *red} +broken_path_overlay: {foreground: *pink} diff --git a/config/kak/autoload/auto-pairs b/config/kak/autoload/auto-pairs new file mode 160000 +Subproject e812ee6006b1c3d8c9afa45a0a90d28714636f8 diff --git a/config/kak/autoload/fzf.kak b/config/kak/autoload/fzf.kak new file mode 160000 +Subproject 8fcce0c9fcea36d2371877eea4045ac26ad7698 diff --git a/config/kak/autoload/kak-ansi b/config/kak/autoload/kak-ansi new file mode 160000 +Subproject 14feefb47012bb03dcbbbc920cc51f54f4eee4b diff --git a/config/kak/autoload/kak-harpoon b/config/kak/autoload/kak-harpoon new file mode 160000 +Subproject 28e2019d4a619e3a4a14d420177532a82c7903f diff --git a/config/kak/autoload/kakboard b/config/kak/autoload/kakboard new file mode 160000 +Subproject 5759dcc5af593ff88a7faecc41a8f549ec44077 diff --git a/config/kak/autoload/kakoune-focus b/config/kak/autoload/kakoune-focus new file mode 160000 +Subproject d39ee2f1dcf450f5c8b05c6bfda0227e9b985d9 diff --git a/config/kak/autoload/kakoune-state-save b/config/kak/autoload/kakoune-state-save new file mode 160000 +Subproject e8b6c269ac91eab45b0fe0d2b1f5dd49515ecd0 diff --git a/config/kak/autoload/kakoune-sudo-write b/config/kak/autoload/kakoune-sudo-write new file mode 160000 +Subproject ec0d6d26ceaadd93d6824630ba587b31e442214 diff --git a/config/kak/autoload/kakpipe b/config/kak/autoload/kakpipe new file mode 160000 +Subproject 7f29ee36b26cf1a6aab2ceb74a9d46f71de11f2 diff --git a/config/kak/autoload/nanoline.kak b/config/kak/autoload/nanoline.kak new file mode 160000 +Subproject a7c5773e592fbc62341e4f34bf78ee5d0d44c5c diff --git a/config/kak/autoload/standard-library b/config/kak/autoload/standard-library new file mode 120000 index 0000000..24049f7 --- /dev/null +++ b/config/kak/autoload/standard-library @@ -0,0 +1 @@ +/nix/store/kr84jgb3bfca47m0njizy2pi61adh2wk-kakoune-2025.06.03/share/kak/rc \ No newline at end of file diff --git a/config/kak/colemak.kak b/config/kak/colemak.kak new file mode 100644 index 0000000..e4af6ff --- /dev/null +++ b/config/kak/colemak.kak @@ -0,0 +1,38 @@ +map global normal n j +map global normal <a-n> <a-j> +map global normal <a-N> <a-J> +map global normal e k +map global normal i l +map global normal I L +map global normal <a-i> <a-l> +map global normal <a-I> <a-L> + +map global normal j n +map global normal <a-j> <a-n> +map global normal <a-J> <a-N> +map global normal J N +map global normal l i +map global normal <a-l> <a-i> +map global normal <a-L> <a-I> + +map global normal k e +map global normal K E +map global normal <a-e> <a-k> +map global normal <a-k> <a-e> +map global normal <a-E> <a-K> +map global normal <a-K> <a-E> + +# Select whole lines when moving selection with J or K +map global normal N Jx +map global normal E Kx + +# Make I insert before every line +map global normal L "<a-s>I" + +map global goto l '' +map global goto i l -docstring 'line end' +map global goto j '' +map global goto n j -docstring 'buffer bottom' +map global goto e '' +map global goto k '' +map global goto e k -docstring 'buffer top' diff --git a/config/kak/colors/black_mocha.kak b/config/kak/colors/black_mocha.kak new file mode 100644 index 0000000..518400b --- /dev/null +++ b/config/kak/colors/black_mocha.kak @@ -0,0 +1,82 @@ +# Black Mocha + +evaluate-commands %sh{ + rosewater='rgb:f5e0dc' + flamingo='rgb:f2cdcd' + pink='rgb:f5c2e7' + mauve='rgb:cba6f7' + red='rgb:f38ba8' + maroon='rgb:eba0ac' + peach='rgb:fab387' + yellow='rgb:f9e2af' + green='rgb:a6e3a1' + teal='rgb:94e2d5' + sky='rgb:89dceb' + sapphire='rgb:74c7ec' + blue='rgb:89b4fa' + lavender='rgb:b4befe' + text='rgb:cdd6f4' + subtext1='rgb:bac2de' + subtext0='rgb:a6adc8' + overlay2='rgb:9399b2' + overlay1='rgb:7f849c' + overlay0='rgb:6c7086' + surface2='rgb:585b70' + surface1='rgb:45475a' + surface0='rgb:313244' + base='rgb:000000' + mantle='rgb:181825' + crust='rgb:11111b' + + echo " + set-face global title ${text}+b + set-face global header ${subtext0}+b + set-face global bold ${maroon}+b + set-face global italic ${maroon}+i + set-face global mono ${green} + set-face global block ${sapphire} + set-face global link ${blue} + set-face global bullet ${peach} + set-face global list ${peach} + + set-face global Default ${text},${base} + set-face global PrimarySelection ${text},${surface2} + set-face global SecondarySelection ${text},${surface2} + set-face global PrimaryCursor ${crust},${rosewater} + set-face global SecondaryCursor ${text},${overlay0} + set-face global PrimaryCursorEol ${surface2},${lavender} + set-face global SecondaryCursorEol ${surface2},${overlay1} + set-face global LineNumbers ${overlay1},${base} + set-face global LineNumbersWrapped ${base},${base} + set-face global LineNumberCursor ${lavender},${base}+b + set-face global MenuForeground ${text},${surface1}+b + set-face global MenuBackground ${text},${surface0} + set-face global MenuInfo ${crust},${teal} + set-face global Information ${crust},${teal} + set-face global Error ${crust},${red} + set-face global StatusLine ${text},${mantle} + set-face global StatusLineMode ${crust},${yellow} + set-face global StatusLineInfo ${crust},${teal} + set-face global StatusLineValue ${crust},${yellow} + set-face global StatusCursor ${crust},${rosewater} + set-face global Prompt ${teal},${base}+b + set-face global MatchingChar ${maroon},${base} + set-face global Whitespace ${overlay1},${base}+f + set-face global WrapMarker Whitespace + set-face global BufferPadding ${base},${base} + + set-face global value ${peach} + set-face global type ${blue} + set-face global variable ${text} + set-face global module ${maroon} + set-face global function ${blue} + set-face global string ${green} + set-face global keyword ${mauve} + set-face global operator ${sky} + set-face global attribute ${green} + set-face global comment ${overlay0} + set-face global documentation comment + set-face global meta ${yellow} + set-face global builtin ${red} + " +} diff --git a/config/kak/colors/modus-vivendi.kak b/config/kak/colors/modus-vivendi.kak new file mode 100644 index 0000000..32930b9 --- /dev/null +++ b/config/kak/colors/modus-vivendi.kak @@ -0,0 +1,210 @@ +# Modus-Vivendi theme for Kakoune + +# Color palette +# declare-option str black default +declare-option str bg_main 'default' +declare-option str bg_terminal_main 'rgb:000000' +declare-option str fg_main 'rgb:ffffff' +declare-option str bg_dim 'rgb:1e1e1e' +declare-option str fg_dim 'rgb:989898' +declare-option str bg_alt 'rgb:000000' +declare-option str fg_alt 'rgb:c6daff' +declare-option str bg_active 'rgb:535353' +declare-option str bg_inactive 'rgb:303030' +declare-option str red 'rgb:ff5f59' +declare-option str red_bright 'rgb:ff7f86' +declare-option str green 'rgb:44bc44' +declare-option str green_bright 'rgb:00c06f' +declare-option str yellow 'rgb:d0bc00' +declare-option str yellow_bright 'rgb:dfaf7a' +declare-option str blue 'rgb:2fafff' +declare-option str blue_bright 'rgb:00bcff' +declare-option str purple 'rgb:feacd0' +declare-option str purple_bright 'rgb:b6a0ff' +declare-option str bg_mode_line 'rgb:000000' +declare-option str fg_mode_line 'rgb:cdd6f4' +declare-option str cursor 'rgb:ffffff' +declare-option str bg_hl_line 'rgb:2f3849' +declare-option str fg_space 'rgb:646464' +declare-option str magenta_warmer 'rgb:f78fe7' +declare-option str blue_warmer 'rgb:79a8ff' +declare-option str cyan 'rgb:00d3d0' +declare-option str cyan_warmer 'rgb:4ae2f0' +declare-option str cyan_cooler 'rgb:6ae4b9' +declare-option str red_faint 'rgb:ff9580' +declare-option str green_faint 'rgb:88ca9f' +declare-option str yellow_faint 'rgb:d2b580' +declare-option str blue_faint 'rgb:82b0ec' +declare-option str magenta_faint 'rgb:caa6df' +declare-option str cyan_faint 'rgb:9ac8e0' +declare-option str fg_link 'rgb:79a8ff' +declare-option str fg_prose_code 'rgb:6ae4b9' + +declare-option str psel 'rgb:5a5a5a' +declare-option str ssel 'rgb:2f3849' + +# Reference +# https://github.com/mawww/kakoune/blob/master/colors/default.kak +# For code +set-face global value 'rgb:ffffff' +set-face global type 'rgb:6ae4b9' +set-face global variable 'rgb:00d3d0' +set-face global keyword 'rgb:b6a0ff' +set-face global module 'rgb:ffffff' +set-face global function 'rgb:feacd0' +set-face global string 'rgb:79a8ff' +set-face global builtin 'rgb:f78fe7' +set-face global constant 'rgb:00bcff' +set-face global comment 'rgb:989898' +set-face global meta 'rgb:ff7f86' + +set-face global operator 'rgb:ffffff' +set-face global comma 'rgb:ffffff' +set-face global bracket 'rgb:2f7f9f' + +# For markup +set-face global title "%opt{fg_main}+b" +set-face global header "%opt{fg_main}+b" +set-face global bold "%opt{fg_main}+b" +set-face global italic "%opt{fg_main}+i" +set-face global mono "%opt{fg_prose_code}" +set-face global block "%opt{fg_dim}" +set-face global link "%opt{fg_link}+u" +set-face global bullet "%opt{fg_dim}" +set-face global list "%opt{fg_main}" + +# Builtin faces +#set-face global Default "%opt{fg_main},%opt{bg_main}" +set-face global Default "%opt{fg_main},default" +set-face global PrimarySelection "default,%opt{psel}" +set-face global SecondarySelection "default,%opt{ssel}" +set-face global PrimaryCursor "%opt{bg_terminal_main},%opt{cursor}" +set-face global SecondaryCursor "%opt{bg_terminal_main},%opt{fg_alt}" +set-face global PrimaryCursorEol "%opt{bg_terminal_main},%opt{red_bright}" +set-face global SecondaryCursorEol "%opt{bg_terminal_main},%opt{blue}" +set-face global LineNumbers "%opt{fg_dim},%opt{bg_main}" +set-face global LineNumberCursor "%opt{fg_alt},%opt{bg_main}+b" +set-face global LineNumbersWrapped "%opt{bg_dim},%opt{bg_main}+i" +set-face global MenuForeground "%opt{bg_terminal_main},%opt{fg_main}+b" +set-face global MenuBackground "%opt{fg_main},%opt{bg_alt}" +set-face global MenuInfo "%opt{fg_alt},%opt{bg_alt}" +set-face global Information "%opt{fg_mode_line},%opt{bg_mode_line}" +set-face global Error "%opt{red},%opt{bg_mode_line}" +set-face global StatusLine "%opt{fg_mode_line},%opt{bg_mode_line}" +set-face global StatusLineMode "%opt{fg_mode_line},%opt{bg_mode_line}" +set-face global StatusLineInfo "%opt{fg_mode_line},%opt{bg_mode_line}" +set-face global StatusLineValue "%opt{fg_mode_line},%opt{bg_mode_line}" +set-face global StatusCursor "%opt{fg_main},%opt{blue}" +set-face global Prompt "%opt{fg_mode_line},%opt{bg_mode_line}" +set-face global MatchingChar "%opt{blue},%opt{bg_main}" +set-face global Whitespace "%opt{fg_space},%opt{bg_main}+f" +set-face global WrapMarker Whitespace +set-face global BufferPadding "%opt{bg_terminal_main},%opt{bg_main}" + +# For tree-sitter (kak-tree-sitter) +# -- Keywords -- +set-face global ts_keyword "%opt{purple_bright}" +set-face global ts_keyword_conditional "%opt{purple_bright}+i" +set-face global ts_keyword_control_conditional "%opt{purple_bright}+i" +set-face global ts_keyword_control_import "%opt{purple_bright}+i" +set-face global ts_keyword_directive "%opt{red_bright}+i" +set-face global ts_keyword_storage "%opt{purple_bright}" +set-face global ts_keyword_storage_modifier "%opt{purple_bright}" +set-face global ts_keyword_storage_modifier_mut "%opt{purple_bright}" +set-face global ts_keyword_storage_modifier_ref "%opt{cyan_cooler}" + +# -- Functions -- +set-face global ts_function "%opt{purple}" +set-face global ts_function_builtin "%opt{magenta_warmer}+i" +set-face global ts_function_macro "%opt{red_bright}" +set-face global ts_function_method "%opt{purple}" + +# -- Types -- +set-face global ts_type "%opt{cyan_cooler}" +set-face global ts_type_builtin "%opt{cyan_cooler}" +set-face global ts_type_enum_variant "%opt{cyan_warmer}" +set-face global ts_type_parameter "%opt{cyan}+i" +set-face global ts_constructor "%opt{cyan_cooler}" + +# -- Strings -- +set-face global ts_string "%opt{blue_warmer}" +set-face global ts_string_regexp "%opt{green_bright}" +set-face global ts_string_escape "%opt{purple}" +set-face global ts_string_special "%opt{blue}" +set-face global ts_string_special_path "%opt{green_bright}" +set-face global ts_string_special_symbol "%opt{purple_bright}" +set-face global ts_string_symbol "%opt{red_bright}" + +# -- Constants -- +set-face global ts_constant "%opt{blue_bright}" +set-face global ts_constant_builtin "%opt{blue_bright}" +set-face global ts_constant_builtin_boolean "%opt{blue_bright}" +set-face global ts_constant_character "%opt{blue_bright}" +set-face global ts_constant_macro "%opt{red_bright}" +set-face global ts_constant_numeric "%opt{fg_main}" + +# -- Variables -- +set-face global ts_variable "%opt{cyan}" +set-face global ts_variable_builtin "%opt{purple_bright}" +set-face global ts_variable_other_member "%opt{cyan_warmer}" +set-face global ts_variable_parameter "%opt{cyan}+i" + +# -- Comments & operators -- +set-face global ts_comment "%opt{fg_dim}" +set-face global ts_comment_unused "%opt{fg_dim}+s" +set-face global ts_operator "%opt{fg_main}" +set-face global ts_punctuation "%opt{fg_main}" +set-face global ts_punctuation_special "%opt{purple_bright}" + +# -- Properties, namespaces, labels -- +set-face global ts_property "%opt{cyan}" +set-face global ts_namespace "%opt{cyan}+i" +set-face global ts_label "%opt{cyan}+i" +set-face global ts_attribute "%opt{red_bright}" + +# -- Markup -- +set-face global ts_markup_bold "%opt{fg_main}+b" +set-face global ts_markup_italic "%opt{fg_main}+i" +set-face global ts_markup_strikethrough "%opt{fg_dim}+s" +set-face global ts_markup_heading "%opt{fg_main}+b" +set-face global ts_markup_heading_1 "%opt{fg_main}+b" +set-face global ts_markup_heading_2 "%opt{yellow_faint}+b" +set-face global ts_markup_heading_3 "%opt{blue_faint}+b" +set-face global ts_markup_heading_4 "%opt{purple}+b" +set-face global ts_markup_heading_5 "%opt{green_faint}+b" +set-face global ts_markup_heading_6 "%opt{red_faint}+b" +set-face global ts_markup_heading_marker "%opt{fg_dim}" +set-face global ts_markup_list_checked "%opt{fg_dim}" +set-face global ts_markup_list_numbered "%opt{fg_dim}" +set-face global ts_markup_list_unchecked "%opt{fg_dim}" +set-face global ts_markup_list_unnumbered "%opt{fg_dim}" +set-face global ts_markup_link_label "%opt{fg_link}" +set-face global ts_markup_link_url "%opt{fg_alt}" +set-face global ts_markup_link_uri "%opt{fg_alt}" +set-face global ts_markup_link_text "%opt{fg_link}+u" +set-face global ts_markup_quote "%opt{fg_main}+i" +set-face global ts_markup_raw "%opt{fg_prose_code}" + +# -- Diff -- +set-face global ts_diff_plus "%opt{green}" +set-face global ts_diff_minus "%opt{red}" +set-face global ts_diff_delta "%opt{blue}" +set-face global ts_diff_delta_moved "%opt{purple_bright}" + +# -- Diagnostics -- +set-face global ts_error "%opt{red}+b" +set-face global ts_warning "%opt{yellow}+b" +set-face global ts_hint "%opt{blue}+b" +set-face global ts_info "%opt{green}+b" + +# -- Others -- +set-face global ts_embedded "%opt{purple_bright}" +set-face global ts_include "%opt{purple_bright}" +set-face global ts_load "%opt{purple_bright}" +set-face global ts_tag "%opt{purple_bright}" +set-face global ts_tag_error "%opt{red}" +set-face global ts_text "%opt{fg_main}" +set-face global ts_text_title "%opt{fg_main}+b" +set-face global ts_conceal "%opt{fg_dim}+i" +set-face global ts_special "%opt{blue}" +set-face global ts_spell "%opt{fg_main}" diff --git a/config/kak/compilation-mode.kak b/config/kak/compilation-mode.kak new file mode 100644 index 0000000..bdbb5e2 --- /dev/null +++ b/config/kak/compilation-mode.kak @@ -0,0 +1,61 @@ +# Requires kakpipe and unbuffer + +declare-option -docstring "The last command ran in compilation-mode +"\ +str compile_last_command "" + +declare-option -docstring "How the compile buffer should be displayed +Options: + 'default': Create a new buffer in the current kakoune window + 'new': Create a new window via ':terminal' + 'tmux_vertical': Create a tmux vertical split + 'tmux_horizontal': Create a tmux horizontal split + 'tmux_popup': Create a tmux popup window +"\ +str compile_run_mode "default" + +define-command -hidden -params 1.. compile-exec %{ + evaluate-commands %sh{ + case "$kak_opt_compile_run_mode" in + default) + exec kakpipe fifo -s "$kak_session" -- unbuffer "$@" + ;; + new) + printf 'terminal kak -e "set-option global compile_run_mode default; compile %s"\n' "$*" + ;; + tmux_vertical|tmux_horizontal|tmux_popup) + if [ -z "$kak_client_env_TMUX" ]; then + echo 'fail "tmux is not running"' + exit + fi + case "$kak_opt_compile_run_mode" in + tmux_vertical) + tmux_args="split-window -t '${kak_client_env_TMUX_PANE}' -v" + ;; + tmux_horizontal) + tmux_args="split-window -t '${kak_client_env_TMUX_PANE}' -h" + ;; + tmux_popup) + tmux_args="popup -E -t '${kak_client_env_TMUX_PANE}'" + ;; + esac + printf "nop %%sh{ tmux %s kak -e 'set-option global compile_run_mode default; compile %s' }\n" "$tmux_args" "$*" + ;; + esac + } +} + +define-command -docstring "Compile: run a command in a fifo buffer" compile -params 1.. %{ + set-option global compile_last_command "%arg{@}" + compile-exec %arg{@} +} + +define-command -docstring "Recompile: re-run the last compile command" recompile %{ + evaluate-commands %sh{ + if [ -z "$kak_opt_compile_last_command" ]; then + echo 'fail "No previous compile command"' + else + echo "compile-exec $kak_opt_compile_last_command" + fi + } +} diff --git a/config/kak/compilation-mode_classic.kak b/config/kak/compilation-mode_classic.kak new file mode 100644 index 0000000..348fcf0 --- /dev/null +++ b/config/kak/compilation-mode_classic.kak @@ -0,0 +1,20 @@ +# Requires kakpipe and unbuffer + +declare-option str compile_last_command "" + +define-command -docstring "Compile: run a command in a fifo buffer" compile -params 1.. %{ + set-option global compile_last_command "%arg{@}" + evaluate-commands %sh{ exec kakpipe fifo -s $kak_session -- unbuffer "$@" } +} + +define-command -docstring "Recompile: re-run the last compile command" recompile %{ + evaluate-commands %sh{ + if [ -z "$kak_opt_compile_last_command" ]; then + echo 'fail "No previous compile command"' + else + exec kakpipe fifo -s $kak_session -- unbuffer $kak_opt_compile_last_command + fi + } +} + + diff --git a/config/kak/kakrc b/config/kak/kakrc new file mode 100644 index 0000000..06bf35c --- /dev/null +++ b/config/kak/kakrc @@ -0,0 +1,357 @@ +# Venomade's kakrc + + +# ------ +# SOURCE +# ------ + +# Use Colemak keybinds +source ~/.config/kak/colemak.kak +source ~/.config/kak/compilation-mode.kak + + +# ------- +# OPTIONS +# ------- + +# Set tab width +set-option global tabstop 2 +set-option global indentwidth 2 + +# Display line numbers +add-highlighter global/ number-lines -hlcursor + +# Softwrap long lines +add-highlighter global/ wrap -word -indent + +# Set the colorscheme +colorscheme 'modus-vivendi' + +# Move the modeline to the top of the screen +set-option global ui_options terminal_status_on_top=yes + +# Don't show changelog at startup +set-option global startup_info_version 10000000000000 + +# Add scroll margin +set-option global scrolloff 5,5 + +# Use ripgrep instead of grep +set-option global grepcmd 'rg -HUn --no-heading --sort path --vimgrep' + +# Remove trailing whitespace on save +hook -group auto-trim-whitespace global BufWritePre .* %{ try %{ execute-keys -draft \%s\h+$<ret>d } } + +# Disable Clippy +set-option -add global ui_options terminal_assistant=none + +# Disable word completion +set-option global completers filename + +# -------- +# KEYBINDS +# -------- + +# Buffer Keybinds +declare-user-mode buffer-mode +map global user b ':enter-user-mode buffer-mode<ret>' -docstring 'buffer...' +map global buffer-mode d ':delete-buffer<ret>' -docstring 'delete buffer' +map global buffer-mode k ':delete-buffer!<ret>' -docstring 'kill buffer' +map global buffer-mode n ':buffer-next<ret>' -docstring 'next buffer' +map global buffer-mode p ':buffer-previous<ret>' -docstring 'previous buffer' + +# map global buffer-mode b '<esc>:prompt -buffer-completion buffer: %{ buffer %val{text} }<ret>' -docstring 'switch buffer' + +# Comment line +map global normal "#" ":comment-line<ret>" + +# File Keybinds +declare-user-mode file-mode +map global user f ':enter-user-mode file-mode<ret>' -docstring 'file...' +# map global file-mode f '<esc>:prompt -shell-script-candidates %{ fd --type f } file: %{ edit %val{text} }<ret>' -docstring "find file" +map global file-mode c ':e ~/.config/kak/kakrc<ret>' -docstring 'open config' +map global file-mode t ':e ~/Documents/Notes/TODO.md<ret>' -docstring 'open todo' + +# Search case-insensitive by default +map global normal "/" "/(?Si)" +map global normal "?" "?(?Si)" +map global normal "<a-/>" "<a-/>(?Si)" +map global normal "<a-?>" "<a-?>(?Si)" + +# Select inner line +map global normal X x_ + +# Use tab for autocomplete +# hook global InsertCompletionShow .* %{ +# try %{ +# execute-keys -draft 'h<a-K>\h<ret>' +# map window insert <tab> <c-n> +# map window insert <s-tab> <c-p> +# hook -once -always window InsertCompletionHide .* %{ +# unmap window insert <tab> <c-n> +# unmap window insert <s-tab> <c-p> +# } +# } +# } + +# Tab jumps to next snippet placeholder by default in insert mode +map global insert <tab> '<esc>: lsp-snippets-select-next-placeholders<ret>i' +map global insert <s-tab> '<esc>: lsp-snippets-select-next-placeholders<ret>i' # optional reverse + +# When completion menu shows, remap tab to cycle completions — but only if not in a snippet +hook global InsertCompletionShow .* %{ + try %{ + execute-keys -draft 'h<a-K>\h<ret>' + try %{ + eval %sh{ [ -n "${kak_opt_lsp_snippets_placeholder_groups}" ] && echo "fail" } + map window insert <tab> <c-n> + map window insert <s-tab> <c-p> + hook -once -always window InsertCompletionHide .* %{ + unmap window insert <tab> <c-n> + unmap window insert <s-tab> <c-p> + } + } + } +} + +# Map tab and shift-tab to indent and dedent in normal mode +map global normal <tab> '>' +map global normal <s-tab> '<' + +# Terminal related bindings +declare-user-mode terminal-mode +map global user t ':enter-user-mode terminal-mode<ret>' -docstring 'terminal...' +map global terminal-mode t ':terminal zsh<ret>' -docstring 'open terminal' +map global terminal-mode s ':tmux-repl-horizontal <ret>' -docstring 'open terminal split (H)' +map global terminal-mode v ':tmux-repl-vertical<ret>' -docstring 'open terminal split (V)' + +define-command smart-gh \ + -docstring "Smart goto line start." \ +%{ + set-register c %val{cursor_column} + + execute-keys gi + + evaluate-commands %sh{ + orig_col="${kak_reg_c}" + indent_col="${kak_cursor_column}" + + if [ "${orig_col}" -le "${indent_col}" ]; then + echo "execute-keys gh" + fi + } +} + + +map global goto h <esc>:smart-gh<ret> -docstring 'line begin (smart)' + +# Window Management +declare-user-mode window-mode +map global user w ':enter-user-mode window-mode<ret>' -docstring 'window...' +map global window-mode s ':tmux-terminal-horizontal kak -c %val{session}<ret>' -docstring 'open window split (H)' +map global window-mode v ':tmux-terminal-vertical kak -c %val{session}<ret>' -docstring 'open window split (V)' + + +# ------- +# PLUGINS +# ------- + +# Nanoline is a cleaner alternative to the default modeline +set-option global nanoline_rw_face_dark rgb:11111b,rgb:b4befe +nanoline dark +nanoline-format + +# Use auto-pairs +enable-auto-pairs + +# Enable Copy-Paste with kakboard +hook global WinCreate .* %{ kakboard-enable } + +# Load LSP +eval %sh{kak-lsp} + +set-option global modelinefmt "%opt{lsp_modeline} %opt{modelinefmt}" + +map global user l ':enter-user-mode lsp<ret>' -docstring 'lsp...' + +map global goto d <esc>:lsp-definition<ret> -docstring 'LSP definition' +map global goto r <esc>:lsp-references<ret> -docstring 'LSP references' +map global goto y <esc>:lsp-type-definition<ret> -docstring 'LSP type definition' + +map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder' + +map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol' +map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol' +map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method' +map global object t '<a-semicolon>lsp-object Class Interface Module Namespace Struct<ret>' -docstring 'LSP class or module' +map global object d '<a-semicolon>lsp-diagnostic-object error warning<ret>' -docstring 'LSP errors and warnings' +map global object D '<a-semicolon>lsp-diagnostic-object error<ret>' -docstring 'LSP errors' + +hook global WinSetOption lsp_code_action_indicator=.* %{ + set-option window lsp_code_action_indicator "[A]" +} + +hook global WinSetOption lsp_progress_indicator=.* %{ + set-option window lsp_progress_indicator "[P]" +} + +hook global GlobalSetOption lsp_modeline_message_requests=.* %{ + evaluate-commands %sh{ + if [ -n "$kak_hook_param_capture_0" ]; then + echo "set-option global lsp_modeline_message_requests '[M]'" + fi + } +} + +# Save with formatting with :W +define-command W %{ + lsp-formatting-sync + w +} + +set-face global InlayDiagnosticHint 'rgb:444444' + +# FZF + +require-module fzf +set-option global fzf_tmux_popup true +set-option global fzf_tmux_popup_width '80%' +set-option global fzf_default_opts '--color=base16' +set-option global fzf_highlight_command 'bat' +require-module fzf-file +set-option global fzf_file_command 'fd' +require-module fzf-grep +set-option global fzf_grep_command 'rg' + +map global file-mode f ':require-module fzf-file; fzf-file<ret>' -docstring 'find file' +map global file-mode p ':require-module fzf-file; fzf-file buffile-dir<ret>' -docstring 'find file at path' +map global file-mode g ':require-module fzf-grep; fzf-grep<ret>' -docstring 'grep files' +map global file-mode d ':require-module fzf-cd; fzf-cd<ret>' -docstring 'change directory' +map global file-mode / ':require-module fzf-search; fzf-buffer-search<ret>' -docstring 'search current file' + +map global buffer-mode b ':require-module fzf-buffer; fzf-buffer<ret>' -docstring 'switch buffer' + +# map global user F ':fzf-mode<ret>' -docstring 'fzf...' + +# Harpoon +harpoon-add-bindings + +# Kakpipe +require-module kakpipe + +set-option global compile_run_mode 'tmux_horizontal' + +declare-user-mode compile-mode +map global user c ':enter-user-mode compile-mode<ret>' -docstring 'compile...' +map global compile-mode c '<esc>:prompt -shell-completion "compile: " %{ evaluate-commands %sh{ echo "compile $kak_text" } }<ret>' -docstring 'compile' +map global compile-mode r ':recompile<ret>' -docstring 'recompile' + +# Kakoune Focus +declare-user-mode selection-mode +map global user s ':enter-user-mode selection-mode<ret>' -docstring 'selection...' +map global selection-mode f ':focus-toggle<ret>' -docstring "toggle selections focus" + +define-command focus-live-enable %{ + focus-selections + hook -group focus window NormalIdle .* %{ focus-extend } +} +define-command focus-live-disable %{ + remove-hooks window focus + focus-clear +} + + +# --------- +# FILETYPES +# --------- + +# Lua +hook global BufSetOption filetype=lua %{ + set-option buffer lsp_servers %exp{ + # Minimal setup for luals (Lua doesn't really work with LSP, I've tried) + [luals] + filetypes = ["lua"] + root_globs = [".git/", ".luarc.json", ".luarc.jsonc", ".editorconfig", ".kakrc"] + command = "lua-language-server" + + [luals.settings.Lua] + codeLens.enable = false + completion.autoRequire = false # afaik not supported by kakoune + completion.enable = true + completion.callSnippet = "Replace" + completion.showWord = "Disable" + completion.postfix = "@" + diagnostics.enable = true + diagnostics.disable = [ + "lowercase-global", + "spell-check", + ] + format.enable = true + hint.enable = true + hint.paramName = "Disable" + hint.paramType = false + hover.enable = true + runtime.path = [ + "?.lua", + "?/init.lua", + ] + runtime.version = "Lua 5.4" + semantic.enable = false + + [luals.settings.Lua.diagnostics.severity] + undefined-field = "Warning" + undefined-global = "Warning" + + # [emmylua_ls] + # filetypes = ["lua"] + # root_globs = [".git/", ".luarc.json", ".editorconfig", ".kakrc", ".emmyrc.json"] + # command = "emmylua_ls" + } +} + +hook global WinSetOption filetype=lua %{ + add-highlighter window/emmylua_direct regex "---\s*(@(?:alias|as|class|enum|generic|return|type|overload))\s+([^\n]*)" 1:attribute 2:type + add-highlighter window/emmylua_labeled regex "---\s*(@(?:alias|cast|field|param))\s+([a-zA-Z0-9_\?]*) ([^\n]*)" 1:attribute 2:variable 3:type + add-highlighter window/emmylua_enum_variant regex '---\s*\|\s*("[^\n]*")' 1:string +} + +# Markdown +hook global BufSetOption filetype=markdown %{ + set-option buffer lsp_servers %exp{ + [zk_lsp] + filetypes = ["markdown"] + root_globs = [".git/", ".zk/", ".kakrc"] + command = "zk" + args = ["lsp"] + [harper] + filetypes = ["markdown"] + root_globs = [".git/", ".zk/", ".kakrc"] + command = "harper-ls" + args = ["--stdio"] + settings_section = "_" + [harper.settings._.harper-ls] + #isolateEnglish = true # Currently very buggy + dialect = "British" + [harper.settings._.harper-ls.markdown] + IgnoreLinkTitle = true } +} + +# ---- +# MISC +# ---- + +# TODO: Fix this TODO Highlighter +hook -group todohighlight global BufCreate .* %{ + add-highlighter buffer/todo-highlight regex "%opt{comment_line}[ \t]*\b(TODO|FIXME|HACK)\b" 1:default+bu@comment +} + +# Enable LSP (Must come just before settings, after everything else lsp) +lsp-enable + +lsp-diagnostic-lines-disable global +lsp-inlay-diagnostics-enable global +# lsp-inlay-code-lenses-enable global +lsp-inlay-hints-enable global +set-option global lsp_hover_anchor true +# lsp-auto-hover-enable +lsp-auto-signature-help-enable diff --git a/config/kanata/config.kbd b/config/kanata/config.kbd new file mode 100644 index 0000000..a805cf7 --- /dev/null +++ b/config/kanata/config.kbd @@ -0,0 +1,39 @@ +#| +This minimal config changes Caps Lock to act as Caps Lock on quick tap, but +if held, it will act as Left Ctrl. It also changes the backtick/grave key to +act as backtick/grave on quick tap, but change ijkl keys to arrow keys on hold. + +This text between the two pipe+octothorpe sequences is a multi-line comment. +|# + +;; Text after double-semicolons are single-line comments. + +#| +One defcfg entry may be added, which is used for configuration key-pairs. These +configurations change kanata's behaviour at a more global level than the other +configuration entries. +|# + +(defcfg + #| + This configuration will process all keys pressed inside of kanata, even if + they are not mapped in defsrc. This is so that certain actions can activate + at the right time for certain input sequences. By default, unmapped keys are + not processed through kanata due to a Windows issue related to AltGr. If you + use AltGr in your keyboard, you will likely want to follow the simple.kbd + file while unmapping lctl and ralt from defsrc. + |# + process-unmapped-keys yes +) + +(defsrc + caps +) + +(deflayer default + @cap +) + +(defalias + cap (tap-hold 200 200 esc lctl) +) diff --git a/config/lazygit/.gitignore b/config/lazygit/.gitignore new file mode 100644 index 0000000..ace2661 --- /dev/null +++ b/config/lazygit/.gitignore @@ -0,0 +1 @@ +state.yml diff --git a/config/lazygit/config.yml b/config/lazygit/config.yml new file mode 100644 index 0000000..0151f13 --- /dev/null +++ b/config/lazygit/config.yml @@ -0,0 +1,182 @@ +gui: + border: single + +keybinding: + universal: + quit: q + quit-alt1: <c-c> + suspendApp: <c-z> + return: <esc> + quitWithoutChangingDirectory: Q + togglePanel: <tab> + prevItem: <up> + nextItem: <down> + prevItem-alt: e + nextItem-alt: n + prevPage: ',' + nextPage: . + scrollLeft: H + scrollRight: I + gotoTop: < + gotoBottom: '>' + gotoTop-alt: <home> + gotoBottom-alt: <end> + toggleRangeSelect: v + rangeSelectDown: <s-down> + rangeSelectUp: <s-up> + prevBlock: <left> + nextBlock: <right> + prevBlock-alt: h + nextBlock-alt: i + nextBlock-alt2: <tab> + prevBlock-alt2: <backtab> + jumpToBlock: + - "1" + - "2" + - "3" + - "4" + - "5" + focusMainView: "0" + nextMatch: "k" + prevMatch: "K" + startSearch: / + optionMenu: <disabled> + optionMenu-alt1: '?' + select: <space> + goInto: <enter> + confirm: <enter> + confirmMenu: <enter> + confirmSuggestion: <enter> + confirmInEditor: <a-enter> + confirmInEditor-alt: <c-s> + remove: d + new: "n" + edit: j + openFile: o + scrollUpMain: <pgup> + scrollDownMain: <pgdown> + scrollUpMain-alt1: E + scrollDownMain-alt1: N + scrollUpMain-alt2: <c-u> + scrollDownMain-alt2: <c-d> + executeShellCommand: ':' + createRebaseOptionsMenu: m + + # 'Files' appended for legacy reasons + pushFiles: P + + # 'Files' appended for legacy reasons + pullFiles: p + refresh: R + createPatchOptionsMenu: <c-p> + nextTab: ']' + prevTab: '[' + nextScreenMode: + + prevScreenMode: _ + cyclePagers: '|' + undo: z + redo: Z + filteringMenu: <c-s> + diffingMenu: W + diffingMenu-alt: <c-j> + copyToClipboard: <c-o> + openRecentRepos: <c-r> + submitEditorText: <enter> + extrasMenu: '@' + toggleWhitespaceInDiffView: <c-w> + increaseContextInDiffView: '}' + decreaseContextInDiffView: '{' + increaseRenameSimilarityThreshold: ) + decreaseRenameSimilarityThreshold: ( + openDiffTool: <c-t> + status: + checkForUpdate: u + recentRepos: <enter> + allBranchesLogGraph: a + files: + commitChanges: c + commitChangesWithoutHook: w + amendLastCommit: A + commitChangesWithEditor: C + findBaseCommitForFixup: <c-f> + confirmDiscard: x + ignoreFile: l + refreshFiles: r + stashAllChanges: s + viewStashOptions: S + toggleStagedAll: a + viewResetOptions: D + fetch: f + toggleTreeView: '`' + openMergeOptions: M + openStatusFilter: <c-b> + copyFileInfoToClipboard: "y" + collapseAll: '-' + expandAll: = + branches: + createPullRequest: o + viewPullRequestOptions: O + copyPullRequestURL: <c-y> + checkoutBranchByName: c + forceCheckoutBranch: F + checkoutPreviousBranch: '-' + rebaseBranch: r + renameBranch: R + mergeIntoCurrentBranch: M + moveCommitsToNewBranch: "K" + viewGitFlowOptions: l + fastForward: f + createTag: T + pushTag: P + setUpstream: u + fetchRemote: f + addForkRemote: F + sortOrder: s + worktrees: + viewWorktreeOptions: w + commits: + squashDown: s + renameCommit: r + renameCommitWithEditor: R + viewResetOptions: g + markCommitAsFixup: f + setFixupMessage: c + createFixupCommit: F + squashAboveCommits: S + moveDownCommit: <c-n> + moveUpCommit: <c-e> + amendToCommit: A + resetCommitAuthor: a + pickCommit: p + revertCommit: t + cherryPickCopy: C + pasteCommits: V + markCommitAsBaseForRebase: B + tagCommit: T + checkoutCommit: <space> + resetCherryPick: <c-R> + copyCommitAttributeToClipboard: "y" + openLogMenu: <c-l> + openInBrowser: o + viewBisectOptions: b + startInteractiveRebase: l + selectCommitsOfCurrentBranch: '*' + amendAttribute: + resetAuthor: a + setAuthor: A + addCoAuthor: c + stash: + popStash: g + renameStash: r + commitFiles: + checkoutCommitFile: c + main: + toggleSelectHunk: a + pickBothHunks: b + editSelectHunk: J + submodules: + init: l + update: u + bulkMenu: b + commitMessage: + commitMenu: <c-o> diff --git a/config/nvim/.gitignore b/config/nvim/.gitignore new file mode 100644 index 0000000..e033bc6 --- /dev/null +++ b/config/nvim/.gitignore @@ -0,0 +1 @@ +lazy-lock.json diff --git a/config/nvim/.luarc.json b/config/nvim/.luarc.json new file mode 100644 index 0000000..d6288ee --- /dev/null +++ b/config/nvim/.luarc.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "Lua.runtime.version": "LuaJIT", + "workspace.checkThirdParty": false, + "workspace.library": [ + "$VIMRUNTIME" + ], + "Lua.diagnostics.enable": true, + "Lua.format.defaultConfig": { + "indent_style": "space", + "indent_size": "2" + }, + "typeFormat.config": false, + "completion.callSnippet": "Replace", + "completion.showWord": "Disable", + "completion.workspaceWord": false +} diff --git a/config/nvim/ftplugin/markdown.lua b/config/nvim/ftplugin/markdown.lua new file mode 100644 index 0000000..4f658e4 --- /dev/null +++ b/config/nvim/ftplugin/markdown.lua @@ -0,0 +1,10 @@ +vim.keymap.set('n', 'n', 'gj', { buffer = true, noremap = true }) +vim.keymap.set('n', 'e', 'gk', { buffer = true, noremap = true }) + +vim.opt_local.wrap = true +vim.opt_local.linebreak = true + +vim.opt_local.number = false +vim.opt_local.relativenumber = false + +vim.treesitter.start(vim.api.nvim_get_current_buf(), 'markdown') diff --git a/config/nvim/init.lua b/config/nvim/init.lua new file mode 100644 index 0000000..4b53a96 --- /dev/null +++ b/config/nvim/init.lua @@ -0,0 +1,10 @@ +-- Setup Config +require("config.colemak") +require("config.options") +require("config.keymaps") + +-- Setup Lazy Plugin Manager +require("manager") + +-- Test Script +require("scripts") diff --git a/config/nvim/lua/config/colemak.lua b/config/nvim/lua/config/colemak.lua new file mode 100644 index 0000000..e6ce33b --- /dev/null +++ b/config/nvim/lua/config/colemak.lua @@ -0,0 +1,32 @@ +local function map(mode, lhs, rhs, opts) + local options = { noremap = true, silent = true } + if opts then + options = vim.tbl_extend("force", options, opts) + end + vim.keymap.set(mode, lhs, rhs, options) +end + +map("", "n", "j") +map("", "e", "k") +map("", "i", "l") +map("", "j", "n") +map("", "k", "e") +map("", "l", "i") +map("", "K", "E") +map("", "N", "J") +map("", "E", "K") -- As in 'Explore' documentation +map("", "L", "I") +map("", "I", "L") +map("", "J", "N") + +map("n", "<c-w>h", "<c-w>h") +map("n", "<c-w>n", "<c-w>j") +map("n", "<c-w>e", "<c-w>k") +map("n", "<C-w>i", "<c-w>l") + +map ("", "gn", "gj") +map ("", "ge", "gk") + +-- Kakoune Holdover +map ("", "gh", "0") +map ("", "gi", "$") diff --git a/config/nvim/lua/config/keymaps.lua b/config/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..514a311 --- /dev/null +++ b/config/nvim/lua/config/keymaps.lua @@ -0,0 +1,53 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "<leader>bk", vim.cmd.bdelete, + { desc = "Kill Buffer" }) +vim.keymap.set("n", "<leader>bn", vim.cmd.bnext, + { desc = "Next Buffer" }) +vim.keymap.set("n", "<leader>bp", vim.cmd.bprev, + { desc = "Previous Buffer" }) + +vim.keymap.set("n", "E", vim.lsp.buf.hover) +vim.keymap.set("n", "<C-e>", vim.diagnostic.open_float) +vim.keymap.set("n", "<leader>ld", vim.lsp.buf.definition, + { desc = "Go to Definition" }) +vim.keymap.set("n", "<leader>lt", vim.lsp.buf.type_definition, + { desc = "Go to Type Definition"} ) +vim.keymap.set("n", "<leader>li", vim.lsp.buf.implementation, + { desc = "Go to Implementation" }) +vim.keymap.set("n", "<leader>la", vim.lsp.buf.code_action, + { desc = "Show Code Actions" }) +vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format, + { desc = "Format Document" }) +vim.keymap.set("n", "<leader>lr", vim.lsp.buf.rename, + { desc = "Rename" }) +vim.keymap.set("n", "<leader>lk", function() + vim.diagnostic.jump({ count = 1, float = true }) +end, + { desc = "Next Error" }) +-- vim.keymap.set("n", "<leader>lh", vim.lsp.buf.hover, +-- { desc = "Hover Diagnostics" }) + +vim.keymap.set("n", "<leader>wh", vim.cmd.split, + { desc = "Split Window Horizontally" }) +vim.keymap.set("n", "<leader>wv", vim.cmd.vsplit, + { desc = "Split Window Vertically" }) +vim.keymap.set("n", "<leader>wc", "<C-w>q", + { desc = "Close Window" }) +vim.keymap.set("n", "<leader>ww", "<C-w>w", + { desc = "Next Window" }) + +vim.keymap.set("n", "<leader>foc", function() + vim.cmd('edit ~/.config/nvim/init.lua') +end, { desc = "Open Config File" }) + +vim.keymap.set("n", "<leader>fot", function() + vim.cmd('edit ~/Documents/TODO.org') +end, { desc = "Open Todo File" }) + +vim.keymap.set("n", "<leader>fon", function() + vim.cmd('edit ~/Documents/Notes.org') +end, { desc = "Open Notes File" }) + +vim.keymap.set('n', '<Tab>', '==', { noremap = true, silent = true }) + +vim.keymap.set('n', 'q:', ':q<CR>', { noremap = true }) diff --git a/config/nvim/lua/config/options.lua b/config/nvim/lua/config/options.lua new file mode 100644 index 0000000..f7bc9d8 --- /dev/null +++ b/config/nvim/lua/config/options.lua @@ -0,0 +1,107 @@ +vim.opt.nu = true +vim.opt.rnu = true + +vim.opt.tabstop = 2 +vim.opt.softtabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.autoindent = true + +vim.opt.smartindent = true + +vim.opt.wrap = false + +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undodir = os.getenv("HOME") .. "/.nvim/undodir" +vim.opt.undofile = true + +vim.opt.hlsearch = false +vim.opt.incsearch = true + +vim.opt.termguicolors = true + +vim.opt.scrolloff = 12 + +vim.opt.updatetime = 50 + +vim.opt.splitbelow = true +vim.opt.splitright = true + +vim.opt.encoding = "utf-8" + +vim.opt.shell = "zsh" + +vim.opt.mouse = "a" + +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.incsearch = true + +-- vim.opt.cursorline = true + +vim.opt.title = true + +vim.opt.clipboard = "unnamedplus" + +-- vim.opt.colorcolumn = "80" + +vim.opt.signcolumn = 'no' + +vim.cmd "set showtabline=0 | set laststatus=0" + +vim.wo.fillchars='eob: ' + +vim.opt.conceallevel = 3 + +-- Window Borders +vim.o.winborder = 'rounded' + +-- Remove Whitespaces on File Save +vim.api.nvim_create_autocmd({ "BufWritePre" }, { + pattern = { "*" }, + command = [[%s/\s\+$//e]], +}) + +-- Define highlight groups for line numbers with diagnostics +vim.api.nvim_set_hl(0, "LineNrDiagnosticError", { bg = "#3f1d1d", fg = "#ff6c6b" }) +vim.api.nvim_set_hl(0, "LineNrDiagnosticWarn", { bg = "#3f311d", fg = "#ECBE7B" }) +vim.api.nvim_set_hl(0, "LineNrDiagnosticInfo", { bg = "#1d2d3f", fg = "#51afef" }) +vim.api.nvim_set_hl(0, "LineNrDiagnosticHint", { bg = "#1d3f2d", fg = "#98be65" }) + +local function set_line_number_highlight() + -- Clear existing highlights + vim.fn.sign_unplace("LineNrDiagnostics") + + -- Get diagnostics per buffer + for _, diag in ipairs(vim.diagnostic.get(0)) do + local hl_group = nil + if diag.severity == vim.diagnostic.severity.ERROR then + hl_group = "LineNrDiagnosticError" + elseif diag.severity == vim.diagnostic.severity.WARN then + hl_group = "LineNrDiagnosticWarn" + elseif diag.severity == vim.diagnostic.severity.INFO then + hl_group = "LineNrDiagnosticInfo" + elseif diag.severity == vim.diagnostic.severity.HINT then + hl_group = "LineNrDiagnosticHint" + end + + if hl_group then + vim.fn.sign_place(0, "LineNrDiagnostics", hl_group, vim.api.nvim_get_current_buf(), { + lnum = diag.lnum + 1, -- diagnostics are 0-indexed + priority = 10, + }) + end + end +end + +-- Create the sign definitions +vim.fn.sign_define("LineNrDiagnosticError", { text = "", texthl = "LineNrDiagnosticError", numhl = "LineNrDiagnosticError" }) +vim.fn.sign_define("LineNrDiagnosticWarn", { text = "", texthl = "LineNrDiagnosticWarn", numhl = "LineNrDiagnosticWarn" }) +vim.fn.sign_define("LineNrDiagnosticInfo", { text = "", texthl = "LineNrDiagnosticInfo", numhl = "LineNrDiagnosticInfo" }) +vim.fn.sign_define("LineNrDiagnosticHint", { text = "", texthl = "LineNrDiagnosticHint", numhl = "LineNrDiagnosticHint" }) + +-- Update line numbers when diagnostics change +vim.api.nvim_create_autocmd({ "DiagnosticChanged", "BufEnter", "CursorHold" }, { + callback = set_line_number_highlight, +}) diff --git a/config/nvim/lua/manager.lua b/config/nvim/lua/manager.lua new file mode 100644 index 0000000..f450d31 --- /dev/null +++ b/config/nvim/lua/manager.lua @@ -0,0 +1,26 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +require("lazy").setup({ + spec = { + { import = "plugins" }, + }, + install = { colorscheme = { "modus" } }, + checker = { enabled = true, notify = false }, +}) diff --git a/config/nvim/lua/plugins/autopairs.lua b/config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..c37e301 --- /dev/null +++ b/config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,8 @@ +return { + "windwp/nvim-autopairs", + config = function() + require("nvim-autopairs").setup({ + disable_filetype = { "TelescopePrompt" , "vim" } + }) + end, +} diff --git a/config/nvim/lua/plugins/catppuccin.lua b/config/nvim/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..9b09225 --- /dev/null +++ b/config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,15 @@ +return { + 'catppuccin/nvim', + name = 'catppuccin', + priority = 1000, + config = function() + require('catppuccin').setup({ + flavour = 'mocha', + transparent_background = true, + float = { + transparent = true, + }, + }) + vim.cmd.colorscheme('catppuccin') + end, +} diff --git a/config/nvim/lua/plugins/cmp.lua b/config/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..69a2396 --- /dev/null +++ b/config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,99 @@ +return { + 'hrsh7th/nvim-cmp', + dependencies = { + 'neovim/nvim-lspconfig', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'lukas-reineke/cmp-rg', + 'onsails/lspkind.nvim' + }, + config = function() + local cmp = require('cmp') + local lspkind = require('lspkind') + cmp.setup({ + -- preselect = cmp.PreselectMode.None, + completion = { + completeopt = "menu,menuone,noinsert", + callSnippet = "Replace", + keywordSnippet = "Replace", + }, + window = { + completion = cmp.config.window.bordered({}), + documentation = cmp.config.window.bordered({}), + }, + snippet = { + expand = function(arg) + vim.snippet.expand(arg.body) + end + }, + mapping = cmp.mapping.preset.insert({ + ['<Tab>'] = cmp.mapping.confirm({ select = true }), + ['<C-n>'] = cmp.mapping.select_next_item(), + ['<C-p>'] = cmp.mapping.select_prev_item(), + ['<C-g>'] = cmp.mapping.abort(), + }), + sources = cmp.config.sources( + { + { name = 'nvim_lsp' }, + }, + { + { name = 'path' }, + } + -- { + -- { name = 'buffer' }, + -- { name = 'rg', keyword_length = 3 } + -- } + ), + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol' + }) + }, + -- view = { + -- entries = 'native' + -- }, + }) + + local capabilities = require('cmp_nvim_lsp').default_capabilities() + vim.lsp.config('lua_ls', { + -- cmd = { '/home/venomade/.local/share/lua-language-server/bin/lua-language-server' }, + capabilities = capabilities, + root_markers = { + ".luarc.json", + ".luarc.jsonc", + ".git", + }, + settings = { + Lua = { + runtime = { + version = 'Lua 5.4', + path = vim.list_extend( + vim.split(package.path, ';'), + { + '?.lua', + '?/init.lua', + './stubs/?.lua', + './stubs/?/init.lua' + }), + }, + workspace = { + library = { + vim.env.HOME .. '/.luarocks/share/lua/5.4', + './stubs' + }, + }, + diagnostics = { + enable = true, + }, + }, + }, + }) + + vim.lsp.enable('lua_ls') + vim.lsp.config('clangd', { + capabilities = capabilities + }) + vim.lsp.enable('clangd') + end +} diff --git a/config/nvim/lua/plugins/colorizer.lua b/config/nvim/lua/plugins/colorizer.lua new file mode 100644 index 0000000..460eb5c --- /dev/null +++ b/config/nvim/lua/plugins/colorizer.lua @@ -0,0 +1,15 @@ +return { + 'norcalli/nvim-colorizer.lua', + config = function() + require("colorizer").setup({ "*" }, { + RGB = true, + RRGGBB = true, + names = false, + RRGGBBAA = true, + rgb_fn = true, + hsl_fn = true, + css = false, + css_fn = false, + }) + end +} diff --git a/config/nvim/lua/plugins/compile.lua b/config/nvim/lua/plugins/compile.lua new file mode 100644 index 0000000..8d824de --- /dev/null +++ b/config/nvim/lua/plugins/compile.lua @@ -0,0 +1,20 @@ +return { + "ej-shafran/compile-mode.nvim", + branch = "latest", + dependencies = { + "nvim-lua/plenary.nvim", + }, + config = function() + vim.g.compile_mode = {} + + local compile_mode = require("compile-mode") + + vim.keymap.set("n", "<leader>cc", compile_mode.compile, + { desc = "Compile" }) + vim.keymap.set("n", "<leader>cr", compile_mode.recompile, + { desc = "Recompile" }) + vim.keymap.set("n", "<leader>cq", compile_mode.interrupt, + { desc = "Quit Compile (Interrupt)" }) + + end +} diff --git a/config/nvim/lua/plugins/image.lua b/config/nvim/lua/plugins/image.lua new file mode 100644 index 0000000..1ab0f9a --- /dev/null +++ b/config/nvim/lua/plugins/image.lua @@ -0,0 +1,20 @@ +return { + '3rd/image.nvim', + config = function() + require("image").setup({ + backend = "sixel", + processor = "magick_cli", + integrations = { + markdown = { + enabled = true, + only_render_image_at_cursor = true, + only_render_image_at_cursor_mode = "popup", -- or "inline" + floating_windows = true, -- if true, images will be rendered in floating markdown windows + }, + }, + window_overlap_clear_ft_ignore = { "cmp_menu", "cmp_docs" }, + editor_only_render_when_focused = true, -- auto show/hide images when the editor gains/looses focus + }) + end, + build = false, +} diff --git a/config/nvim/lua/plugins/lazygit.lua b/config/nvim/lua/plugins/lazygit.lua new file mode 100644 index 0000000..f9ddc84 --- /dev/null +++ b/config/nvim/lua/plugins/lazygit.lua @@ -0,0 +1,20 @@ +return { + "kdheepak/lazygit.nvim", + lazy = true, + cmd = { + "LazyGit", + "LazyGitConfig", + "LazyGitCurrentFile", + "LazyGitFilter", + "LazyGitFilterCurrentFile", + }, + -- optional for floating window border decoration + dependencies = { + "nvim-lua/plenary.nvim", + }, + -- setting the keybinding for LazyGit with 'keys' is recommended in + -- order to load the plugin when the command is run for the first time + keys = { + { "<leader>g", "<cmd>LazyGit<cr>", desc = "LazyGit" } + } +} diff --git a/config/nvim/lua/plugins/lualine.lua b/config/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..5412061 --- /dev/null +++ b/config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,38 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require("lualine").setup({ + options = { + icons_enabled = true, + component_separators = { left = '|', right = '|'}, + section_separators = { left = '', right = ''}, + theme = { + normal = { + a = { bg = '#000000' }, + b = { bg = '#000000' }, + c = { bg = '#000000' }, + }, + inactive = { + a = { bg = '#000000' }, + b = { bg = '#000000' }, + c = { bg = '#000000' }, + } + }, + }, + sections = { + lualine_a = {"mode", { + "filetype", + icon_only = true, + separator = "", + padding = { right = 0, left = 1 }, + }, "filename" }, + lualine_b = {}, + lualine_c = {}, + lualine_x = {"diagnostics"}, + lualine_y = {}, + lualine_z = {} + } + }) + end, +} diff --git a/config/nvim/lua/plugins/oil.lua b/config/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..3eb396d --- /dev/null +++ b/config/nvim/lua/plugins/oil.lua @@ -0,0 +1,28 @@ +return { + 'stevearc/oil.nvim', + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + + function _G.get_oil_winbar() + local bufnr = vim.api.nvim_win_get_buf(vim.g.statusline_winid) + local dir = require("oil").get_current_dir(bufnr) + if dir then + return vim.fn.fnamemodify(dir, ":~") + else + -- If there is no current directory (e.g. over ssh), just show the buffer name + return vim.api.nvim_buf_get_name(0) + end + end + + require('oil').setup({ + win_options = { + winbar = "%!v:lua.get_oil_winbar()", + }, + view_options = { + show_hidden = true + } + }) + vim.keymap.set('n', '-', '<CMD>Oil<CR>', {desc = "Open Dir in Oil"}) + end, + lazy = false, +} diff --git a/config/nvim/lua/plugins/rainbow-delimiters.lua b/config/nvim/lua/plugins/rainbow-delimiters.lua new file mode 100644 index 0000000..9fe4a06 --- /dev/null +++ b/config/nvim/lua/plugins/rainbow-delimiters.lua @@ -0,0 +1,6 @@ +return { + "hiphish/rainbow-delimiters.nvim", + config = function() + require('rainbow-delimiters.setup').setup({}) + end, +} diff --git a/config/nvim/lua/plugins/remember.lua b/config/nvim/lua/plugins/remember.lua new file mode 100644 index 0000000..911d9c6 --- /dev/null +++ b/config/nvim/lua/plugins/remember.lua @@ -0,0 +1,7 @@ +return { + 'vladdoster/remember.nvim', + config = function() + require'remember'.setup({}) + end +} + diff --git a/config/nvim/lua/plugins/render-markdown.lua b/config/nvim/lua/plugins/render-markdown.lua new file mode 100644 index 0000000..b87f8a1 --- /dev/null +++ b/config/nvim/lua/plugins/render-markdown.lua @@ -0,0 +1,114 @@ +return { + 'MeanderingProgrammer/render-markdown.nvim', + dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, + config = function() + require('render-markdown').setup({ + link = { + enabled = true, + render_modes = false, + footnote = { + enabled = true, + superscript = true, + prefix = '', + suffix = '', + }, + image = ' ', + email = ' ', + hyperlink = ' ', + highlight = 'RenderMarkdownLink', + wiki = { + icon = ' ', + body = function() + return nil + end, + highlight = 'RenderMarkdownWikiLink', + }, + custom = { + web = { pattern = '^http', icon = ' ' }, + github = { pattern = 'github%.com', icon = ' ' }, + stackoverflow = { pattern = 'stackoverflow%.com', icon = ' ' }, + wikipedia = { pattern = 'wikipedia%.org', icon = ' ' }, + youtube = { pattern = 'youtube%.com', icon = ' ' }, + reddit = { pattern = 'reddit%.com', icon = ' ' }, + old_reddit = { pattern = 'old.reddit%.com', icon = ' ' }, + gvc = { pattern = 'git%.venomade%.com', icon = ' ' }, + catechism = { pattern = 'ccc%.directory', icon = ' ' }, + bible = { pattern = 'biblenow%.net', icon = ' ' }, + luarocks = { pattern = 'luarocks%.org', icon = ' ' }, + }, + }, + callout = { + note = { raw = '[!NOTE]', rendered = ' Note', highlight = 'RenderMarkdownInfo' }, + tip = { raw = '[!TIP]', rendered = ' Tip', highlight = 'RenderMarkdownSuccess' }, + important = { raw = '[!IMPORTANT]', rendered = ' Important', highlight = 'RenderMarkdownHint' }, + warning = { raw = '[!WARNING]', rendered = ' Warning', highlight = 'RenderMarkdownWarn' }, + caution = { raw = '[!CAUTION]', rendered = ' Caution', highlight = 'RenderMarkdownError' }, + abstract = { raw = '[!ABSTRACT]', rendered = ' Abstract', highlight = 'RenderMarkdownInfo' }, + summary = { raw = '[!SUMMARY]', rendered = ' Summary', highlight = 'RenderMarkdownInfo' }, + tldr = { raw = '[!TLDR]', rendered = ' Tldr', highlight = 'RenderMarkdownInfo' }, + info = { raw = '[!INFO]', rendered = ' Info', highlight = 'RenderMarkdownInfo' }, + todo = { raw = '[!TODO]', rendered = ' Todo', highlight = 'RenderMarkdownInfo' }, + hint = { raw = '[!HINT]', rendered = ' Hint', highlight = 'RenderMarkdownSuccess' }, + success = { raw = '[!SUCCESS]', rendered = ' Success', highlight = 'RenderMarkdownSuccess' }, + check = { raw = '[!CHECK]', rendered = ' Check', highlight = 'RenderMarkdownSuccess' }, + done = { raw = '[!DONE]', rendered = ' Done', highlight = 'RenderMarkdownSuccess' }, + question = { raw = '[!QUESTION]', rendered = ' Question', highlight = 'RenderMarkdownWarn' }, + help = { raw = '[!HELP]', rendered = ' Help', highlight = 'RenderMarkdownWarn' }, + faq = { raw = '[!FAQ]', rendered = ' Faq', highlight = 'RenderMarkdownWarn' }, + attention = { raw = '[!ATTENTION]', rendered = ' Attention', highlight = 'RenderMarkdownWarn' }, + failure = { raw = '[!FAILURE]', rendered = ' Failure', highlight = 'RenderMarkdownError' }, + fail = { raw = '[!FAIL]', rendered = ' Fail', highlight = 'RenderMarkdownError' }, + missing = { raw = '[!MISSING]', rendered = ' Missing', highlight = 'RenderMarkdownError' }, + danger = { raw = '[!DANGER]', rendered = ' Danger', highlight = 'RenderMarkdownError' }, + error = { raw = '[!ERROR]', rendered = ' Error', highlight = 'RenderMarkdownError' }, + bug = { raw = '[!BUG]', rendered = ' Bug', highlight = 'RenderMarkdownError' }, + example = { raw = '[!EXAMPLE]', rendered = ' Example', highlight = 'RenderMarkdownHint' }, + quote = { raw = '[!QUOTE]', rendered = ' Quote', highlight = 'RenderMarkdownQuote' }, + cite = { raw = '[!CITE]', rendered = ' Cite', highlight = 'RenderMarkdownQuote' }, + }, + checkbox = { + enabled = true, + render_modes = false, + bullet = false, + right_pad = 1, + unchecked = { + icon = ' ', + highlight = 'RenderMarkdownUnchecked', + scope_highlight = nil, + }, + checked = { + icon = ' ', + highlight = 'RenderMarkdownChecked', + scope_highlight = nil, + }, + custom = { + todo = { raw = '[-]', rendered = ' ', highlight = 'RenderMarkdownTodo', scope_highlight = nil }, + }, + }, + bullet = { + enabled = true, + render_modes = false, + icons = { '●', '○', '◆', '◇' }, + ordered_icons = function(ctx) + local value = vim.trim(ctx.value) + local index = tonumber(value:sub(1, #value - 1)) + return ('%d.'):format(index > 1 and index or ctx.index) + end, + left_pad = 0, + right_pad = 0, + highlight = 'RenderMarkdownBullet', + scope_highlight = {}, + }, + quote = { icon = '▋' }, + anti_conceal = { + enabled = false, + }, + heading = { + icons = { ' ', ' ', ' ', ' ', ' ', ' ' }, + backgrounds = {}, + }, + nested = false, + }) + end, +} + diff --git a/config/nvim/lua/plugins/telescope.lua b/config/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..7cfe5c5 --- /dev/null +++ b/config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,40 @@ +return { + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + -- defaults = { + -- borderchars = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, + -- }, + }) + + local tscope = require('telescope.builtin') + vim.keymap.set("n", "<leader>ff", function() + local cwd + if vim.bo.filetype == "oil" then + cwd = require("oil").get_current_dir() + else + cwd = vim.fn.expand("%:p:h") + end + tscope.find_files({ cwd = cwd }) + end, { desc = "Find File" }) + + vim.keymap.set("n", "<leader>fp", function() + tscope.find_files({ + cwd = vim.loop.cwd(), + }) + end, { desc = "Find Project File" }) + vim.keymap.set('n', '<leader>bb', tscope.buffers, + { desc = "Find Buffer" }) + vim.keymap.set('n', '<leader>fh', tscope.help_tags, + { desc = "Find Help" }) + vim.keymap.set('n', '<leader>fg', tscope.live_grep, + { desc = "Find by Grep" }) + vim.keymap.set('n', '<leader>fr', tscope.oldfiles, + { desc = "Find Recent Files" }) + vim.keymap.set('n', '<leader>lw', tscope.diagnostics, + { desc = "Search Diagnostics" }) + vim.keymap.set('n', '<leader>lg', tscope.lsp_references, + { desc = "Search References" }) + end, +} diff --git a/config/nvim/lua/plugins/todo-comments.lua b/config/nvim/lua/plugins/todo-comments.lua new file mode 100644 index 0000000..69f907e --- /dev/null +++ b/config/nvim/lua/plugins/todo-comments.lua @@ -0,0 +1,14 @@ +return { + "folke/todo-comments.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + opts = { + + }, + config = function() + require('todo-comments').setup({}) + vim.keymap.set('n', '<leader>ft', function() + vim.cmd('TodoTelescope') + end, + { desc = "Find Buffer" }) + end, +} diff --git a/config/nvim/lua/plugins/ui.lua b/config/nvim/lua/plugins/ui.lua new file mode 100644 index 0000000..5df6f44 --- /dev/null +++ b/config/nvim/lua/plugins/ui.lua @@ -0,0 +1,27 @@ +return { + "OXY2DEV/ui.nvim", + lazy = false, + config = function() + require("ui").setup({ + cmdline = { + enable = true, + row_offset = 0, + }, + messages = { + enable = true, + }, + popupmenu = { + enable = false, + }, + }); + + local spec = require("ui.spec") + + spec.config.message.showcmd.modifier = function(_, lines) + return { + lines = { "" }, + extmarks = { {} }, + } + end + end, +}; diff --git a/config/nvim/lua/plugins/which-key.lua b/config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..c068002 --- /dev/null +++ b/config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,17 @@ +return { + 'folke/which-key.nvim', + event = 'VeryLazy', + opts = { + icons = { mappings = false }, + delay = 1000 + }, + keys = { + { + '<leader>?', + function() + require('which-key').show({ global = false }) + end, + desc = 'Buffer Local Keymaps', + }, + }, +} diff --git a/config/nvim/lua/plugins/zk.lua b/config/nvim/lua/plugins/zk.lua new file mode 100644 index 0000000..ce2e11a --- /dev/null +++ b/config/nvim/lua/plugins/zk.lua @@ -0,0 +1,26 @@ +return { + "zk-org/zk-nvim", + lazy = false, + config = function() + require("zk").setup({ + picker = "telescope", + lsp = { + config = { + name = "zk", + cmd = { "zk", "lsp" }, + filetypes = { "markdown" }, + }, + auto_attach = { + enabled = true, + }, + }, + }) + end, + keys = { + { "<leader>zz", "<cmd>ZkNotes<cr>", desc = "Notes" }, + { "<leader>zl", "<cmd>ZkLinks<cr>", desc = "Links" }, + { "<leader>zb", "<cmd>ZkBacklinks<cr>", desc = "Backlinks" }, + { "<leader>zi", "<cmd>ZkInsertLink<cr>", desc = "Insert Link" }, + { "<leader>zd", "<cmd>ZkCd<cr>", desc = "Enter Directory" }, + } +} diff --git a/config/nvim/lua/scripts/diagnostics.lua b/config/nvim/lua/scripts/diagnostics.lua new file mode 100644 index 0000000..0855af1 --- /dev/null +++ b/config/nvim/lua/scripts/diagnostics.lua @@ -0,0 +1,760 @@ +--[[ +*Fancy* diagnostics for `Neovim`. + +## Usage + +```lua +require("diagnostics").setup(); +``` + +You can then hit `D` to show diagnostics for the current line. + +## Highlight groups + +This script uses highlight groups provided by [highlights.lua](https://github.com/OXY2DEV/nvim/blob/main/lua/scripts/highlights.lua). + +The used groups are, +- `FancyDiagnostic`, Default group for diagnostics. +- `FancyDiagnosticIcon`, Default group for the icons of diagnostics. +- `FancyDiagnosticInfo`, Group for `information` diagnostics. +- `FancyDiagnosticInfoIcon`, Group for the icons of `information` diagnostics. +- `FancyDiagnosticHint`, Group for `hint` diagnostics. +- `FancyDiagnosticHintIcon`, Group for the icons of `hint` diagnostics. +- `FancyDiagnosticWarn`, Group for `warning` diagnostics. +- `FancyDiagnosticWarnIcon`, Group for the icons of `warning` diagnostics. +- `FancyDiagnosticError`, Group for `error` diagnostics. +- `FancyDiagnosticErrorIcon`, Group for the icons of `error` diagnostics. + +## Dependencies + +- [beacon.lua](https://github.com/OXY2DEV/nvim/blob/main/lua/scripts/beacon.lua), For highlighting cursor. +- [highlights.lua](https://github.com/OXY2DEV/nvim/blob/main/lua/scripts/highlights.lua), For highlight groups. +- [types/diagnostics.lua](https://github.com/OXY2DEV/nvim/blob/main/lua/scripts/types/diagnostics.lua), For type definition. + +## Configuration + +Use `setup()` for setting configuration. See [types/diagnostics.lua#diagnostics.config](https://github.com/OXY2DEV/nvim/blob/main/lua/scripts/types/diagnostics.lua#L3-L19) for the type definition. +]] +local diagnostics = {}; + +---@param level string +---@param icon string +---@return table +local function handle_diagnostic_level (level, icon) + ---|fS + + local default = string.format("FancyDiagnostic%s", "Default"); + local default_icon_hl = string.format("FancyDiagnostic%sIcon", "Default"); + + local bg = string.format("FancyDiagnostic%s", level); + local icon_hl = string.format("FancyDiagnostic%sIcon", level); + + return { + width = 3, + + line_hl_group = function (_, current) + return current and bg or default; + end, + icon = function (_, current) + return { + { "▌", current and icon_hl or default_icon_hl }, + { icon, current and icon_hl or default_icon_hl }, + { " ", current and bg or default }, + } + end, + padding = function (_, current) + return { + { "▌", current and icon_hl or default_icon_hl }, + { " ", current and icon_hl or default_icon_hl }, + { " ", current and bg or default }, + } + end + }; + + ---|fE +end + +---@class diagnostics.config +diagnostics.config = { + ---|fS + + keymap = "D", + + decoration_width = 4, + width = function (items) + local max = math.floor(vim.o.columns * 0.4); + local use = 1 + + for _, item in ipairs(items) do + local width = vim.fn.strdisplaywidth(item.message or ""); + + use = math.min( + math.max(width, 0), + max + ); + end + + return use; + end, + + max_height = function () + return math.floor(vim.o.lines * 0.4); + end, + + beacon = { + ---|fS + + default = { + from = function () + local fg = vim.api.nvim_get_hl(0, { name = "@comment", link = false }).fg; + return fg and string.format("#%06x", fg) or "#9399b2"; + end, + to = function () + local bg = vim.api.nvim_get_hl(0, { name = vim.o.statusline and "Cursorline" or "Normal", link = false }).bg; + return bg and string.format("#%06x", bg) or "#1e1e2e"; + end, + + steps = 10, + interval = 100, + }, + + [vim.diagnostic.severity.INFO] = { + from = function () + local fg = vim.api.nvim_get_hl(0, { name = "FancyDiagnosticInfoIcon", link = false }).fg; + return fg and string.format("#%06x", fg) or "#94e2d5"; + end + }, + [vim.diagnostic.severity.HINT] = { + from = function () + local fg = vim.api.nvim_get_hl(0, { name = "FancyDiagnosticHintIcon", link = false }).fg; + return fg and string.format("#%06x", fg) or "#94e2d5"; + end + }, + [vim.diagnostic.severity.WARN] = { + from = function () + local fg = vim.api.nvim_get_hl(0, { name = "FancyDiagnosticWarnIcon", link = false }).fg; + return fg and string.format("#%06x", fg) or "#f9e2af"; + end + }, + [vim.diagnostic.severity.ERROR] = { + from = function () + local fg = vim.api.nvim_get_hl(0, { name = "FancyDiagnosticErrorIcon", link = false }).fg; + return fg and string.format("#%06x", fg) or "#f38ba8"; + end + }, + + ---|fE + }, + + decorations = { + ---|fS + + [vim.diagnostic.severity.INFO] = handle_diagnostic_level("Info", " "), + [vim.diagnostic.severity.HINT] = handle_diagnostic_level("Hint", " "), + [vim.diagnostic.severity.WARN] = handle_diagnostic_level("Warn", " "), + [vim.diagnostic.severity.ERROR] = handle_diagnostic_level("Error", " "), + + ---|fE + }, + + ---|fE +}; + +--[[ Evaluates `val`. ]] +---@param val any +---@param ... any +---@return any +local function eval(val, ...) + ---|fS + + if type(val) ~= "function" then + return val; + else + local can_call, new_val = pcall(val, ...); + + if can_call and new_val ~= nil then + return new_val; + end + end + + ---|fE +end + +--[[ Gets diagnostic item `decoration`. ]] +---@param level vim.diagnostic.Severity | "default" Diagnostic severity. +---@param ... any Extra arguments to be used for value evaluation. +---@return diagnostics.decorations__static decoration Static version of the diagnostic item's decoration. +local function get_decorations (level, ...) + ---|fS + + local output = {}; + + for k, v in pairs(diagnostics.config.decorations[level]) do + output[k] = eval(v, ...); + end + + return output; + + ---|fE +end + +--[[ Gets `beacon` configuration. ]] +---@param level? vim.diagnostic.Severity | "default" Diagnostic level. +---@param ... any Extra arguments to be used for value evaluation. +---@return table? +local function get_beacon_config (level, ...) + ---|fS + + if not level or not diagnostics.config.beacon then + return; + end + + local output = {}; + + for k, v in pairs(diagnostics.config.beacon[level]) do + output[k] = eval(v, ...); + end + + return output; + + ---|fE +end + +--[[ Turns given **virtual text** into **format string** for the statusline. ]] +---@param virt_text diagnostics.decoration_fragment[] Virtual text. +---@return string sign Virtual text as a sign(use in `statuscolumn`, `statusline`, `tabline` or `winbar`) +local function virt_text_to_sign (virt_text) + ---|fS + + local output = ""; + + for _, item in ipairs(virt_text) do + if type(item[2]) == "string" then + output = output .. string.format("%%#%s#%s", item[2], item[1]) .. "%#Normal#"; + else + output = output .. item[1]; + end + end + + return output; + + ---|fE +end + +------------------------------------------------------------------------------ + +---@type integer Decoration namespace. +diagnostics.ns = vim.api.nvim_create_namespace("fancy_diagnostics"); + +---@type integer, integer Diagnostics buffer & window. +diagnostics.buffer, diagnostics.window = nil, nil; + +--[[ Which *quadrant* the diagnostics window is currently using? ]] +---@type +---| "top_left" +---| "top_right" +---| "bottom_left" +---| "bottom_right" +---| "center" +diagnostics.quad = nil; + +---@type diagnostics.signs.entry[] +diagnostics.sign_data = {}; + +--[[ Prepares the buffer for the diagnostics window. ]] +diagnostics.__prepare = function () + ---|fS + + if not diagnostics.buffer or not vim.api.nvim_buf_is_valid(diagnostics.buffer) then + diagnostics.buffer = vim.api.nvim_create_buf(false, true); + end + + ---|fE +end + +--[[ Updates the *quadrant* which is being used by the diagnostics window. ]] +---@param quad +---| "top_left" +---| "top_right" +---| "bottom_left" +---| "bottom_right" +---| "center" +---@param state boolean +diagnostics.update_quad = function (quad, state) + ---|fS + + if not _G.__used_quads then + -- NIT: Should this set a default state value? + return; + end + + _G.__used_quads[quad] = state; + + ---|fE +end + +--[[ Returns `{opts}` for `nvim_open_win()` based on the parameters. ]] +---@param window integer Window ID. +---@param w integer Window width. +---@param h integer Window height. +---@return string | string[] border Window border. +---@return "editor" | "cursor" relative Relative position for floating window. +---@return "NE" | "NW" | "SE" | "SW" anchor Anchor position. +---@return integer row Window position in Y-axis. +---@return integer col Window position in X-axis. +diagnostics.__win_args = function (window, w, h) + ---|fS + + ---@type [ integer, integer ] + local cursor = vim.api.nvim_win_get_cursor(window); + ---@type table<string, integer> + local screenpos = vim.fn.screenpos(window, cursor[1], cursor[2]); + + local screen_width = vim.o.columns - 2; + local screen_height = vim.o.lines - vim.o.cmdheight - 2; + + local quad_pref = { "bottom_right", "top_right", "bottom_left", "top_left" }; + local quads = { + ---|fS + + center = { + relative = "editor", + anchor = "NW", + + row = math.ceil((vim.o.lines - h) / 2), + col = math.ceil((vim.o.columns - w) / 2), + border = "rounded" + }, + + top_left = { + condition = function () + if h >= screenpos.row then + -- Not enough space above. + return false; + elseif screenpos.curscol <= w then + -- Not enough space before. + return false; + end + + return true; + end, + + relative = "cursor", + border = { "╭", "─", "╮", "│", "┤", "─", "╰", "│" }, + anchor = "SE", + row = 0, + col = 1 + }, + top_right = { + condition = function () + if h >= screenpos.row then + -- Not enough space above. + return false; + elseif screenpos.curscol + w > screen_width then + -- Not enough space after. + return false; + end + + return true; + end, + + relative = "cursor", + border = { "╭", "─", "╮", "│", "╯", "─", "├", "│" }, + anchor = "SW", + row = 0, + col = 0 + }, + + bottom_left = { + condition = function () + if screenpos.row + h > screen_height then + -- Not enough space below. + return false; + elseif screenpos.curscol <= w then + -- Not enough space before. + return false; + end + + return true; + end, + + relative = "cursor", + border = { "╭", "─", "┤", "│", "╯", "─", "╰", "│" }, + anchor = "NE", + row = 1, + col = 1 + }, + bottom_right = { + condition = function () + if screenpos.row + h > screen_height then + -- Not enough space below. + return false; + elseif screenpos.curscol + w > screen_width then + -- Nor enough space after. + return false; + end + + return true; + end, + + relative = "cursor", + border = { "├", "─", "╮", "│", "╯", "─", "╰", "│" }, + anchor = "NW", + row = 1, + col = 0 + } + + ---|fE + }; + + for _, pref in ipairs(quad_pref) do + if _G.__used_quads and _G.__used_quads[pref] == true then + goto continue; + elseif not quads[pref] then + goto continue; + end + + local quad = quads[pref]; + local ran_cond, cond = pcall(quad.condition); + + if ran_cond and cond then + diagnostics.quad = pref; + return quad.border, quad.cursor, quad.anchor, quad.row, quad.col; + end + + ::continue:: + end + + diagnostics.quad = "center"; + + local fallback = quads.center; + return fallback.border, fallback.cursor, fallback.anchor, fallback.row, fallback.col; + + ---|fE +end + +------------------------------------------------------------------------------ + +--[[ Closes diagnostics window. ]] +diagnostics.close = function () + ---|fS + + if diagnostics.window and vim.api.nvim_win_is_valid(diagnostics.window) then + pcall(vim.api.nvim_win_close, diagnostics.window, true); + diagnostics.window = nil; + + if diagnostics.quad then + diagnostics.update_quad(diagnostics.quad, false); + diagnostics.quad = nil; + end + end + + ---|fE +end + +---@type beacon.instance Beacon instance to use for the Cursor. +diagnostics.__beacon = nil; + +--[[ External integrations. ]] +---@param window integer Window Id. +---@param beacon_config beacon.instance.config Configuration for `beacon`. +diagnostics.__integration = function (window, beacon_config) + ---|fS + + -- Markdown rendering. + if package.loaded["markview"] then + package.loaded["markview"].render(diagnostics.buffer, { + enable = true, + hybrid_mode = false + }, { + markdown_inline = { + inline_codes = { + virtual = true + } + } + }); + end + + -- Beacon. + if package.loaded["scripts.beacon"] then + if not diagnostics.__beacon then + diagnostics.__beacon = require("scripts.beacon").new(window, beacon_config); + else + diagnostics.__beacon:update(window, beacon_config); + end + + diagnostics.__beacon:start(); + end + + ---|fE +end + +--- Custom statuscolumn. +---@return string +_G.fancy_diagnostics_statuscolumn = function () + ---|fS + + if vim.tbl_isempty(diagnostics.sign_data) then + return ""; + end + + local lnum = vim.v.lnum; + + local data = diagnostics.sign_data[lnum]; + local start = data.start_row; + + if not data then + return ""; + elseif vim.v.virtnum == 0 and start == lnum then + return virt_text_to_sign(data.icon); + else + return virt_text_to_sign(data.padding or data.icon); + end + + ---|fE +end + +--- Hover function for diagnostics. +---@param window integer +diagnostics.hover = function (window) + ---|fS + + window = window or vim.api.nvim_get_current_win(); + + ---@type integer Source buffer. + local buffer = vim.api.nvim_win_get_buf(window); + ---@type [ integer, integer ] + local cursor = vim.api.nvim_win_get_cursor(window); + + local items = vim.diagnostic.get(buffer, { lnum = cursor[1] - 1 }); + + ---@type boolean Is the window already open? + local already_open = diagnostics.window and vim.api.nvim_win_is_valid(diagnostics.window); + + if #items == 0 then + -- No diagnostics available. + diagnostics.close(); + vim.api.nvim_echo({ + { " diagnostics.lua ", "DiagnosticVirtualTextWarn" }, + { ": ", "@comment" }, + { "No diagnostic under cursor", "@comment" }, + }, true, {}); + return; + elseif already_open then + vim.api.nvim_set_current_win(diagnostics.window); + return; + end + + if diagnostics.quad then + -- If the old window's quadrant wasn't freed, we free it here. + diagnostics.update_quad(diagnostics.quad, false) + end + + diagnostics.__prepare(); + vim.bo[diagnostics.buffer].ft = "markdown"; + + -- Clear old decorations. + vim.api.nvim_buf_clear_namespace(diagnostics.buffer, diagnostics.ns, 0, -1); + vim.api.nvim_buf_set_lines(diagnostics.buffer, 0, -1, false, {}); + + local W = eval(diagnostics.config.width, items); + local D = eval(diagnostics.config.decoration_width, items); + + ---@type table Configuration used for calculating window height. + local height_calc_config = { + relative = "editor", + + row = 0, col = 1, + width = W - D, height = 2, + + style = "minimal", + hide = true, + }; + + if not diagnostics.window or not vim.api.nvim_win_is_valid(diagnostics.window) then + diagnostics.window = vim.api.nvim_open_win(diagnostics.buffer, false, height_calc_config); + else + vim.api.nvim_win_set_config(diagnostics.window, height_calc_config); + end + + vim.wo[diagnostics.window].wrap = true; + vim.wo[diagnostics.window].linebreak = true; + vim.wo[diagnostics.window].breakindent = true; + + local diagnostic_lines = 0; + + ---@type integer Line where the cursor should be placed. + local cursor_y = 1; + local ranges = {}; + + local start_row = 1; + ---@type vim.diagnostic.Severity | nil + local level; + + diagnostics.sign_data = {}; + + for i, item in ipairs(items) do + ---|fS + + local from = i == 1 and 0 or -1; + local lines = vim.split(item.message, "\n", { trimempty = true }) + + local start = item.col; + local stop = item.end_col; + + local current = false; + + if cursor[2] >= start and cursor[2] <= stop then + cursor_y = i; + current = true; + end + + vim.api.nvim_buf_set_lines(diagnostics.buffer, from, -1, false, lines); + local decorations = get_decorations(item.severity, item, current); + + ranges[i] = { item.lnum, item.col }; + + vim.api.nvim_buf_set_extmark(diagnostics.buffer, diagnostics.ns, diagnostic_lines, 0, { + end_row = diagnostic_lines + #lines, + line_hl_group = decorations.line_hl_group, + }); + + diagnostic_lines = diagnostic_lines + #lines; + + if current == true and ( not level or item.severity < level ) then + level = item.severity; + end + + for _ = 1, #lines do + -- Signs + table.insert(diagnostics.sign_data, { + start_row = start_row, + + current = current, + width = decorations.width, + + icon = decorations.icon, + line_hl_group = decorations.line_hl_group, + padding = decorations.padding, + }); + end + + start_row = start_row + #lines; + + ---|fE + end + + local beacon_config = vim.tbl_extend("force", + get_beacon_config("default", {}, true), + get_beacon_config(level, {}, true) or {} + ); + + local H = vim.api.nvim_win_text_height(diagnostics.window, { start_row = 0, end_row = -1 }).all; + + local _, relative, anchor, row, col = diagnostics.__win_args(window, W, H); + + local win_config = { + relative = relative or "cursor", + + row = row or 0, col = col or 0, + width = W, height = H, + + anchor = anchor, + border = "none", + + style = "minimal", + hide = false, + }; + + vim.api.nvim_win_set_config(diagnostics.window, win_config); + vim.api.nvim_win_set_cursor(diagnostics.window, { cursor_y, 0 }); + + -- Update quadrant state. + diagnostics.update_quad(diagnostics.quad, true); + + -- Set necessary options. + vim.wo[diagnostics.window].signcolumn = "no"; + vim.wo[diagnostics.window].statuscolumn = "%!v:lua.fancy_diagnostics_statuscolumn()"; + + vim.wo[diagnostics.window].conceallevel = 3; + vim.wo[diagnostics.window].concealcursor = "ncv"; + + vim.wo[diagnostics.window].winhl = "FloatBorder:@comment,Normal:Normal"; + + diagnostics.__integration(window, beacon_config); + + ---|fS + + + vim.api.nvim_buf_set_keymap(diagnostics.buffer, "n", "<CR>", "", { + desc = "Go to diagnostic location", + callback = function () + ---|fS + + ---@type [ integer, integer ] Selected item. + local _cursor = vim.api.nvim_win_get_cursor(diagnostics.window); + ---@type [ integer, integer ]? Diagnostic location. + local location = ranges[_cursor[1]]; + + if location then + location[1] = location[1] + 1; + + vim.api.nvim_win_set_cursor(window, location); + vim.api.nvim_set_current_win(window); + + diagnostics.close(); + end + + ---|fE + end + }); + + vim.api.nvim_buf_set_keymap(diagnostics.buffer, "n", "q", "", { + desc = "Exit diagnostics window", + callback = function () + pcall(vim.api.nvim_set_current_win, window); + diagnostics.close(); + end + }); + + ---|fE + + ---|fE +end + +--- Configuration for the diagnostics module. +---@param config? diagnostics.config +diagnostics.setup = function (config) + ---|fS + + if type(config) == "table" then + diagnostics.config = vim.tbl_extend("force", diagnostics.config, config); + end + + if diagnostics.config.keymap then + vim.api.nvim_set_keymap("n", diagnostics.config.keymap, "", { + callback = diagnostics.hover + }); + end + + vim.api.nvim_create_autocmd({ + "CursorMoved", "CursorMovedI" + }, { + callback = function () + local win = vim.api.nvim_get_current_win(); + + if diagnostics.window and win ~= diagnostics.window then + diagnostics.close(); + + if diagnostics.quad then + diagnostics.update_quad(diagnostics.quad, false); + diagnostics.quad = nil; + end + end + end + }); + + ---|fE +end + +return diagnostics; diff --git a/config/nvim/lua/scripts/init.lua b/config/nvim/lua/scripts/init.lua new file mode 100644 index 0000000..0933bb0 --- /dev/null +++ b/config/nvim/lua/scripts/init.lua @@ -0,0 +1,4 @@ +require("scripts.diagnostics").setup({ + keymap = '<leader>le' + -- TODO: Find out how to which-key this +}) diff --git a/config/shell/alias b/config/shell/alias new file mode 100644 index 0000000..a431fd9 --- /dev/null +++ b/config/shell/alias @@ -0,0 +1,13 @@ +alias rgf='rg --files | rg' +alias ls='eza --icons=auto' +alias md='mkdir' +alias cat='bat -pp' +alias man='batman' +alias diff='batdiff' +alias fzf="fzf --preview 'bat --style=numbers --color=always {}'" +alias vi="nvim" +alias vim="nvim" +alias em="emacs -nw" +alias et="emacsclient -t" +alias ec="emacsclient -c" +alias sbcl="ros run --" \ No newline at end of file diff --git a/config/shell/functions b/config/shell/functions new file mode 100644 index 0000000..0661814 --- /dev/null +++ b/config/shell/functions @@ -0,0 +1,20 @@ +gvc() { + if [[ $1 == "clone" ]]; then + shift + git clone git@git.venomade.com:"$@" + else + ssh git@git.venomade.com "$@" + fi +} + +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + command yazi "$@" --cwd-file="$tmp" + IFS= read -r -d '' cwd < "$tmp" + [ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" + rm -f -- "$tmp" +} + +function pcd() { + cd "$(project)" +} diff --git a/config/shell/vars b/config/shell/vars new file mode 100644 index 0000000..03936fe --- /dev/null +++ b/config/shell/vars @@ -0,0 +1,7 @@ +export EDITOR=kak +export ZK_NOTEBOOK_DIR=$HOME/Documents/Notes +export XDG_CONFIG_HOME=$HOME/.config +export GOPATH=$HOME/.go +export LIMA_SHELL=/bin/zsh +export LANGUAGE=en_GB +export CPATH=/usr/include diff --git a/config/starship/config.toml b/config/starship/config.toml new file mode 100644 index 0000000..00e6b86 --- /dev/null +++ b/config/starship/config.toml @@ -0,0 +1,95 @@ +# Get editor completions based on the config schema +"$schema" = 'https://starship.rs/config-schema.json' + +# Inserts a blank line between shell prompts +add_newline = true + +format = """ +$nix_shell\ +$directory\ +$git_branch\ +$git_status\ +$git_commit\ +$status\ +$fill\ +$lua\ +$rust\ +$golang\ +$haskell\ +$jobs\ +$cmd_duration\ +$line_break\ +$character""" + +#[custom.linux] +#format = '[$symbol \[$output\]]($style) ' +#symbol = ' ' +#command = "cat /etc/os-release | grep '^ID=' | sed 's/ID=//' | sed 's/^./\\U&/'" +#os = 'linux' +#style = 'bold #f5e0dc' +#when = true + +[nix_shell] +format = '[$symbol]($style) ' +symbol = ' ' +style = 'bold #74c7ec' + +[directory] +style = '#b2bbfb' +truncation_length = 2 + +[git_branch] +symbol = ' ' +format = '[$symbol$branch(:$remote_branch)]($style) ' +style = 'bold #eba0ac' +ignore_branches = ['master', 'main'] + +[git_status] +format = '([\[$all_status$ahead_behind\]]($style) )' +style = 'bold #89dceb' + +[git_commit] +format = '[\[#$hash$tag\]]($style) ' +style = 'bold #94e2d5' + +[status] +format = '[\[$status\]]($style)' +disabled = false + +[fill] +symbol = ' ' + +[lua] +format = '[$symbol($version )]($style)' +version_format = '$major.$minor' +symbol = ' ' +detect_files = ['.lua-version', '.luarc.json'] + +[rust] +format = '[$symbol($version )]($style)' +version_format = '$major.$minor' +symbol = ' ' +style = 'bold #fab387' + +[golang] +format = '[$symbol($version )]($style)' +version_format = '$major.$minor' +symbol = ' ' +style = 'bold #94e2d5' + +[haskell] +format = '[$symbol($ghc_version )]($style)' +symbol = ' ' +style = 'bold #cba6f7' + +[cmd_duration] +format = '[ $duration]($style) ' +style = 'bold #f9e2af' + +# Replace the '❯' symbol in the prompt with '➜' +[character] # The name of the module we are configuring is 'character' +success_symbol = '[](bold #a6e3a1)' +error_symbol = '[](bold #f38ba8)' + +# TODO +# - [direnv] diff --git a/config/tmux/tmux.conf b/config/tmux/tmux.conf new file mode 100644 index 0000000..e87d8aa --- /dev/null +++ b/config/tmux/tmux.conf @@ -0,0 +1,66 @@ +set -a terminal-features "screen-256color:RGB" +set -ga terminal-overrides ",*col*:Tc" +set -g allow-passthrough all +set -ga update-environment TERM +set -ga update-environment TERM_PROGRAM +set -g prefix C-SPACE +set -g default-shell "~/.nix-profile/bin/zsh" + +set -g base-index 1 +setw -g pane-base-index 1 +set -g renumber-windows on + +set -g status-position top +set -g status-justify right +set -g status-style "bg=default" +set -g window-status-current-style "fg=#b4befe bold" +set -g message-style "bg=default fg=#b4befe bold" +set -g status-right "" +set -g status-left-length 40 +set -g status-left "#S " + +set -g mouse on + +set-option -g set-titles on +set-option -g set-titles-string "#T" + +set -g visual-activity off +set -g visual-bell off +set -g visual-silence off +setw -g monitor-activity off +set -g bell-action none + +setw -g mode-style 'fg=#000000 bg=#cdd6f4 bold' + +set -g window-style 'bg=#151515' +set -g window-active-style 'bg=#000000' + +set -g pane-border-style 'fg=#a6adc8' +set -g pane-active-border-style 'fg=#b4befe' + +bind s split-window -h -c "#{pane_current_path}" +bind v split-window -v -c "#{pane_current_path}" +unbind '"' +unbind % + +bind-key Tab next-window +bind-key k confirm-before -p "kill window #W? (y/n)" kill-window +bind-key c new-window + +bind-key t display-popup + +bind-key h select-pane -L +bind-key i select-pane -R +bind-key e select-pane -U +bind-key n select-pane -D + +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +bind r source-file "~/.config/tmux/tmux.conf" \; display-message "Config reloaded" +bind b set -g status +bind g neww -n "lazygit" lazygit +bind y new-window -n "yazi" yazi +bind E show-environment -g diff --git a/config/translate-shell/init.trans b/config/translate-shell/init.trans new file mode 100644 index 0000000..5d16d36 --- /dev/null +++ b/config/translate-shell/init.trans @@ -0,0 +1,7 @@ +{ + :translate-shell "0.9.7" + :verbose false + :hl "en" + :tl "pt-br" + :user-agent "Mozilla/5.0 (X11; CrOS aarch64 15329.44.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" +} diff --git a/config/yazi/keymap.toml b/config/yazi/keymap.toml new file mode 100644 index 0000000..27da4fc --- /dev/null +++ b/config/yazi/keymap.toml @@ -0,0 +1,164 @@ +"$schema" = "https://yazi-rs.github.io/schemas/keymap.json" + +# Manager / File list layer +[[mgr.prepend_keymap]] +on = [ "e" ] +run = "arrow -1" + +[[mgr.prepend_keymap]] +on = [ "n" ] +run = "arrow 1" + +[[mgr.prepend_keymap]] +on = [ "E" ] +run = "arrow -5" + +[[mgr.prepend_keymap]] +on = [ "N" ] +run = "arrow 5" + +[[mgr.prepend_keymap]] +on = [ "h" ] +run = "leave" + +[[mgr.prepend_keymap]] +on = [ "i" ] +run = "enter" + +[[mgr.prepend_keymap]] +on = [ "H" ] +run = "back" + +[[mgr.prepend_keymap]] +on = [ "I" ] +run = "forward" + +[[mgr.prepend_keymap]] +on = [ "<C-e>" ] +run = "seek -5" + +[[mgr.prepend_keymap]] +on = [ "<C-n>" ] +run = "seek 5" + +[[mgr.prepend_keymap]] +on = [ "k" ] +run = "link" + +[[mgr.prepend_keymap]] +on = [ "K" ] +run = "link --relative" + +[[mgr.prepend_keymap]] +on = [ "j" ] +run = "find_arrow" + +[[mgr.prepend_keymap]] +on = [ "J" ] +run = "find_arrow --previous" + + +# Tasks layer +[[tasks.prepend_keymap]] +on = [ "W" ] +run = "close" + +[[tasks.prepend_keymap]] +on = [ "e" ] +run = "arrow -1" + +[[tasks.prepend_keymap]] +on = [ "n" ] +run = "arrow 1" + + +# Select layer (spot/picker remnants) +[[spot.prepend_keymap]] +on = [ "e" ] +run = "arrow -1" + +[[spot.prepend_keymap]] +on = [ "n" ] +run = "arrow 1" + +[[spot.prepend_keymap]] +on = [ "E" ] +run = "arrow -5" + +[[spot.prepend_keymap]] +on = [ "N" ] +run = "arrow 5" + + +# Input layer +[[input.prepend_keymap]] +on = [ "l" ] +run = "insert" + +[[input.prepend_keymap]] +on = [ "<C-h>" ] +run = [ "move -999", "insert" ] + +[[input.prepend_keymap]] +on = [ "<C-i>" ] +run = [ "move 999", "insert --append" ] + +[[input.prepend_keymap]] +on = [ "h" ] +run = "move -1" + +[[input.prepend_keymap]] +on = [ "i" ] +run = "move 1" + +[[input.prepend_keymap]] +on = [ "=" ] +run = "forward --end-of-word" + +[[input.prepend_keymap]] +on = [ "H" ] +run = "move -999" + +[[input.prepend_keymap]] +on = [ "I" ] +run = "move 999" + +[[input.prepend_keymap]] +on = [ "x" ] +run = [ "delete", "move 1 --in-operating" ] + +[[input.prepend_keymap]] +on = [ "u" ] +run = "undo" + +[[input.prepend_keymap]] +on = [ "U" ] +run = "redo" + + +# Completion layer +[[cmp.prepend_keymap]] +on = [ "<C-e>" ] +run = "arrow -1" + +[[cmp.prepend_keymap]] +on = [ "<C-n>" ] +run = "arrow 1" + + +# Help layer +[[help.prepend_keymap]] +on = [ "e" ] +run = "arrow -1" + +[[help.prepend_keymap]] +on = [ "n" ] +run = "arrow 1" + +[[help.prepend_keymap]] +on = [ "E" ] +run = "arrow -5" + +[[help.prepend_keymap]] +on = [ "N" ] +run = "arrow 5" diff --git a/config/yazi/modus_vivendi.tmTheme b/config/yazi/modus_vivendi.tmTheme new file mode 100644 index 0000000..15d2429 --- /dev/null +++ b/config/yazi/modus_vivendi.tmTheme @@ -0,0 +1,439 @@ +<!-- Modus Themes for Bat --> +<!-- Auto generated with https://github.com/miikanissi/modus-themes.nvim/blob/master/lua/modus-themes/extras/bat.lua --> + +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>name</key> + <string>modus_vivendi</string> + <key>settings</key> + <array> + <dict> + <key>settings</key> + <dict> + <key>background</key> + <string>#000000</string> + <key>caret</key> + <string>#989898</string> + <key>foreground</key> + <string>#ffffff</string> + <key>invisibles</key> + <string>#989898</string> + <key>lineHighlight</key> + <string>#2f3849</string> + <key>selection</key> + <string>#7030af</string> + <key>findHighlight</key> + <string>#7a6100</string> + <key>selectionBorder</key> + <string>#646464</string> + <key>gutterForeground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Comment</string> + <key>scope</key> + <string>comment</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>italic</string> + <key>foreground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>String</string> + <key>scope</key> + <string>string</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Number</string> + <key>scope</key> + <string>constant.numeric</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#82b0ec</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Built-in constant</string> + <key>scope</key> + <string>constant.language</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#6ae4b9</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>User-defined constant</string> + <key>scope</key> + <string>constant.character, constant.other</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#ffffff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Variable</string> + <key>scope</key> + <string>variable</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Ruby's @variable</string> + <key>scope</key> + <string>variable.other.readwrite.instance</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>String interpolation</string> + <key>scope</key> + <string>constant.character.escaped, constant.character.escape, string source, string source.ruby</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d2b580</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Keyword</string> + <key>scope</key> + <string>keyword</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>italic</string> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Storage</string> + <key>scope</key> + <string>storage</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Storage type</string> + <key>scope</key> + <string>storage.type</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Class name</string> + <key>scope</key> + <string>entity.name.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Inherited class</string> + <key>scope</key> + <string>entity.other.inherited-class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#b6a0ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function name</string> + <key>scope</key> + <string>entity.name.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#feacd0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Function argument</string> + <key>scope</key> + <string>variable.parameter</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Tag name</string> + <key>scope</key> + <string>entity.name.tag</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Tag attribute</string> + <key>scope</key> + <string>entity.other.attribute-name</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library function</string> + <key>scope</key> + <string>support.function</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#feacd0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library constant</string> + <key>scope</key> + <string>support.constant</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#6ae4b9</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library class/type</string> + <key>scope</key> + <string>support.type, support.class</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#6ae4b9</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Library variable</string> + <key>scope</key> + <string>support.other.variable</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00d3d0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Invalid</string> + <key>scope</key> + <string>invalid</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Invalid deprecated</string> + <key>scope</key> + <string>invalid.deprecated</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#989898</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON String</string> + <key>scope</key> + <string>meta.structure.dictionary.json string.quoted.double.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.header</string> + <key>scope</key> + <string>meta.diff, meta.diff.header</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#feacd0</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.deleted</string> + <key>scope</key> + <string>markup.deleted</string> + <key>settings</key> + <dict> + <key>background</key> + <string>#4f1119</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.inserted</string> + <key>scope</key> + <string>markup.inserted</string> + <key>settings</key> + <dict> + <key>background</key> + <string>#00381f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>diff.changed</string> + <key>scope</key> + <string>markup.changed</string> + <key>settings</key> + <dict> + <key>background</key> + <string>#363300</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>constant.numeric.line-number.find-in-files - match</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#82b0ec</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>entity.name.filename</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#2fafff</string> + </dict> + </dict> + <dict> + <key>scope</key> + <string>message.error</string> + <key>settings</key> + <dict> + <key>fontStyle</key> + <string>bold</string> + <key>foreground</key> + <string>#ff7f9f</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON Punctuation</string> + <key>scope</key> + <string>punctuation.definition.string.begin.json - meta.structure.dictionary.value.json, punctuation.definition.string.end.json - meta.structure.dictionary.value.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#ffffff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON Structure</string> + <key>scope</key> + <string>meta.structure.dictionary.json string.quoted.double.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>JSON String</string> + <key>scope</key> + <string>meta.structure.dictionary.value.json string.quoted.double.json</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#79a8ff</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Escape Characters</string> + <key>scope</key> + <string>constant.character.escape</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#d2b580</string> + </dict> + </dict> + <dict> + <key>name</key> + <string>Regular Expressions</string> + <key>scope</key> + <string>string.regexp</string> + <key>settings</key> + <dict> + <key>foreground</key> + <string>#00c06f</string> + </dict> + </dict> + </array> + <key>uuid</key> + <string>09CE9B40-0137-442C-8512-7CEAFC78C153</string> + <key>colorSpaceName</key> + <string>sRGB</string> + <key>semanticClass</key> + <string>Modus Vivendi</string> + </dict> +</plist> diff --git a/config/yazi/theme.toml b/config/yazi/theme.toml new file mode 100644 index 0000000..7e83248 --- /dev/null +++ b/config/yazi/theme.toml @@ -0,0 +1,135 @@ +# Modus Themes for Yazi +# Auto generated with https://github.com/miikanissi/modus-themes.nvim/blob/master/lua/modus-themes/extras/yazi.lua + +[manager] +# NOTE: can combined with tmTheme (sublime colorshceme file) for preview code highlight +highlight = "~/.config/yazi/modus_vivendi.tmTheme" + +cwd = { fg = "#00d3d0", italic = true } + +# Hovered +hovered = { bg = "#2f3849" } +preview_hovered = { bg = "#2f3849" } + +# Find +find_keyword = { fg = "#ffffff", bg = "#7030af", bold = true } +find_position = { fg = "#79a8ff", bg = "#1e1e1e", bold = true } + +# Marker +marker_copied = { fg = "#70b900", bg = "#70b900" } +marker_cut = { fg = "#ff5f59", bg = "#ff5f59" } +marker_marked = { fg = "#feacd0", bg = "#feacd0" } +marker_selected = { fg = "#2fafff", bg = "#2fafff" } + +# Tab +tab_active = { fg = "#000000", bg = "#2fafff" } +tab_inactive = { fg = "#989898", bg = "#000000" } +tab_width = 1 + +# Count +count_copied = { fg = "#000000", bg = "#70b900" } +count_cut = { fg = "#000000", bg = "#ff6b55" } +count_selected = { fg = "#000000", bg = "#79a8ff" } + +# Border +border_symbol = "│" +border_style = { fg = "#C4C4C4" } + +[status] +separator_open = "" +separator_close = "" +separator_style = { fg = "#0f0f0f", bg = "#0f0f0f" } + +# Mode +mode_normal = { fg = "#000000", bg = "#2fafff", bold = true } +mode_select = { fg = "#000000", bg = "#f78fe7", bold = true } +mode_unset = { fg = "#000000", bg = "#db7b5f", bold = true } + +# Progress +progress_label = { fg = "#989898", bold = true } +progress_normal = { fg = "#000000" } +progress_error = { fg = "#ff5f59" } + +# Permissions +permissions_t = { fg = "#2fafff" } +permissions_r = { fg = "#d0bc00" } +permissions_w = { fg = "#ff5f59" } +permissions_x = { fg = "#44bc44" } +permissions_s = { fg = "#989898" } + +[select] +border = { fg = "#C4C4C4" } +active = { fg = "#ffffff", bg = "#646464" } +inactive = { fg = "#ffffff" } + +# Input +[input] +border = { fg = "#00bcff" } +title = {} +value = { fg = "#f78fe7" } +selected = { bg = "#646464" } + +# Completion +[completion] +border = { fg = "#00bcff" } +active = { fg = "#ffffff", bg = "#646464" } +inactive = { fg = "#ffffff" } + +# Tasks +[tasks] +border = { fg = "#C4C4C4" } +title = {} +hovered = { fg = "#ffffff", bg="#646464" } + +# Which +[which] +cols = 3 +mask = { bg = "#0f0f0f" } +cand = { fg = "#00d3d0" } +rest = { fg = "#2fafff" } +desc = { fg = "#feacd0" } +separator = " " +separator_style = { fg = "#989898" } + +# Notify +[notify] +title_info = { fg = "#00bcff" } +title_warn = { fg = "#d0bc00" } +title_error = { fg = "#ff5f59" } + +# Help +[help] +on = { fg = "#44bc44" } +run = { fg = "#feacd0" } +hovered = { bg = "#646464" } +footer = { fg = "#ffffff", bg = "#0f0f0f" } + +[filetype] + +rules = [ + # Images + { mime = "image/*", fg = "#00d3d0" }, + + # Media + { mime = "{audio,video}/*", fg = "#fec43f" }, + + # Archives + { mime = "application/*zip", fg = "#feacd0" }, + { mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "#feacd0" }, + + # Documents + { mime = "application/{pdf,doc,rtf,vnd.*}", fg = "#00d3d0" }, + + # Empty files + # { mime = "inode/x-empty", fg = "#ff5f59" }, + + # Special files + { name = "*", is = "orphan", bg = "#ff5f59" }, + { name = "*", is = "exec" , fg = "#44bc44" }, + + { name = "*.rs", fg = "#db7b5f" }, + + # Fallback + { name = "*/", fg = "#2fafff" } +] + diff --git a/config/yazi/yazi.toml b/config/yazi/yazi.toml new file mode 100644 index 0000000..59cc31d --- /dev/null +++ b/config/yazi/yazi.toml @@ -0,0 +1,12 @@ +[mgr] +sort_by = "mtime" +sort_reverse = true +show_hidden = true +linemode = "size" +scrolloff = 12 +ratio = [1,2,0] + +[opener] +edit = [ + { run = "kak %s", block = true, for = "unix" }, +] diff --git a/config/zk/config.toml b/config/zk/config.toml new file mode 100644 index 0000000..6605d1d --- /dev/null +++ b/config/zk/config.toml @@ -0,0 +1,34 @@ +[notebook] +dir = "~/Documents/Notes" + +[note] +filename = "{{slug title}}" +template = "note.md" + +[extra] +author = "Venomade" + +[format.markdown] +link-format = "wiki" +hashtags = true +colon-tags = false +multiword-tags = true + +[tool] +editor = "/home/venomade/.nix-profile/bin/emacs" +shell = "/home/venomade/.nix-profile/bin/zsh" +fzf-preview = "bat -p --color always {-1}" + +[lsp] +[lsp.diagnostics] +wiki-title = "hint" +dead-link = "error" +missing-backlink = { level = "warning", position = "bottom" } + +[group.diario] +paths = ["Diario"] + +[group.diario.note] +filename = "{{format-date now '%Y-%m-%d'}}" +extension = "md" +template = "daily.md" diff --git a/config/zk/templates/daily.md b/config/zk/templates/daily.md new file mode 100644 index 0000000..cb128bd --- /dev/null +++ b/config/zk/templates/daily.md @@ -0,0 +1,9 @@ +--- +title: Entrada do Diário - {{format-date now '%Y-%m-%d'}} +tags: [diario, {{format-date now '%B'}}, {{format-date now 'year'}}] +--- +<!-- + +# Entrada do Diário - {{format-date now '%Y-%m-%d'}} + +{{content}} diff --git a/config/zk/templates/note.md b/config/zk/templates/note.md new file mode 100644 index 0000000..be4c1d2 --- /dev/null +++ b/config/zk/templates/note.md @@ -0,0 +1,6 @@ +--- +title: {{title}} +tags: [] +--- + +{{content}} diff --git a/dots/lesskey b/dots/lesskey new file mode 100644 index 0000000..9d06169 --- /dev/null +++ b/dots/lesskey @@ -0,0 +1,4 @@ +n forw-line +e back-line +j repeat-search +J reverse-search diff --git a/dots/zshrc b/dots/zshrc new file mode 100644 index 0000000..4d4b507 --- /dev/null +++ b/dots/zshrc @@ -0,0 +1,55 @@ +# Venomade's zshrc + +# source global variables and aliases +[ -f "$HOME/.config/shell/alias" ] && source "$HOME/.config/shell/alias" +[ -f "$HOME/.config/shell/vars" ] && source "$HOME/.config/shell/vars" +[ -f "$HOME/.config/shell/functions" ] && source "$HOME/.config/shell/functions" + +# load modules +zmodload zsh/complist +autoload -U compinit && compinit +autoload -U colors && colors + +# completion +zstyle ':completion:*' menu select +zstyle ':completion:*' special-dirs true +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} ma=0\;33 + +# options +setopt append_history inc_append_history share_history +setopt auto_menu menu_complete +setopt auto_param_slash +setopt no_case_glob no_case_match +setopt globdots +setopt extended_glob +setopt share_history + +# history +export HISTFILE=~/.zsh_history +export HISTSIZE=10000 +export SAVEHIST=10000 + + +# termtitle +shorten_path() { + local path="${PWD/#$HOME/~}" + local parts=("${(@s:/:)path}") + + if (( ${#parts} > 3 )); then + echo "${parts[1]}/.../${parts[-2]}/${parts[-1]}" + else + echo "$path" + fi +} + +autoload -Uz add-zsh-hook +precmd() { + print -Pn "\e]0;$(shorten_path)\a" +} + +export STARSHIP_CONFIG=~/.config/starship/config.toml +eval "$(starship init zsh)" + +# source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh + +bindkey -e diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..47563c9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,118 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1771102945, + "narHash": "sha256-e5NfW8NhC3qChR8bHVni/asrig/ZFzd1wzpq+cEE/tg=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "ff5e5d882c51f9a032479595cbab40fd04f56399", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin-emacs": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1772076615, + "narHash": "sha256-ELVNo7zh6N32Ooncgs9URPpWwC86tWPYoieJPLxTaGo=", + "owner": "nix-giant", + "repo": "nix-darwin-emacs", + "rev": "065050b9e06a30c01b41539b75464fff972fecd6", + "type": "github" + }, + "original": { + "owner": "nix-giant", + "repo": "nix-darwin-emacs", + "rev": "065050b9e06a30c01b41539b75464fff972fecd6", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1759397282, + "narHash": "sha256-ohaApD0NtpszUBgTl/GGBUkNYwVgaQWivugNpuip9X8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b2f842e4d99dc35a0951b9582c64bb26789e929d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.05-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1771008912, + "narHash": "sha256-gf2AmWVTs8lEq7z/3ZAsgnZDhWIckkb+ZnAo5RzSxJg=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a82ccc39b39b621151d6732718e3e250109076fa", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nix-darwin-emacs": "nix-darwin-emacs", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..204de9a --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Home Manager configuration of venomade"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-darwin-emacs = { + url = "github:nix-giant/nix-darwin-emacs/065050b9e06a30c01b41539b75464fff972fecd6"; + }; + }; + outputs = + { nixpkgs, home-manager, nix-darwin-emacs, ... }: + let + mkHome = system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ ./home.nix ]; + extraSpecialArgs = { + inherit system nix-darwin-emacs; + }; + }; + in + { + homeConfigurations = { + "venomade" = mkHome "aarch64-linux"; + "venomade-darwin" = mkHome "aarch64-darwin"; + }; + }; +} diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..7cf5f66 --- /dev/null +++ b/home.nix @@ -0,0 +1,113 @@ +{ config, lib, pkgs, system, nix-darwin-emacs, ... }: +let + isDarwin = builtins.match ".*-darwin" system != null; + + emacsPackage = + if isDarwin + then nix-darwin-emacs.packages.${system}.emacs-30 + else pkgs.emacs-pgtk; + + homeDirectory = + if isDarwin + then "/Users/venomade" + else "/home/venomade"; +in +{ + home.username = "venomade"; + home.homeDirectory = homeDirectory; + home.packages = with pkgs; [ + + # Neovim + neovim + imagemagick + fzf + ripgrep + fd + + # Emacs + emacsPackage + emacs-lsp-booster + + # Kakoune + kakoune + kakoune-lsp + expect + + # Nix + nil + + # Lua + lua-language-server + lua5_4 + + # Rust + rustc + cargo + rust-analyzer + clippy + + # C + clang + clang-tools + bear + valgrind + + # Lisp + luaPackages.fennel + fnlfmt + fennel-ls + + # Shell + zsh + tmux + bat + bat-extras.batman + bat-extras.batdiff + eza + jellyfin-tui + lazygit + starship + yazi + zk + harper + translate-shell + + ] ++ lib.optionals isDarwin [ + lima + ]; + programs.git = { + enable = true; + settings.user = { + name = "venomade"; + email = "venomade@venomade.com"; + }; + }; + + home.stateVersion = "25.11"; + programs.home-manager.enable = true; + home.file = + let + configDir = "${config.home.homeDirectory}/.dotfiles/config"; + dotsDir = "${config.home.homeDirectory}/.dotfiles/dots"; + + configEntries = lib.mapAttrs + (name: _: { + target = ".config/${name}"; + source = config.lib.file.mkOutOfStoreSymlink "${configDir}/${name}"; + recursive = true; + }) + (lib.filterAttrs + (name: type: type == "directory") + (builtins.readDir ./config)); + + dotsEntries = lib.mapAttrs + (name: _: { + target = ".${name}"; + source = config.lib.file.mkOutOfStoreSymlink "${dotsDir}/${name}"; + }) + (lib.filterAttrs + (name: type: type == "regular") + (builtins.readDir ./dots)); + in + configEntries // dotsEntries; +} |
