Skip to content

Instantly share code, notes, and snippets.

View jamescherti's full-sized avatar

James Cherti jamescherti

View GitHub Profile
@jamescherti
jamescherti / switch-project-find-file.el
Last active May 3, 2024 15:13
Emacs: Switch to another project using (find-file)
;; Description:
;; Emacs: Switch to another project using (find-file)
;; Gits URL: https://gist.github.com/jamescherti/bf74fb911d17583e7f4b57946f1ea775
;; License: MIT
;; Author: James Cherti
(defun my-project-prompt-project-dir ()
"Prompt the user for a directory that is one of the known project roots."
(project--ensure-read-project-list)
(setq pr-dir (completing-read "Select project: " project--list nil t)))
;; Description:
;; Prevent 'evil-paste-after' and 'evil-paste-before' from failing when the
;; paste ring (akin to the clipboard) is empty.
;;
;; Gits URL:
;; License: MIT
;; Author: James Cherti
(defun ignore-empty-ring-errors (orig-func &rest args)
"Ignore errors related to the empty ring when calling ORIG-FUNC with ARGS."
@jamescherti
jamescherti / emacs-org-move-subtree.el
Last active April 6, 2024 23:10
Emacs Evil: Move Org subtrees up or down while preserving the cursor's column
;; Description:
;; Emacs Evil: Move Org subtrees up or down while preserving the cursor's
;; column. Unlike the default behavior in Emacs Org, which moves the cursor to
;; the beginning of the line, this approach maintains the cursor's current
;; column position, avoiding undesirable cursor movement.
;;
;; URL: https://gist.github.com/jamescherti/35475b05a45482f4bde325895073aa3e
;; License: MIT
;; Author: James Cherti
@jamescherti
jamescherti / emacs-org-strike-done.el
Last active April 6, 2024 16:04
Strike through DONE tasks in the Emacs Org Mode
;; Strike through DONE tasks in the Emacs Org Mode
;; URL: https://gist.github.com/jamescherti/e12d494296643e67d6e9a8150b14c4cb
;; License: MIT
;; Author: James Cherti
;; Enable the fontification of headlines for tasks that have been marked as
;; completed. This means that the entire headline, not just the TODO keyword,
;; will visually change to reflect the task's completion status.
(setq org-fontify-done-headline t)
@jamescherti
jamescherti / compile-emacs.sh
Last active April 26, 2024 13:59
Compile Emacs: My parameters to compile Emacs
#!/usr/bin/env sh
# Description:
# The parameters I use to compile Emacs >=29 to my specific needs and preferences.
#
# Gits URL: https://gist.github.com/jamescherti/62c993aa71630abfd2a436e3028171ce
# License: MIT
# Author: James Cherti
#
CFLAGS="-O2 -march=native -fomit-frame-pointer" \
@jamescherti
jamescherti / emacs-org-mode-replace-hyphen-bullet.el
Last active March 20, 2024 12:28
Emacs org mode: Replace list hyphen with bullet
;; Emacs org mode: Replace list hyphen "-" with bullet
;; URL: https://gist.github.com/jamescherti/61ebd7ff293d989a385d2e73fa0b45b4
(font-lock-add-keywords
'org-mode '(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1)
(match-end 1)
"\u2022"))))))
@jamescherti
jamescherti / picom.conf
Last active March 18, 2024 11:45
Optimized picom.conf config (tested on an NVIDIA card)
# Optimized picom.conf configuration (tested on an NVIDIA card)
# Gits URL: https://gist.github.com/jamescherti/59f61eeaf17ccc16e1eab2c98d699d31
# License: MIT
# Maintainer of this picom.conf: James Cherti
#################################
# Shadows #
#################################
# Enabled client-side shadows on windows. Note desktop windows
;; Emacs Consult snippet: Exclude *.asc files from Consult Preview
;;
;; The purpose of excluding ".asc" files in this case is to prevent the preview feature
;; from triggering password prompts each time navigation occurs within the list of files
;; displayed by Emacs consult.
;; The default regex: (setq consult-preview-excluded-files ("\\`/[^/|:]+:"))
;;
;; Author: James Cherti
;; GitHub Gist: https://gist.github.com/jamescherti/901ea7aa68f2051914e20bddbeb53178
;; License: MIT
@jamescherti
jamescherti / terminal-tango-theme.vim
Last active November 10, 2023 20:27
Tango color scheme for Vim’s built-in Terminal
" Language: Vim script
" Author: James Cherti
" License: MIT
" Description: Improve the color scheme of Vim Terminal (Tango dark theme),
" and prevent :colorscheme from changing the terminal color scheme.
" URL: https://www.jamescherti.com/vim-tango-color-scheme-vim-terminal/
" Gnome-Terminal Tango Dark
let g:terminal_ansi_colors_black = '#2E3436'
@jamescherti
jamescherti / rename-buffer-and-file.el
Last active September 8, 2023 15:47
Emacs Lisp: Rename both current buffer and file it is visiting.
;; Language: Emacs Lisp (elisp)
;; Description: Rename both current buffer and file it is visiting.
;; Author: James Cherti
;; License: MIT
;; URL: https://gist.github.com/jamescherti/fc1054ce24606c4574cfa41d1ed67412
(defun rename-buffer-and-file ()
"Rename both current buffer and file it is visiting."
(interactive)
(let* ((bufname (buffer-name))