Move all the way up to base.el
This commit is contained in:
parent
1f1d488cda
commit
aad3f3919c
5 changed files with 13 additions and 13 deletions
150
pkg/base.el
150
pkg/base.el
|
|
@ -1,150 +0,0 @@
|
|||
;;; pkg/base.el --- summary -*- lexical-binding: t; -*-
|
||||
|
||||
;; Author: Maciej Szlosarczyk
|
||||
;; Maintainer: Maciej Szlosarczyk
|
||||
;; Version: 0.1-snapshot
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; pkg/base defines basic packages and environment.
|
||||
|
||||
;;; Code:
|
||||
|
||||
;;;;;;;; Other optimizations ;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;; Stolen from Doom Emacs. ;;;;;;;;;;;;;
|
||||
|
||||
;; Update emacs less often
|
||||
(setq idle-update-delay 1.0)
|
||||
|
||||
;; Disable bidirectional text rendering for a modest performance boost. I've set
|
||||
;; this to `nil' in the past, but the `bidi-display-reordering's docs say that
|
||||
;; is an undefined state and suggest this to be just as good:
|
||||
(setq-default bidi-display-reordering 'left-to-right
|
||||
bidi-paragraph-direction 'left-to-right)
|
||||
|
||||
;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions
|
||||
;; in non-focused windows.
|
||||
(setq-default cursor-in-non-selected-windows nil)
|
||||
(setq highlight-nonselected-windows nil)
|
||||
|
||||
;; More performant rapid scrolling over unfontified regions. May cause brief
|
||||
;; spells of inaccurate syntax highlighting right after scrolling, which should
|
||||
;; quickly self-correct.
|
||||
(setq fast-but-imprecise-scrolling t)
|
||||
|
||||
;;;;;;;;; TRAMP configuration ;;;;;;;;;;;;;;;;
|
||||
(require 'tramp)
|
||||
(setq tramp-default-method "ssh")
|
||||
|
||||
;;;;;;;;; Emacs bindings ;;;;;;;;;;;;;;;;;;;;;
|
||||
(global-set-key (kbd "RET") 'newline)
|
||||
|
||||
;;;;;;;;; Easy copying of data ;;;;;;;;;;;;;;;
|
||||
(use-package easy-kill :straight t :defer t
|
||||
:config (global-set-key [remap kill-ring-save] 'easy-kill))
|
||||
|
||||
;; Move buffers around with buffer keys
|
||||
(use-package buffer-move
|
||||
:straight t
|
||||
:defer t
|
||||
:bind ("C-c m [" . buf-move-left)
|
||||
("C-c m ]" . buf-move-right)
|
||||
("C-c m {" . buf-move-up)
|
||||
("C-c m }" . buf-move-down))
|
||||
|
||||
;; #====================== Backup config #==============================
|
||||
(setq backup-directory-alist
|
||||
`((".*" . "~/.emacs.d/backups/auto-save-list")))
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*", "~/.emacs.d/backups/auto-save-list" t)))
|
||||
|
||||
(setq backup-by-copying t)
|
||||
(setq delete-old-versions t
|
||||
kept-new-versions 6
|
||||
kept-old-versions 2
|
||||
version-control t)
|
||||
|
||||
; Do not create .#foo.file lock files
|
||||
(setq create-lockfiles nil)
|
||||
|
||||
;; Enable line numbers and show cursors position
|
||||
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
|
||||
(add-hook 'text-mode-hook 'display-line-numbers-mode)
|
||||
(add-hook 'conf-mode-hook 'display-line-numbers-mode)
|
||||
;; (global-display-line-numbers-mode t)
|
||||
(column-number-mode t)
|
||||
|
||||
;; Turn off sounds
|
||||
(setq ring-bell-function 'ignore)
|
||||
|
||||
;; Enable y/n answers to questions
|
||||
(fset 'yes-or-no-p 'y-or-n-p)
|
||||
|
||||
;; Only warn if a file is bigger than 50 MB when trying to open it
|
||||
(setq large-file-warning-threshold 50000000)
|
||||
|
||||
;; Numbers are arbitrary, but work on a large screen. Default is 160
|
||||
(setq split-width-threshold 180)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;; Tree sitter ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(use-package tree-sitter :straight t)
|
||||
(use-package tree-sitter-langs :straight t :requires (tree-sitter))
|
||||
(use-package tree-sitter-indent :straight t)
|
||||
|
||||
(global-tree-sitter-mode)
|
||||
(add-hook 'tree-sitter-after-on-hook 'tree-sitter-hl-mode)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;; Shell stuff ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
|
||||
|
||||
;; Disable warning related to PATH on startup
|
||||
(defvar exec-path-from-shell-check-startup-files nil)
|
||||
|
||||
;; Allow to execute path from shell
|
||||
(use-package exec-path-from-shell
|
||||
:if (memq window-system '(x mac ns))
|
||||
:straight t
|
||||
:config (add-to-list 'exec-path "/usr/local/bin")
|
||||
(exec-path-from-shell-initialize))
|
||||
|
||||
(use-package direnv :straight t :config (direnv-mode))
|
||||
;; (use-package shadowenv :straight t :config (shadowenv-global-mode))
|
||||
|
||||
;; Draw underline lower
|
||||
(setq x-underline-at-descent-line t)
|
||||
|
||||
;;; Get rid of bad parts of the windows
|
||||
(tool-bar-mode -1)
|
||||
(scroll-bar-mode -1)
|
||||
(setq indicate-buffer-boundaries nil
|
||||
indicate-empty-lines nil)
|
||||
|
||||
;;;;;;;;;;;;;;;;; Treemacs
|
||||
(use-package treemacs :straight t :defer t)
|
||||
(use-package treemacs-all-the-icons :defer t :requires (treemacs) :straight t
|
||||
:config
|
||||
(treemacs-load-theme "all-the-icons")
|
||||
(treemacs-project-follow-mode t))
|
||||
|
||||
;;;;;;;;;;;;;;;;; Record frequency of different commands. Review them later
|
||||
(use-package keyfreq
|
||||
:defer t
|
||||
:straight t
|
||||
:config
|
||||
(keyfreq-mode t)
|
||||
(keyfreq-autosave-mode t))
|
||||
|
||||
;;;;;;;;;;;;;;;;; Show hints about key combinations
|
||||
(use-package which-key
|
||||
:straight t
|
||||
:config (which-key-mode t))
|
||||
|
||||
;;;;;;;;;;;;;;;;; Use C-n to create a new line
|
||||
(setq next-line-add-newlines t)
|
||||
|
||||
;;;;;;;;;;;;;;;;; Speed up long line display by disabling bidirectional text
|
||||
(setq-default bidi-paragraph-direction 'left-to-right
|
||||
bidi-inhibit-bpa t)
|
||||
|
||||
(provide '+custom-pkg-base)
|
||||
;;; base.el ends here
|
||||
41
pkg/ivy.el
41
pkg/ivy.el
|
|
@ -1,41 +0,0 @@
|
|||
;;; pkg/ivy -- summary -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Counsel, Swiper and Ivy.
|
||||
;;; Code:
|
||||
|
||||
(require '+custom-pkg-keys-mode "$HOME/.emacs.d/pkg/keys-mode.el")
|
||||
|
||||
|
||||
(use-package helpful :straight t :defer t)
|
||||
(use-package counsel :straight t :defer t :requires (helpful)
|
||||
:config
|
||||
;; Use helpful for showing Elisp documentation
|
||||
(setq counsel-describe-function-function #'helpful-callable)
|
||||
(setq counsel-describe-variable-function #'helpful-variable))
|
||||
|
||||
(use-package swiper :straight t :defer t)
|
||||
|
||||
(use-package ivy
|
||||
:requires (counsel swiper helpful)
|
||||
:straight t
|
||||
:defer t
|
||||
:config (setq ivy-use-virtual-buffers t ;; Display recent files in ivy-switch-buffer
|
||||
ivy-count-format "(%d of %d) " ;; Current candidate count style
|
||||
ivy-wrap t ;; Wrap around completions
|
||||
ivy-display-style 'fancy ;; Formatting style
|
||||
))
|
||||
|
||||
(define-key +custom-keys-mode-map (kbd "C-c a") 'counsel-rg)
|
||||
(define-key +custom-keys-mode-map (kbd "C-c t") 'counsel-find-file)
|
||||
(define-key +custom-keys-mode-map (kbd "C-c C-s") 'swiper) ;; Find things by regexp
|
||||
(define-key +custom-keys-mode-map (kbd "M-x") 'counsel-M-x) ;; M-x on steroids
|
||||
|
||||
;; List all key bindings there are.
|
||||
(define-key +custom-keys-mode-map (kbd "<f1> f") 'counsel-describe-function)
|
||||
(define-key +custom-keys-mode-map (kbd "<f1> v") 'counsel-describe-variable)
|
||||
(define-key +custom-keys-mode-map (kbd "<f1> l") 'counsel-find-library)
|
||||
(define-key +custom-keys-mode-map (kbd "<f2> i") 'counsel-info-lookup-symbol)
|
||||
(define-key +custom-keys-mode-map (kbd "<f2> u") 'counsel-unicode-char)
|
||||
|
||||
(provide '+custom-pkg-ivy)
|
||||
;;; ivy.el ends here
|
||||
15
pkg/magit.el
15
pkg/magit.el
|
|
@ -1,15 +0,0 @@
|
|||
;;; pkg/magit -- summary -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
(use-package magit
|
||||
:straight t
|
||||
:defer t
|
||||
:bind ("<f5> c" . magit-checkout)
|
||||
("<f5> b" . magit-blame-addition)
|
||||
("<f5> g" . magit-status)
|
||||
(:map magit-blame-mode-map
|
||||
("<f5> b" . 'magit-blame-quit)))
|
||||
|
||||
(provide '+custom-pkg-magit)
|
||||
;;; magit.el ends here
|
||||
|
|
@ -1,103 +0,0 @@
|
|||
;;; sys-specific -- summary -*- lexical-binding: t; -*-
|
||||
;;; Commentary:
|
||||
;;; Make Emacs play nicer with specific operating systems
|
||||
;;; Code:
|
||||
|
||||
(defconst IS-MAC (eq system-type 'darwin))
|
||||
(defconst IS-BSD (eq system-type 'berkeley-unix))
|
||||
(defconst IS-GNU (eq system-type 'gnu/linux))
|
||||
|
||||
(require '+custom-pkg-keys-mode "$HOME/.emacs.d/pkg/keys-mode.el")
|
||||
|
||||
(defun +custom-function-delete-window ()
|
||||
"Kill a window."
|
||||
(interactive) (delete-window))
|
||||
|
||||
;;;;;;;;; Mac-specific config ;;;;;;;;;;;;;;;;;;;;;
|
||||
(if IS-MAC
|
||||
(progn
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-command-modifier 'hyper)
|
||||
|
||||
(defun mac-switch-meta nil
|
||||
"Switch meta between Option and Command."
|
||||
(interactive)
|
||||
(if (eq mac-option-modifier nil)
|
||||
(progn
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-command-modifier 'hyper))
|
||||
(progn
|
||||
(setq mac-option-modifier nil)
|
||||
(setq mac-command-modifier 'meta))))
|
||||
|
||||
;;;;;;;;; Mac binding (fix) ;;;;;;;;;;;;;;;;;;
|
||||
(define-key +custom-keys-mode-map (kbd "H-<right>") 'end-of-line)
|
||||
(define-key +custom-keys-mode-map (kbd "H-<left>") 'beginning-of-line)
|
||||
(define-key +custom-keys-mode-map (kbd "H-<up>") 'scroll-down) ; WTF is this reverse, I dunno
|
||||
(define-key +custom-keys-mode-map (kbd "H-<down>") 'scroll-up)
|
||||
|
||||
(define-key +custom-keys-mode-map [(hyper a)] 'mark-whole-buffer)
|
||||
(define-key +custom-keys-mode-map [(hyper v)] 'yank)
|
||||
(define-key +custom-keys-mode-map [(hyper x)] 'kill-region)
|
||||
(define-key +custom-keys-mode-map [(hyper c)] 'kill-ring-save)
|
||||
(define-key +custom-keys-mode-map [(hyper s)] 'save-buffer)
|
||||
(define-key +custom-keys-mode-map [(hyper l)] 'goto-line)
|
||||
(define-key +custom-keys-mode-map [(hyper b)] 'treemacs)
|
||||
(define-key +custom-keys-mode-map [(hyper w)] '+custom-function-delete-window)
|
||||
(define-key +custom-keys-mode-map [(hyper z)] 'undo)
|
||||
(define-key +custom-keys-mode-map [(hyper q)] 'kill-emacs)
|
||||
|
||||
;; Disable meta on right alt (useful for Polish characters)
|
||||
;; (setq mac-right-option-modifier nil)
|
||||
))
|
||||
|
||||
(defun +custom-switch-right-left-alt ()
|
||||
"Set keyboard to das keyboard."
|
||||
(interactive)
|
||||
(if (eq mac-right-option-modifier nil)
|
||||
(progn
|
||||
(setq mac-right-option-modifier 'meta)
|
||||
(setq mac-option-modifier nil))
|
||||
(progn
|
||||
(setq mac-option-modifier 'meta)
|
||||
(setq mac-right-option-modifier nil))))
|
||||
|
||||
;;;;;;;;; Mac-specific config ;;;;;;;;;;;;;;;;;;;;;
|
||||
(if IS-GNU
|
||||
(progn
|
||||
;;;; Save and undo
|
||||
(define-key +custom-keys-mode-map (kbd "s-s") 'save-buffer)
|
||||
(define-key +custom-keys-mode-map (kbd "s-z") 'undo)
|
||||
(define-key +custom-keys-mode-map (kbd "s-a") 'mark-whole-buffer)
|
||||
|
||||
;;;;;;;; Copy and paste bindings ;;;;;;;;;;;;;;;;;;
|
||||
(define-key +custom-keys-mode-map (kbd "s-x") 'kill-region)
|
||||
(define-key +custom-keys-mode-map (kbd "s-v") 'yank)
|
||||
(define-key +custom-keys-mode-map (kbd "s-c") 'kill-ring-save)
|
||||
|
||||
;;;;;;;;; Linux Ergo bindings (fix) ;;;;;;;;;;;;;;;;;;
|
||||
(define-key +custom-keys-mode-map (kbd "C-<right>") 'end-of-line)
|
||||
(define-key +custom-keys-mode-map (kbd "C-<left>") 'beginning-of-line)
|
||||
(define-key +custom-keys-mode-map (kbd "C-<up>") 'scroll-down) ; WTF is this reverse, I dunno
|
||||
(define-key +custom-keys-mode-map (kbd "C-<down>") 'scroll-up)))
|
||||
|
||||
;;;;;;;;; BSD-specific config ;;;;;;;;;;;;;;;;;;;;;
|
||||
(if IS-BSD
|
||||
(progn
|
||||
(define-key +custom-keys-mode-map (kbd "A-<right>") 'end-of-line)
|
||||
(define-key +custom-keys-mode-map (kbd "A-<left>") 'beginning-of-line)
|
||||
(define-key +custom-keys-mode-map (kbd "A-<up>") 'scroll-down) ; WTF is this reverse, I dunno
|
||||
(define-key +custom-keys-mode-map (kbd "A-<down>") 'scroll-up)
|
||||
|
||||
(define-key +custom-keys-mode-map (kbd "A-a") 'mark-whole-buffer)
|
||||
(define-key +custom-keys-mode-map (kbd "A-v") 'yank)
|
||||
(define-key +custom-keys-mode-map (kbd "A-x") 'kill-region)
|
||||
(define-key +custom-keys-mode-map (kbd "A-c") 'kill-ring-save)
|
||||
(define-key +custom-keys-mode-map (kbd "A-s") 'save-buffer)
|
||||
(define-key +custom-keys-mode-map (kbd "A-l") 'goto-line)
|
||||
(define-key +custom-keys-mode-map (kbd "A-w" '+delete-window)
|
||||
(define-key +custom-keys-mode-map (kbd "A-z") 'undo)
|
||||
(define-key +custom-keys-mode-map (kbd "A-q") 'kill-emacs))))
|
||||
|
||||
(provide '+custom-pkg-sys-specific)
|
||||
;;; sys-specific.el ends here
|
||||
Loading…
Add table
Add a link
Reference in a new issue