This is my emacs config written as a literate program via org-babel.
Magit requires ‘transient’ >= 0.5.0, but due to bad defaults, Emacs’ package manager, refuses to upgrade this and other built-in packages to higher releases from GNU Elpa.
(setq package-install-upgrade-built-in t)
;; (progn
;; (unload-feature ’transient t)
;; ;; (require ’transient)
;; )
(use-package transient)
;; (use-package jsonrpc
;; :ensure t
;; :defer t)
Adjust gc-cons-threshold. The default setting is too low for lsp-mode’s needs due to the fact that client/server communication generates a lot of memory/garbage.
(setq gc-cons-threshold 100000000)
Increase the amount of data which Emacs reads from the process. Again the emacs default is too low 4k considering that the some of the language server responses are in 800k - 3M range.
(setq read-process-output-max (* 1024 1024)) ;; 1mb
Do this early, before any mappings are added. This is a problem on Macbook where option and command is weirdly placed.
(defun global-unset-all-super-key ()
"Will unset any single key in global keymap that has the super modifier."
(let ((km (current-global-map)))
(while km
(let ((maybe-event (and (listp (car km))
(caar km))))
(if (and (eventp maybe-event) ; Also filters maybe-event when
; nil because (car km) was not a list.
(memq 'super (event-modifiers maybe-event)))
(global-unset-key (vector maybe-event))))
(setq km (cdr km)))))
(provide 'global-unset-all-super-key)
(when (string-equal system-type "darwin")
(require 'global-unset-all-super-key)
(global-unset-all-super-key))
(setq inhibit-compacting-font-caches t)
(setq ad-redefinition-action 'accept)
(defalias 'yes-or-no-p 'y-or-n-p)
;; exec-path-from-shell
(use-package exec-path-from-shell
:config
(exec-path-from-shell-initialize))
(set-default-coding-systems 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-language-environment 'utf-8)
(setq locale-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(when (display-graphic-p)
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)))
(defun enable-minor-mode (my-pair)
"Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (regexp . minor-mode)."
(if (buffer-file-name)
(if (string-match (car my-pair) buffer-file-name)
(funcall (cdr my-pair)))))
(use-package doom-themes
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
;; Load the theme (doom-one, doom-molokai, etc); keep in mind that each theme
;; may have their own settings.
;; (load-theme 'doom-flatwhite t)
;(load-theme 'doom-dracula t)
;; (load-theme 'doom-ayu-mirage t)
(load-theme 'doom-oksolar-light t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
;; (doom-themes-neotree-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config)
)
(use-package nerd-icons
)
(use-package unicode-fonts
:config
(unicode-fonts-setup))
Enable emoji font https://old.reddit.com/r/emacs/comments/mvlid5/native_emojis_in_emacs_just_some_pure_fun/
;; Emoji: 😄, 🤦, 🏴
(set-fontset-font t 'symbol "Apple Color Emoji")
(set-fontset-font t 'symbol "Noto Color Emoji" nil 'append)
(set-fontset-font t 'symbol "Segoe UI Emoji" nil 'append)
(set-fontset-font t 'symbol "Symbola" nil 'append)
;;(set-frame-font "Hack 14")
(set-frame-font "CommitMono 14")
(global-set-key (vector (list 'control mouse-wheel-down-event)) 'text-scale-increase)
(global-set-key (vector (list 'control mouse-wheel-up-event)) 'text-scale-decrease)
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)
(if window-system
(tool-bar-mode -1))
(if window-system
(menu-bar-mode -1))
(scroll-bar-mode -1)
(add-to-list 'default-frame-alist '(fullscreen . maximized))
(global-unset-key (kbd "C-z"))
(setq-default whitespace-style (quote (spaces tabs newline space-mark tab-mark newline-mark)))
(global-visual-line-mode t)
;;(use-package smooth-scrolling)
;;(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq scroll-conservatively 101) ;; move minimum when cursor exits view, instead of recentering
(setq mouse-wheel-scroll-amount '(5)) ;; mouse scroll moves 1 line at a time, instead of 5 lines
(setq mouse-wheel-progressive-speed nil) ;; on a long mouse scroll keep scrolling by 1 line
(setq-default cursor-type 'bar)
Apply syntax highlighting to all buffers
(global-font-lock-mode t)
(global-hl-line-mode +1)
(use-package highlight-indent-guides
:config
(setq highlight-indent-guides-method 'bitmap)
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode))
(show-paren-mode 1)
(setq-default show-paren-delay 0)
Highlight matching delimiters parens, brackets, and braces with different colors https://www.emacswiki.org/emacs/RainbowDelimiters
(use-package rainbow-delimiters
:config
(progn
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)))
This minor mode sets background color to strings that match color. https://elpa.gnu.org/packages/rainbow-mode.html
(use-package rainbow-mode
:hook (css-mode sass-mode scss-mode web-mode html-mode))
Save window layout history.
(winner-mode 1)
(use-package nlinum
:config
(add-hook 'prog-mode-hook 'nlinum-mode))
nlinum-hl [tries to] remedy an issue in nlinum where line numbers disappear, due to a combination of bugs internal to nlinum and the fontification processes of certain major-modes and commands. Load this after nlinum
(use-package nlinum-hl)
(setq-default linum-format " %4d ")
;; show column number
(setq-default column-number-mode t)
(use-package minions
:config
(minions-mode 1))
(use-package mode-icons
:config
(mode-icons-mode))
https://github.com/mina86/auto-dim-other-buffers.el The auto-dim-other-buffers-mode is a global minor mode which makes windows without focus less prominent. With many windows in a frame, the idea is that this mode helps recognise which is the selected window by providing a non-intrusive but still noticeable visual indicator.
(use-package auto-dim-other-buffers
:config
(auto-dim-other-buffers-mode t)
)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
;; make tab key always call a indent command.
(setq-default tab-always-indent t)
;; make tab key call indent command or insert tab character, depending on cursor position
(setq-default tab-always-indent nil)
;; make tab key do indent first then completion.
(setq-default tab-always-indent 'complete)
(setq-default fill-column 88)
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(setq select-enable-clipboard t)
https://www.reddit.com/r/emacs/comments/30g5wo/the_kill_ring_and_the_clipboard/
(setq save-interprogram-paste-before-kill t)
Look through everything you’ve killed recently https://github.com/browse-kill-ring/browse-kill-ring
(use-package browse-kill-ring)
(delete-selection-mode t)
(global-set-key (kbd "RET") 'newline-and-indent)
(defun duplicate-line()
(interactive)
(move-beginning-of-line 1)
(kill-line)
(yank)
(open-line 1)
(next-line 1)
(yank)
)
(global-set-key (kbd "C-c d") 'duplicate-line)
(global-set-key (kbd "M-[") 'insert-pair)
(global-set-key (kbd "M-{") 'insert-pair)
(global-set-key (kbd "M-\"") 'insert-pair)
(use-package multiple-cursors
:config
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines))
(global-set-key (kbd "C-c M-s") 'sort-lines)
https://github.com/purcell/whole-line-or-region/
This minor mode allows functions to operate on the current line if they would normally operate on a region and region is currently undefined.
(use-package whole-line-or-region)
(use-package move-text
:config
(move-text-default-bindings))
(use-package expand-region
:config
(global-set-key (kbd "C-=") 'er/expand-region))
https://github.com/remyferre/comment-dwim-2 comment-dwim-2 is a replacement for the Emacs’ built-in command comment-dwim
(use-package comment-dwim-2
:config
(global-set-key (kbd "M-;") 'comment-dwim-2))
https://emacs-tree-sitter.github.io/
TODO: Use after + hook to prog/mode?
(use-package tree-sitter
:config (global-tree-sitter-mode)
:hook (tree-sitter-after-on . tree-sitter-hl-mode)
)
(use-package tree-sitter-langs)
Utilities/helpers for key-bindings.
(use-package which-key
:defer 0.2
:diminish
:config (which-key-mode))
This package is a emacs-which-key extension, which use posframe to show which-key popup.
(use-package which-key-posframe
:config
(which-key-posframe-mode))
(setq make-backup-files nil) ; stop creating backup~ files
(setq auto-save-default nil) ; stop creating #autosave# files
(setq create-lockfiles nil) ; stop creating .#lock file links
(setq backup-directory-alist
`((".*" . ,temporary-file-directory)))
(setq auto-save-file-name-transforms
`((".*" ,temporary-file-directory t)))
(setq backup-by-copying t ; Don't delink hardlinks
version-control t ; Use version numbers on backups
delete-old-versions t ; Automatically delete excess backups
kept-new-versions 20 ; how many of the newest versions to keep
kept-old-versions 5 ; and how many of the old
)
(defun force-backup-of-buffer ()
"Make a special 'per session' backup at the first save of each Emacs session."
(when (not buffer-backed-up)
;; Override the default parameters for per-session backups.
(let ((backup-directory-alist '(("" . temporary-file-directory)))
(kept-new-versions 3))
(backup-buffer)))
;; Make a "per save" backup on each save. The first save results in
;; both a per-session and a per-save backup, to keep the numbering
;; of per-save backups consistent.
(let ((buffer-backed-up nil))
(backup-buffer)))
(add-hook 'before-save-hook 'force-backup-of-buffer)
(defun volatile-kill-buffer ()
"Kill current buffer unconditionally."
(interactive)
(let ((buffer-modified-p nil))
(kill-buffer (current-buffer))))
(global-set-key (kbd "C-x k") 'volatile-kill-buffer)
(global-auto-revert-mode t)
(defun show-file-name ()
"Show the full path file name in the minibuffer."
(interactive)
(message (buffer-file-name)))
(global-set-key [C-f1] 'show-file-name)
(add-to-list 'auth-sources "~/.authinfo" t)
(require 'auth-source)
https://github.com/joodland/bm
(use-package bm
:demand t
:init
;; restore on load (even before you require bm)
(setq bm-restore-repository-on-load t)
:config
;; Allow cross-buffer 'next'
(setq bm-cycle-all-buffers t)
;; where to store persistant files
(setq bm-repository-file "~/.emacs.d/bm-repository")
;; save bookmarks
(setq-default bm-buffer-persistence t)
;; Loading the repository from file when on start up.
(add-hook' after-init-hook 'bm-repository-load)
;; Restoring bookmarks when on file find.
(add-hook 'find-file-hooks 'bm-buffer-restore)
;; Saving bookmarks
(add-hook 'kill-buffer-hook #'bm-buffer-save)
;; Saving the repository to file when on exit.
;; kill-buffer-hook is not called when Emacs is killed, so we
;; must save all bookmarks first.
(add-hook 'kill-emacs-hook #'(lambda nil
(bm-buffer-save-all)
(bm-repository-save)))
;; The `after-save-hook' is not necessary to use to achieve persistence,
;; but it makes the bookmark data in repository more in sync with the file
;; state.
(add-hook 'after-save-hook #'bm-buffer-save)
;; Restoring bookmarks
(add-hook 'find-file-hooks #'bm-buffer-restore)
(add-hook 'after-revert-hook #'bm-buffer-restore)
;; The `after-revert-hook' is not necessary to use to achieve persistence,
;; but it makes the bookmark data in repository more in sync with the file
;; state. This hook might cause trouble when using packages
;; that automatically reverts the buffer (like vc after a check-in).
;; This can easily be avoided if the package provides a hook that is
;; called before the buffer is reverted (like `vc-before-checkin-hook').
;; Then new bookmarks can be saved before the buffer is reverted.
;; Make sure bookmarks is saved before check-in (and revert-buffer)
(add-hook 'vc-before-checkin-hook #'bm-buffer-save)
;; Use mouse + left fring to handle bookmarks
(global-set-key (kbd "<left-fringe> <mouse-1>") 'bm-toggle-mouse)
(global-set-key (kbd "C-<mouse-4>") 'bm-next-mouse)
;; (global-set-key (kbd "C-<mouse-3>") 'bm-previous-mouse)
;; fix Lisp nesting exceeds ‘max-lisp-eval-depth’ in bm-count
(setq max-lisp-eval-depth 10000)
:bind (("C-x p n" . bm-next)
("C-x p p" . bm-previous)
("C-x p t" . bm-toggle))
)
;; HACK: To make bm work in emacs-29
;; https://github.com/joodland/bm/issues/45
;; (defun bm-lists (&optional direction predicate)
;; "Return a pair of lists giving all the bookmarks of the current buffer.
;; The car has all the bookmarks before the overlay center;
;; the cdr has all the bookmarks after the overlay center.
;; A bookmark implementation of `overlay-lists'.
;; If optional argument DIRECTION is provided, only return bookmarks
;; in the specified direction.
;; If optional argument PREDICATE is provided, it is used as a
;; selection criteria for filtering the lists."
;; (if (null predicate)
;; (setq predicate 'bm-bookmarkp))
;; (overlay-recenter (point))
;; (cond ((equal 'forward direction)
;; (cons nil (remq nil (mapcar predicate (overlays-in (point) (point-max))))))
;; ((equal 'backward direction)
;; (cons (remq nil (mapcar predicate (overlays-in (point-min) (point)))) nil))
;; (t
;; (cons
;; (remq nil (mapcar predicate (overlays-in (point-min) (point))))
;; (remq nil (mapcar predicate (overlays-in (point) (point-max))))))))
;; https://github.com/elbeno/dotemacs/blob/94208542da779372fd44fd693204089601dcf824/.emacs.d/hacks.el#L114
(defun sm/bm-lists (&optional direction predicate)
"Return a pair of lists giving all the bookmarks of the current buffer.
The car has all the bookmarks before the overlay center;
the cdr has all the bookmarks after the overlay center.
A bookmark implementation of `overlay-lists'.
If optional argument DIRECTION is provided, only return bookmarks
in the specified direction.
If optional argument PREDICATE is provided, it is used as a
selection criteria for filtering the lists."
(if (null predicate)
(setq predicate 'bm-bookmarkp))
(overlay-recenter (point))
(cond ((equal 'forward direction)
(cons nil (remq nil (mapcar predicate (overlays-in (point) (point-max))))))
((equal 'backward direction)
(cons (remq nil (mapcar predicate (overlays-in (point-min) (point)))) nil))
(t
(cons
(remq nil (mapcar predicate (overlays-in (point-min) (point))))
(remq nil (mapcar predicate (overlays-in (point) (point-max))))))))
(advice-add #'bm-lists
:override #'sm/bm-lists)
(use-package projectile
:diminish projectile-mode
:init
(setq projectile-keymap-prefix (kbd "C-c p"))
:config
(projectile-global-mode)
(setq projectile-completion-system 'default)
(setq projectile-enable-caching t)
(setq projectile-indexing-method 'alien)
)
(use-package dumb-jump
:config
;; enable the xref backend, evaluate
(add-hook 'xref-backend-functions #'dumb-jump-xref-activate)
;; Use completing-read to select a target. That way a completion framework of your choice (Icomplete, Helm, Ivy, ...) will be used instead of the default pop-up buffer. To do this, evaluate
(setq xref-show-definitions-function #'xref-show-definitions-completing-read)
)
(use-package neotree
:config
(global-set-key [f8] 'neotree-toggle)
(setq neo-smart-open t)
(setq-default neo-show-hidden-files t)
;; (setq neo-theme 'icons)
;; (setq projectile-switch-project-action 'neotree-projectile-action)
)
(defun text-scale-twice ()(interactive)(progn(text-scale-adjust 0)(text-scale-decrease 2)))
(add-hook 'neo-after-create-hook (lambda (_)(call-interactively 'text-scale-twice)))
https://www.emacswiki.org/emacs/RecentFiles Recentf is a minor mode that builds a list of recently opened files. This list is is automatically saved across sessions on exiting Emacs - you can then access this list through a command or the menu.
(recentf-mode 1)
(setq recentf-max-menu-items 25)
(setq recentf-max-saved-items 25)
;;(global-set-key "\C-x\ \C-r" 'recentf-open-files)
https://github.com/oantolin/orderless This package provides an orderless completion style that divides the pattern into space-separated components, and matches candidates that match all of the components in any order. Each component can match in any one of several ways: literally, as a regexp, as an initialism, in the flex style, or as multiple word prefixes. By default, regexp and literal matches are enabled.
(use-package orderless
:init
;; :init (icomplete-mode) ; optional but recommended!
;; Configure a custom style dispatcher (see the Consult wiki)
;; (setq orderless-style-dispatchers '(+orderless-dispatch)
;; orderless-component-separator #'orderless-escapable-split-on-space)
(setq completion-styles '(orderless)
completion-category-defaults nil
completion-category-overrides '((file (styles . (partial-completion))))))
(use-package vertico
:init
(vertico-mode)
;; Different scroll margin
(setq vertico-scroll-margin 0)
;; Show more candidates
(setq vertico-count 20)
;; Grow and shrink the Vertico minibuffer
(setq vertico-resize t)
;; Optionally enable cycling for `vertico-next' and `vertico-previous'.
(setq vertico-cycle t)
)
Simple but effective sorting and filtering for Emacs. https://github.com/raxod502/prescient.el
prescient.el is a library which sorts and filters lists of candidates, such as appear when you use a package like Ivy or Company. Extension packages such as ivy-prescient.el and company-prescient.el adapt the library for usage with various frameworks.
prescient.el also provides a completion style (prescient) for filtering candidates via Emacs’s generic completion, such as in Icomplete, Vertico, and Corfu. These last two have extension packages to correctly set up filtering and sorting.
(use-package prescient)
(use-package vertico-prescient
:config
;; cause Vertico to use prescient.el
(vertico-prescient-mode t)
;; usage statistics to be saved between Emacs sessions
(prescient-persist-mode t)
)
(use-package company-prescient
:after company
:config
(company-prescient-mode t))
Marginalia are marks or annotations placed at the margin of the page of a book or in this case helpful colorful annotations placed at the margin of the minibuffer for your completion candidates. Marginalia can only add annotations to be displayed with the completion candidates. It cannot modify the appearance of the candidates themselves, which are shown as supplied by the original commands.
https://github.com/minad/marginalia
(use-package marginalia
:bind (:map minibuffer-local-map
("C-M-a" . marginalia-cycle)
;; When using the Embark package, you can bind `marginalia-cycle' as an Embark action!
;;:map embark-general-map
;; ("A" . marginalia-cycle)
)
;; The :init configuration is always executed (Not lazy!)
:init
;; Must be in the :init section of use-package such that the mode gets
;; enabled right away. Note that this forces loading the package.
(marginalia-mode)
;; Prefer richer, more heavy, annotations over the lighter default variant.
;; E.g. M-x will show the documentation string additional to the keybinding.
;; By default only the keybinding is shown as annotation.
;; Note that there is the command `marginalia-cycle' to
;; switch between the annotators.
;; (setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil))
)
https://github.com/oantolin/embark/
(use-package embark
:bind
(("C-." . embark-act)
("C-;" . embark-dwim)
("C-h B;" . embark-bindings))
:init
;; Optionally replace the key help with a completing-read interface
(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
:after (embark consult)
:demand t ; only necessary if you have the hook below
;; if you want to have consult previews as you move around an
;; auto-updating embark collect buffer
:hook
(embark-collect-mode . consult-preview-at-point-mode))
Consult provides practical commands based on the Emacs completion function completing-read. Completion allows you to quickly select an item from a list of candidates. Consult offers in particular an advanced buffer switching command consult-buffer to switch between buffers and recently opened files.
(use-package consult
;; Replace bindings. Lazily loaded due by `use-package'.
:bind (("C-x M-:" . consult-complex-command)
("C-c h" . consult-history)
("C-c m" . consult-mode-command)
("C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
("C-x r x" . consult-register)
("C-x r b" . consult-bookmark)
("M-g g" . consult-goto-line)
("M-g M-g" . consult-goto-line)
("M-g o" . consult-outline) ;; "M-s o" is a good alternative.
("M-g l" . consult-line) ;; "M-s l" is a good alternative.
("M-g m" . consult-mark) ;; I recommend to bind Consult navigation
("M-g k" . consult-global-mark) ;; commands under the "M-g" prefix.
("M-g r" . consult-ripgrep) ;; or consult-grep, consult-ripgrep
("M-g f" . consult-find) ;; or consult-locate, my-fdfind
("M-g i" . consult-project-imenu) ;; or consult-imenu
("M-g e" . consult-error)
("M-s m" . consult-multi-occur)
("M-y" . consult-yank-pop)
("<help> a" . consult-apropos))
;; The :init configuration is always executed (Not lazy!)
:init
;; Custom command wrappers. It is generally encouraged to write your own
;; commands based on the Consult commands. Some commands have arguments which
;; allow tweaking. Furthermore global configuration variables can be set
;; locally in a let-binding.
(defun my-fdfind (&optional dir)
(interactive "P")
(let ((consult-find-command '("fdfind" "--color=never" "--full-path")))
(consult-find dir)))
;; Replace `multi-occur' with `consult-multi-occur', which is a drop-in replacement.
(fset 'multi-occur #'consult-multi-occur)
;; Configure other variables and modes in the :config section, after lazily loading the package
:config
;; Optionally configure a function which returns the project root directory
(autoload 'projectile-project-root "projectile")
(setq consult-project-root-function #'projectile-project-root)
;; Optionally configure narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; (kbd "C-+")
;; Optionally make narrowing help available in the minibuffer.
;; Probably not needed if you are using which-key.
;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
;; Optional configure a view library to be used by `consult-buffer'.
;; The view library must provide two functions, one to open the view by name,
;; and one function which must return a list of views as strings.
;; Example: https://github.com/minad/bookmark-view/
;; (setq consult-view-open-function #'bookmark-jump
;; consult-view-list-function #'bookmark-view-names)
;; Optionally enable previews. Note that individual previews can be disabled
;; via customization variables.
;; (consult-preview-mode)
)
;; TODO Instal and figure out consult-vertico
;; Optionally add the `consult-flycheck' command.
(use-package consult-flycheck
:bind (:map flycheck-command-map
("!" . consult-flycheck)))
https://github.com/Wilfred/helpful Helpful is an alternative to the built-in Emacs help that provides much more contextual information.
(use-package helpful
)
(setq completion-cycle-threshold 3)
CTRLF (pronounced “control F”) is an intuitive and efficient solution for single-buffer text search in Emacs. https://github.com/raxod502/ctrlf
(use-package ctrlf
:config
(ctrlf-mode +1))
(use-package ag
:config
;; (setq-default ag-reuse-window 't)
(setq-default ag-reuse-buffers 't)
(setq ag-highlight-search t)
;; (setq ag-ignore-list (quote (
;; "*migrations/*"
;; "*node_modules/*"
;; "*elpa/*"
;; "*lib/*"
;; "*build/*"
;; "*static/*"
;; )))
(setq-default ag-arguments '(
"--smart-case"
"--stats"
"--ignore-dir" "migrations"
"--ignore-dir" "node_modules"
"--ignore-dir" "elpa"
"--ignore-dir" "lib"
"--ignore-dir" "build"
"--ignore" "*?.min.js"
"--ignore" "*?.map"
"--ignore" "*?.min.js"
"--ignore" "*?.min.css"
"--ignore" "*.csv"
"--ignore" "*.svg"
"--ignore" "*.json"
"--ignore" "*.yaml"
"--ignore" "*.yml"
))
(global-set-key "\C-c\C-g" 'ag-project))
https://github.com/Wilfred/deadgrep
(use-package deadgrep
:config
(global-set-key (kbd "<f5>") #'deadgrep))
(use-package fzf
:bind
;; Don't forget to set keybinds!
:config
(setq fzf/args "-x --color bw --print-query --margin=1,0 --no-hscroll"
fzf/executable "fzf"
fzf/git-grep-args "-i --line-number %s"
;; command used for `fzf-grep-*` functions
;; example usage for ripgrep:
fzf/grep-command "rg --no-heading -nH"
; fzf/grep-command "grep -nrH"
;; If nil, the fzf buffer will appear at the top of the window
fzf/position-bottom t
fzf/window-height 15))
(use-package company
:config
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0.2
company-minimum-prefix-length 1
company-selection-wrap-around t
company-tooltip-align-annotations t
company-tooltip-flip-when-above nil
company-tooltip-limit 10
company-tooltip-minimum 3
company-tooltip-margin 1
company-transformers '(company-sort-by-occurrence)
company-dabbrev-downcase nil)
;; Add yasnippet support for all company backends
;; https://github.com/syl20bnr/spacemacs/pull/179
(defvar company-mode/enable-yas t "Enable yasnippet for all backends.")
(defun company-mode/backend-with-yas (backend)
(if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
backend
(append (if (consp backend) backend (list backend))
'(:with company-yasnippet))))
)
Company-statistics is a global minor mode built on top of the in-buffer completion system company-mode. The idea is to keep a log of a certain number of completions you choose, along with some context information, and use that to rank candidates the next time you have to choose — hopefully showing you likelier candidates at the top of the list.
(use-package company-statistics
:config
(company-statistics-mode))
;; Prevent undo tree files from polluting your git repo
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
(use-package undo-tree
:config
(global-undo-tree-mode 1))
(use-package vterm
:config
(setq vterm-buffer-name-string "%s"
vterm-max-scrollback 100000
vterm-kill-buffer-on-exit t)
;; Change the font in vterm buffers to a mono-spaced font (the fixed-pitch face)
;; if the default font in Emacs is a proportional font.
(add-hook 'vterm-mode-hook
(lambda ()
(set (make-local-variable 'buffer-face-mode-face) 'fixed-pitch)
(buffer-face-mode t)))
)
An Emacs global minor mode allowing eshell to use vterm for visual commands. https://github.com/iostapyshyn/eshell-vterm
(use-package eshell-vterm
:after eshell
:config
(eshell-vterm-mode))
This package simplifies shell management and sudo access by providing the following commands. better-shell-for-current-dir better-shell-for-projectile-root - Like better-shell-for-current-dir, except you are taken to the projectile root of the current directory, provided you have projectile installed. better-shell-shell - cycle through existing shell buffers https://github.com/killdash9/better-shell
(use-package better-shell
:bind (("C-'" . better-shell-shell)
;;("C-;" . better-shell-remote-open)
))
(use-package keyfreq
:config
(keyfreq-mode 1)
(keyfreq-autosave-mode 1))
(use-package yasnippet
:config
(yas-global-mode 1)
(add-hook 'term-mode-hook (lambda()
(setq yas-dont-activate-functions t))))
(use-package yasnippet-snippets)
Auto-format source code in many languages using the same command for all languages. https://github.com/lassik/emacs-format-all-the-code
(use-package format-all)
(use-package magit
:config
(setq magit-auto-revert-mode nil)
(setq magit-last-seen-setup-instructions "1.4.0"))
(add-hook 'magit-log-edit-mode-hook
'(lambda ()
(shell-command "./.git/hooks/pre-commit")))
Use magit + delta to show diffs. https://github.com/dandavison/magit-delta
Install delta via instructions here: https://github.com/dandavison/delta
(use-package magit-delta
:config
(magit-delta-mode))
Forge allows you to work with Git forges, such as Github and Gitlab
(use-package forge
:after magit)
(use-package vc-msg)
(use-package browse-at-remote
:bind ("C-c g g" . browse-at-remote)
)
(use-package git-timemachine
:elpaca (git-timemachine :type git :host codeberg :repo "pidu/git-timemachine")
)
Highlights uncommitted changes on the left side of the window, allows you to jump between and revert them selectively.
(use-package diff-hl
:config
(global-diff-hl-mode)
)
https://github.com/Artawower/blamer.el A git blame plugin for emacs inspired by VS Code’s GitLens plugin and Vim plugin
(use-package blamer
:elpaca (:host github :repo "artawower/blamer.el")
:bind (("s-i" . blamer-show-posframe-commit-info))
:custom
(blamer-idle-time 0.3)
(blamer-min-offset 70)
:custom-face
(blamer-face ((t :foreground "#7a88cf"
:background nil
:height 140
:italic t)))
:config
(setq blamer-show-avatar-p t)
(global-blamer-mode 1))
(use-package dotenv-mode
:mode (("\\.env$" . dotenv-mode)))
https://github.com/wbolster/emacs-direnv
brew install direnv
(use-package direnv
:config
(setq-default direnv-always-show-summary t)
(setq-default direnv-show-paths-in-summary t)
(setq-default direnv-use-faces-in-summary t)
(direnv-mode)
)
https://github.com/emacs-lsp/dap-mode/
(use-package dap-mode
:config
(setq dap-auto-configure-features '(sessions locals controls tooltip)))
https://editorconfig.org/ https://github.com/editorconfig/editorconfig-emacs
(use-package editorconfig
:ensure t
:config
(editorconfig-mode 1))
(use-package let-alist)
(use-package flycheck
:init (global-flycheck-mode)
:config
(setq-default flycheck-checker-error-threshold 500)
(setq-default flycheck-highlighting-mode 'lines)
(setq-default flycheck-idle-change-delay 3)
(setq-default flycheck-display-errors-delay 0))
(use-package eldoc
:ensure t)
(use-package eglot
:ensure
:after (:any prog-mode)
:config
(add-hook 'python-mode-hook 'eglot-ensure)
)
https://notes.alexkehayias.com/using-a-language-server-in-a-docker-container/
pip install “python-lsp-server[all]” TODO: Figure out 3rd party plugins https://github.com/python-lsp/python-lsp-server#3rd-party-plugins
;; (use-package python-mode
;; :ensure nil
;; :hook (python-mode . lsp-deferred)
;; :custom
;; ;; NOTE: Set these if Python 3 is called "python3" on your system!
;; ;; (python-shell-interpreter "python3")
;; ;; (dap-python-executable "python3")
;; (dap-python-debugger 'debugpy)
;; :config
;; (require 'dap-python)
;; )
;; TODO: Move to use-package block
(add-hook 'python-mode-hook
(lambda ()
(setq indent-tabs-mode nil)
(setq tab-width 4)
(setq-default python-indent-guess-indent-offset nil)
(setq python-indent-offset 4)))
https://github.com/galaunay/poetry.el
(use-package poetry
;; :hook
;; (python-mode . poetry-tracking-mode)
)
Need to do some extra steps to config direnv with poetry lassik/emacs-format-all-the-code#29 (comment)
(use-package python-pytest)
(use-package yaml-mode
:mode (("\\.yaml$" . yaml-mode)))
(use-package toml-mode)
npm install -g typescript-language-server typescript vue-language-server
(use-package tide
:after (typescript-mode company flycheck)
:hook (
(typescript-mode . tide-setup)
(typescript-mode . tide-hl-identifier-mode)
(before-save . tide-format-before-save))
:config
(flycheck-add-mode 'typescript-tslint)
)
(use-package prettier-js
:config
;;(add-hook 'web-mode-hook 'prettier-js-mode)
(add-hook 'web-mode-hook #'(lambda ()
(enable-minor-mode
'("\\.jsx?\\'" . prettier-js-mode))))
)
(use-package web-mode
:mode (
("\\.css$" . web-mode)
("\\.html$" . web-mode)
("\\.js$" . web-mode)
("\\.ts$" . web-mode)
("\\.json$" . web-mode)
("\\.jsx$" . web-mode)
("\\.tsx$" . web-mode)
("\\.vue$" . web-mode)
("\\.scss$" . web-mode)
("\\.less$" . web-mode))
:config
(setq-default indent-tabs-mode nil) ;; no TABS
(setq web-mode-code-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-enable-auto-closing t)
(setq web-mode-enable-auto-expanding t)
(setq web-mode-enable-auto-opening t)
(setq web-mode-enable-auto-pairing t)
(setq web-mode-enable-auto-pairing t)
(setq web-mode-enable-auto-quoting nil)
(setq web-mode-enable-css-colorization t)
(setq web-mode-enable-current-column-highlight t)
(setq web-mode-enable-current-element-highlight t)
(setq web-mode-js-indent-offset 2)
(setq web-mode-markup-indent-offset 2)
(setq web-mode-content-types-alist
'(("jsx" . "\\.js[x]?\\'")
;;("tsx" . "\\.ts[x]?\\'")
)
)
;; Default comment to //
(setq-default web-mode-comment-formats (remove '("javascript" . "/*") web-mode-comment-formats))
(add-to-list 'web-mode-comment-formats '("javascript" . "//"))
)
(use-package company-web);
(use-package emmet-mode)
(use-package rust-mode
:hook (rust-mode . lsp)
:config
(setq rust-format-on-save t)
(define-key rust-mode-map (kbd "C-c C-c") 'rust-run)
)
;; Add keybindings for interacting with Cargo
(use-package cargo
:hook (rust-mode . cargo-minor-mode))
(use-package flycheck-rust
:config (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))
(use-package go-mode
:bind (
;; If you want to switch existing go-mode bindings to use lsp-mode/gopls instead
;; uncomment the following lines
;; ("C-c C-j" . lsp-find-definition)
;; ("C-c C-d" . lsp-describe-thing-at-point)
)
;; :hook ((go-mode . lsp-deferred)
;; (before-save . lsp-format-buffer)
;; (before-save . lsp-organize-imports))
)
Install CLI markdown first
brew install markdown
# apt-get install pandoc
(use-package markdown-mode)
(add-hook 'markdown-mode-hook
(lambda ()
(when buffer-file-name
(add-hook 'after-save-hook
'check-parens
nil t))))
(use-package flymd)
(defun my-flymd-browser-function (url)
(let ((browse-url-browser-function 'browse-url-firefox))
(browse-url url)))
(setq flymd-browser-open-function 'my-flymd-browser-function)
(use-package dockerfile-mode
:mode "Dockerfile$")
Activate babel languages
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)
(screen . t)
(R . t)
(C . t)
(css . t)
(python . t)
(js . t)
(haskell . t)
(clojure . t)
(lisp . t)
(org . t)
(sql . t)
))
(use-package solidity-mode
:config
;; (setq solidity-comment-style 'slash)
;; (setq solidity-solc-path "~/cpp-ethereum/build/solc/solc")
;; (setq solidity-solium-path "~/.npm-global/bin/solium")
)
(use-package solidity-flycheck
:config
;; (setq solidity-flycheck-solc-checker-active t)
;; or
;; (setq solidity-flycheck-solium-checker-active t)
)
(use-package elixir-mode
:init
(add-hook 'elixir-mode-hook
(lambda ()
(push '(">=" . ?\u2265) prettify-symbols-alist)
(push '("<=" . ?\u2264) prettify-symbols-alist)
(push '("!=" . ?\u2260) prettify-symbols-alist)
(push '("==" . ?\u2A75) prettify-symbols-alist)
(push '("=~" . ?\u2245) prettify-symbols-alist)
(push '("<-" . ?\u2190) prettify-symbols-alist)
(push '("->" . ?\u2192) prettify-symbols-alist)
(push '("<-" . ?\u2190) prettify-symbols-alist)
(push '("|>" . ?\u25B7) prettify-symbols-alist))))
https://github.com/leon-barrett/just-mode.el
(use-package just-mode)
Note that org mode actually is installed first via init.el, to ensure org-babel can process this literate config property with the right version loaded. Otherwise the built-in org gets mixed up with the one via straight. I’m still leaving the org section and any custom config here.
;; Change ... to downward arrow when there's stuff under a header.
(setq org-hide-leading-stars t)
;; Use syntax highlighting in source blocks while editing.
(setq org-src-fontify-natively t)
(font-lock-flush)
;; Make TAB act as if it were issued in a buffer of the language's major mode.
(setq org-src-tab-acts-natively t)
(setq org-support-shift-select 'always)
;; Highlight some keywords
;; (setq org-todo-keyword-faces
;; '(("TODO" . (:foreground "yellow" :weight bold))
;; ("DONE" . "green")
;; ))
;; (setq org-catch-invisible-edits 'smart)
;; (setq org-ctrl-k-protect-subtree t)
;; Save archive file after something is archived.
(setq org-archive-subtree-save-file-p t)
;; Hide emphasis markers */~=+
(setq org-hide-emphasis-markers t)
;; Ensure org section expands on search
;; TODO: not working with ctrl+f still
(setq-default org-fold-core-style 'overlays)
https://github.com/minad/org-modern
(use-package org-modern
:custom
;; (add-hook 'org-mode-hook #'org-modern-mode)
;; (add-hook 'org-agenda-finalize-hook #'org-modern-agenda)
;; :
config
(global-org-modern-mode)
)
(use-package org-contrib)
(use-package doct
:defer t
;;recommended: defer until calling doct
:commands (doct))
(setq org-babel-python-command "python3")
(org-babel-do-load-languages
'org-babel-load-languages
'((python . t)))
https://github.com/bastibe/org-journal
(use-package org-journal
:config
(defun org-journal-file-header-func (time)
"Custom function to create journal header."
(concat
(pcase org-journal-file-type
(`daily "#+TITLE: Daily Journal\n#+STARTUP: showeverything")
(`weekly "#+TITLE: Weekly Journal\n#+STARTUP: folded")
(`monthly "#+TITLE: Monthly Journal\n#+STARTUP: folded")
(`yearly "#+TITLE: Yearly Journal\n#+STARTUP: folded"))))
(setq org-journal-file-header 'org-journal-file-header-func)
(setq org-journal-dir "~/Projects/Notes/journal/")
(setq org-journal-file-type 'daily)
(setq org-journal-file-format "%Y%m%d.org")
)
(defvar yt-iframe-format
;; You may want to change your width and height.
(concat "<iframe width=\"440\""
" height=\"335\""
" src=\"https://www.youtube.com/embed/%s\""
" frameborder=\"0\""
" allowfullscreen>%s</iframe>"))
(org-add-link-type
"yt"
(lambda (handle)
(browse-url
(concat "https://www.youtube.com/embed/"
handle)))
(lambda (path desc backend)
(cl-case backend
(html (format yt-iframe-format
path (or desc "")))
(latex (format "\href{%s}{%s}"
path (or desc "video"))))))
Searching/Filtering notes
(use-package deft
:custom
(deft-extensions '("org" "txt" "md"))
(deft-directory "~/Projects/Notes/")
(deft-recursive t)
(deft-use-filename-as-title t)
:config
(global-set-key [f9] 'deft)
)
(use-package zetteldeft
:after deft
:config (zetteldeft-set-classic-keybindings))
Emacs major mode for working with mermaid graphs
brew install mermaid-cli
(use-package mermaid-mode)
What is D2?
D2 is a diagram scripting language that turns text to diagrams. It stands for Declarative Diagramming. Declarative, as in, you describe what you want diagrammed, it generates the image.
https://d2lang.com/tour/intro/
First install CLI tool brew install d2
https://github.com/andorsk/d2-mode https://github.com/dmacvicar/ob-d2
(use-package d2-mode)
(use-package ob-d2
:elpaca (:type git :host github :repo "dmacvicar/ob-d2")
:defer t)
(defun eww-default () (interactive)
(setq browse-url-browser-function 'eww-browse-url))
eradio is a simple internet radio player for Emacs. https://github.com/olav35/eradio
(use-package eradio
:config
;; (setq eradio-player '("mpv" "--no-video" "--no-terminal"))
(setq eradio-player '("/Applications/VLC.app/Contents/MacOS/VLC" "--no-video" "-I" "rc"))
;;(global-set-key (kbd "C-c r p") 'eradio-play)
;;(global-set-key (kbd "C-c r s") 'eradio-stop)
)
(setq eradio-channels
'(
("secretagent - somafm" . "http://somafm.com/secretagent130.pls")
("groovesalad - somafm" . "http://somafm.com/groovesalad130.pls")
("groovesalad - somafm" . "http://somafm.com/groovesalad130.pls")
("defcon - somafm" . "https://somafm.com/defcon130.pls")
("cafe - lainon" . "https://lainon.life/radio/cafe.ogg.m3u")
))
Ebook manager
(use-package calibredb
:config
(setq calibredb-root-dir "~/Calibre Library/")
(setq calibredb-db-dir (expand-file-name "metadata.db" calibredb-root-dir))
)
(use-package pdf-tools
:elpaca (pdf-tools :type git :host github
:repo "vedang/pdf-tools")
:mode ("\\.pdf\\'" . pdf-view-mode)
:config
(pdf-tools-install)
(setq auto-revert-interval 0.5)
;; Fix blurry PDFs on MacOS.
;; From https://github.com/politza/pdf-tools/issues/51
(setq pdf-view-use-scaling t)
)
https://huggingface.co/bigcode/starcoder https://gitlab.com/daanturo/starhugger.el
(setq starhugger-api-token
(auth-source-pick-first-password :host "starhugger"))
;; Use https://huggingface.co/codellama/CodeLlama-13b-hf, best to be set before loading this package
(setq starhugger-model-id "codellama/CodeLlama-13b-hf")
(global-set-key (kbd "M-\\") #'starhugger-trigger-suggestion)
(elpaca (starhugger :repo "https://gitlab.com/daanturo/starhugger.el" :files (:defaults "*.py")))
;; (straight-use-package '(starhugger :repo "https://gitlab.com/daanturo/starhugger.el" :files (:defaults "*.py")))
(with-eval-after-load 'starhugger
;; `starhugger-inline-menu-item' makes a conditional binding that is only active at the inline suggestion start
(define-key starhugger-inlining-mode-map (kbd "TAB") (starhugger-inline-menu-item #'starhugger-accept-suggestion))
(define-key starhugger-inlining-mode-map (kbd "M-[") (starhugger-inline-menu-item #'starhugger-show-prev-suggestion))
(define-key starhugger-inlining-mode-map (kbd "M-]") (starhugger-inline-menu-item #'starhugger-show-next-suggestion))
(define-key starhugger-inlining-mode-map (kbd "M-f") (starhugger-inline-menu-item #'starhugger-accept-suggestion-by-word)))
(use-package copilot
:elpaca (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
:ensure t
:config
(add-hook 'prog-mode-hook 'copilot-mode)
(define-key copilot-completion-map (kbd "C-<tab>") 'copilot-accept-completion)
;; (define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
)
https://github.com/karthink/gptel
(defun sm/revert-all-file-buffers ()
"Refresh all open file buffers without confirmation.
Buffers in modified (not yet saved) state in emacs will not be reverted. They
will be reverted though if they were modified outside emacs.
Buffers visiting files which do not exist any more or are no longer readable
will be killed."
(interactive)
(dolist (buf (buffer-list))
(let ((filename (buffer-file-name buf)))
;; Revert only buffers containing files, which are not modified;
;; do not try to revert non-file buffers like *Messages*.
(when (and filename
(not (buffer-modified-p buf)))
(if (file-readable-p filename)
;; If the file exists and is readable, revert the buffer.
(with-current-buffer buf
(revert-buffer :ignore-auto :noconfirm :preserve-modes))
;; Otherwise, kill the buffer.
(let (kill-buffer-query-functions) ; No query done when killing buffer
(kill-buffer buf)
(message "Killed non-existing/unreadable file buffer: %s" filename))))))
(message "Finished reverting buffers containing unmodified files."))
(defun xah-quote-lines ()
"Change current text block's lines to quoted lines with comma or other separator char.
When there is a text selection, act on the selection, else, act on a text block separated by blank lines.
For example,
cat
dog
cow
becomes
\"cat\",
\"dog\",
\"cow\",
or
(cat)
(dog)
(cow)
If the delimiter is any left bracket, the end delimiter is automatically the matching bracket.
URL `http://ergoemacs.org/emacs/emacs_quote_lines.html'
Version 2020-06-26"
(interactive)
(let* (
$p1
$p2
($quoteToUse
(read-string
"Quote to use:" "\"" nil
'(
""
"\""
"'"
"("
"{"
"["
)))
($separator
(read-string
"line separator:" "," nil
'(
""
","
";"
)))
($beginQuote $quoteToUse)
($endQuote
;; if begin quote is a bracket, set end quote to the matching one. else, same as begin quote
(let (($syntableValue (aref (syntax-table) (string-to-char $beginQuote))))
(if (eq (car $syntableValue ) 4) ; ; syntax table, code 4 is open paren
(char-to-string (cdr $syntableValue))
$quoteToUse
))))
(if (use-region-p)
(setq $p1 (region-beginning) $p2 (region-end))
(progn
(if (re-search-backward "\n[ \t]*\n" nil "move")
(progn (re-search-forward "\n[ \t]*\n")
(setq $p1 (point)))
(setq $p1 (point)))
(re-search-forward "\n[ \t]*\n" nil "move")
(skip-chars-backward " \t\n" )
(setq $p2 (point))))
(save-excursion
(save-restriction
(narrow-to-region $p1 $p2)
(goto-char (point-min))
(catch 'EndReached
(while t
(skip-chars-forward "\t ")
(insert $beginQuote)
(end-of-line )
(insert $endQuote $separator)
(if (eq (point) (point-max))
(throw 'EndReached t)
(forward-char 1))))))))
(set-register ?t (cons 'file "~/Projects/Notes/todo.org"))
(set-register ?i (cons 'file "~/.emacs.d/README.org"))
(set-register ?s (cons 'file "~/Projects/Notes/scratch.org"))
;; (add-to-list 'auth-sources "~/.authinfo" t) ;; pinboard, magit-forge
(setq-default org-directory "~/Projects/Notes")
(setq-default org-roam-directory "~/Projects/Notes/")
(setq-default org-roam-index-file "index.org")
(setq-default org-agenda-files '("~/Projects/Notes/todo.org"))
(setq-default rmh-elfeed-org-files '("~/Projects/Notes/elfeed.org"))
;; Forcing django mode on all html
;; TODO: Better way to do this?
(setq-default web-mode-engines-alist
'(("django" . "\\.html\\'")))
(defun relevize-enable () (interactive)
;; Python
;; (pyvenv-activate "~/Library/Caches/pypoetry/virtualenvs/relevize-KceeEHPb-py3.9")
(defun eslint-fix-file ()
(interactive)
(message "eslint --fixing the file" (buffer-file-name))
(shell-command (concat "~/Projects/relevize/relevize/vue-app/node_modules/eslint/bin/eslint.js --fix " (buffer-file-name))))
(defun eslint-fix-file-and-revert ()
(interactive)
(eslint-fix-file)
(revert-buffer t t))
)
;; (defun eventbus-enable () (interactive)
;; ;; Python
;; (pyvenv-activate "~/Library/Caches/pypoetry/virtualenvs/eventbusk-It3kPIr7-py3.9")
;; (setq flycheck-pylintrc "~/Projects/Airbase/eventbusk/pyproject.toml")
;; (setq flycheck-flake8rc "~/Projects/Airbase/eventbusk/.flake8")
;; (setq flycheck-python-mypy-config "~/Projects/Airbase/eventbusk/.mypy.ini")
;; )
;; (defun airbase-enable () (interactive)
;; ;; JS
;; (setq web-mode-code-indent-offset 2)
;; (setq web-mode-markup-indent-offset 2)
;; (setq web-mode-css-indent-offset 2)
;; (setq web-mode-js-indent-offset 2)
;; ;;(prettier-js-mode 1)
;; (setq prettier-args '())
;; ;; Python
;; (pyvenv-activate "/Users/sidmitra/Library/Caches/pypoetry/virtualenvs/airbase-backend-csyzUOJz-py3.11")
;; (setq flycheck-pylintrc "~/Projects/Airbase/airbase-backend/pyproject.toml")
;; (setq flycheck-flake8rc "~/Projects/Airbase/airbase-backend/ci_scripts/.flake8")
;; (setq flycheck-python-mypy-config "~/Projects/Airbase/airbase-backend/ci_scripts/mypy.ini")
;; ;; (lsp-deferred)
;; ;; unset run-python shortcut, interferes with helm-projectile open file
;; (global-unset-key (kbd "C-c C-p"))
;; )
;; (defun airbase-disable () (interactive)
;; )
(defun custom-ag-args () (interactive)
(set
q-default ag-arguments '(
"--smart-case"
"--stats"
"--ignore-dir" "migrations"
"--ignore-dir" "node_modules"
"--ignore-dir" "elpa"
"--ignore-dir" "lib"
"--ignore-dir" "build"
"--ignore" "\pdf_purchase_order.html"
"--ignore" "\*.min.js"
"--ignore" "\*.min.css"
"--ignore" "\*.csv"
"--ignore" "\*.svg"
"--ignore" "\*.json"
"--ignore" "\*.yaml"
"--ignore" "\*.yml"
))
)
;; https://erick.navarro.io/blog/using-compilation-mode-to-run-all-the-things/
(defun sm/run-pytest ()
"Run pytest over the current project."
(interactive)
(let ((default-directory (projectile-project-root)))
(compile "poetry run pytest tests/")))