194 lines
6.5 KiB
EmacsLisp
194 lines
6.5 KiB
EmacsLisp
;;; $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 "Sebastian Moser"
|
|
;; user-mail-address "c2vi.dev@gmail.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)
|
|
;; Specify both a dark and light theme, like so and Doom will choose which one
|
|
;; to load based on your system light/dark setting:
|
|
;;
|
|
;; (setq doom-theme '(doom-one . doom-one-light)) ; (DARK . LIGHT)
|
|
;;
|
|
;; If you want more pro-active theme switching based on OS light/dark mode, look
|
|
;; up the `auto-dark' package.
|
|
|
|
;; 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 "relative")
|
|
|
|
;; 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 "~/work/things/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.
|
|
|
|
(map! "C-p" #'execute-extended-command)
|
|
;;(map! :leader "a" #'execute-extended-command)
|
|
;;(map! :nv ":" #'execute-extended-command)
|
|
|
|
(after! evil
|
|
;;(map! :nv ":" #'execute-extended-command)
|
|
(map! :gnv "C-p" #'execute-extended-command)
|
|
(map! :gnv "C-e" #'projectile-find-file)
|
|
)
|
|
|
|
(after! 'better-jumper
|
|
(map! :gnv "C-i" #'projectile-find-file)
|
|
)
|
|
|
|
(with-eval-after-load 'projectile
|
|
(add-to-list 'projectile-globally-ignored-directories "node_modules")
|
|
(add-to-list 'projectile-globally-ignored-directories ".obsidian")
|
|
(setq projectile-indexing-method 'native)
|
|
)
|
|
|
|
|
|
(after! obsidian
|
|
(setq obsidian-directory "~/work/things"
|
|
obsidian-inbox-directory "semi-public"
|
|
markdown-enable-wiki-links t
|
|
)
|
|
|
|
(global-obsidian-mode t)
|
|
)
|
|
|
|
|
|
|
|
;;; clipboard
|
|
(after! evil
|
|
(setq interprogram-cut-function nil
|
|
interprogram-paste-function nil)
|
|
)
|
|
(defun my/clipboard-copy (beg end)
|
|
"Copy region to the OS clipboard (bypassing the kill-ring)."
|
|
(interactive "r")
|
|
(let ((text (buffer-substring-no-properties beg end))
|
|
(inhibit-message t))
|
|
(gui-select-text text)
|
|
(deactivate-mark)
|
|
(when (called-interactively-p 'any)
|
|
(message "Copied to clipboard: %d chars" (length text)))))
|
|
|
|
(defun my/clipboard-paste ()
|
|
"Paste from the OS clipboard, replacing the region if active."
|
|
(interactive)
|
|
(let ((text (gui-get-selection 'CLIPBOARD)))
|
|
(unless text
|
|
(user-error "OS clipboard is empty"))
|
|
(when (use-region-p)
|
|
(delete-region (region-beginning) (region-end)))
|
|
(insert-for-yank text)))
|
|
(map! :v "C-c" #'my/clipboard-copy
|
|
:v "C-v" #'my/clipboard-paste
|
|
:i "C-v" #'my/clipboard-paste) ; insert-state paste, terminal-style
|
|
|
|
|
|
;;; in buffer completions
|
|
(setq tab-always-indent 'complete)
|
|
(after! corfu
|
|
; possible: basic, initials, orderless, partial-completion substring, flex
|
|
(setq completion-styles '(orderless flex partial-completion substring))
|
|
(setq corfu-cycle t
|
|
corfu-preview-current nil
|
|
corfu-min-width 20
|
|
corfu-on-exact-match 'insert
|
|
corfu-quit-no-match t
|
|
corfu-quit-at-boundary t
|
|
corfu-popupinfo-delay '(1.25 . 0.5))
|
|
(corfu-popupinfo-mode 1)
|
|
;; history-based sorting, persisted across restarts
|
|
(corfu-history-mode 1)
|
|
(after! savehist
|
|
(add-to-list 'savehist-additional-variables 'corfu-history)))
|
|
|
|
|
|
|
|
;;; C-i to pick first completion thing
|
|
(after! corfu
|
|
(defun my/corfu-insert-first ()
|
|
"Insert the first candidate immediately."
|
|
(interactive)
|
|
(corfu-next)
|
|
(corfu-insert)
|
|
)
|
|
(map! :map corfu-map
|
|
"<insert-state> C-i" #'my/corfu-insert-first
|
|
)
|
|
)
|
|
|
|
|
|
;;; better eval mappings
|
|
(map! :leader "m e" #'eval-last-sexp)
|
|
(map! :leader "m r" #'eval-print-last-sexp)
|
|
|
|
|
|
;;; scratch
|
|
(defun my/scratch ()
|
|
(lookup-key corfu-map (kbd "C-u"))
|
|
(lookup-key corfu-map (kbd "C-i"))
|
|
(define-key corfu-map (kbd "C-i") 'my/corfu-insert-first)
|
|
(substitute-command-keys "\\{corfu-map}")
|
|
|
|
)
|
|
|
|
;(setq completion-styles '(base initials orderless flex partial-completion substring))
|