Files
emacs-dotfiles/.config.d/05-basic.el
Vladislav Slobodenyuk 34b25f2352 The great config remake.
I decided to go back to the basics with this one. Only the packages I think
I *REALLY* need (or want) are left, the rest are replaced by the built-in
alternatives or even better, removed.
2026-03-13 15:51:28 +09:00

74 lines
2.7 KiB
EmacsLisp

;;; 05-basic.el --- Setup some basics. -*- no-byte-compile: t; lexical-binding: t; -*-
;; This package provides a complete git integration
(use-package magit
:ensure t
:defer t
:commands (magit))
;; A must have for any NixOS user
(use-package direnv
:ensure t
:defer nil
:config (direnv-mode))
;; 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)
;; 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)
;; As vterm requires a compiled part, on NixOS its installation is handled by
;; the system configuration. However, for some reason, after some update emacs
;; stopped loading it automatically. So, to remedy that, we load it if it was
;; not already loaded.
(unless (memq 'vterm features)
(load "vterm" t)
(unless (memq 'vterm features)
(message "Failed to load vterm. It is probably not installed.")))
;; This folder contains some custom libraries I wrote that could be loaded.
(add-to-list
'load-path
(expand-file-name
(concat minimal-emacs-user-directory "load")))
;; Add my input method to allow reverse-im to work properly with my keyboard
;; setup. It is defined in a library in the load directory, see above.
(register-input-method
"cyrillic-workman" "Russian" 'quail-use-package
"RUW@" "Russian (ЙЦУКЕН) input method simulating Workman keyboard"
"cyrillic-workman-input-method")
;; Reverse-IM creates additional bindings that allow usage of different input
;; methods without changing the keyboard layout (most of the time ,for example:
;; keybinds on russian layout will work with this package).
(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 '("cyrillic-workman")) ; translate these methods
(reverse-im-mode t)
;; Windmove family of commands allow easy navigation when there is more than two
;; buffers on screen. The bindings are the Vim movement commands with the
;; Control+Shift modifiers, adjusted for the workman layout and shifted a bit
;; down and to the left.
(keymap-global-set "C-S-k" #'windmove-left)
(keymap-global-set "C-S-l" #'windmove-down)
(keymap-global-set "C-<" #'windmove-up)
(keymap-global-set "C->" #'windmove-right)
;;; 05-basic.el ends here