Compare commits

...

7 Commits

72 changed files with 7166 additions and 249 deletions
+1
View File
@@ -3,3 +3,4 @@ PRIVATE
.bash*
local_*
local-*
neovim/dot-config/nvim/lua/plugins/*
+46 -1
View File
@@ -137,7 +137,8 @@ eval "$(starship init bash)"
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Pagers
#export PAGER="$(which moar)"
export PAGER="less"
export LESS="-FIRX"
# export MANPAGER="$PAGER"
# Github CLI aliases
@@ -159,3 +160,47 @@ source /home/seb/.config/broot/launcher/bash/br
[ -f "/home/seb/.ghcup/env" ] && . "/home/seb/.ghcup/env" # ghcup-env
alias nodeman='ssh hwsec nodeman'
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/seb/miniforge3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/seb/miniforge3/etc/profile.d/conda.sh" ]; then
. "/home/seb/miniforge3/etc/profile.d/conda.sh"
else
export PATH="/home/seb/miniforge3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
# >>> mamba initialize >>>
# !! Contents within this block are managed by 'mamba shell init' !!
export MAMBA_EXE='/home/seb/miniforge3/bin/mamba';
export MAMBA_ROOT_PREFIX='/home/seb/miniforge3';
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --root-prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__mamba_setup"
else
alias mamba="$MAMBA_EXE" # Fallback on help from mamba activate
fi
unset __mamba_setup
# <<< mamba initialize <<<
# >>> juliaup initialize >>>
# !! Contents within this block are managed by juliaup !!
case ":$PATH:" in
*:/home/seb/.juliaup/bin:*)
;;
*)
export PATH=/home/seb/.juliaup/bin${PATH:+:${PATH}}
;;
esac
# <<< juliaup initialize <<<
+6
View File
@@ -1,2 +1,8 @@
export PATH="$HOME/scripts:$PATH"
export PATH="$HOME/.config/emacs/bin:$PATH"
export PAGER="less"
export LESS="-FIRX"
# Proton Pass cli settings
export PROTON_PASS_KEY_PROVIDER=keyring
export PROTON_PASS_LINUX_KEYRING=dbus
+75
View File
@@ -0,0 +1,75 @@
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets. It is optional.
;; (setq user-full-name "John Doe"
;; user-mail-address "john@doe.com")
;; Doom exposes five (optional) variables for controlling fonts in Doom:
;;
;; - `doom-font' -- the primary font to use
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;; - `doom-symbol-font' -- for symbols
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
;;
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
;;
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
;;
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
;; refresh your font settings. If Emacs still can't find your font, it likely
;; wasn't installed correctly. Font issues are rarely Doom issues!
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one)
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type t)
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/org/")
;; Whenever you reconfigure a package, make sure to wrap your config in an
;; `with-eval-after-load' block, otherwise Doom's defaults may override your
;; settings. E.g.
;;
;; (with-eval-after-load 'PACKAGE
;; (setq x y))
;;
;; The exceptions to this rule:
;;
;; - Setting file/directory variables (like `org-directory')
;; - Setting variables which explicitly tell you to set them before their
;; package is loaded (see 'C-h v VARIABLE' to look them up).
;; - Setting doom variables (which start with 'doom-' or '+').
;;
;; Here are some additional functions/macros that will help you configure Doom.
;;
;; - `load!' for loading external *.el files relative to this one
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
;; etc).
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
+198
View File
@@ -0,0 +1,198 @@
;;;init.el -*- lexical-binding: t; -*-
;;
;; This file controls what Doom modules are enabled and what order they load
;; in. Remember to run 'doom sync' after modifying it!
;;
;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's
;; documentation. There you'll find a link to Doom's Module Index where all
;; of our modules are listed, including what flags they support.
;;
;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or
;; 'C-c c k' for non-vim users) to view its documentation. This works on
;; flags as well (those symbols that start with a plus).
;;
;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its
;; directory (for easy access to its source code).
;;
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
;;chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
:completion
;;company ; the ultimate code completion backend
(corfu +orderless) ; complete with cap(f), cape and a flying feather!
;;helm ; the *other* search engine for love and life
;;ido ; the other *other* search engine...
;;ivy ; a search engine for love and life
vertico ; the search engine of the future
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
;;doom-quit ; DOOM quit-message prompts when you quit Emacs
;;(emoji +unicode) ; 🙂
hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
;;indent-guides ; highlighted indent columns
;;ligatures ; ligatures and symbols to make your code pretty again
;;minimap ; show a map of the code on the side
modeline ; snazzy, Atom-inspired modeline, plus API
;;nav-flash ; blink cursor line after big motions
;;neotree ; a project drawer, like NERDTree for vim
ophints ; highlight the region an operation acts on
(popup +defaults) ; tame sudden yet inevitable temporary windows
;;smooth-scroll ; So smooth you won't believe it's not butter
;;tabs ; a tab bar for Emacs
;;treemacs ; a project drawer, like neotree but cooler
;;unicode ; extended unicode support for various languages
(vc-gutter +pretty) ; vcs diff in the fringe
;; vi-tilde-fringe ; fringe tildes to mark beyond EOB
;;window-select ; visually switch windows
workspaces ; tab emulation, persistence & separate workspaces
;;zen ; distraction-free coding or writing
:editor
(evil +everywhere); come to the dark side, we have cookies
;; file-templates ; auto-snippets for empty files
fold ; (nigh) universal code folding
;;(format +onsave) ; automated prettiness
;;god ; run Emacs commands without modifier keys
;;lispy ; vim for lisp, for people who don't like vim
;;multiple-cursors ; editing in many places at once
;;objed ; text object editing for the innocent
;;parinfer ; turn lisp into python, sort of
;;rotate-text ; cycle region at point between text candidates
snippets ; my elves. They type so I don't have to
(whitespace +guess +trim) ; a butler for your whitespace
;;word-wrap ; soft wrapping with language-aware indent
:emacs
dired ; making dired pretty [functional]
electric ; smarter, keyword-based electric-indent
;;eww ; the internet is gross
;;ibuffer ; interactive buffer management
tramp ; remote files at your arthritic fingertips
undo ; persistent, smarter undo for your inevitable mistakes
vc ; version-control and Emacs, sitting in a tree
:term
;;eshell ; the elisp shell that works everywhere
;;shell ; simple shell REPL for Emacs
;;term ; basic terminal emulator for Emacs
;;vterm ; the best terminal emulation in Emacs
:checkers
syntax ; tasing you for every semicolon you forget
;;(spell +flyspell) ; tasing you for misspelling mispelling
;;grammar ; tasing grammar mistake every you make
:tools
;;ansible
;;biblio ; Writes a PhD for you (citation needed)
;;collab ; buffers with friends
;;debugger ; FIXME stepping through code, to help you add bugs
;;direnv
;;docker
;;editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
(eval +overlay) ; run code, run (also, repls)
lookup ; navigate your code and its documentation
;;llm ; when I said you needed friends, I didn't mean...
(lsp +eglot) ; M-x vscode
magit ; a git porcelain for Emacs
;;make ; run make tasks from Emacs
;;pass ; password manager for nerds
;;pdf ; pdf enhancements
;;terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
tree-sitter ; syntax and parsing, sitting in a tree...
;;upload ; map local to remote projects via ssh/ftp
:os
(:if (featurep :system 'macos) macos) ; improve compatibility with macOS
;;tty ; improve the terminal Emacs experience
:lang
;;ada ; In strong typing we (blindly) trust
;;agda ; types of types of types of types...
;;beancount ; mind the GAAP
(cc +lsp) ; C > C++ == 1
;;clojure ; java with a lisp
;;common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
data ; config/data formats
;;(dart +flutter) ; paint ui and not much else
;;dhall
;;elixir ; erlang done right
;;elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;erlang ; an elegant language for a more civilized age
;;ess ; emacs speaks statistics
;;factor
;;faust ; dsp, but you get to keep your soul
;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER)
;;fsharp ; ML stands for Microsoft's Language
;;fstar ; (dependent) types and (monadic) effects and Z3
;;gdscript ; the language you waited for
(go +lsp) ; the hipster dialect
;;(graphql +lsp) ; Give queries a REST
;;(haskell +lsp) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ; a language you can depend on
;;json ; At least it ain't XML
;;janet ; Fun fact: Janet is me!
(java +lsp) ; the poster child for carpal tunnel syndrome
;;javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;kotlin ; a better, slicker Java(Script)
;;latex ; writing papers in Emacs has never been so fun
;;lean ; for folks with too much to prove
;;ledger ; be audit you can be
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
org ; organize your plain life in plain text
;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;graphviz ; diagrams for confusing yourself even more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
;;racket ; a DSL for DSLs
;;raku ; the artist formerly known as perl6
;;rest ; Emacs as a REST client
;;rst ; ReST in peace
;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
(rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
;;(scheme +guile) ; a fully conniving family of lisps
sh ; she sells {ba,z,fi}sh shells on the C xor
;;sml
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
;;terra ; Earth and Moon in alignment for performance.
;;web ; the tubes
;;yaml ; JSON, but readable
;;zig ; C, but simpler
:email
;;(mu4e +org +gmail)
;;notmuch
;;(wanderlust +gmail)
:app
;;calendar
;;emms
;;everywhere ; *leave* Emacs!? You must be joking
;;irc ; how neckbeards socialize
;;(rss +org) ; emacs as an RSS reader
:config
;;literate
(default +bindings +smartparens))
+54
View File
@@ -0,0 +1,54 @@
;; -*- no-byte-compile: t; -*-
;;; $DOOMDIR/packages.el
;; To install a package:
;;
;; 1. Declare them here in a `package!' statement,
;; 2. Run 'doom sync' in the shell,
;; 3. Restart Emacs.
;;
;; Use 'C-h f package\!' to look up documentation for the `package!' macro.
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;; (package! some-package)
;; To install a package directly from a remote git repo, you must specify a
;; `:recipe'. You'll find documentation on what `:recipe' accepts here:
;; https://github.com/radian-software/straight.el#the-recipe-format
;; (package! another-package
;; :recipe (:host github :repo "username/repo"))
;; If the package you are trying to install does not contain a PACKAGENAME.el
;; file, or is located in a subdirectory of the repo, you'll need to specify
;; `:files' in the `:recipe':
;; (package! this-package
;; :recipe (:host github :repo "username/repo"
;; :files ("some-file.el" "src/lisp/*.el")))
;; If you'd like to disable a package included with Doom, you can do so here
;; with the `:disable' property:
;; (package! builtin-package :disable t)
;; You can override the recipe of a built in package without having to specify
;; all the properties for `:recipe'. These will inherit the rest of its recipe
;; from Doom or MELPA/ELPA/Emacsmirror:
;; (package! builtin-package :recipe (:nonrecursive t))
;; (package! builtin-package-2 :recipe (:repo "myfork/package"))
;; Specify a `:branch' to install a package from a particular branch or tag.
;; This is required for some packages whose default branch isn't 'master' (which
;; our package manager can't deal with; see radian-software/straight.el#279)
;; (package! builtin-package :recipe (:branch "develop"))
;; Use `:pin' to specify a particular commit to install.
;; (package! builtin-package :pin "1a2b3c4d5e")
;; Doom's packages are pinned to a specific commit and updated from release to
;; release. The `unpin!' macro allows you to unpin single packages...
;; (unpin! pinned-package)
;; ...or multiple packages
;; (unpin! pinned-package another-pinned-package)
;; ...Or *all* packages (NOT RECOMMENDED; will likely break things)
;; (unpin! t)
File diff suppressed because it is too large Load Diff
+492
View File
@@ -0,0 +1,492 @@
;;; early-init.el --- Early Init -*- lexical-binding: t; -*-
;; Author: James Cherti <https://www.jamescherti.com/contact/>
;; URL: https://github.com/jamescherti/minimal-emacs.d
;; Package-Requires: ((emacs "29.1"))
;; Keywords: maint
;; Version: 1.4.2
;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Commentary:
;; The minimal-emacs.d project is a lightweight and optimized Emacs base
;; (init.el and early-init.el) that gives you full control over your
;; configuration. It provides better defaults, an optimized startup, and a clean
;; foundation for building your own vanilla Emacs setup.
;;
;; Building the minimal-emacs.d init.el and early-init.el was the result of
;; extensive research and testing to fine-tune the best parameters and
;; optimizations for an Emacs configuration.
;;
;; Do not modify this file; instead, modify pre-early-init.el or
;; post-early-init.el.
;;; Code:
;;; Internal variables
;; Backup of `gc-cons-threshold' and `gc-cons-percentage' before startup.
(defvar minimal-emacs--backup-gc-cons-threshold gc-cons-threshold)
(defvar minimal-emacs--backup-gc-cons-percentage gc-cons-percentage)
;; Temporarily raise the garbage collection threshold to its maximum value.
;; It will be restored later to controlled values.
(setq gc-cons-threshold most-positive-fixnum)
(setq gc-cons-percentage 1.0)
;;; Variables
(defvar minimal-emacs-ui-features '()
"List of user interface features to enable in minimal Emacs setup.
This variable holds a list of Emacs UI features that can be enabled:
- context-menu (Enables the context menu in graphical environments.)
- tool-bar (Enables the tool bar in graphical environments.)
- menu-bar (Enables the menu bar in graphical environments.)
- dialogs (Enables both file dialogs and dialog boxes.)
- tooltips (Enables tooltips.)")
(defvar minimal-emacs-frame-title-format "%b Emacs"
"Template for displaying the title bar of visible and iconified frame.")
(defvar minimal-emacs-debug (bound-and-true-p init-file-debug)
"Non-nil to enable debug.")
(defvar minimal-emacs-optimize-startup-gc t
"If non-nil, increase `gc-cons-threshold' during startup to reduce pauses.
After Emacs finishes loading, `gc-cons-threshold' is restored to the value
stored in `minimal-emacs-gc-cons-threshold'.")
(defvar minimal-emacs-gc-cons-threshold (* 32 1024 1024)
"Value to which `gc-cons-threshold' is set after Emacs startup.
Ignored if `minimal-emacs-optimize-startup-gc' is nil.")
(defvar minimal-emacs-gc-cons-percentage gc-cons-percentage
"Value to which `gc-cons-percentage' is set after Emacs startup.
Ignored if `minimal-emacs-optimize-startup-gc' is nil.")
(defvar minimal-emacs-gc-cons-threshold-restore-delay nil
"Number of seconds to wait before restoring `gc-cons-threshold'.")
(defvar minimal-emacs-optimize-file-name-handler-alist t
"Enable optimization of `file-name-handler-alist'.
When non-nil, this variable activates optimizations to reduce file name handler
lookups during Emacs startup.")
(defvar minimal-emacs-disable-mode-line-during-startup t
"Disable the mode line during startup.
This reduces visual clutter and slightly enhances startup performance. The
tradeoff is that the mode line is hidden during the startup phase.")
(defvar minimal-emacs-package-initialize-and-refresh t
"Whether to automatically initialize and refresh packages.
When set to non-nil, Emacs will automatically call `package-initialize' and
`package-refresh-contents' to set up and update the package system.")
(defvar minimal-emacs-inhibit-redisplay-during-startup nil
"Suppress redisplay during startup to improve performance.
This prevents visual updates while Emacs initializes. The tradeoff is that you
won't see the progress or activities during the startup process.")
(defvar minimal-emacs-inhibit-message-during-startup nil
"Suppress startup messages for a cleaner experience.
This slightly enhances performance. The tradeoff is that you won't be informed
of the progress or any relevant activities during startup.")
(defvar minimal-emacs-user-directory user-emacs-directory
"Directory beneath minimal-emacs.d files are placed.
Note that this should end with a directory separator.")
(defvar minimal-emacs-load-pre-early-init t
"If non-nil, attempt to load `pre-early-init.el`.")
(defvar minimal-emacs-load-post-early-init t
"If non-nil, attempt to load `post-early-init.el`.")
(defvar minimal-emacs-load-pre-init t
"If non-nil, attempt to load `pre-init.el`.")
(defvar minimal-emacs-load-post-init t
"If non-nil, attempt to load `post-init.el`.")
;;; Load pre-early-init.el
;; Prefer loading newer compiled files
(setq load-prefer-newer t)
(when minimal-emacs-debug
(setq debug-on-error minimal-emacs-debug))
(defvar minimal-emacs--success nil)
(defun minimal-emacs--check-success ()
"Verify that the Emacs configuration has loaded successfully."
(unless minimal-emacs--success
(cond
((or (file-exists-p (expand-file-name "~/.emacs.el"))
(file-exists-p (expand-file-name "~/.emacs")))
(error "Emacs ignored loading 'init.el'. Please ensure that files such as ~/.emacs or ~/.emacs.el do not exist, as they may be preventing Emacs from loading the 'init.el' file"))
(t
(error "Configuration error. Debug by starting Emacs with: --debug-init")))))
(unless noninteractive
(add-hook 'emacs-startup-hook #'minimal-emacs--check-success 102))
(defvar minimal-emacs-load-compiled-init-files nil
"If non-nil, attempt to load byte-compiled .elc for init files.
This will enable minimal-emacs to load byte-compiled or possibly native-compiled
init files for the following initialization files: pre-init.el, post-init.el,
pre-early-init.el, and post-early-init.el.")
(defun minimal-emacs--remove-el-file-suffix (filename)
"Remove the Elisp file suffix from FILENAME and return it (.el, .el.gz...)."
(let ((suffixes (mapcar (lambda (ext) (concat ".el" ext))
load-file-rep-suffixes)))
(catch 'done
(dolist (suffix suffixes filename)
(when (string-suffix-p suffix filename)
(setq filename (substring filename 0 (- (length suffix))))
(throw 'done t))))
filename))
(defun minimal-emacs-load-user-init (filename)
"Execute a file of Lisp code named FILENAME."
(let ((init-file (expand-file-name filename
minimal-emacs-user-directory)))
(if (not minimal-emacs-load-compiled-init-files)
(load init-file :no-error (not minimal-emacs-debug) :nosuffix)
;; Remove the file suffix (.el, .el.gz, etc.) to let the `load' function
;; select between .el and .elc files.
(setq init-file (minimal-emacs--remove-el-file-suffix init-file))
(load init-file :no-error (not minimal-emacs-debug)))))
(when minimal-emacs-load-pre-early-init
(minimal-emacs-load-user-init "pre-early-init.el"))
(setq custom-theme-directory
(expand-file-name "themes/" minimal-emacs-user-directory))
(setq custom-file (expand-file-name "custom.el" minimal-emacs-user-directory))
;;; Garbage collection
;; Garbage collection significantly affects startup times. This setting delays
;; garbage collection during startup but will be reset later.
(defun minimal-emacs--restore-gc-values ()
"Restore garbage collection values to minimal-emacs.d values."
(setq gc-cons-threshold minimal-emacs-gc-cons-threshold)
(setq gc-cons-percentage minimal-emacs-gc-cons-percentage))
(defun minimal-emacs--restore-gc ()
"Restore garbage collection settings."
(if (and (bound-and-true-p minimal-emacs-gc-cons-threshold-restore-delay)
;; In noninteractive mode, the event loop does not run
(not noninteractive))
;; Defer garbage collection during initialization to avoid 2 collections.
(run-with-timer minimal-emacs-gc-cons-threshold-restore-delay nil
#'minimal-emacs--restore-gc-values)
(minimal-emacs--restore-gc-values)))
(if minimal-emacs-optimize-startup-gc
;; `gc-cons-threshold' is managed by minimal-emacs.d
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-gc 105)
;; gc-cons-threshold is not managed by minimal-emacs.d.
(when (= gc-cons-threshold most-positive-fixnum)
(setq gc-cons-threshold minimal-emacs--backup-gc-cons-threshold)
(setq gc-cons-percentage minimal-emacs--backup-gc-cons-percentage)))
;;; Native compilation and Byte compilation
(unless (and (featurep 'native-compile)
(fboundp 'native-comp-available-p)
(native-comp-available-p))
;; Deactivate the `native-compile' feature if it is not available
(setq features (delq 'native-compile features)))
(setq native-comp-warning-on-missing-source minimal-emacs-debug
native-comp-async-report-warnings-errors (or minimal-emacs-debug 'silent))
(setq jka-compr-verbose minimal-emacs-debug)
(setq byte-compile-warnings minimal-emacs-debug
byte-compile-verbose minimal-emacs-debug)
;;; Miscellaneous
(set-language-environment "UTF-8")
;; Increase how much is read from processes in a single chunk
(setq read-process-output-max (* 2 1024 1024)) ; 1024kb
(setq process-adaptive-read-buffering nil)
;; Don't ping things that look like domain names.
(setq ffap-machine-p-known 'reject)
(setq warning-minimum-level (if minimal-emacs-debug :warning :error))
(setq warning-suppress-types '((lexical-binding)))
(when minimal-emacs-debug
(setq message-log-max 16384))
;; In PGTK, this timeout introduces latency. Reducing it from the default 0.1
;; improves responsiveness of childframes and related packages.
(when (boundp 'pgtk-wait-for-event-timeout)
(setq pgtk-wait-for-event-timeout 0.001))
;; Disable warnings from the legacy advice API. They aren't useful.
(setq ad-redefinition-action 'accept)
;;; Performance: Miscellaneous options
;; Font compacting can be very resource-intensive, especially when rendering
;; icon fonts on Windows. This will increase memory usage.
(setq inhibit-compacting-font-caches t)
(when (not noninteractive)
;; Resizing the Emacs frame can be costly when changing the font. Disable this
;; to improve startup times with fonts larger than the system default.
(setq frame-resize-pixelwise t)
;; Without this, Emacs will try to resize itself to a specific column size
(setq frame-inhibit-implied-resize t)
;; A second, case-insensitive pass over `auto-mode-alist' is time wasted.
;; No second pass of case-insensitive search over auto-mode-alist.
(setq auto-mode-case-fold nil)
;; Reduce *Message* noise at startup. An empty scratch buffer (or the
;; dashboard) is more than enough, and faster to display.
(setq inhibit-startup-screen t
inhibit-startup-echo-area-message user-login-name)
(setq initial-buffer-choice nil
inhibit-startup-buffer-menu t
inhibit-x-resources t)
;; Disable bidirectional text scanning for a modest performance boost.
(setq-default bidi-display-reordering 'left-to-right
bidi-paragraph-direction 'left-to-right)
;; Give up some bidirectional functionality for slightly faster re-display.
(setq bidi-inhibit-bpa t)
;; Remove "For information about GNU Emacs..." message at startup
(advice-add 'display-startup-echo-area-message :override #'ignore)
;; Suppress the vanilla startup screen completely. We've disabled it with
;; `inhibit-startup-screen', but it would still initialize anyway.
(advice-add 'display-startup-screen :override #'ignore)
(unless minimal-emacs-debug
;; Unset command line options irrelevant to the current OS. These options
;; are still processed by `command-line-1` but have no effect.
(unless (eq system-type 'darwin)
(setq command-line-ns-option-alist nil))
(unless (memq initial-window-system '(x pgtk))
(setq command-line-x-option-alist nil))))
;;; Performance: File-name-handler-alist
(defvar minimal-emacs--old-file-name-handler-alist (default-toplevel-value
'file-name-handler-alist))
(defun minimal-emacs--respect-file-handlers (fn args-left)
"Respect file handlers.
FN is the function and ARGS-LEFT is the same argument as `command-line-1'.
Emacs processes command-line files very early in startup. These files may
include special paths like TRAMP paths, so restore `file-name-handler-alist' for
this stage of initialization."
(let ((file-name-handler-alist (if args-left
minimal-emacs--old-file-name-handler-alist
file-name-handler-alist)))
(funcall fn args-left)))
(defun minimal-emacs--restore-file-name-handler-alist ()
"Restore `file-name-handler-alist'."
(set-default-toplevel-value
'file-name-handler-alist
;; Merge instead of overwrite to preserve any changes made since startup.
(delete-dups (append file-name-handler-alist
minimal-emacs--old-file-name-handler-alist))))
(when (and minimal-emacs-optimize-file-name-handler-alist
(not minimal-emacs-debug))
;; Determine the state of bundled libraries using calc-loaddefs.el. If
;; compressed, retain the gzip handler in `file-name-handler-alist`. If
;; compiled or neither, omit the gzip handler during startup for improved
;; startup and package load time.
(set-default-toplevel-value
'file-name-handler-alist
(if (locate-file-internal "calc-loaddefs.el" load-path)
nil
(list (rassq 'jka-compr-handler
minimal-emacs--old-file-name-handler-alist))))
;; Ensure the new value persists through any current let-binding.
(put 'file-name-handler-alist 'initial-value
minimal-emacs--old-file-name-handler-alist)
;; Emacs processes command-line files very early in startup. These files may
;; include special paths TRAMP. Restore `file-name-handler-alist'.
(advice-add 'command-line-1 :around #'minimal-emacs--respect-file-handlers)
(add-hook 'emacs-startup-hook #'minimal-emacs--restore-file-name-handler-alist
101))
;;; Performance: Inhibit redisplay
(defun minimal-emacs--reset-inhibit-redisplay ()
"Reset inhibit redisplay."
(setq-default inhibit-redisplay nil)
(remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay))
(when (and minimal-emacs-inhibit-redisplay-during-startup
(not noninteractive)
(not minimal-emacs-debug))
;; Suppress redisplay and redraw during startup to avoid delays and
;; prevent flashing an unstyled Emacs frame.
(setq-default inhibit-redisplay t)
(add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-redisplay -100))
;;; Performance: Inhibit message
(defun minimal-emacs--reset-inhibit-message ()
"Reset inhibit message."
(setq-default inhibit-message nil)
(remove-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message))
(when (and minimal-emacs-inhibit-message-during-startup
(not noninteractive)
(not minimal-emacs-debug))
(setq-default inhibit-message t)
(add-hook 'post-command-hook #'minimal-emacs--reset-inhibit-message -100))
;;; Performance: Disable mode-line during startup
(defvar-local minimal-emacs--hidden-mode-line nil
"Store the buffer-local value of `mode-line-format' during startup.")
(when (and minimal-emacs-disable-mode-line-during-startup
(not noninteractive)
(not minimal-emacs-debug))
(put 'mode-line-format
'initial-value (default-toplevel-value 'mode-line-format))
(setq-default mode-line-format nil)
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (local-variable-p 'mode-line-format)
(setq minimal-emacs--hidden-mode-line mode-line-format)
(setq mode-line-format nil)))))
;;; Restore values
(defun minimal-emacs--startup-load-user-init-file (fn &rest args)
"Advice to reset `mode-line-format'. FN and ARGS are the function and args."
(unwind-protect
;; Start up as normal
(apply fn args)
;; If we don't undo inhibit-{message, redisplay} and there's an error, we'll
;; see nothing but a blank Emacs frame.
(when minimal-emacs-inhibit-message-during-startup
(setq-default inhibit-message nil))
(when minimal-emacs-inhibit-redisplay-during-startup
(setq-default inhibit-redisplay nil))
;; Restore the mode-line
(when minimal-emacs-disable-mode-line-during-startup
(unless (default-toplevel-value 'mode-line-format)
(setq-default mode-line-format (get 'mode-line-format
'initial-value)))
(dolist (buf (buffer-list))
(with-current-buffer buf
(when (local-variable-p 'minimal-emacs--hidden-mode-line)
(setq mode-line-format minimal-emacs--hidden-mode-line)
(kill-local-variable 'minimal-emacs--hidden-mode-line)))))))
(advice-add 'startup--load-user-init-file :around
#'minimal-emacs--startup-load-user-init-file)
;;; UI elements
(setq frame-title-format minimal-emacs-frame-title-format
icon-title-format minimal-emacs-frame-title-format)
;; Disable startup screens and messages
(setq inhibit-splash-screen t)
;; I intentionally avoid calling `menu-bar-mode', `tool-bar-mode', and
;; `scroll-bar-mode' because manipulating frame parameters can trigger or queue
;; a superfluous and potentially expensive frame redraw at startup, depending
;; on the window system. The variables must also be set to `nil' so users don't
;; have to call the functions twice to re-enable them.
(unless (memq 'menu-bar minimal-emacs-ui-features)
(push '(menu-bar-lines . 0) default-frame-alist)
(unless (memq window-system '(mac ns))
(setq menu-bar-mode nil)))
(defun minimal-emacs--setup-toolbar (&rest _)
"Setup the toolbar."
(when (fboundp 'tool-bar-setup)
(advice-remove 'tool-bar-setup #'ignore)
(when (bound-and-true-p tool-bar-mode)
(funcall 'tool-bar-setup))))
(unless noninteractive
(when (fboundp 'tool-bar-setup)
;; Temporarily override the tool-bar-setup function to prevent it from
;; running during the initial stages of startup
(advice-add 'tool-bar-setup :override #'ignore)
(advice-add 'startup--load-user-init-file :after
#'minimal-emacs--setup-toolbar)))
(unless (memq 'tool-bar minimal-emacs-ui-features)
(push '(tool-bar-lines . 0) default-frame-alist)
(setq tool-bar-mode nil))
(setq default-frame-scroll-bars 'right)
(push '(vertical-scroll-bars) default-frame-alist)
(push '(horizontal-scroll-bars) default-frame-alist)
(setq scroll-bar-mode nil)
(unless (memq 'tooltips minimal-emacs-ui-features)
(when (bound-and-true-p tooltip-mode)
(tooltip-mode -1)))
;; Disable GUIs because they are inconsistent across systems, desktop
;; environments, and themes, and they don't match the look of Emacs.
(unless (memq 'dialogs minimal-emacs-ui-features)
(setq use-file-dialog nil)
(setq use-dialog-box nil))
;;; Security
(setq gnutls-verify-error t) ; Prompts user if there are certificate issues
(setq tls-checktrust t) ; Ensure SSL/TLS connections undergo trust verification
(setq gnutls-min-prime-bits 3072) ; Stronger GnuTLS encryption
;; This results in a more compact output that emphasizes performance
(setq use-package-expand-minimally t)
(setq use-package-minimum-reported-time (if minimal-emacs-debug 0 0.1))
(setq use-package-verbose minimal-emacs-debug)
(setq use-package-always-ensure (not noninteractive))
(setq use-package-enable-imenu-support t)
;; package.el
(setq package-enable-at-startup nil) ; Let the init.el file handle this
(setq package-quickstart-file
(expand-file-name "package-quickstart.el" user-emacs-directory))
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("melpa-stable" . "https://stable.melpa.org/packages/")))
(setq package-archive-priorities '(("gnu" . 99)
("nongnu" . 80)
("melpa" . 70)
("melpa-stable" . 50)))
;;; Load post-early-init.el
(when minimal-emacs-load-post-early-init
(minimal-emacs-load-user-init "post-early-init.el"))
;; Local variables:
;; byte-compile-warnings: (not obsolete free-vars)
;; End:
;;; early-init.el ends here
+579
View File
@@ -0,0 +1,579 @@
;;; init.el --- Init -*- lexical-binding: t; -*-
;; Author: James Cherti <https://www.jamescherti.com/contact/>
;; URL: https://github.com/jamescherti/minimal-emacs.d
;; Package-Requires: ((emacs "29.1"))
;; Keywords: maint
;; Version: 1.4.2
;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Commentary:
;; The minimal-emacs.d project is a lightweight and optimized Emacs base
;; (init.el and early-init.el) that gives you full control over your
;; configuration. It provides better defaults, an optimized startup, and a clean
;; foundation for building your own vanilla Emacs setup.
;;
;; Building the minimal-emacs.d init.el and early-init.el was the result of
;; extensive research and testing to fine-tune the best parameters and
;; optimizations for an Emacs configuration.
;;
;; Do not modify this file; instead, modify pre-init.el or post-init.el.
;;; Code:
;;; Load pre-init.el
(if (fboundp 'minimal-emacs-load-user-init)
(when minimal-emacs-load-pre-init
(minimal-emacs-load-user-init "pre-init.el"))
(error "The early-init.el file failed to load"))
;;; Before package
;; The initial buffer is created during startup even in non-interactive
;; sessions, and its major mode is fully initialized. Modes like `text-mode',
;; `org-mode', or even the default `lisp-interaction-mode' load extra packages
;; and run hooks, which can slow down startup.
;;
;; Using `fundamental-mode' for the initial buffer to avoid unnecessary
;; startup overhead.
(setq initial-major-mode 'fundamental-mode
initial-scratch-message nil)
;; Set-language-environment sets default-input-method, which is unwanted.
(setq default-input-method nil)
;; Ask the user whether to terminate asynchronous compilations on exit.
;; This prevents native compilation from leaving temporary files in /tmp.
(setq native-comp-async-query-on-exit t)
;; Allow for shorter responses: "y" for yes and "n" for no.
(setq read-answer-short t)
(if (boundp 'use-short-answers)
(setq use-short-answers t)
(advice-add 'yes-or-no-p :override #'y-or-n-p))
;;; Undo/redo
(setq undo-limit (* 13 160000)
undo-strong-limit (* 13 240000)
undo-outer-limit (* 13 24000000))
;;; package.el
(when (and (bound-and-true-p minimal-emacs-package-initialize-and-refresh)
(not (bound-and-true-p byte-compile-current-file)))
;; Initialize and refresh package contents again if needed
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(when (and (version< emacs-version "29.1")
(not (package-installed-p 'use-package)))
(package-install 'use-package))
(require 'use-package))
;;; Minibuffer
(setq enable-recursive-minibuffers t) ; Allow nested minibuffers
;; Keep the cursor out of the read-only portions of the.minibuffer
(setq minibuffer-prompt-properties
'(read-only t intangible t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode)
;;; Display and user interface
;; By default, Emacs "updates" its ui more often than it needs to
(setq which-func-update-delay 1.0)
(setq idle-update-delay which-func-update-delay) ;; Obsolete in >= 30.1
(defalias #'view-hello-file #'ignore) ; Never show the hello file
;; No beeping or blinking
(setq visible-bell nil)
(setq ring-bell-function #'ignore)
;; Position underlines at the descent line instead of the baseline.
(setq x-underline-at-descent-line t)
(setq truncate-string-ellipsis "")
(setq display-time-default-load-average nil) ; Omit load average
;;; Show-paren
(setq show-paren-delay 0.1
show-paren-highlight-openparen t
show-paren-when-point-inside-paren t
show-paren-when-point-in-periphery t)
;;; Buffer management
(setq custom-buffer-done-kill t)
;; Disable auto-adding a new line at the bottom when scrolling.
(setq next-line-add-newlines nil)
;; This setting forces Emacs to save bookmarks immediately after each change.
;; Benefit: you never lose bookmarks if Emacs crashes.
(setq bookmark-save-flag 1)
(setq uniquify-buffer-name-style 'forward)
(setq remote-file-name-inhibit-cache 50)
;; Disable fontification during user input to reduce lag in large buffers.
;; Also helps marginally with scrolling performance.
(setq redisplay-skip-fontification-on-input t)
;;; Misc
(setq whitespace-line-column nil) ; Use the value of `fill-column'.
;; Disable ellipsis when printing s-expressions in the message buffer
(setq eval-expression-print-length nil
eval-expression-print-level nil)
;; This directs gpg-agent to use the minibuffer for passphrase entry
(setq epg-pinentry-mode 'loopback)
;; By default, Emacs stores sensitive authinfo credentials as unencrypted text
;; in your home directory. Use GPG to encrypt the authinfo file for enhanced
;; security.
(setq auth-sources (list "~/.authinfo.gpg"))
;;; `display-line-numbers-mode'
(setq-default display-line-numbers-width 3)
(setq-default display-line-numbers-widen t)
;;; imenu
;; Automatically rescan the buffer for Imenu entries when `imenu' is invoked
;; This ensures the index reflects recent edits.
(setq imenu-auto-rescan t)
;; Prevent truncation of long function names in `imenu' listings
(setq imenu-max-item-length 160)
;;; Tramp
(setq tramp-verbose 1)
;;; Files
;; Delete by moving to trash in interactive mode
(setq delete-by-moving-to-trash (not noninteractive))
(setq remote-file-name-inhibit-delete-by-moving-to-trash t)
;; Ignoring this is acceptable since it will redirect to the buffer regardless.
(setq find-file-suppress-same-file-warnings t)
;; Automatically resolve symlinks to their true paths. This sets the correct
;; working directory so C-x C-f opens in the right folder and version control
;; tools recognize the Git repository.
(setq find-file-visit-truename t
;; Automatically follow a symlink to its source if that source is managed
;; by a version control system, rather than asking for permission.
vc-follow-symlinks t)
;; Prefer vertical splits over horizontal ones
(setq split-width-threshold 170
split-height-threshold nil)
;;; comint (general command interpreter in a window)
(setq ansi-color-for-comint-mode t
comint-prompt-read-only t
comint-buffer-maximum-size 4096)
;;; Compilation
(setq compilation-ask-about-save nil
compilation-always-kill t
compilation-scroll-output 'first-error)
;; Skip confirmation prompts when creating a new file or buffer
(setq confirm-nonexistent-file-or-buffer nil)
;;; Backup files
;; Disable the creation of lockfiles (e.g., .#filename).
;; Modern workflows rely on `global-auto-revert-mode' to handle external file
;; changes gracefully, making the restrictive nature of lockfiles unnecessary.
(setq create-lockfiles nil)
;; Disable backup files (e.g., filename~). Note that `auto-save-default'
;; remains enabled by default. Even with `make-backup-files' backups disabled,
;; Emacs will still generate temporary recovery files (e.g., #filename#) for
;; unsaved buffers. This protects your active work from sudden crashes while
;; ensuring the file system is cleaned up immediately upon a successful save.
(setq make-backup-files nil)
(setq backup-directory-alist
`(("." . ,(expand-file-name "backup" user-emacs-directory))))
(setq tramp-backup-directory-alist backup-directory-alist)
(setq backup-by-copying-when-linked t)
(setq backup-by-copying t) ; Backup by copying rather renaming
(setq delete-old-versions t) ; Delete excess backup versions silently
(setq version-control t) ; Use version numbers for backup files
(setq kept-new-versions 5)
(setq kept-old-versions 5)
;;; VC
(setq vc-git-print-log-follow t)
(setq vc-git-diff-switches '("--histogram")) ; Faster algorithm for diffing.
;;; Auto save
;; Enable auto-save to safeguard against crashes or data loss. The
;; `recover-file' or `recover-session' functions can be used to restore
;; auto-saved data.
(setq auto-save-no-message t)
(when noninteractive
;; The command line interface
(setq enable-dir-local-variables nil)
(setq case-fold-search nil))
;; Do not auto-disable auto-save after deleting large chunks of
;; text.
(setq auto-save-include-big-deletions t)
(setq auto-save-list-file-prefix
(expand-file-name "autosave/" user-emacs-directory))
(setq tramp-auto-save-directory
(expand-file-name "tramp-autosave/" user-emacs-directory))
(setq auto-save-file-name-transforms
`(("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'"
,(file-name-concat auto-save-list-file-prefix "tramp-\\2-") sha1)
("\\`/\\([^/]+/\\)*\\([^/]+\\)\\'"
,(file-name-concat auto-save-list-file-prefix "\\2-") sha1)))
;; Ensure the directory for auto-save session logs exists with restricted
;; permissions.
(when auto-save-default
(let ((auto-save-dir (file-name-directory auto-save-list-file-prefix)))
(unless (file-exists-p auto-save-dir)
(with-file-modes #o700
(make-directory auto-save-dir t)))))
;; Auto save options
(setq kill-buffer-delete-auto-save-files t)
;; Remove duplicates from the kill ring to reduce clutter
(setq kill-do-not-save-duplicates t)
;;; Auto revert
;; Auto-revert in Emacs is a feature that automatically updates the contents of
;; a buffer to reflect changes made to the underlying file.
;; Revert other buffers (e.g, Dired)
(setq global-auto-revert-non-file-buffers t)
(setq global-auto-revert-ignore-modes '(Buffer-menu-mode)) ; Resolve issue #29
;;; recentf
;; `recentf' is an that maintains a list of recently accessed files.
(setq recentf-max-saved-items 300) ; default is 20
(setq recentf-max-menu-items 15)
(setq recentf-auto-cleanup 'mode)
;;; saveplace
;; Enables Emacs to remember the last location within a file upon reopening.
(setq save-place-file (expand-file-name "saveplace" user-emacs-directory))
(setq save-place-limit 600)
;;; savehist
;; `savehist-mode' is an Emacs feature that preserves the minibuffer history
;; between sessions.
(setq history-length 300)
(setq savehist-additional-variables
'(register-alist ; macros
mark-ring global-mark-ring ; marks
search-ring regexp-search-ring)) ; searches
;;; Frames and windows
(setq resize-mini-windows 'grow-only)
;; The native border "uses" a pixel of the fringe on the rightmost
;; splits, whereas `window-divider-mode' does not.
(setq window-divider-default-bottom-width 1
window-divider-default-places t
window-divider-default-right-width 1)
;;; Scrolling
;; Enables faster scrolling. This may result in brief periods of inaccurate
;; syntax highlighting, which should quickly self-correct.
(setq fast-but-imprecise-scrolling t)
;; Move point to top/bottom of buffer before signaling a scrolling error.
(setq scroll-error-top-bottom t)
;; Keep screen position if scroll command moved it vertically out of the window.
(setq scroll-preserve-screen-position t)
;; Emacs recenters the window when the cursor moves past `scroll-conservatively'
;; lines beyond the window edge. A value over 101 disables recentering; the
;; default (0) is too eager. Here it is set to 20 for a balanced behavior.
(setq scroll-conservatively 20)
;; 1. Preventing automatic adjustments to `window-vscroll' for long lines.
;; 2. Resolving the issue of random half-screen jumps during scrolling.
(setq auto-window-vscroll nil)
;; Horizontal scrolling
(setq hscroll-margin 2
hscroll-step 1)
;; Emacs 29
(when (memq 'context-menu minimal-emacs-ui-features)
(when (and (display-graphic-p) (fboundp 'context-menu-mode))
(add-hook 'after-init-hook #'context-menu-mode)))
;;; Cursor
;; The blinking cursor is distracting and interferes with cursor settings in
;; some minor modes that try to change it buffer-locally (e.g., Treemacs).
(when (bound-and-true-p blink-cursor-mode)
(blink-cursor-mode -1))
;; Don't blink the paren matching the one at point, it's too distracting.
(setq blink-matching-paren nil)
;; Reduce rendering/line scan work by not rendering cursors or regions in
;; non-focused windows.
(setq highlight-nonselected-windows nil)
;;; Text editing, indent, font, and formatting
;; Avoid automatic frame resizing when adjusting settings.
(setq global-text-scale-adjust-resizes-frames nil)
;; A longer delay can be annoying as it causes a noticeable pause after each
;; deletion, disrupting the flow of editing.
(setq delete-pair-blink-delay 0.03)
;; Continue wrapped lines at whitespace rather than breaking in the
;; middle of a word.
(setq-default word-wrap t)
;; Disable wrapping by default due to its performance cost.
(setq-default truncate-lines t)
;; If enabled and `truncate-lines' is disabled, soft wrapping will not occur
;; when the window is narrower than `truncate-partial-width-windows' characters.
(setq truncate-partial-width-windows nil)
;; Configure automatic indentation to be triggered exclusively by newline and
;; DEL (backspace) characters.
(setq-default electric-indent-chars '(?\n ?\^?))
;; Prefer spaces over tabs. Spaces offer a more consistent default compared to
;; 8-space tabs. This setting can be adjusted on a per-mode basis as needed.
(setq-default indent-tabs-mode nil
tab-width 4)
;; Enable indentation and completion using the TAB key
(setq tab-always-indent 'complete)
(setq tab-first-completion 'word-or-paren-or-punct)
;; Perf: Reduce command completion overhead.
(setq read-extended-command-predicate #'command-completion-default-include-p)
;; Enable multi-line commenting which ensures that `comment-indent-new-line'
;; properly continues comments onto new lines.
(setq comment-multi-line t)
;; Ensures that empty lines within the commented region are also commented out.
;; This prevents unintended visual gaps and maintains a consistent appearance.
(setq comment-empty-lines t)
;; We often split terminals and editor windows or place them side-by-side,
;; making use of the additional horizontal space.
(setq-default fill-column 80)
;; Disable the obsolete practice of end-of-line spacing from the typewriter era.
(setq sentence-end-double-space nil)
;; According to the POSIX, a line is defined as "a sequence of zero or more
;; non-newline characters followed by a terminating newline".
(setq require-final-newline t)
;; Eliminate delay before highlighting search matches
(setq lazy-highlight-initial-delay 0)
;;; Filetype
;; Do not notify the user each time Python tries to guess the indentation offset
(setq python-indent-guess-indent-offset-verbose nil)
(setq sh-indent-after-continuation 'always)
;;; Dired and ls-lisp
(setq dired-free-space nil
dired-dwim-target t ; Propose a target for intelligent moving/copying
dired-deletion-confirmer 'y-or-n-p
dired-filter-verbose nil
dired-recursive-deletes 'top
dired-recursive-copies 'always
dired-vc-rename-file t
dired-create-destination-dirs 'ask
;; Suppress Dired buffer kill prompt for deleted dirs
dired-clean-confirm-killing-deleted-buffers nil)
;; This is a higher-level predicate that wraps `dired-directory-changed-p'
;; with additional logic. This `dired-buffer-stale-p' predicate handles remote
;; files, wdired, unreadable dirs, and delegates to dired-directory-changed-p
;; for modification checks.
(setq auto-revert-remote-files nil)
(setq dired-auto-revert-buffer 'dired-buffer-stale-p)
;; dired-omit-mode
(setq dired-omit-verbose nil
dired-omit-files (concat "\\`[.]\\'"))
(setq ls-lisp-verbosity nil)
(setq ls-lisp-dirs-first t)
;;; Ediff
;; Configure Ediff to use a single frame and split windows horizontally
(setq ediff-window-setup-function 'ediff-setup-windows-plain
ediff-split-window-function 'split-window-horizontally)
;;; Help
;; Enhance `apropos' and related functions to perform more extensive searches
(setq apropos-do-all t)
;; Fixes #11: Prevents help command completion from triggering autoload.
;; Loading additional files for completion can slow down help commands and may
;; unintentionally execute initialization code from some libraries.
(setq help-enable-completion-autoload nil)
(setq help-enable-autoload nil)
(setq help-enable-symbol-autoload nil)
(setq help-window-select t) ;; Focus new help windows when opened
;;; Eglot
(setq eglot-report-progress minimal-emacs-debug) ; Prevent minibuffer spam
(setq eglot-autoshutdown t) ; Shut down after killing last managed buffer
;; A setting of nil or 0 means Eglot will not block the UI at all, allowing
;; Emacs to remain fully responsive, although LSP features will only become
;; available once the connection is established in the background.
(setq eglot-sync-connect 0)
;; Activate Eglot in cross-referenced non-project files
(setq eglot-extend-to-xref t)
;; Eglot optimization
(if minimal-emacs-debug
(setq eglot-events-buffer-config '(:size 2000000 :format full))
;; This reduces log clutter to improves performance.
(setq jsonrpc-event-hook nil)
;; Reduce memory usage and avoid cluttering *EGLOT events* buffer
(setq eglot-events-buffer-size 0) ; Deprecated
(setq eglot-events-buffer-config '(:size 0 :format short)))
;;; Flymake
(setq flymake-show-diagnostics-at-end-of-line nil)
(setq flymake-wrap-around nil)
;;; hl-line-mode
;; Highlighting the current window, reducing clutter and improving performance
(setq hl-line-sticky-flag nil)
(setq global-hl-line-sticky-flag nil)
;;; icomplete
;; Do not delay displaying completion candidates in `fido-mode' or
;; `fido-vertical-mode'
(setq icomplete-compute-delay 0.01)
;;; flyspell
;; Improves flyspell performance by preventing messages from being displayed for
;; each word when checking the entire buffer.
(setq flyspell-issue-message-flag nil)
(setq flyspell-issue-welcome-flag nil)
;;; ispell
;; In Emacs 30 and newer, disable Ispell completion to avoid annotation errors
;; when no `ispell' dictionary is set.
(setq text-mode-ispell-word-completion nil)
(setq ispell-silently-savep t)
;;; ibuffer
(setq ibuffer-formats
'((mark modified read-only locked
" " (name 55 55 :left :elide)
" " (size 8 -1 :right)
" " (mode 18 18 :left :elide) " " filename-and-process)
(mark " " (name 16 -1) " " filename)))
;;; xref
;; Enable completion in the minibuffer instead of the definitions buffer
(setq xref-show-definitions-function 'xref-show-definitions-completing-read
xref-show-xrefs-function 'xref-show-definitions-completing-read)
;;; abbrev
;; Ensure the abbrev_defs file is stored in the correct location when
;; `user-emacs-directory' is modified, as it defaults to ~/.emacs.d/abbrev_defs
;; regardless of the change.
(setq abbrev-file-name (expand-file-name "abbrev_defs" user-emacs-directory))
(setq save-abbrevs 'silently)
;;; dabbrev
(setq dabbrev-upcase-means-case-search t)
(setq dabbrev-ignored-buffer-modes
'(archive-mode image-mode docview-mode tags-table-mode
pdf-view-mode tags-table-mode))
(setq dabbrev-ignored-buffer-regexps
'(;; - Buffers starting with a space (internal or temporary buffers)
"\\` "
;; Tags files such as ETAGS, GTAGS, RTAGS, TAGS, e?tags, and GPATH,
;; including versions with numeric extensions like <123>
"\\(?:\\(?:[EG]?\\|GR\\)TAGS\\|e?tags\\|GPATH\\)\\(<[0-9]+>\\)?"))
;;; Remove warnings from narrow-to-region, upcase-region...
(dolist (cmd '(list-timers narrow-to-region narrow-to-page
upcase-region downcase-region
list-threads erase-buffer scroll-left
dired-find-alternate-file set-goal-column))
(put cmd 'disabled nil))
;;; Load post init
(when (and minimal-emacs-load-post-init
(fboundp 'minimal-emacs-load-user-init))
(minimal-emacs-load-user-init "post-init.el"))
(setq minimal-emacs--success t)
;; Local variables:
;; byte-compile-warnings: (not obsolete free-vars)
;; End:
;;; init.el ends here
+842
View File
@@ -0,0 +1,842 @@
;;; post-init.el --- DESCRIPTION -*- no-byte-compile: t; lexical-binding: t; -*-
;; Auto-revert in Emacs is a feature that automatically updates the
;; contents of a buffer to reflect changes made to the underlying file
;; on disk.
(use-package exec-path-from-shell
:if (and (or (display-graphic-p) (daemonp))
(eq system-type 'darwin)) ; macOS only
:demand t
:functions exec-path-from-shell-initialize
:config
(dolist (var '("TMPDIR"
"SSH_AUTH_SOCK" "SSH_AGENT_PID"
"GPG_AGENT_INFO"
;; "FZF_DEFAULT_COMMAND" "FZF_DEFAULT_OPTS" ; fzf
;; "VIRTUAL_ENV" ; Python
;; "GOPATH" "GOROOT" "GOBIN" ; Go
;; "CARGO_HOME" "RUSTUP_HOME" ; Rust
;; "NVM_DIR" "NODE_PATH" ; Node/JS
"LANG" "LC_CTYPE"))
(add-to-list 'exec-path-from-shell-variables var))
;; Initialize
(exec-path-from-shell-initialize))
;; Recentf is an Emacs package that maintains a list of recently
;; accessed files, making it easier to reopen files you have worked on
;; recently.
(use-package autorevert
:ensure nil
:commands (auto-revert-mode global-auto-revert-mode)
:hook
(after-init . global-auto-revert-mode)
:init
;; (setq auto-revert-verbose t)
(setq auto-revert-interval 3)
(setq auto-revert-remote-files nil)
(setq auto-revert-use-notify t)
(setq auto-revert-avoid-polling nil))
;; Recentf is an Emacs package that maintains a list of recently
;; accessed files, making it easier to reopen files you have worked on
;; recently.
(use-package recentf
:ensure nil
:commands (recentf-mode recentf-cleanup)
:hook
(after-init . recentf-mode)
:init
(setq recentf-auto-cleanup (if (daemonp) 300 'never))
(setq recentf-exclude
(list "\\.tar$" "\\.tbz2$" "\\.tbz$" "\\.tgz$" "\\.bz2$"
"\\.bz$" "\\.gz$" "\\.gzip$" "\\.xz$" "\\.zip$"
"\\.7z$" "\\.rar$"
"COMMIT_EDITMSG\\'"
"\\.\\(?:gz\\|gif\\|svg\\|png\\|jpe?g\\|bmp\\|xpm\\)$"
"-autoloads\\.el$" "autoload\\.el$"))
:config
;; A cleanup depth of -90 ensures that `recentf-cleanup' runs before
;; `recentf-save-list', allowing stale entries to be removed before the list
;; is saved by `recentf-save-list', which is automatically added to
;; `kill-emacs-hook' by `recentf-mode'.
(add-hook 'kill-emacs-hook #'recentf-cleanup -90))
;; savehist is an Emacs feature that preserves the minibuffer history between
;; sessions. It saves the history of inputs in the minibuffer, such as commands,
;; search strings, and other prompts, to a file. This allows users to retain
;; their minibuffer history across Emacs restarts.
(use-package savehist
:ensure nil
:commands (savehist-mode savehist-save)
:hook
(after-init . savehist-mode)
:init
(setq history-length 300)
(setq savehist-autosave-interval 600))
;; save-place-mode enables Emacs to remember the last location within a file
;; upon reopening. This feature is particularly beneficial for resuming work at
;; the precise point where you previously left off.
(use-package saveplace
:ensure nil
:commands (save-place-mode save-place-local-mode)
:hook
(after-init . save-place-mode)
:init
(setq save-place-limit 400))
;; Enable `auto-save-mode' to prevent data loss. Use `recover-file' or
;; `recover-session' to restore unsaved changes.
(setq auto-save-default t)
;; Trigger an auto-save after 300 keystrokes
(setq auto-save-interval 300)
;; Trigger an auto-save 30 seconds of idle time.
(setq auto-save-timeout 30)
;; When auto-save-visited-mode is enabled, Emacs will auto-save file-visiting
;; buffers after a certain amount of idle time if the user forgets to save it
;; with save-buffer or C-x s for example.
;;
;; This is different from auto-save-mode: auto-save-mode periodically saves
;; all modified buffers, creating backup files, including those not associated
;; with a file, while auto-save-visited-mode only saves file-visiting buffers
;; after a period of idle time, directly saving to the file itself without
;; creating backup files.
(setq auto-save-visited-interval 5) ; Save after 5 seconds if inactivity
(auto-save-visited-mode 1)
;; Vertico provides a vertical completion interface, making it easier to
;; navigate and select from completion candidates (e.g., when `M-x` is pressed).
(use-package vertico
;; (Note: It is recommended to also enable the savehist package.)
:config
(vertico-mode))
;; Vertico leverages Orderless' flexible matching capabilities, allowing users
;; to input multiple patterns separated by spaces, which Orderless then
;; matches in any order against the candidates.
(use-package orderless
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
;; Marginalia allows Embark to offer you preconfigured actions in more contexts.
;;
;; annotations to the completion candidates displayed in Vertico's interface.
(use-package marginalia
:commands (marginalia-mode marginalia-cycle)
:hook (after-init . marginalia-mode))
;; Embark integrates with Consult and Vertico to provide context-sensitive
;; actions and quick access to commands based on the current selection, further
;; improving user efficiency and workflow within Emacs. Together, they create a
;; cohesive and powerful environment for managing completions and interactions.
(use-package embark
;; Embark is an Emacs package that acts like a context menu, allowing
;; users to perform context-sensitive actions on selected items
;; directly from the completion interface.
:commands (embark-act
embark-dwim
embark-export
embark-collect
embark-bindings
embark-prefix-help-command)
:bind
(("C-." . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init
(setq prefix-help-command #'embark-prefix-help-command)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
(use-package embark-consult
:hook
(embark-collect-mode . consult-preview-at-point-mode))
;; Consult offers a suite of commands for efficient searching, previewing, and
;; interacting with buffers, file contents, and more, improving various tasks.
(use-package consult
:bind (;; C-c bindings in `mode-specific-map'
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command)
("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
("C-x t b" . consult-buffer-other-tab)
("C-x r b" . consult-bookmark)
("C-x p b" . consult-project-buffer)
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop)
;; M-g bindings in `goto-map'
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake)
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline)
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map'
("M-s d" . consult-find)
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history)
("M-s e" . consult-isearch-history)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history)
("M-r" . consult-history))
;; Enable automatic preview at point in the *Completions* buffer.
:hook (completion-list-mode . consult-preview-at-point-mode)
:init
;; Optionally configure the register formatting. This improves the register
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Optionally tweak the register preview window.
(advice-add #'register-preview :override #'consult-register-window)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Aggressive asynchronous that yield instantaneous results. (suitable for
;; high-performance systems.) Note: Minad, the author of Consult, does not
;; recommend aggressive values.
;; Read: https://github.com/minad/consult/discussions/951
;;
;; However, the author of minimal-emacs.d uses these parameters to achieve
;; immediate feedback from Consult.
;; (setq consult-async-input-debounce 0.02
;; consult-async-input-throttle 0.05
;; consult-async-refresh-delay 0.02)
:config
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult-source-bookmark consult-source-file-register
consult-source-recent-file consult-source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
(setq consult-narrow-key "<"))
;; The easysession Emacs package is a session manager for Emacs that can persist
;; and restore file editing buffers, indirect buffers/clones, Dired buffers,
;; windows/splits, the built-in tab-bar (including tabs, their buffers, and
;; windows), and Emacs frames. It offers a convenient and effortless way to
;; manage Emacs editing sessions and utilizes built-in Emacs functions to
;; persist and restore frames.
(use-package easysession
:commands (easysession-switch-to
easysession-save-as
easysession-save-mode
easysession-load-including-geometry)
:custom
(easysession-mode-line-misc-info t) ; Display the session in the modeline
(easysession-save-interval (* 10 60)) ; Save every 10 minutes
:init
;; Key mappings
(global-set-key (kbd "C-c ss") #'easysession-save)
(global-set-key (kbd "C-c sl") #'easysession-switch-to)
(global-set-key (kbd "C-c sL") #'easysession-switch-to-and-restore-geometry)
(global-set-key (kbd "C-c sr") #'easysession-rename)
(global-set-key (kbd "C-c sR") #'easysession-reset)
(global-set-key (kbd "C-c sd") #'easysession-delete)
(if (fboundp 'easysession-setup)
;; The `easysession-setup' function adds hooks:
;; - To enable automatic session loading during `emacs-startup-hook', or
;; `server-after-make-frame-hook' when running in daemon mode.
;; - To automatically save the session at regular intervals, and when
;; Emacs exits.
(easysession-setup)
;; Legacy
;; The depth 102 and 103 have been added to to `add-hook' to ensure that the
;; session is loaded after all other packages. (Using 103/102 is
;; particularly useful for those using minimal-emacs.d, where some
;; optimizations restore `file-name-handler-alist` at depth 101 during
;; `emacs-startup-hook`.)
(add-hook 'emacs-startup-hook #'easysession-load-including-geometry 102)
(add-hook 'emacs-startup-hook #'easysession-save-mode 103)))
;; The markdown-mode package provides a major mode for Emacs for syntax
;; highlighting, editing commands, and preview support for Markdown documents.
;; It supports core Markdown syntax as well as extensions like GitHub Flavored
;; Markdown (GFM).
(use-package markdown-mode
:commands (gfm-mode
gfm-view-mode
markdown-mode
markdown-view-mode)
:mode (("\\.markdown\\'" . markdown-mode)
("\\.md\\'" . markdown-mode)
("README\\.md\\'" . gfm-mode))
:bind
(:map markdown-mode-map
("C-c C-e" . markdown-do)))
;; Automatically generate a table of contents when editing Markdown files
(use-package markdown-toc
:commands (markdown-toc-generate-toc
markdown-toc-generate-or-refresh-toc
markdown-toc-delete-toc
markdown-toc--toc-already-present-p)
:custom
(markdown-toc-header-toc-title "**Table of Contents**"))
(use-package kirigami
:commands (kirigami-open-fold
kirigami-open-fold-rec
kirigami-close-fold
kirigami-toggle-fold
kirigami-open-folds
kirigami-close-folds-except-current
kirigami-close-folds)
:bind
(("C-c z o" . kirigami-open-fold) ; Open fold at point
("C-c z O" . kirigami-open-fold-rec) ; Open fold recursivelyo
("C-c z r" . kirigami-open-folds) ; Open all folds
("C-c z c" . kirigami-close-fold) ; Close fold at point
("C-c z m" . kirigami-close-folds) ; Close all folds
("C-c z a" . kirigami-toggle-fold))) ; Toggle fold at point
;; Uncomment the following if you are an `evil-mode' user:
;; (with-eval-after-load 'evil
;; (define-key evil-normal-state-map "zo" 'kirigami-open-fold)
;; (define-key evil-normal-state-map "zO" 'kirigami-open-fold-rec)
;; (define-key evil-normal-state-map "zc" 'kirigami-close-fold)
;; (define-key evil-normal-state-map "za" 'kirigami-toggle-fold)
;; (define-key evil-normal-state-map "zr" 'kirigami-open-folds)
;; (define-key evil-normal-state-map "zm" 'kirigami-close-folds))
;; The built-in outline-minor-mode provides structured code folding in modes
;; such as Emacs Lisp and Python, allowing users to collapse and expand sections
;; based on headings or indentation levels. This feature enhances navigation and
;; improves the management of large files with hierarchical structures.
(use-package outline
:ensure nil
:commands outline-minor-mode
:hook
(;; Use " ▼" instead of the default ellipsis "..." for folded text to make
;; folds more visually distinctive and readable.
(outline-minor-mode
.
(lambda()
(let* ((display-table (or buffer-display-table (make-display-table)))
(face-offset (* (face-id 'shadow) (ash 1 22)))
(value (vconcat (mapcar (lambda (c) (+ face-offset c)) ""))))
(set-display-table-slot display-table 'selective-display value)
(setq buffer-display-table display-table))))))
;; Enable the mode
(add-hook 'emacs-lisp-mode-hook #'outline-minor-mode)
(add-hook 'lisp-mode-hook #'outline-minor-mode)
(add-hook 'conf-mode-hook #'outline-minor-mode)
(add-hook 'markdown-mode-hook #'outline-minor-mode)
(add-hook 'diff-mode-hook #'outline-minor-mode)
;; Systems and General Purpose
(add-hook 'c-mode-hook #'hs-minor-mode)
(add-hook 'c++-mode-hook #'hs-minor-mode)
(add-hook 'java-mode-hook #'hs-minor-mode)
(add-hook 'rust-mode-hook #'hs-minor-mode)
(add-hook 'go-mode-hook #'hs-minor-mode)
(add-hook 'ruby-mode-hook #'hs-minor-mode)
;; Web and Frontend
(add-hook 'js-mode-hook #'hs-minor-mode)
(add-hook 'typescript-mode-hook #'hs-minor-mode)
(add-hook 'css-mode-hook #'hs-minor-mode)
;; Scripting, Data, and Infrastructure
(add-hook 'sh-mode-hook #'hs-minor-mode) ; for bash/shell scripts
(add-hook 'json-mode-hook #'hs-minor-mode)
(add-hook 'lua-mode-hook #'hs-minor-mode)
(add-hook 'nxml-mode-hook #'hs-minor-mode)
(add-hook 'html-mode-hook #'hs-minor-mode) ;; mhtml and html
;; Intelligent code folding by using the structural understanding of the
;; built-in tree-sitter parser. Unlike traditional folding methods that rely on
;; regular expressions or indentation, treesit-fold uses the actual syntax tree
;; of the code to accurately identify foldable regions such as functions,
;; classes, comments, and documentation strings. This allows for faster and more
;; precise folding behavior that respects the grammar of the programming
;; language, ensuring that fold boundaries are always syntactically correct even
;; in complex or nested code structures.
(use-package treesit-fold
:commands (treesit-fold-close
treesit-fold-close-all
treesit-fold-open
treesit-fold-toggle
treesit-fold-open-all
treesit-fold-mode
global-treesit-fold-mode
treesit-fold-open-recursively
treesit-fold-line-comment-mode)
:custom
(treesit-fold-line-count-show t)
(treesit-fold-line-count-format "")
:config
(set-face-attribute 'treesit-fold-replacement-face nil
:foreground "#808080"
:box nil
:weight 'bold))
;; Systems and General Purpose
(add-hook 'c-ts-mode-hook #'treesit-fold-mode)
(add-hook 'c++-ts-mode-hook #'treesit-fold-mode)
(add-hook 'java-ts-mode-hook #'treesit-fold-mode)
(add-hook 'rust-ts-mode-hook #'treesit-fold-mode)
(add-hook 'go-ts-mode-hook #'treesit-fold-mode)
(add-hook 'ruby-ts-mode-hook #'treesit-fold-mode)
;; Web and Frontend
(add-hook 'js-ts-mode-hook #'treesit-fold-mode)
(add-hook 'typescript-ts-mode-hook #'treesit-fold-mode)
(add-hook 'tsx-ts-mode-hook #'treesit-fold-mode)
(add-hook 'css-ts-mode-hook #'treesit-fold-mode)
(add-hook 'html-ts-mode-hook #'treesit-fold-mode)
;; Scripting and Infrastructure
(add-hook 'bash-ts-mode-hook #'treesit-fold-mode)
(add-hook 'cmake-ts-mode-hook #'treesit-fold-mode)
(add-hook 'dockerfile-ts-mode-hook #'treesit-fold-mode)
;; Data and Configuration
(add-hook 'json-ts-mode-hook #'treesit-fold-mode)
(add-hook 'toml-ts-mode-hook #'treesit-fold-mode)
;; Third-party
;; (add-hook 'kotlin-ts-mode-hook #'treesit-fold-mode)
;; (add-hook 'swift-ts-mode-hook #'treesit-fold-mode)
;; (add-hook 'elixir-ts-mode-hook #'treesit-fold-mode)
;; (add-hook 'zig-ts-mode-hook #'treesit-fold-mode)
;; The [dumb-jump](https://github.com/jacktasia/dumb-jump) package provides context-aware 'go to definition' functionality for 50+ programming languages without requiring a language server. It works by using simple heuristics and regular expression searches to locate the definitions of functions, variables, and symbols across project files.
;;
;; Unlike more sophisticated language-aware tools (e.g., eglot or lsp-mode), `dumb-jump' does not parse code semantically, which makes it lightweight and fast, but sometimes less precise. It integrates with popular navigation packages like `xref', allowing users to jump to definitions or references.
(use-package dumb-jump
:commands dumb-jump-xref-activate
:init
;; Register `dumb-jump' as an xref backend so it integrates with
;; `xref-find-definitions'. A priority of 90 ensures it is used only when no
;; more specific backend is available.
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate 90)
(setq dumb-jump-aggressive nil)
;; (setq dumb-jump-quiet t)
;; Number of seconds a rg/grep/find command can take before being warned to
;; use ag and config.
(setq dumb-jump-max-find-time 3)
;; Use `completing-read' so that selection of jump targets integrates with the
;; active completion framework (e.g., Vertico, Ivy, Helm, Icomplete),
;; providing a consistent minibuffer-based interface whenever multiple
;; definitions are found.
(setq dumb-jump-selector 'completing-read)
;; If ripgrep is available, force `dumb-jump' to use it because it is
;; significantly faster and more accurate than the default searchers (grep,
;; ag, etc.).
(when (executable-find "rg")
(setq dumb-jump-force-searcher 'rg)
(setq dumb-jump-prefer-searcher 'rg)))
;; The stripspace Emacs package provides stripspace-local-mode, a minor mode
;; that automatically removes trailing whitespace and blank lines at the end of
;; the buffer when saving.
(use-package stripspace
:commands stripspace-local-mode
;; Enable for prog-mode-hook, text-mode-hook, conf-mode-hook
:hook ((prog-mode . stripspace-local-mode)
(text-mode . stripspace-local-mode)
(conf-mode . stripspace-local-mode))
:custom
;; The `stripspace-only-if-initially-clean' option:
;; - nil to always delete trailing whitespace.
;; - Non-nil to only delete whitespace when the buffer is clean initially.
;; (The initial cleanliness check is performed when `stripspace-local-mode'
;; is enabled.)
(stripspace-only-if-initially-clean nil)
;; Enabling `stripspace-restore-column' preserves the cursor's column position
;; even after stripping spaces. This is useful in scenarios where you add
;; extra spaces and then save the file. Although the spaces are removed in the
;; saved file, the cursor remains in the same position, ensuring a consistent
;; editing experience without affecting cursor placement.
(stripspace-restore-column t))
;; The [diff-hl](https://github.com/dgutov/diff-hl) package highlights uncommitted changes in the window margin, enabling navigation between them. Also known as source control gutter indicators, it displays added, modified, and deleted lines in real time. In Git-controlled buffers, changes can be staged and unstaged directly, providing a clear view of version-control changes without running `git diff`. By default, the module does not start `diff-hl-mode` automatically.
```elisp
(use-package diff-hl
:commands (diff-hl-mode
global-diff-hl-mode)
:hook (prog-mode . diff-hl-mode)
:init
(setq diff-hl-flydiff-delay 0.4) ; Faster
(setq diff-hl-show-staged-changes nil) ; Realtime feedback
(setq diff-hl-update-async t) ; Do not block Emacs
(setq diff-hl-global-modes '(not pdf-view-mode image-mode)))
;; Org mode is a major mode designed for organizing notes, planning, task
;; management, and authoring documents using plain text with a simple and
;; expressive markup syntax. It supports hierarchical outlines, TODO lists,
;; scheduling, deadlines, time tracking, and exporting to multiple formats
;; including HTML, LaTeX, PDF, and Markdown.
(use-package org
:commands (org-mode org-version)
:mode
("\\.org\\'" . org-mode)
:custom
(org-hide-leading-stars t)
(org-startup-indented t)
(org-adapt-indentation nil)
(org-edit-src-content-indentation 0)
;; (org-fontify-done-headline t)
;; (org-fontify-todo-headline t)
;; (org-fontify-whole-heading-line t)
;; (org-fontify-quote-and-verse-blocks t)
(org-startup-truncated t))
;; Set up the Language Server Protocol (LSP) servers using Eglot.
(use-package eglot
:ensure nil
:commands (eglot-ensure
eglot-rename
eglot-format-buffer))
;; This automates the process of updating installed packages
(use-package auto-package-update
:custom
;; Set the number of days between automatic updates.
;; Here, packages will only be updated if at least 7 days have passed
;; since the last successful update.
(auto-package-update-interval 7)
;; Suppress display of the *auto-package-update results* buffer after updates.
;; This keeps the user interface clean and avoids unnecessary interruptions.
(auto-package-update-hide-results t)
;; Automatically delete old package versions after updates to reduce disk
;; usage and keep the package directory clean. This prevents the accumulation
;; of outdated files in Emacs's package directory, which consume
;; unnecessary disk space over time.
(auto-package-update-delete-old-versions t)
;; Uncomment the following line to enable a confirmation prompt
;; before applying updates. This can be useful if you want manual control.
(auto-package-update-prompt-before-update t)
:config
;; Run package updates automatically at startup, but only if the configured
;; interval has elapsed.
(auto-package-update-maybe)
;; Schedule a background update attempt daily at 10:00 AM.
;; This uses Emacs' internal timer system. If Emacs is running at that time,
;; the update will be triggered. Otherwise, the update is skipped for that
;; day. Note that this scheduled update is independent of
;; `auto-package-update-maybe` and can be used as a complementary or
;; alternative mechanism.
(auto-package-update-at-time "10:00"))
;; The [buffer-terminator](https://github.com/jamescherti/buffer-terminator.el) Emacs package *automatically and safely kills buffers*, ensuring a clean and efficient workspace while *enhancing the performance of Emacs* by reducing open buffers, which minimizes active modes, timers, processes...
;;
;; ;; Beyond performance, *buffer-terminator* provides other benefits. For instance, if you occasionally need to close annoying or unused buffers, *buffer-terminator* can handle this automatically, eliminating the need for manual intervention. (The default configuration is suitable for most users. However, the *buffer-terminator* package is highly customizable. You can define specific rules for retaining or terminating buffers by modifying the `buffer-terminator-rules-alist` with your preferred set of rules.)
(use-package buffer-terminator
:custom
;; Enable/Disable verbose mode to log buffer cleanup events
(buffer-terminator-verbose nil)
;; Set the inactivity timeout (in seconds) after which buffers are considered
;; inactive (default is 30 minutes):
(buffer-terminator-inactivity-timeout (* 30 60)) ; 30 minutes
;; Define how frequently the cleanup process should run (default is every 10
;; minutes):
(buffer-terminator-interval (* 10 60)) ; 10 minutes
:config
(buffer-terminator-mode 1))
;; A file and project explorer for Emacs that displays a structured tree
;; layout, similar to file browsers in modern IDEs. It functions as a sidebar
;; in the left window, providing a persistent view of files, projects, and
;; other elements.
(use-package treemacs
:commands (treemacs
treemacs-select-window
treemacs-delete-other-windows
treemacs-select-directory
treemacs-bookmark
treemacs-find-file
treemacs-find-tag)
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t d" . treemacs-select-directory)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag))
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(setq treemacs-collapse-dirs (if treemacs-python-executable 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-directory-name-transformer #'identity
treemacs-display-in-side-window t
treemacs-eldoc-display 'simple
treemacs-file-event-delay 2000
treemacs-file-extension-regex treemacs-last-period-regex-value
treemacs-file-follow-delay 0.2
treemacs-file-name-transformer #'identity
treemacs-follow-after-init t
treemacs-expand-after-init t
treemacs-find-workspace-method 'find-for-file-or-pick-first
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-header-scroll-indicators '(nil . "^^^^^^")
treemacs-hide-dot-git-directory t
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-move-files-by-mouse-dragging t
treemacs-move-forward-on-expand nil
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-position 'left
treemacs-read-string-input 'from-child-frame
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-litter-directories '("/node_modules" "/.venv" "/.cask")
treemacs-project-follow-into-home nil
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-asc
treemacs-select-when-already-in-treemacs 'move-back
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-text-scale nil
treemacs-user-mode-line-format nil
treemacs-user-header-line-format nil
treemacs-wide-toggle-width 70
treemacs-width 35
treemacs-width-increment 1
treemacs-width-is-initially-locked t
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;; (treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
;;(when treemacs-python-executable
;; (treemacs-git-commit-diff-mode t))
(pcase (cons (not (null (executable-find "git")))
(not (null treemacs-python-executable)))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple)))
(treemacs-hide-gitignored-files-mode nil))
;; (use-package treemacs-evil
;; :after (treemacs evil)
;;
;; (use-package treemacs-icons-dired
;; :hook (dired-mode . treemacs-icons-dired-enable-once)
;;
;; (use-package treemacs-tab-bar ; treemacs-tab-bar if you use tab-bar-mode
;; :after (treemacs)
;; :config (treemacs-set-scope-type 'Tabs))
;;
;; (treemacs-start-on-boot)
;; Helpful is an alternative to the built-in Emacs help that provides much more
;; contextual information.
(use-package helpful
:commands (helpful-callable
helpful-variable
helpful-key
helpful-command
helpful-at-point
helpful-function)
:bind
([remap describe-command] . helpful-command)
([remap describe-function] . helpful-callable)
([remap describe-key] . helpful-key)
([remap describe-symbol] . helpful-symbol)
([remap describe-variable] . helpful-variable)
:custom
(helpful-max-buffers 7))
;; The [avy](https://github.com/abo-abo/avy) package is a navigation framework designed for jumping directly to any visible text on the screen with minimal keystrokes. The primary benefit of *avy* is a substantial increase in navigational efficiency, as it minimizes keystrokes compared to iterative methods like arrow keys or standard search.
;;
;; It operates by generating a dynamic, temporary mapping: upon invocation, such as with the command `avy-goto-char` or `avy-goto-char-2`, the user inputs a target character, and `avy` highlights all visible instances on the screen with unique key sequences. Typing the short sequence corresponding to the desired location instantly moves the point directly there.
;;
;; To configure **avy**, add the following to `~/.emacs.d/post-init.el`:
(use-package avy
:commands (avy-goto-char
avy-goto-char-2
avy-next)
:init
(global-set-key (kbd "C-'") 'avy-goto-char-2))
;; The author recommends using `avy-goto-char-2` (typically bound to `C-'`). Upon invocation, *avy* prompts the user to input a two-character sequence. Subsequently, all visible instances of this sequence are highlighted with unique, concise labels (e.g., single letters or numbers). The user then simply presses the key corresponding to the desired label, and *avy* instantly transports the cursor to that specific occurrence.
(use-package bufferfile
:commands (bufferfile-copy
bufferfile-rename
bufferfile-delete)
:custom
;; If non-nil, display messages during file renaming operations
(bufferfile-verbose nil)
;; If non-nil, enable using version control (VC) when available
(bufferfile-use-vc nil)
;; Specifies the action taken after deleting a file and killing its buffer.
(bufferfile-delete-switch-to 'parent-directory))
;; Configure the `tab-bar-show` variable to 1 to display the tab bar exclusively
;; when multiple tabs are open:
(setopt tab-bar-show 1)
;; ### Persisting and Restoring Text Scale
;;
;; The [persist-text-scale](https://github.com/jamescherti/persist-text-scale.el) Emacs package provides `persist-text-scale-mode`, which ensures that all adjustments made with `text-scale-increase` and `text-scale-decrease` are persisted and restored across sessions. As a result, the text size in each buffer remains consistent, even after restarting Emacs.
;;
;; This package also facilitates grouping buffers into categories, allowing buffers within the same category to share a consistent text scale. This ensures uniform font sizes when adjusting text scaling. By default:
;; - Each file-visiting buffer has its own independent text scale.
;; - Special buffers, identified by their buffer names, each retain their own text scale setting.
;; - All Dired buffers maintain the same font size, treating Dired as a unified "file explorer" where the text scale remains consistent across different buffers.
;;
;; This category-based behavior can be further customized by assigning a function to the `persist-text-scale-buffer-category-function` variable. The function determines how buffers are categorized by returning a category identifier (string) based on the buffer's context. Buffers within the same category will share the same text scale.
;;
;; To configure the *persist-text-scale* package, add the following to your `~/.emacs.d/post-init.el`:
(use-package persist-text-scale
:commands (persist-text-scale-mode
persist-text-scale-restore)
:hook (after-init . persist-text-scale-mode)
:custom
(text-scale-mode-step 1.07))
;; Display the current line and column numbers in the mode line
(setq line-number-mode t)
(setq column-number-mode t)
(setq mode-line-position-column-line-format '("%l:%C"))
;; Display of line numbers in the buffer:
(setq-default display-line-numbers-type 'absolute)
(dolist (hook '(prog-mode-hook text-mode-hook conf-mode-hook))
(add-hook hook #'display-line-numbers-mode))
(use-package which-key
:ensure nil ; builtin
:commands which-key-mode
:hook (after-init . which-key-mode)
:custom
(which-key-idle-delay 1.5)
(which-key-idle-secondary-delay 0.25)
(which-key-add-column-padding 1)
(which-key-max-description-length 40))
(unless (and (eq window-system 'mac)
(bound-and-true-p mac-carbon-version-string))
;; Enables `pixel-scroll-precision-mode' on all operating systems and Emacs
;; versions, except for emacs-mac.
;;
;; Enabling `pixel-scroll-precision-mode' is unnecessary with emacs-mac, as
;; this version of Emacs natively supports smooth scrolling.
;; https://bitbucket.org/mituharu/emacs-mac/commits/65c6c96f27afa446df6f9d8eff63f9cc012cc738
(setq pixel-scroll-precision-use-momentum nil) ; Precise/smoother scrolling
(pixel-scroll-precision-mode 1))
;; Paren match highlighting
(add-hook 'after-init-hook #'show-paren-mode)
(use-package uniquify
:ensure nil
:custom
(uniquify-buffer-name-style 'reverse)
(uniquify-separator "")
(uniquify-after-kill-buffer-p t))
;; (setq truncate-lines nil)
+5
View File
@@ -0,0 +1,5 @@
;;; pre-early-init.el --- DESCRIPTION -*- no-byte-compile: t; lexical-binding: t; -*-
(setq user-emacs-directory (expand-file-name "var/" minimal-emacs-user-directory))
(setq package-user-dir (expand-file-name "elpa" user-emacs-directory))
(setq inhibit-default-init t)
+6
View File
@@ -3,3 +3,9 @@ theme = "yellowed"
[editor.cursor-shape]
insert = "bar"
[editor.soft-wrap]
enable = true
[editor.lsp]
auto-signature-help = false
+139
View File
@@ -0,0 +1,139 @@
# author: Gael Lopes Da Silva
# project: Yellowed
# github: https://github.com/Gael-Lopes-Da-Silva/YellowedHelix
"attribute" = { fg = "text" }
"type" = { fg = "text" }
"type.builtin" = { fg = "keywords" }
"type.enum" = { fg = "keywords" }
"constructor" = { fg = "text", modifiers = ["bold"] }
"constant" = { fg = "text", modifiers = ["bold"] }
"constant.builtin" = { fg = "constants", modifiers = ["bold"] }
"constant.character" = { fg = "string" }
"constant.character.escape" = { fg = "constants", modifiers = ["bold"] }
"constant.numeric" = { fg = "keywords" }
"string" = { fg = "string" }
"string.regexp" = { fg = "constants" }
"comment" = { fg = "comment" }
"variable" = { fg = "text" }
"variable.builtin" = { fg = "keywords" }
"variable.parameter" = { fg = "text", modifiers = ["italic"] }
"label" = { fg = "text" }
"punctuation" = { fg = "text" }
"punctuation.special" = { fg = "constants", modifiers = ["bold"] }
"keyword" = { fg = "keywords", modifiers = ["bold"] }
"keyword.control" = { fg = "keywords" }
"keyword.control.return" = { fg = "keywords", modifiers = ["bold"] }
"keyword.operator" = { fg = "keywords" }
"keyword.directive" = { fg = "keywords" }
"operator" = { fg = "keywords" }
"function" = { fg = "text", modifiers = ["bold"] }
"tag" = { fg = "keywords", modifiers = ["bold"] }
"namespace" = { fg = "text" }
"special" = { fg = "yellow" }
"markup.heading.marker" = { fg = "keywords", modifiers = ["bold"] }
"markup.heading.1" = { fg = "text", modifiers = ["bold"] }
"markup.heading.2" = { fg = "text", modifiers = ["bold"] }
"markup.heading.3" = { fg = "text", modifiers = ["bold"] }
"markup.heading.4" = { fg = "text", modifiers = ["bold"] }
"markup.heading.5" = { fg = "text", modifiers = ["bold"] }
"markup.heading.6" = { fg = "text", modifiers = ["bold"] }
"markup.list" = { fg = "keywords", modifiers = ["bold"] }
"markup.bold" = { modifiers = ["bold"] }
"markup.italic" = { modifiers = ["italic"] }
"markup.link.url" = { fg = "text", modifiers = ["underlined"] }
"markup.link.text" = { fg = "string" }
"markup.quote" = { fg = "text" }
"markup.raw" = { fg = "string" }
"diff.plus" = { fg = "green" }
"diff.minus" = { fg = "red" }
"diff.delta" = { fg = "blue" }
"diff.delta.moved" = { fg = "gray" }
"ui.background" = { bg = "dark_gray", fg = "text" }
"ui.background.separator" = { fg = "text" }
"ui.cursor" = { bg = "yellow", fg = "black" }
"ui.cursor.normal" = { bg = "yellow", fg = "black" }
"ui.cursor.insert" = { bg = "yellow", fg = "black" }
"ui.cursor.select" = { bg = "yellow", fg = "black" }
"ui.cursor.match" = { bg = "light_gray" }
"ui.cursor.primary" = { bg = "yellow", fg = "black" }
"ui.cursor.primary.normal" = { bg = "yellow", fg = "black" }
"ui.cursor.primary.insert" = { bg = "yellow", fg = "black" }
"ui.cursor.primary.select" = { bg = "yellow", fg = "black" }
"ui.debug.breakpoint" = { fg = "red" }
"ui.debug.active" = { fg = "green" }
"ui.gutter" = { fg = "light_gray" }
"ui.gutter.selected" = { fg = "light_gray" }
"ui.highlight.frameline" = { fg = "gray" }
"ui.linenr" = { fg = "light_gray" }
"ui.linenr.selected" = { fg = "yellow" }
"ui.statusline" = { fg = "text", bg = "gray" }
"ui.statusline.inactive" = { fg = "light_gray", bg = "gray" }
"ui.statusline.normal" = { bg = "light_gray" }
"ui.statusline.insert" = { bg = "green" }
"ui.statusline.select" = { bg = "purple" }
"ui.statusline.separator" = { fg = "dark_gray" }
"ui.popup" = { bg = "menu", fg = "text" }
"ui.popup.info" = { bg = "menu", fg = "text" }
"ui.window" = { fg = "text" }
"ui.help" = { fg = "text", bg = "menu" }
"ui.text" = { fg = "text" }
"ui.text.focus" = { bg = "gray" }
"ui.text.inactive" = { fg = "text" }
"ui.text.info" = { fg = "text" }
"ui.virtual.ruler" = { bg = "light_gray" }
"ui.virtual.whitespace" = { fg = "light_gray" }
"ui.virtual.indent-guide" = { fg = "light_gray" }
"ui.virtual.inlay-hint" = { fg = "light_gray" }
"ui.virtual.inlay-hint.parameter" = { fg = "light_gray" }
"ui.virtual.inlay-hint.type" = { fg = "light_gray" }
"ui.virtual.wrap" = { fg = "light_gray" }
"ui.virtual.jump-label" = { fg = "blue", bg = "selection", modifiers = ["bold", "underlined"] }
"ui.menu" = { fg = "text", bg = "gray" }
"ui.menu.selected" = { fg = "text", bg = "light_gray", modifiers = ["bold"] }
"ui.menu.scroll" = { fg = "light_gray", bg = "dark_gray" }
"ui.selection" = { bg = "selection" }
"ui.selection.primary" = { bg = "selection" }
"ui.highlight" = { bg = "light_gray" }
"ui.cursorline.primary" = { bg = "gray" }
"ui.cursorline.secondary" = { bg = "gray" }
"ui.cursorcolumn.primary" = { bg = "gray" }
"ui.cursorcolumn.secondary" = { bg = "gray" }
"warning" = { fg = "warning" }
"error" = { fg = "error" }
"info" = { fg = "info" }
"hint" = { fg = "hint" }
"diagnostic.warning" = { underline = { color = "warning", style = "curl" } }
"diagnostic.error" = { underline = { color = "error", style = "curl" } }
"diagnostic.info" = { underline = { color = "info", style = "curl" } }
"diagnostic.hint" = { underline = { color = "hint", style = "curl" } }
"diagnostic.unnecessary" = { modifiers = ["dim"] }
"diagnostic.deprecated" = { modifiers = ["crossed_out"] }
[palette]
# interface
yellow = "#ffd900"
gray = "#2a2a2a"
dark_gray = "#242424"
light_gray = "#545454"
purple = "#994c92"
blue = "#008DFF"
menu = "#202020"
selection = "#3f3f3f"
yellowish = "#ffdf00"
# syntax
text = "#FFFFFF"
comment = "#6b6b6b"
string = "#378b1d"
constants = "#ff80f4"
keywords = "#ffd900"
warning = "#FF9C00"
error = "#FF0000"
info = "#0092FF"
hint = "#4DFF00"
-245
View File
@@ -1,245 +0,0 @@
-- since this is just an example spec, don't actually load anything here and return an empty spec
-- stylua: ignore
if true then return {} end
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
--
-- In your plugin files, you can:
-- * add extra plugins
-- * disable/enabled LazyVim plugins
-- * override the configuration of LazyVim plugins
return {
-- add gruvbox
{ "ellisonleao/gruvbox.nvim" },
-- Configure LazyVim to load gruvbox
{
"LazyVim/LazyVim",
opts = {
colorscheme = "gruvbox",
},
},
-- change trouble config
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
-- disable trouble
{ "folke/trouble.nvim", enabled = false },
-- override nvim-cmp and add cmp-emoji
{
"hrsh7th/nvim-cmp",
dependencies = { "hrsh7th/cmp-emoji" },
---@param opts cmp.ConfigSchema
opts = function(_, opts)
table.insert(opts.sources, { name = "emoji" })
end,
},
-- change some telescope options and a keymap to browse plugin files
{
"nvim-telescope/telescope.nvim",
keys = {
-- add a keymap to browse plugin files
-- stylua: ignore
{
"<leader>fp",
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
desc = "Find Plugin File",
},
},
-- change some options
opts = {
defaults = {
layout_strategy = "horizontal",
layout_config = { prompt_position = "top" },
sorting_strategy = "ascending",
winblend = 0,
},
},
},
-- add pyright to lspconfig
{
"neovim/nvim-lspconfig",
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- pyright will be automatically installed with mason and loaded with lspconfig
pyright = {},
},
},
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").lsp.on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
tsserver = {},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- example to setup with typescript.nvim
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
-- Specify * to use this function as a fallback for any server
-- ["*"] = function(server, opts) end,
},
},
},
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
{ import = "lazyvim.plugins.extras.lang.typescript" },
-- add more treesitter parsers
{
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = {
"bash",
"html",
"javascript",
"json",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"tsx",
"typescript",
"vim",
"yaml",
},
},
},
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
-- would overwrite `ensure_installed` with the new value.
-- If you'd rather extend the default config, use the code below instead:
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add tsx and treesitter
vim.list_extend(opts.ensure_installed, {
"tsx",
"typescript",
})
end,
},
-- the opts function can also be used to change the default opts:
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function(_, opts)
table.insert(opts.sections.lualine_x, "😄")
end,
},
-- or you can return new options to override all the defaults
{
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
opts = function()
return {
--[[add your custom lualine config here]]
}
end,
},
-- use mini.starter instead of alpha
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
{ import = "lazyvim.plugins.extras.lang.json" },
-- add any tools you want to have installed below
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"stylua",
"shellcheck",
"shfmt",
"flake8",
},
},
},
-- Use <tab> for completion and snippets (supertab)
-- first: disable default <tab> and <s-tab> behavior in LuaSnip
{
"L3MON4D3/LuaSnip",
keys = function()
return {}
end,
},
-- then: setup supertab in cmp
{
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-emoji",
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local luasnip = require("luasnip")
local cmp = require("cmp")
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
-- this way you will only jump inside the snippet region
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
})
end,
},
}
-1
View File
@@ -1 +0,0 @@
return { "ellisonleao/glow.nvim", config = true, cmd = "Glow" }
@@ -7,8 +7,9 @@
"lazyvim.plugins.extras.util.dot",
"lazyvim.plugins.extras.util.mini-hipatterns"
],
"install_version": 7,
"news": {
"NEWS.md": "10960"
"NEWS.md": "11866"
},
"version": 7
"version": 8
}
+207
View File
@@ -0,0 +1,207 @@
This is the license for Oil code.
- The Python interpreter license is in Python-2.7.13/LICENSE
- py-yajl has licenses in its source files, e.g. py-yajl/*.[ch]
- yajl's license is in py-yajl/yajl/COPYING
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
#
# Common shell functions for task scripts.
#
# Usage:
# source $LIB_OSH/task-five.sh
#
# test-foo() { # define task functions
# echo foo
# }
# task-five "$@"
# Definition of a "task"
#
# - File invokes task-five "$@"
# - or maybe you can look at its source
# - It's a shell function
# - Has ### docstring
# - Doesn't start with _
: ${LIB_OSH=stdlib/osh}
source $LIB_OSH/byo-server.sh
_show-help() {
# TODO:
# - Use awk to find comments at the top of the file?
# - Use OSH to extract docstrings
# - BYO_COMMAND=list-tasks will reuse that logic? It only applies to the
# current file, not anything in a different file?
echo "Usage: $0 TASK_NAME ARGS..."
echo
echo "To complete tasks, run:"
echo " source devtools/completion.bash"
echo
echo "Tasks:"
if command -v column >/dev/null; then
_print-funcs | column
else
_print-funcs
fi
}
task-five() {
# Respond to BYO_COMMAND=list-tasks, etc. All task files need this.
byo-maybe-run
case ${1:-} in
''|--help|-h)
_show-help
exit 0
;;
esac
if ! declare -f "$1" >/dev/null; then
echo "$0: '$1' isn't an action in this task file. Try '$0 --help'"
exit 1
fi
"$@"
}
+27
View File
@@ -0,0 +1,27 @@
# Two functions I actually use, all the time.
#
# To keep depenedencies small, this library will NEVER grow other functions
# (and is named to imply that.)
#
# Usage:
# source --builtin two.sh
#
# Examples:
# log 'hi'
# die 'expected a number'
if command -v source-guard >/dev/null; then # include guard for YSH
source-guard two || return 0
fi
log() {
### Write a message to stderr.
echo "$@" >&2
}
die() {
### Write an error message with the script name, and exit with status 1.
log "$0: fatal: $@"
exit 1
}
@@ -0,0 +1,14 @@
[metadata]
name = "alias"
description = "A channel to select from shell aliases"
[source]
# you may need to adjust the command depending on your shell
command = "$SHELL -ic 'alias'"
output = "{split:=:0}"
[preview]
command = "$SHELL -ic 'alias' | grep -E '^(alias )?{split:=:0}='"
[ui.preview_panel]
size = 30
@@ -0,0 +1,10 @@
# UNTESTED
[metadata]
name = "bash-history"
description = "A channel to select from your bash history"
requirements = ["bash"]
[source]
command = "sed '1!G;h;$!d' ${HISTFILE:-${HOME}/.bash_history}"
no_sort = true
frecency = false
@@ -0,0 +1,30 @@
[metadata]
name = "brew-packages"
description = "List and manage Homebrew packages"
requirements = ["brew"]
[source]
command = [
"brew list --formula",
"brew list --cask",
]
[preview]
command = "brew info '{}'"
[ui]
layout = "portrait"
[keybindings]
ctrl-u = "actions:upgrade"
ctrl-d = "actions:uninstall"
[actions.upgrade]
description = "Upgrade the selected package"
command = "brew upgrade '{}'"
mode = "execute"
[actions.uninstall]
description = "Uninstall the selected package"
command = "brew uninstall '{}'"
mode = "execute"
@@ -0,0 +1,22 @@
[metadata]
name = "cargo-commands"
description = "List available cargo commands and extensions"
requirements = ["cargo"]
[source]
command = "cargo --list 2>/dev/null | tail -n +2 | awk '{print $1}'"
[preview]
command = "cargo {} --help 2>/dev/null | head -50"
[ui]
layout = "portrait"
preview_panel = { size = 60 }
[keybindings]
enter = "actions:run"
[actions.run]
description = "Run the selected cargo command"
command = "cargo '{}'"
mode = "execute"
@@ -0,0 +1,18 @@
[metadata]
name = "channels"
description = "Select a television channel"
requirements = ["tv", "bat"]
[source]
command = ["tv list-channels"]
[preview]
command = "bat -pn --color always ${XDG_CONFIG_HOME:-$HOME/.config}/television/cable/**/{}.toml"
[keybindings]
enter = "actions:channel-enter"
[actions.channel-enter]
description = "Enter a television channel"
command = "tv {}"
mode = "execute"
@@ -0,0 +1,13 @@
[metadata]
name = "dirs"
description = "A channel to select from directories"
requirements = ["fd"]
[source]
command = ["fd -t d", "fd -t d --hidden"]
[preview]
command = "ls -la --color=always '{}'"
[keybindings]
shortcut = "f2"
@@ -0,0 +1,42 @@
[metadata]
name = "distrobox-list"
description = "A channel to select a container from distrobox"
requirements = ["distrobox", "bat"]
[source]
command = ["distrobox list | awk -F '|' '{ gsub(/ /, \"\", $2); print $2}' | tail --lines=+2"]
[preview]
command = "(distrobox list | column -t -s '|' | awk -v selected_name={} 'NR==1 || $0 ~ selected_name') && echo && distrobox enter -d {} | bat --plain --color=always -lbash"
[keybindings]
ctrl-e = "actions:distrobox-enter"
ctrl-l = "actions:distrobox-list"
ctrl-r = "actions:distrobox-rm"
ctrl-s = "actions:distrobox-stop"
ctrl-u = "actions:distrobox-upgrade"
[actions.distrobox-enter]
description = "Enter a distrobox"
command = "distrobox enter {}"
mode = "execute"
[actions.distrobox-list]
description = "List a distrobox"
command = "distrobox list | column -t -s '|' | awk -v selected_name={} 'NR==1 || $0 ~ selected_name'"
mode = "execute"
[actions.distrobox-rm]
description = "Remove a distrobox"
command = "distrobox rm {}"
mode = "execute"
[actions.distrobox-stop]
description = "Stop a distrobox"
command = "distrobox stop {}"
mode = "execute"
[actions.distrobox-upgrade]
description = "Upgrade a distrobox"
command = "distrobox upgrade {}"
mode = "execute"
@@ -0,0 +1,56 @@
[metadata]
name = "docker-containers"
description = "List and manage Docker containers"
requirements = ["docker"]
[source]
command = [
"docker ps --format '{{.Names}}\\t{{.Image}}\\t{{.Status}}'",
"docker ps -a --format '{{.Names}}\\t{{.Image}}\\t{{.Status}}'",
]
display = "{split:\\t:0} ({split:\\t:2})"
output = "{split:\\t:0}"
[preview]
command = "docker inspect '{split:\\t:0}' | jq -C '.[0] | {Name, State, Config: {Image: .Config.Image, Cmd: .Config.Cmd}, NetworkSettings: {IPAddress: .NetworkSettings.IPAddress}}'"
[ui]
layout = "portrait"
[keybindings]
ctrl-s = "actions:start"
f2 = "actions:stop"
ctrl-r = "actions:restart"
ctrl-l = "actions:logs"
ctrl-e = "actions:exec"
ctrl-d = "actions:remove"
[actions.start]
description = "Start the selected container"
command = "docker start '{split:\\t:0}'"
mode = "fork"
[actions.stop]
description = "Stop the selected container"
command = "docker stop '{split:\\t:0}'"
mode = "fork"
[actions.restart]
description = "Restart the selected container"
command = "docker restart '{split:\\t:0}'"
mode = "fork"
[actions.logs]
description = "Follow logs of the selected container"
command = "docker logs -f '{split:\\t:0}'"
mode = "execute"
[actions.exec]
description = "Execute shell in the selected container"
command = "docker exec -it '{split:\\t:0}' /bin/sh"
mode = "execute"
[actions.remove]
description = "Remove the selected container"
command = "docker rm '{split:\\t:0}'"
mode = "execute"
@@ -0,0 +1,34 @@
[metadata]
name = "docker-images"
description = "A channel to select from Docker images"
requirements = ["docker", "jq"]
[source]
command = "docker images --format '{{.Repository}}:{{.Tag}} {{.ID}}'"
output = "{split: :-1}"
[preview]
command = "docker image inspect '{split: :-1}' | jq -C"
[ui]
layout = "portrait"
[keybindings]
ctrl-r = "actions:run"
ctrl-d = "actions:remove"
ctrl-s = "actions:shell"
[actions.run]
description = "Run a container from the selected image"
command = "docker run -it '{split: :-1}'"
mode = "execute"
[actions.shell]
description = "Run a shell in the selected image"
command = "docker run -it '{split: :-1}' /bin/sh"
mode = "execute"
[actions.remove]
description = "Remove the selected image"
command = "docker rmi '{split: :-1}'"
mode = "execute"
@@ -0,0 +1,18 @@
[metadata]
name = "dotfiles"
description = "A channel to select from your user's dotfiles"
requirements = ["fd", "bat"]
[source]
command = "fd -t f . $HOME/.config"
[preview]
command = "bat -n --color=always '{}'"
[keybindings]
enter = "actions:edit"
[actions.edit]
description = "Edit the selected dotfile"
command = "${EDITOR:-vim} '{}'"
mode = "execute"
@@ -0,0 +1,31 @@
[metadata]
name = "downloads"
description = "Browse recent files in Downloads folder"
requirements = ["fd", "bat"]
[source]
command = "fd -t f . ~/Downloads --changed-within 30d 2>/dev/null | head -200"
[preview]
command = "bat -n --color=always '{}' 2>/dev/null || file '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]
enter = "actions:open"
ctrl-d = "actions:delete"
ctrl-m = "actions:move"
[actions.open]
description = "Open the selected file with default application"
command = "xdg-open '{}' 2>/dev/null || open '{}'"
mode = "fork"
[actions.delete]
description = "Delete the selected file"
command = "rm -i '{}'"
mode = "execute"
[actions.move]
description = "Move the selected file to current directory"
command = "mv '{}' ."
mode = "fork"
@@ -0,0 +1,17 @@
[metadata]
name = "env"
description = "A channel to select from environment variables"
[source]
command = "printenv"
output = "{split:=:1..}" # output the value
[preview]
command = "echo '{split:=:1..}'"
[ui]
layout = "portrait"
preview_panel = { size = 20, header = "{split:=:0}" }
[keybindings]
shortcut = "f3"
@@ -0,0 +1,27 @@
[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fd", "bat"]
[source]
command = ["fd -t f", "fd -t f -H"]
[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]
shortcut = "f1"
f12 = "actions:edit"
ctrl-up = "actions:goto_parent_dir"
[actions.edit]
description = "Opens the selected entries with the default editor (falls back to vim)"
command = "${EDITOR:-vim} '{}'"
# use `mode = "fork"` if you want to return to tv afterwards
mode = "execute"
[actions.goto_parent_dir]
description = "Re-opens tv in the parent directory"
command = "tv files .."
mode = "execute"
@@ -0,0 +1,32 @@
[metadata]
name = "gh-issues"
description = "List GitHub issues for the current repo"
requirements = ["gh", "jq"]
[source]
command = '''gh issue list --state open --limit 100 --json number,title,createdAt,author,labels | jq -r 'sort_by(.createdAt) | reverse | .[] | " \u001b[32m#\(.number)\u001b[39m \(.title) \u001b[33m@\(.author.login)\u001b[39m" + (if (.labels | length) > 0 then " " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end)'
'''
ansi = true
output = "{strip_ansi|split:#:1|split: :0}"
[ui]
layout = "portrait"
preview_panel = { header = '{strip_ansi|split:#:1|split: :0}' }
[preview]
command = '''gh issue view '{strip_ansi|split:#:1|split: :0}' --json number,title,body,state,author,createdAt,updatedAt,labels,assignees | jq -r '
" " + .title,
" #" + (.number | tostring),
"",
" \u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m",
" \u001b[36mAuthor:\u001b[39m \u001b[33m" + .author.login + "\u001b[39m",
" \u001b[36mCreated:\u001b[39m " + (.createdAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end),
" \u001b[36mUpdated:\u001b[39m " + (.updatedAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end),
(if (.labels | length) > 0 then " \u001b[36mLabels:\u001b[39m " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end),
(if (.assignees | length) > 0 then " \u001b[36mAssignees:\u001b[39m " + ([.assignees[].login] | join(", ")) else "" end),
"",
" \u001b[90m────────────────────────────────────────────────────────────\u001b[39m",
"",
(.body // "")'
'''
@@ -0,0 +1,32 @@
[metadata]
name = "gh-prs"
description = "List GitHub PRs for the current repo"
requirements = ["gh", "jq"]
[source]
command = '''gh pr list --state open --limit 100 --json number,title,createdAt,author,labels | jq -r 'sort_by(.createdAt) | reverse | .[] | " \u001b[32m#\(.number)\u001b[39m \(.title) \u001b[33m@\(.author.login)\u001b[39m" + (if (.labels | length) > 0 then " " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end)'
'''
output = '{strip_ansi|split:#:1|split: :0}'
ansi = true
[ui]
layout = "portrait"
[preview]
command = '''gh pr view '{strip_ansi|split:#:1|split: :0}' --json number,title,body,state,headRefName,baseRefName,author,createdAt,updatedAt,mergeable,changedFiles,additions,deletions,labels,assignees,reviewDecision,headRepository,headRepositoryOwner | jq -r '
" " + .title,
" #" + (.number | tostring),
"",
" \u001b[36mStatus:\u001b[39m \u001b[32m" + .state + "\u001b[39m " + .baseRefName + " ← " + .headRefName,
" \u001b[36mRepo:\u001b[39m \u001b[34m" + (.headRepositoryOwner.login) + "/" + (.headRepository.name) + "\u001b[39m",
" \u001b[36mAuthor:\u001b[39m \u001b[33m" + .author.login + "\u001b[39m",
" \u001b[36mCreated:\u001b[39m " + (.createdAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end),
" \u001b[36mUpdated:\u001b[39m " + (.updatedAt | fromdateiso8601 | (now - .) | if . < 3600 then (./60|floor|tostring) + " minutes ago" elif . < 86400 then (./3600|floor|tostring) + " hours ago" else (./86400|floor|tostring) + " days ago" end),
(if (.labels | length) > 0 then " \u001b[36mLabels:\u001b[39m " + ([.labels[] | "\u001b[35m" + .name + "\u001b[39m"] | join(" ")) else "" end),
" \u001b[36mMerge Status:\u001b[39m " + (if .mergeable == "MERGEABLE" then "\u001b[32m✓ Clean\u001b[39m" elif .mergeable == "CONFLICTING" then "\u001b[31m✗ Dirty\u001b[39m" else "\u001b[33m? Unknown\u001b[39m" end),
" \u001b[36mChanges:\u001b[39m " + (.changedFiles | tostring) + " files \u001b[32m+" + (.additions | tostring) + "\u001b[39m \u001b[31m-" + (.deletions | tostring) + "\u001b[39m",
"",
" \u001b[90m────────────────────────────────────────────────────────────\u001b[39m",
"",
(.body // "")'
'''
@@ -0,0 +1,37 @@
[metadata]
name = "git-branch"
description = "A channel to select from git branches"
requirements = ["git"]
[source]
command = "git --no-pager branch --all --format=\"%(refname:short)\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0}'"
[keybindings]
enter = "actions:checkout"
ctrl-d = "actions:delete"
ctrl-m = "actions:merge"
ctrl-r = "actions:rebase"
[actions.checkout]
description = "Checkout the selected branch"
command = "git checkout '{0}'"
mode = "execute"
[actions.delete]
description = "Delete the selected branch"
command = "git branch -d '{0}'"
mode = "execute"
[actions.merge]
description = "Merge the selected branch into current branch"
command = "git merge '{0}'"
mode = "execute"
[actions.rebase]
description = "Rebase current branch onto the selected branch"
command = "git rebase '{0}'"
mode = "execute"
@@ -0,0 +1,33 @@
[metadata]
name = "git-diff"
description = "A channel to select files from git diff commands"
requirements = ["git"]
[source]
command = "git diff --name-only HEAD"
[preview]
command = "git diff HEAD --color=always -- '{}'"
[ui]
layout = "portrait"
[keybindings]
ctrl-s = "actions:stage"
ctrl-r = "actions:restore"
ctrl-e = "actions:edit"
[actions.stage]
description = "Stage the selected file"
command = "git add '{}'"
mode = "fork"
[actions.restore]
description = "Discard changes in the selected file"
command = "git restore '{}'"
mode = "fork"
[actions.edit]
description = "Open the selected file in editor"
command = "${EDITOR:-vim} '{}'"
mode = "execute"
@@ -0,0 +1,34 @@
[metadata]
name = "git-log"
description = "A channel to select from git log entries"
requirements = ["git"]
[source]
command = "git log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --color=always"
output = "{strip_ansi|split: :1}"
ansi = true
no_sort = true
frecency = false
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{strip_ansi|split: :1}' | head -n 1000"
[keybindings]
ctrl-y = "actions:cherry-pick"
ctrl-r = "actions:revert"
ctrl-o = "actions:checkout"
[actions.cherry-pick]
description = "Cherry-pick the selected commit"
command = "git cherry-pick '{strip_ansi|split: :1}'"
mode = "execute"
[actions.revert]
description = "Revert the selected commit"
command = "git revert '{strip_ansi|split: :1}'"
mode = "execute"
[actions.checkout]
description = "Checkout the selected commit"
command = "git checkout '{strip_ansi|split: :1}'"
mode = "execute"
@@ -0,0 +1,28 @@
[metadata]
name = "git-reflog"
description = "A channel to select from git reflog entries"
requirements = ["git"]
[source]
command = "git reflog --decorate --color=always"
output = "{0|strip_ansi}"
ansi = true
no_sort = true
frecency = false
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0|strip_ansi}'"
[keybindings]
ctrl-o = "actions:checkout"
ctrl-r = "actions:reset"
[actions.checkout]
description = "Checkout the selected reflog entry"
command = "git checkout '{0|strip_ansi}'"
mode = "execute"
[actions.reset]
description = "Reset --hard to the selected reflog entry"
command = "git reset --hard '{0|strip_ansi}'"
mode = "execute"
@@ -0,0 +1,30 @@
[metadata]
name = "git-repos"
requirements = ["fd", "git"]
description = """
A channel to select from git repositories on your local machine.
This channel uses `fd` to find directories that contain a `.git` subdirectory, and then allows you to preview the git log of the selected repository.
"""
[source]
# this is a macos version of the command. While perfectly usable on linux, you may want to tweak it a bit.
command = "fd -g .git -HL -t d -d 10 --prune ~ -E 'Library' -E 'Application Support' --exec dirname '{}'"
display = "{split:/:-1}"
[preview]
command = "cd '{}'; git log -n 200 --pretty=medium --all --graph --color"
[keybindings]
enter = "actions:cd"
ctrl-e = "actions:edit"
[actions.cd]
description = "Open a new shell in the selected repository"
command = "cd '{}' && $SHELL"
mode = "execute"
[actions.edit]
description = "Open the repository in editor"
command = "${EDITOR:-vim} '{}'"
mode = "execute"
@@ -0,0 +1,37 @@
[metadata]
name = "git-stash"
description = "Browse and manage git stash entries"
requirements = ["git"]
[source]
command = "git stash list --color=always"
ansi = true
output = "{strip_ansi|split:\\::0}"
no_sort = true
frecency = false
[preview]
command = "git stash show -p --color=always '{strip_ansi|split:\\::0}'"
[ui]
layout = "portrait"
[keybindings]
enter = "actions:apply"
ctrl-p = "actions:pop"
ctrl-d = "actions:drop"
[actions.apply]
description = "Apply the selected stash"
command = "git stash apply '{strip_ansi|split:\\::0}'"
mode = "execute"
[actions.pop]
description = "Pop the selected stash (apply and remove)"
command = "git stash pop '{strip_ansi|split:\\::0}'"
mode = "execute"
[actions.drop]
description = "Drop the selected stash"
command = "git stash drop '{strip_ansi|split:\\::0}'"
mode = "execute"
@@ -0,0 +1,26 @@
[metadata]
name = "git-tags"
description = "Browse and checkout git tags"
requirements = ["git"]
[source]
command = "git tag --sort=-creatordate"
no_sort = true
frecency = false
[preview]
command = "git show --color=always '{}'"
[keybindings]
enter = "actions:checkout"
ctrl-d = "actions:delete"
[actions.checkout]
description = "Checkout the selected tag"
command = "git checkout '{}'"
mode = "execute"
[actions.delete]
description = "Delete the selected tag"
command = "git tag -d '{}'"
mode = "execute"
@@ -0,0 +1,24 @@
[metadata]
name = "git-worktrees"
description = "List and switch between git worktrees"
requirements = ["git"]
[source]
command = "git worktree list --porcelain | grep '^worktree' | cut -d' ' -f2-"
[preview]
command = "cd '{}' && git log --oneline -10 --color=always && echo && git status --short"
[keybindings]
enter = "actions:cd"
ctrl-d = "actions:remove"
[actions.cd]
description = "Change to the selected worktree"
command = "cd '{}' && $SHELL"
mode = "execute"
[actions.remove]
description = "Remove the selected worktree"
command = "git worktree remove '{}'"
mode = "execute"
@@ -0,0 +1,18 @@
[metadata]
name = "just-recipes"
description = "A channel to select recipes from Justfiles"
requirements = ["just"]
[source]
command = ["just --summary | tr '[:blank:]' '\n'"]
[preview]
command = "just -s {}"
[keybindings]
f5 = "actions:execute-recipe"
[actions.execute-recipe]
description = "Execute a justfile recipe"
command = "just {}"
mode = "execute"
@@ -0,0 +1,27 @@
[metadata]
name = "k8s-contexts"
description = "List and switch kubectl contexts"
requirements = ["kubectl"]
[source]
command = "kubectl config get-contexts -o name"
[preview]
command = "kubectl config view --minify --context='{}' -o yaml"
[ui]
layout = "portrait"
[keybindings]
enter = "actions:use"
ctrl-d = "actions:delete"
[actions.use]
description = "Switch to the selected context"
command = "kubectl config use-context '{}'"
mode = "execute"
[actions.delete]
description = "Delete the selected context"
command = "kubectl config delete-context '{}'"
mode = "execute"
@@ -0,0 +1,37 @@
[metadata]
name = "k8s-deployments"
description = '''List and preview Deployments in a Kubernetes Cluster.
The first source lists only from the current namespace, while the second lists from all.
Keybindings
Press `ctrl-d` to delete the selected Deployment.
'''
requirements = ["kubectl"]
[source]
command = [
'''
kubectl get deployments -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}'
''',
'''
kubectl get deployments -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' --all-namespaces
''',
]
output = "{1}"
[preview]
command = "kubectl describe -n {0} deployments/{1}"
[ui]
layout = "portrait"
preview_panel = { size = 60 }
[keybindings]
ctrl-d = "actions:delete"
[actions.delete]
description = "Delete the selected Deployment"
command = "kubectl delete -n {0} deployments/{1}"
mode = "execute"
@@ -0,0 +1,51 @@
[metadata]
name = "k8s-pods"
description = '''List and preview Pods in a Kubernetes Cluster.
The first source lists only from the current namespace, while the second lists from all.
Keybindings
Press `ctrl-e` to execute shell inside the selected Pod.
Press `ctrl-d` to delete the selected Pod.
Press `ctrl-l` to print and follow the logs of the selected Pod.
'''
requirements = ["kubectl"]
[source]
command = [
'''
kubectl get pods -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}'
''',
'''
kubectl get pods -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' --all-namespaces
''',
]
output = "{1}"
[preview]
command = "kubectl describe -n {0} pods/{1}"
[ui]
layout = "portrait"
preview_panel = { size = 60 }
[keybindings]
ctrl-d = "actions:delete"
ctrl-e = "actions:exec"
ctrl-l = "actions:logs"
[actions.exec]
description = "Execute shell inside the selected Pod"
command = "kubectl exec -i -t -n {0} pods/{1} -- /bin/sh"
mode = "execute"
[actions.delete]
description = "Delete the selected Pod"
command = "kubectl delete -n {0} pods/{1}"
mode = "execute"
[actions.logs]
description = "Follow logs of the selected Pod"
command = "kubectl logs -f -n {0} pods/{1}"
mode = "execute"
@@ -0,0 +1,37 @@
[metadata]
name = "k8s-services"
description = '''List and preview Services in a Kubernetes Cluster.
The first source lists only from the current namespace, while the second lists from all.
keybindings
Press `ctrl-d` to delete the selected Service.
'''
requirements = ["kubectl"]
[source]
command = [
'''
kubectl get services -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}'
''',
'''
kubectl get services -o go-template --template '{{range .items}}{{.metadata.namespace}} {{.metadata.name}}{{"\n"}}{{end}}' --all-namespaces
''',
]
output = "{1}"
[preview]
command = "kubectl describe -n {0} services/{1}"
[ui]
layout = "portrait"
preview_panel = { size = 60 }
[keybindings]
ctrl-d = "actions:delete"
[actions.delete]
description = "Delete the selected Service"
command = "kubectl delete -n {0} services/{1}"
mode = "execute"
@@ -0,0 +1,18 @@
[metadata]
name = "make-targets"
description = "List and run Makefile targets"
requirements = ["make", "awk"]
[source]
command = "make -pRrq 2>/dev/null | awk -F: '/^[a-zA-Z0-9][^$#\\/\\t=]*:([^=]|$)/ {split($1,a,\" \"); print a[1]}' | sort -u | grep -v '^Makefile$'"
[preview]
command = "awk '/^{}[[:space:]]*:/{found=1} found{print; if(/^[^\\t]/ && NR>1 && !/^{}[[:space:]]*:/) exit}' Makefile"
[keybindings]
enter = "actions:run"
[actions.run]
description = "Run the selected make target"
command = "make {}"
mode = "execute"
@@ -0,0 +1,25 @@
[metadata]
name = "man-pages"
description = "Browse and preview system manual pages"
requirements = ["apropos", "man", "col"]
[source]
# List all man pages using apropos
command = "apropos ."
[preview]
# Show the man page for the selected entry
command = "man '{0}' | col -bx"
env = { "MANWIDTH" = "80" }
[keybindings]
enter = "actions:open"
[actions.open]
description = "Open the selected man page in the system pager"
command = "man '{0}'"
mode = "execute"
[ui]
layout = "portrait"
preview_panel = { header = "{0}" }
@@ -0,0 +1,19 @@
[metadata]
name = "mounts"
description = "List mounted filesystems"
requirements = ["df", "awk"]
[source]
command = "df -h --output=target,fstype,size,used,avail,pcent 2>/dev/null | tail -n +2"
display = "{split: :0}"
[preview]
command = "df -h '{}' && echo && ls -la '{}' 2>/dev/null | head -20"
[keybindings]
enter = "actions:cd"
[actions.cd]
description = "Open a shell in the selected mount point"
command = "cd '{}' && $SHELL"
mode = "execute"
@@ -0,0 +1,22 @@
[metadata]
name = "npm-scripts"
description = "List and run npm scripts from package.json"
requirements = ["jq"]
[source]
command = "jq -r '.scripts | to_entries[] | \"\\(.key)\\t\\(.value)\"' package.json 2>/dev/null"
display = "{split:\\t:0}"
[preview]
command = "jq -r '.scripts[\"{split:\\t:0}\"]' package.json"
[ui.preview_panel]
size = 30
[keybindings]
enter = "actions:run"
[actions.run]
description = "Run the selected npm script"
command = "npm run '{split:\\t:0}'"
mode = "execute"
@@ -0,0 +1,9 @@
[metadata]
name = "nu-history"
description = "A channel to select from your nu history"
[source]
command = "nu -c 'open $nu.history-path | lines | uniq | reverse | to text'"
no_sort = true
frecency = false
@@ -0,0 +1,10 @@
[metadata]
name = "path"
description = "Investigate PATH contents"
requirements = ["fd", "bat"]
[source]
command = "printf '%s\n' \"$PATH\" | tr ':' '\n'"
[preview]
command = "fd -tx -d1 . \"{}\" -X printf \"%s\n\" \"{/}\" | sort -f | bat -n --color=always"
@@ -0,0 +1,24 @@
[metadata]
name = "pdf-files"
description = "Browse PDF files"
requirements = ["fd", "pdftotext"]
[source]
command = [
"fd -t f -e pdf .",
"fd -t f -e pdf -H .",
]
[preview]
command = "pdftotext -l 2 -layout '{}' - 2>/dev/null | head -100 || file '{}'"
[ui]
layout = "portrait"
[keybindings]
enter = "actions:open"
[actions.open]
description = "Open the selected PDF with default viewer"
command = "xdg-open '{}' 2>/dev/null || open '{}'"
mode = "fork"
@@ -0,0 +1,27 @@
[metadata]
name = "pip-packages"
description = "List installed Python packages"
requirements = ["pip"]
[source]
command = "pip list --format=freeze 2>/dev/null | cut -d= -f1"
[preview]
command = "pip show '{}'"
[ui]
layout = "portrait"
[keybindings]
ctrl-u = "actions:upgrade"
ctrl-d = "actions:uninstall"
[actions.upgrade]
description = "Upgrade the selected package"
command = "pip install --upgrade '{}'"
mode = "execute"
[actions.uninstall]
description = "Uninstall the selected package"
command = "pip uninstall '{}'"
mode = "execute"
@@ -0,0 +1,14 @@
[metadata]
name = "ports"
description = "List listening ports and associated processes"
requirements = ["ss", "awk"]
[source]
command = "ss -tlnp 2>/dev/null | tail -n +2 | awk '{gsub(/.*:/,\"\",$4); print $4, $1, $6}' | sed 's/users:((\"//; s/\".*//'"
display = "{split: :0} ({split: :2})"
[preview]
command = "ss -tlnp 2>/dev/null | grep ':{split: :0} ' | head -20"
[ui.preview_panel]
size = 40
@@ -0,0 +1,38 @@
[metadata]
name = "procs"
description = "A channel to find and manage running processes"
requirements = ["ps", "awk"]
[source]
command = "ps -e -o pid=,ucomm= | awk '{print $1, $2}'"
display = "{split: :1}"
output = "{split: :0}"
[preview]
command = "ps -p '{split: :0}' -o user,pid,ppid,state,%cpu,%mem,command | fold"
[keybindings]
ctrl-k = "actions:kill"
f2 = "actions:term"
ctrl-s = "actions:stop"
ctrl-c = "actions:cont"
[actions.kill]
description = "Kill the selected process (SIGKILL)"
command = "kill -9 {split: :0}"
mode = "execute"
[actions.term]
description = "Terminate the selected process (SIGTERM)"
command = "kill -15 {split: :0}"
mode = "execute"
[actions.stop]
description = "Stop/pause the selected process (SIGSTOP)"
command = "kill -STOP {split: :0}"
mode = "fork"
[actions.cont]
description = "Continue/resume the selected process (SIGCONT)"
command = "kill -CONT {split: :0}"
mode = "fork"
@@ -0,0 +1,22 @@
[metadata]
name = "recent-files"
description = "List recently modified files (via git or filesystem)"
requirements = ["git", "bat"]
[source]
command = [
"git diff --name-only HEAD~10 HEAD 2>/dev/null || find . -type f -mtime -7 -not -path '*/.*' 2>/dev/null | head -100",
"find . -type f -mmin -60 -not -path '*/.*' 2>/dev/null | head -100",
]
[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]
enter = "actions:edit"
[actions.edit]
description = "Open the selected file in editor"
command = "${EDITOR:-vim} '{}'"
mode = "execute"
@@ -0,0 +1,18 @@
[metadata]
name = "ssh-hosts"
description = "A channel to select hosts from your SSH config"
requirements = ["grep", "tr", "cut", "awk"]
[source]
command = "grep -E '^Host(name)? ' $HOME/.ssh/config | tr -s ' ' | cut -d' ' -f2- | tr ' ' '\n' | grep -v '^$'"
[preview]
command = "awk '/^Host / { found=0 } /^Host (.*[[:space:]])?'{}'([[:space:]].*)?$/ { found=1 } found' $HOME/.ssh/config"
[keybindings]
enter = "actions:connect"
[actions.connect]
description = "SSH into the selected host"
command = "ssh '{}'"
mode = "execute"
@@ -0,0 +1,49 @@
[metadata]
name = "systemd-units"
description = "List and manage systemd services"
requirements = ["systemctl"]
[source]
command = [
"systemctl list-units --type=service --no-pager --no-legend --plain",
"systemctl list-units --type=service --all --no-pager --no-legend --plain",
]
display = "{split: :0}"
[preview]
command = "systemctl status '{split: :0}' --no-pager"
[ui]
layout = "portrait"
[keybindings]
ctrl-s = "actions:start"
f2 = "actions:stop"
ctrl-r = "actions:restart"
ctrl-e = "actions:enable"
ctrl-d = "actions:disable"
[actions.start]
description = "Start the selected service"
command = "sudo systemctl start '{split: :0}'"
mode = "execute"
[actions.stop]
description = "Stop the selected service"
command = "sudo systemctl stop '{split: :0}'"
mode = "execute"
[actions.restart]
description = "Restart the selected service"
command = "sudo systemctl restart '{split: :0}'"
mode = "execute"
[actions.enable]
description = "Enable the selected service"
command = "sudo systemctl enable '{split: :0}'"
mode = "execute"
[actions.disable]
description = "Disable the selected service"
command = "sudo systemctl disable '{split: :0}'"
mode = "execute"
@@ -0,0 +1,28 @@
[metadata]
name = "text"
description = "A channel to find and select text from files"
requirements = ["rg", "bat"]
[source]
command = [
"rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always",
"rg . --no-heading --line-number --hidden --colors 'match:fg:white' --colors 'path:fg:blue' --color=always",
]
ansi = true
output = "{strip_ansi|split:\\::..2}"
[preview]
command = "bat -n --color=always '{strip_ansi|split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = '{strip_ansi|split:\::1}'
[ui]
preview_panel = { header = '{strip_ansi|split:\::..2}' }
[keybindings]
enter = "actions:edit"
[actions.edit]
description = "Open file in editor at line"
command = "${EDITOR:-vim} '+{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'"
mode = "execute"
@@ -0,0 +1,21 @@
[metadata]
name = "tldr"
description = "Browse and preview TLDR help pages for command-line tools"
requirements = ["tldr"]
[source]
command = "tldr --list"
[preview]
command = "tldr '{0}' --color always"
[ui]
layout = "portrait"
[keybindings]
ctrl-e = "actions:open"
[actions.open]
description = "Open the selected TLDR page"
command = "tldr '{0}'"
mode = "execute"
@@ -0,0 +1,25 @@
[metadata]
name = "todo-comments"
description = "Find TODO, FIXME, HACK, and XXX comments in codebase"
requirements = ["rg", "bat"]
[source]
command = "rg -n --color=always '(TODO|FIXME|HACK|XXX|BUG|WARN):?'"
ansi = true
output = "{strip_ansi|split:\\::..2}"
[preview]
command = "bat -n --color=always --highlight-line '{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = "{strip_ansi|split:\\::1}"
[ui]
preview_panel = { header = "{strip_ansi|split:\\::..2}" }
[keybindings]
enter = "actions:edit"
[actions.edit]
description = "Open file in editor at the comment"
command = "${EDITOR:-vim} '+{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'"
mode = "execute"
@@ -0,0 +1,43 @@
[metadata]
name = "unicode"
description = '''Search and insert unicode characters
The UnicodeData.txt file is included by many packages.
In addition to:
Alpine Linux: unicode-character-database
Arch: unicode-character-database
Debian/Ubuntu: unicode-data
Fedora / RHEL / CentOS unicode-ucd
Gentoo: app-i18n/unicode-data
NixOS: unicode/unicode-data
openSUSE: unicode-ucd
UnicodData.txt may also aleady be provided by:
1) Many java packages
2) Latex packages
3) Still others
It may in some cases be necessary to alter UNICODE_FILE below.
'''
requirements = ["awk", "perl"]
[source]
command = '''
UNICODE_FILE="/usr/share/unicode/ucd/UnicodeData.txt"
awk -F';' '
$2 !~ /^</ { print $1 "|" $2 }
' "$UNICODE_FILE" \
| perl -CS -F'\|' -lane '
$code = $F[0];
$desc = $F[1];
$char = chr(hex($code));
print "U+$code|$char|$desc" if $char =~ /\p{Print}/;
'
'''
display = "{split:|:0} {split:|:1} {split:|:2}"
output = "{split:|:1}"
@@ -0,0 +1,11 @@
[metadata]
name = "zsh-history"
description = "A channel to select from your zsh history"
requirements = ["zsh"]
[source]
command = "sed '1!G;h;$!d' ${HISTFILE:-${HOME}/.zsh_history}"
display = "{split:;:1..}"
output = "{split:;:1..}"
no_sort = true
frecency = false
@@ -0,0 +1,247 @@
# CONFIGURATION FILE LOCATION ON YOUR SYSTEM:
# -------------------------------------------
# Defaults:
# ---------
# Linux: `$HOME/.config/television/config.toml`
# macOS: `$HOME/.config/television/config.toml`
# Windows: `%LocalAppData%\television\config.toml`
#
# XDG dirs:
# ---------
# You may use XDG_CONFIG_HOME if set on your system.
# In that case, television will expect the configuration file to be in:
# `$XDG_CONFIG_HOME/television/config.toml`
#
# General settings
# ----------------------------------------------------------------------------
tick_rate = 50
default_channel = "files"
# History settings
# ---------------
# Maximum number of entries to keep in the global history (default: 100)
# The history tracks search queries across all channels and sessions
# Set to 0 to disable history functionality entirely
history_size = 200
# Whether to use global history (default: false)
# When true: history navigation shows entries from all channels
# When false: history navigation is scoped to the current channel
global_history = false
[ui]
# How much space to allocate for the UI (in percentage of the screen)
# ┌─────────────────────────┐
# │ Terminal screen │
# │ ┌───────────────────┐ │
# │ │ │ │
# │ │ Television UI │ │
# │ │ │ │
# │ └───────────────────┘ │
# │ │
# └─────────────────────────┘
ui_scale = 100
# What orientation should tv be (landscape or portrait)
orientation = "landscape"
# The theme to use for the UI
# A list of builtin themes can be found in the `themes` directory of the television
# repository. You may also create your own theme by creating a new file in a `themes`
# directory in your configuration directory (see the `config.toml` location above).
theme = "default"
# Feature-specific configurations
# Each feature can have its own configuration section
[ui.input_bar]
# Where to place the input bar in the UI (top or bottom)
position = "top"
# The input prompt string (defaults to ">" if not specified)
prompt = ">"
# header = "{}"
# padding = {"left": 0, "right": 0, "top": 0, "bottom": 0}
border_type = "rounded" # https://docs.rs/ratatui/latest/ratatui/widgets/block/enum.BorderType.html#variants
[ui.status_bar]
# Status bar separators (bubble):
#separator_open = ""
#separator_close = ""
# Status bar separators (box):
separator_open = ""
separator_close = ""
hidden = false
[ui.results_panel]
border_type = "rounded"
# padding = {"left": 0, "right": 0, "top": 0, "bottom": 0}
[ui.preview_panel]
# Preview panel size (percentage of screen width/height)
size = 50
#header = ""
#footer = ""
scrollbar = true
border_type = "rounded"
# padding = {"left": 0, "right": 0, "top": 0, "bottom": 0}
hidden = false
[ui.help_panel]
# Whether to split the help panel by categories
show_categories = true
hidden = true
[ui.remote_control]
# Whether to show channel descriptions in remote control mode
show_channel_descriptions = true
# Whether to sort channels alphabetically
sort_alphabetically = true
# disabled = false
# Theme color overrides
# ---------------------
# You can override specific colors from the selected theme by adding them here.
# This allows you to customize the appearance without creating a full theme file.
# Colors can be specified as ANSI color names (e.g., "red", "bright-blue") or
# as hex values (e.g., "#ff0000", "#1e1e2e").
#
# Example overrides:
# [ui.theme_overrides]
# background = "#000000"
# text_fg = "#ffffff"
# selection_bg = "#444444"
# match_fg = "#ff0000"
# Keybindings and Events
# ----------------------------------------------------------------------------
#
[keybindings]
# Application control
# ------------------
esc = "quit"
ctrl-c = "quit"
# Navigation and selection
# -----------------------
down = "select_next_entry"
ctrl-n = "select_next_entry"
ctrl-j = "select_next_entry"
up = "select_prev_entry"
ctrl-p = "select_prev_entry"
ctrl-k = "select_prev_entry"
# History navigation
# -----------------
ctrl-up = "select_prev_history"
ctrl-down = "select_next_history"
# Multi-selection
# --------------
tab = "toggle_selection_down"
backtab = "toggle_selection_up"
enter = "confirm_selection"
# Preview panel control
# --------------------
pagedown = "scroll_preview_half_page_down"
pageup = "scroll_preview_half_page_up"
ctrl-f = "cycle_previews"
# Data operations
# --------------
ctrl-y = "copy_entry_to_clipboard"
ctrl-r = "reload_source"
ctrl-s = "cycle_sources"
# UI Features
# ----------
ctrl-t = "toggle_remote_control"
ctrl-x = "toggle_action_picker"
ctrl-o = "toggle_preview"
ctrl-h = "toggle_help"
f12 = "toggle_status_bar"
ctrl-l = "toggle_layout"
# Input field actions
# ----------------------------------------
backspace = "delete_prev_char"
ctrl-w = "delete_prev_word"
ctrl-u = "delete_line"
delete = "delete_next_char"
left = "go_to_prev_char"
right = "go_to_next_char"
home = "go_to_input_start"
ctrl-a = "go_to_input_start"
end = "go_to_input_end"
ctrl-e = "go_to_input_end"
# Shell integration
# ----------------------------------------------------------------------------
#
# The shell integration feature allows you to use television as a picker for
# your shell commands (as well as your shell history with <CTRL-R>).
# E.g. typing `git checkout <CTRL-T>` will open television with a list of
# branches to choose from.
[shell_integration]
# This specifies the default fallback channel if no other channel is matched.
fallback_channel = "files"
[shell_integration.channel_triggers]
# Add your channel triggers here. Each key is a channel that will be triggered
# by the corresponding commands.
# Example: say you want the following commands to trigger the following channels
# when pressing <CTRL-T>:
# `git checkout` should trigger the `git-branches` channel
# `ls` should trigger the `dirs` channel
# `cat` and `cp` should trigger the `files` channel
#
# You would add the following to your configuration file:
# ```
# [shell_integration.channel_triggers]
# "git-branches" = ["git checkout"]
# "dirs" = ["ls"]
# "files" = ["cat", "cp"]
# ```
"alias" = ["alias", "unalias"]
"env" = ["export", "unset"]
"dirs" = ["cd", "ls", "rmdir", "z"]
"files" = [
"cat",
"less",
"head",
"tail",
"vim",
"nano",
"bat",
"cp",
"mv",
"rm",
"touch",
"chmod",
"chown",
"ln",
"tar",
"zip",
"unzip",
"gzip",
"gunzip",
"xz",
]
"git-diff" = ["git add", "git restore"]
"git-branch" = [
"git checkout",
"git branch",
"git merge",
"git rebase",
"git pull",
"git push",
]
"git-log" = ["git log", "git show"]
"docker-images" = ["docker run"]
"git-repos" = ["nvim", "code", "hx", "git clone"]
[shell_integration.keybindings]
# controls which key binding should trigger tv
# for shell autocomplete
"smart_autocomplete" = "ctrl-t"
# controls which keybinding should trigger tv
# for command history
"command_history" = "ctrl-r"