117 lines
3.5 KiB
EmacsLisp
117 lines
3.5 KiB
EmacsLisp
;;; 05-basic.el --- Setup some basics. -*- no-byte-compile: t; lexical-binding: t; -*-
|
||
|
||
;; Setup the font
|
||
(set-face-attribute 'default nil :height 140 :font "Iosevka Nerd Font" :weight 'normal)
|
||
|
||
;; I use narrowing, I am a mature emacs user! I do not need the hand-holding
|
||
;; (usually).
|
||
(put 'narrow-to-region 'disabled nil)
|
||
|
||
;; This package provides which-key, which is a minor mode for Emacs
|
||
;; that displays the key bindings following your currently entered
|
||
;; incomplete command (a prefix) in a popup.
|
||
(use-package which-key
|
||
:ensure t
|
||
:config
|
||
(which-key-mode))
|
||
|
||
;; Pixel perfect scrolling
|
||
(pixel-scroll-precision-mode)
|
||
;; Display time
|
||
(display-time-mode)
|
||
(show-paren-mode +1) ; Paren match highlighting
|
||
;; Winner mode is a global minor mode that records the changes in the
|
||
;; window configuration (i.e. how the frames are partitioned into
|
||
;; windows) so that the changes can be "undone" using the command
|
||
;; ‘winner-undo’.
|
||
(winner-mode 1)
|
||
|
||
;; Configure Emacs to ask for confirmation before exiting
|
||
(setq confirm-kill-emacs 'y-or-n-p)
|
||
|
||
;; This package provides a complete git integration
|
||
(use-package magit
|
||
:ensure t
|
||
:defer t
|
||
:commands (magit))
|
||
|
||
(use-package reverse-im
|
||
:ensure t
|
||
:defer nil)
|
||
|
||
(setq reverse-im-char-fold t) ; use lax matching
|
||
(setq reverse-im-read-char-advice-function #'reverse-im-read-char-include)
|
||
(setq reverse-im-input-methods '("russian-computer")) ; translate these methods
|
||
|
||
(reverse-im-mode t)
|
||
|
||
(electric-indent-mode)
|
||
(electric-pair-mode)
|
||
|
||
(use-package modus-themes
|
||
:ensure t
|
||
:defer nil
|
||
:config
|
||
(load-theme 'modus-operandi-tinted t))
|
||
|
||
(use-package hbdh
|
||
:straight (hbdh :type git :host github :repo "zzhjerry/hbdh-mode")
|
||
:config (hbdh-mode))
|
||
|
||
(defun my/hbdh-highlight-line ()
|
||
"Activate hbdh, dim text outside of current line"
|
||
(interactive)
|
||
(let ((point-beginning (line-beginning-position))
|
||
(point-end (line-end-position)))
|
||
;; note that those are internal functions
|
||
;; probably should use hbdh activation commands instead of this
|
||
(hbdh--activate-overlay point-beginning point-end)
|
||
(hbdh--rewrite-region-face)))
|
||
|
||
(setq hbdh-mode-map (make-sparse-keymap))
|
||
(define-key hbdh-mode-map "a" 'hbdh-activate-on-region)
|
||
(define-key hbdh-mode-map "d" 'hbdh-deactivate)
|
||
(define-key hbdh-mode-map "l" 'my/hbdh-highlight-line)
|
||
|
||
(global-set-key "\C-ch" hbdh-mode-map)
|
||
|
||
;; A must have for any NixOS user
|
||
(use-package direnv
|
||
:ensure t
|
||
:defer nil
|
||
:config (direnv-mode))
|
||
|
||
;; RSS reader
|
||
(use-package elfeed
|
||
:ensure t
|
||
:defer t
|
||
:commands (elfeed)
|
||
:init
|
||
(setq elfeed-feeds
|
||
'("https://sachachua.com/blog/category/emacs-news/feed"
|
||
"https://planet.emacslife.com/atom.xml"))
|
||
:bind (("C-c f" . elfeed)))
|
||
|
||
;; Setting this to true makes it so that Emacs saves existing clipboard text
|
||
;; into kill ring before replacing it.
|
||
(setq save-interprogram-paste-before-kill t)
|
||
|
||
;; Windmove family of commands allow easy navigation when there is more than two
|
||
;; buffers on screen.
|
||
(keymap-global-set "C-S-<left>" 'windmove-left)
|
||
(keymap-global-set "C-S-<right>" 'windmove-right)
|
||
(keymap-global-set "C-S-<up>" 'windmove-up)
|
||
(keymap-global-set "C-S-<down>" 'windmove-down)
|
||
|
||
;; Compile command allows to easily run noninteractive commands, among other
|
||
;; things, like, you know, compiling stuff.
|
||
(keymap-global-set "C-c l" 'compile)
|
||
(keymap-global-set "C-c C-l" 'recompile)
|
||
|
||
;; When set to true, dired will try to guess the target directory. Use this by
|
||
;; first splitting the window in two, selecting the destination in a new buffer,
|
||
;; and use 'C' to copy the file/directory.
|
||
(setq dired-dwim-target t)
|
||
|
||
;;; 05-basic.el ends here
|