diff options
author | venomade <venomade@venomade.com> | 2025-02-27 20:43:57 +0000 |
---|---|---|
committer | venomade <venomade@venomade.com> | 2025-02-27 20:43:57 +0000 |
commit | 5d9bdf29ed503d78b4dcddc40cae59dd874725f1 (patch) | |
tree | 4053c85b0ac8dff53199d6f4082f196b39a3298c | |
parent | 9eb18a3288249845c7dd8143da6aaac9d808d988 (diff) |
Add more configs and the stow ignore
Add configs for: Midnight Commander Emacs mg git X11
-rw-r--r-- | .config/mc/hotlist | 2 | ||||
-rw-r--r-- | .config/mc/hotlist.bak | 1 | ||||
-rw-r--r-- | .config/mc/ini | 166 | ||||
-rw-r--r-- | .config/mc/panels.ini | 37 | ||||
-rw-r--r-- | .emacs.d/config.org | 1102 | ||||
-rw-r--r-- | .emacs.d/init.el | 4 | ||||
-rw-r--r-- | .gitconfig | 3 | ||||
-rw-r--r-- | .mg | 1 | ||||
-rw-r--r-- | .stow-local-ignore | 2 | ||||
-rw-r--r-- | .xsessionrc | 2 |
10 files changed, 1320 insertions, 0 deletions
diff --git a/.config/mc/hotlist b/.config/mc/hotlist new file mode 100644 index 0000000..47b50be --- /dev/null +++ b/.config/mc/hotlist @@ -0,0 +1,2 @@ +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 new file mode 100644 index 0000000..4dbffb7 --- /dev/null +++ b/.config/mc/hotlist.bak @@ -0,0 +1 @@ +ENTRY "/home/venomade/.build/suckless" URL "/home/venomade/.build/suckless" diff --git a/.config/mc/ini b/.config/mc/ini new file mode 100644 index 0000000..115ff36 --- /dev/null +++ b/.config/mc/ini @@ -0,0 +1,166 @@ +[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 new file mode 100644 index 0000000..d22858b --- /dev/null +++ b/.config/mc/panels.ini @@ -0,0 +1,37 @@ +[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/.emacs.d/config.org b/.emacs.d/config.org new file mode 100644 index 0000000..6133c35 --- /dev/null +++ b/.emacs.d/config.org @@ -0,0 +1,1102 @@ +#+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 +*** D +C Interop with a GC. +#+begin_src emacs-lisp + (use-package d-mode + :hook (d-mode . lsp)) +#+end_src +*** 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 +*** 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 +*** 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 +*** 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) + + ;; 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/.emacs.d/init.el b/.emacs.d/init.el new file mode 100644 index 0000000..ff20d92 --- /dev/null +++ b/.emacs.d/init.el @@ -0,0 +1,4 @@ +(org-babel-load-file + (expand-file-name + "config.org" + user-emacs-directory)) diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..8a59d3e --- /dev/null +++ b/.gitconfig @@ -0,0 +1,3 @@ +[user] + name = venomade + email = venomade@venomade.com diff --git a/.mg b/.mg new file mode 100644 index 0000000..480ec1b --- /dev/null +++ b/.mg @@ -0,0 +1 @@ +backup-to-home-directory diff --git a/.stow-local-ignore b/.stow-local-ignore new file mode 100644 index 0000000..35cdaf3 --- /dev/null +++ b/.stow-local-ignore @@ -0,0 +1,2 @@ +.git +README.md diff --git a/.xsessionrc b/.xsessionrc new file mode 100644 index 0000000..c923b63 --- /dev/null +++ b/.xsessionrc @@ -0,0 +1,2 @@ +export QT_QPA_PLATFORMTHEME=gtk2 +export QT_STYLE_OVERRIDE=gtk2 |