;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- ;; Some functionality uses this to identify you, e.g. GPG configuration, email ;; clients, file templates and snippets. It is optional. (setq user-full-name "Jeffrey Serio" user-mail-address "hyperreal@fedoraproject.org") ;; See 'C-h v doom-font' for documentation and more examples of what they ;; accept. For example: (setq doom-font (font-spec :family "JetBrains Mono Nerd Font Mono" :size 14) doom-variable-pitch-font (font-spec :family "Rubik") doom-unicode-font (font-spec :family "JetBrains Mono Nerd Font Mono" :size 14) doom-big-font (font-spec :family "JetBrains Mono Nerd Font Mono" :size 14)) ;; Use catppuccin-mocha theme (setq doom-theme 'catppuccin-mocha) ;; 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 "~/Nextcloud/org/") ;; Set bpython as Python shell interpreter (add-hook! python-mode-hook (setq python-shell-interpreter "bpython")) ;; Make vterm open in another window (setq vterm-other-window 1) ;; Keybinding to kill-whole-line (global-set-key (kbd "M-9") 'kill-whole-line) ;; Popup rule for yasnippet (defun yas-popup-isearch-prompt (prompt choices &optional display-fn) (when (featurep 'popup) (popup-menu* (mapcar (lambda (choice) (popup-make-item (or (and display-fn (funcall display-fn choice)) choice) :value choice)) choices) :prompt prompt ;; start isearch mode immediately :isearch t ))) (setq yas-prompt-functions '(yas-popup-isearch-prompt yas-maybe-ido-prompt yas-completing-prompt yas-no-prompt)) ;; Copy all or text selection (defun xah-copy-all-or-region () "Put the whole buffer content to `kill-ring', or text selection if there's one. Respects `narrow-to-region'. URL `https://ergomacs.org/emacs/emacs_copy_cut_all_or_region.html' Version 2015-08-22" (interactive) (if (use-region-p) (progn (kill-new (buffer-substring (region-beginning) (region-end))) (message "Text selection copied.")) (progn (kill-new (buffer-string)) (message "Buffer content copied.")))) ;; Cut all or text selection (defun xah-cut-all-or-region () "Cut the whole buffer content to `kill-ring', or text selection if there's one. Respects `narrow-to-region'. URL `https://ergomacs.org/emacs/emacs_copy_cut_all_or_region.html' Version 2015-08-22" (interactive) (if (use-region-p) (progn (kill-new (buffer-substring (region-beginning) (region-end))) (delete-region (region-beginning) (region-end))) (progn (kill-new (buffer-string)) (delete-region (point-min) (point-max))))) ;; open URL in Firefox (defun browse-host-firefox (url &rest ignored) "Browse URL with the host's Firefox using distrobox-exec." (interactive "sURL: ") (shell-command (concat "firefox " url))) (setq browse-url-browser-function 'browse-host-firefox) ;; after copy Ctrl+c in Linux X11, you can paste by `yank' in emacs (setq select-enable-clipboard t) ;; after mouse selection copy in X11, you can paste by `yank' in emacs (setq select-enable-primary t) ;; set keybinding for paste (global-set-key (kbd "C-S-V") #'clipboard-yank) ;; Smart home key (defun smart-beginning-of-line () "Move point to first non-whitespace character or beginning-of-line. Move point to the first non-whitespace character on this line. If point was already at that position, move point to beginning of line." (interactive "^") (let ((oldpos (point))) (back-to-indentation) (and (= oldpos (point)) (beginning-of-line)))) (global-set-key (kbd "") 'smart-beginning-of-line) (global-set-key (kbd "") 'end-of-line) ;; Autoformat on save (setq +format-on-save-enabled-modes '(emacs-lisp-mode python-mode)) (setq-hook! 'python-mode-hook +format-with 'black) ;; org-mode, close items with timestamp (setq org-log-done 'time) ;; open Emacs in a maxmimized window (add-to-list 'default-frame-alist '(fullscreen . maximized)) ;; mastodon (setq mastodon-instance-url "https://mastodon.hyperreal.coffee" mastodon-active-user "hyperreal") ;; keybinds for evil-nerd-commenter (global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines) (global-set-key (kbd "C-c l") 'evilnc-quick-comment-or-uncomment-to-the-line) (global-set-key (kbd "C-c c") 'evilnc-copy-and-comment-lines) (global-set-key (kbd "C-c p") 'evilnc-comment-or-uncomment-paragraphs)