Emacs: Refactor basics/*.
This commit is contained in:
parent
db84b0f02e
commit
0f0c3e68c8
|
@ -1,6 +1,6 @@
|
||||||
;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*-
|
;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-08T10:50:44+0100>
|
;; Time-stamp: <2020-03-10T14:32:14+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; buffers.el --- Default settings for buffers. -*- lexical-binding: t; -*-
|
;;; buffers.el --- Default settings for buffers. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-03T04:05:28+0100>
|
;; Time-stamp: <2020-03-10T14:01:00+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Setup scratch buffer.
|
;; * Setup scratch buffer.
|
||||||
|
@ -12,68 +12,49 @@
|
||||||
|
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
:ensure nil
|
:ensure nil
|
||||||
|
:custom ((initial-scratch-message nil) ; Make scratch buffer empty,
|
||||||
:custom
|
(initial-major-mode 'gfm-mode)) ; and select mode.
|
||||||
(initial-scratch-message nil) ; Make scratch buffer empty,
|
:config (progn
|
||||||
(initial-major-mode 'gfm-mode) ; and select mode.
|
|
||||||
|
|
||||||
:config
|
|
||||||
(defvar my/skippable-buffers '("^\\*" "^magit[:-]")
|
(defvar my/skippable-buffers '("^\\*" "^magit[:-]")
|
||||||
"Buffer names ignored by `next-buffer' and `previous-buffer'.")
|
"Buffer names ignored by `next-buffer' and `previous-buffer'.")
|
||||||
(defvar my/never-skippable-buffers '("^\\*scratch\\*$" "^\\*Easy-hugo\\*$")
|
(defvar my/never-skippable-buffers
|
||||||
|
'("^\\*scratch\\*$" "^\\*Easy-hugo\\*$")
|
||||||
"Buffer names never ignored by `next-buffer' and `previous-buffer'.")
|
"Buffer names never ignored by `next-buffer' and `previous-buffer'.")
|
||||||
|
|
||||||
(defun my/buffer-predicate (buffer)
|
(defun my/buffer-predicate (buffer)
|
||||||
"Returns nil if buffer-name matches expression in `my/skippable-buffers'."
|
"Return nil if buffer-name matches expression in `my/skippable-buffers'."
|
||||||
(catch 'return
|
(catch 'return
|
||||||
;; Return t if buffer-name is on never-skippable list.
|
;; Return t if buffer-name is on never-skippable list.
|
||||||
(dolist (expression my/never-skippable-buffers)
|
(dolist (expression my/never-skippable-buffers)
|
||||||
(if (string-match expression (buffer-name buffer))
|
(if (string-match expression (buffer-name buffer))
|
||||||
(throw 'return t)
|
(throw 'return t)))
|
||||||
))
|
|
||||||
;; Return nil if buffer-name is on skippable list.
|
;; Return nil if buffer-name is on skippable list.
|
||||||
(dolist (expression my/skippable-buffers)
|
(dolist (expression my/skippable-buffers)
|
||||||
(if (string-match expression (buffer-name buffer))
|
(if (string-match expression (buffer-name buffer))
|
||||||
(throw 'return nil)
|
(throw 'return nil)))
|
||||||
))
|
|
||||||
t))
|
t))
|
||||||
|
|
||||||
(set-frame-parameter nil 'buffer-predicate 'my/buffer-predicate)
|
(set-frame-parameter nil 'buffer-predicate 'my/buffer-predicate)
|
||||||
|
|
||||||
(defun my/truncate-lines ()
|
(defun my/truncate-lines ()
|
||||||
"Truncate lines instead of wrapping them."
|
"Truncate lines in local buffer instead of wrapping them."
|
||||||
(setq-local truncate-lines t))
|
(setq-local truncate-lines t)))
|
||||||
|
:bind (("M-<left>" . previous-buffer)
|
||||||
|
("M-<right>" . next-buffer))
|
||||||
|
:hook ((prog-mode . my/truncate-lines)
|
||||||
|
(conf-mode . my/truncate-lines)))
|
||||||
|
|
||||||
:bind
|
;; Show and select buffers. Minimal interface for recovery situations.
|
||||||
;; Switch buffers.
|
|
||||||
("M-<left>" . previous-buffer)
|
|
||||||
("M-<right>" . next-buffer)
|
|
||||||
|
|
||||||
:hook
|
|
||||||
(prog-mode . my/truncate-lines)
|
|
||||||
(conf-mode . my/truncate-lines)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Show and select buffers.
|
|
||||||
(use-package bs
|
(use-package bs
|
||||||
:bind
|
:bind ("C-x C-b" . bs-show))
|
||||||
("C-x C-b" . bs-show)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Delete old buffers.
|
;; Delete old buffers.
|
||||||
;; https://www.emacswiki.org/emacs/CleanBufferList
|
;; https://www.emacswiki.org/emacs/CleanBufferList
|
||||||
(use-package midnight
|
(use-package midnight
|
||||||
:defer 10
|
:defer 10
|
||||||
|
:init (setq midnight-delay 30 ; 30 seconds after “midnight”.
|
||||||
:init
|
|
||||||
(setq midnight-delay 30 ; 30 seconds after “midnight”.
|
|
||||||
midnight-period (* 2 60 60)) ; Clean every 2 hours.
|
midnight-period (* 2 60 60)) ; Clean every 2 hours.
|
||||||
|
:custom ((clean-buffer-list-delay-general 1) ; Clean normal bufs after 1d,
|
||||||
:custom
|
(clean-buffer-list-delay-special (* 30 60))) ; special after 30m.
|
||||||
(clean-buffer-list-delay-general 1) ; Clean normal bufs after 1d.
|
:config (progn
|
||||||
(clean-buffer-list-delay-special (* 30 60)) ; Clean special bufs after 30m.
|
|
||||||
|
|
||||||
:config
|
|
||||||
(setq clean-buffer-list-kill-regexps ; Add these to special buffers.
|
(setq clean-buffer-list-kill-regexps ; Add these to special buffers.
|
||||||
(nconc clean-buffer-list-kill-regexps
|
(nconc clean-buffer-list-kill-regexps
|
||||||
'("^magit-?.*:"
|
'("^magit-?.*:"
|
||||||
|
@ -82,14 +63,13 @@
|
||||||
"^\\*Backtrace\\*$"
|
"^\\*Backtrace\\*$"
|
||||||
"^Pfuture-Callback"
|
"^Pfuture-Callback"
|
||||||
)))
|
)))
|
||||||
(midnight-mode t)
|
(midnight-mode t)))
|
||||||
)
|
|
||||||
|
|
||||||
|
;; Dedicate windows to “purposes”.
|
||||||
(use-package window-purpose
|
(use-package window-purpose
|
||||||
:pin melpa ; We need > 1.7 <https://github.com/bmag/emacs-purpose/issues/158>
|
:pin melpa ; We need > 1.7 <https://github.com/bmag/emacs-purpose/issues/158>
|
||||||
:defer nil
|
:defer nil
|
||||||
|
:config (progn
|
||||||
:config
|
|
||||||
(purpose-mode)
|
(purpose-mode)
|
||||||
(add-to-list 'purpose-user-mode-purposes '(c++-mode . cpp))
|
(add-to-list 'purpose-user-mode-purposes '(c++-mode . cpp))
|
||||||
(add-to-list 'purpose-user-mode-purposes '(qml-mode . cpp))
|
(add-to-list 'purpose-user-mode-purposes '(qml-mode . cpp))
|
||||||
|
@ -101,21 +81,20 @@
|
||||||
(add-to-list 'purpose-user-mode-purposes '(Man-mode . help-buf))
|
(add-to-list 'purpose-user-mode-purposes '(Man-mode . help-buf))
|
||||||
(add-to-list 'purpose-user-mode-purposes '(help-mode . help-buf))
|
(add-to-list 'purpose-user-mode-purposes '(help-mode . help-buf))
|
||||||
(add-to-list 'purpose-user-mode-purposes '(info-mode . help-buf))
|
(add-to-list 'purpose-user-mode-purposes '(info-mode . help-buf))
|
||||||
(add-to-list 'purpose-user-mode-purposes '(compilation-mode . compile))
|
(add-to-list 'purpose-user-mode-purposes
|
||||||
|
'(compilation-mode . compile))
|
||||||
|
|
||||||
(add-to-list 'purpose-special-action-sequences
|
(add-to-list 'purpose-special-action-sequences
|
||||||
'(help-buf purpose-display-reuse-window-buffer))
|
'(help-buf purpose-display-reuse-window-buffer))
|
||||||
(purpose-compile-user-configuration)
|
(purpose-compile-user-configuration)
|
||||||
|
|
||||||
(require 'window-purpose-x)
|
(require 'window-purpose-x)
|
||||||
(purpose-x-magit-single-on) ; All Magit buffers have the same purpose.
|
;; Assign all Magit buffers the same purpose.
|
||||||
(purpose-x-kill-setup) ; Replace killed buffers with same purpose.
|
(purpose-x-magit-single-on)
|
||||||
|
(purpose-x-kill-setup)) ; Replace killed buffers with same purpose.
|
||||||
:bind
|
:bind (("<f2>" . purpose-toggle-window-purpose-dedicated)
|
||||||
("<f2>" . purpose-toggle-window-purpose-dedicated)
|
|
||||||
("C-<f2>" . purpose-toggle-window-buffer-dedicated)
|
("C-<f2>" . purpose-toggle-window-buffer-dedicated)
|
||||||
("M-<f2>" . purpose-load-window-layout)
|
("M-<f2>" . purpose-load-window-layout)))
|
||||||
)
|
|
||||||
|
|
||||||
;; Highlight which buffer is active by dimming the others.
|
;; Highlight which buffer is active by dimming the others.
|
||||||
(use-package dimmer
|
(use-package dimmer
|
||||||
|
@ -123,8 +102,7 @@
|
||||||
:config (progn
|
:config (progn
|
||||||
(dimmer-configure-which-key)
|
(dimmer-configure-which-key)
|
||||||
(dimmer-configure-magit)
|
(dimmer-configure-magit)
|
||||||
(dimmer-mode t))
|
(dimmer-mode t)))
|
||||||
)
|
|
||||||
|
|
||||||
(provide 'basics/buffers)
|
(provide 'basics/buffers)
|
||||||
;;; buffers.el ends here
|
;;; buffers.el ends here
|
||||||
|
|
|
@ -1,64 +1,54 @@
|
||||||
;;; global-variables.el --- Set some global variables. -*- lexical-binding: t; -*-
|
;;; global-variables.el --- Set some global variables. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-10T12:59:21+0100>
|
;; Time-stamp: <2020-03-10T14:31:32+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Set `slow-computer'.
|
|
||||||
;; * Set `LC_MESSAGES'.
|
|
||||||
;; * Banish customizations.
|
;; * Banish customizations.
|
||||||
;; * Fewer startup messages.
|
;; * Fewer startup messages.
|
||||||
;; * Configure backup settings.
|
;; * Configure backup settings.
|
||||||
;; * Set username and email-address.
|
;; * Set username and email-address.
|
||||||
;; * Set up authentication sources
|
;; * Set up authentication sources
|
||||||
|
;; * Set `LC_MESSAGES'.
|
||||||
|
;; * Set `slow-computer'.
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(defvar slow-computer nil)
|
|
||||||
(if (member (system-name) '("steuerbeamter" "azimuth" "localhost"))
|
|
||||||
(setq slow-computer t)) ; localhost is schnibble
|
|
||||||
|
|
||||||
;; Show manpages and error messages from compilers in English.
|
|
||||||
(setenv "LC_MESSAGES" "en_US.utf8")
|
|
||||||
|
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:diminish abbrev-mode
|
:diminish abbrev-mode
|
||||||
:diminish auto-fill-function
|
:diminish auto-fill-function
|
||||||
|
|
||||||
:init
|
|
||||||
;; Banish customizations to another file.
|
;; Banish customizations to another file.
|
||||||
(setq custom-file (concat user-emacs-directory "custom.el"))
|
:init (setq custom-file (concat user-emacs-directory "custom.el"))
|
||||||
|
:custom ((inhibit-startup-screen t)
|
||||||
:custom
|
|
||||||
(inhibit-startup-screen t)
|
|
||||||
(inhibit-startup-echo-area-message t)
|
(inhibit-startup-echo-area-message t)
|
||||||
|
|
||||||
(backup-directory-alist ; Save backups in ~/.emacs.d/backups/.
|
(backup-directory-alist ; Save backups in ~/.emacs.d/backups/.
|
||||||
`(("." . ,(concat user-emacs-directory "backups"))))
|
`(("." . ,(concat user-emacs-directory "backups"))))
|
||||||
(delete-old-versions t) ; Delete old backups.
|
(delete-old-versions t) ; Delete old backups.
|
||||||
(kept-new-versions 6) ; Keep 6 newest backups.
|
(kept-new-versions 6) ; Keep 6 newest backups.
|
||||||
(backup-by-copying t) ; Copy to backup folder.
|
(backup-by-copying t) ; Copy to backup folder.
|
||||||
(version-control t) ; Append version numbers to file names.
|
(version-control t) ; Append version numbers to file names.
|
||||||
(auto-save-file-name-transforms ; Save auto-saves in ~/.emacs.d/backups/.
|
(auto-save-file-name-transforms ; Save auto-saves in backup dir.
|
||||||
`((".*" ,(concat user-emacs-directory "backups/") t)))
|
`((".*" ,(concat user-emacs-directory "backups/") t)))
|
||||||
(create-lockfiles nil) ; Don't create lockfiles (.#<file>).
|
(create-lockfiles nil) ; Don't create lockfiles (.#<file>).
|
||||||
|
|
||||||
(user-full-name "tastytea")
|
(user-full-name "tastytea")
|
||||||
(user-mail-address "tastytea@tastytea.de")
|
(user-mail-address "tastytea@tastytea.de")
|
||||||
|
(recentf-max-saved-items 200) ; Number of buffers to keep in history.
|
||||||
|
(auth-sources ; Preference of authentication sources.
|
||||||
|
'("~/.authinfo.gpg" "~/.authinfo" "~/.netrc"))
|
||||||
|
(auth-source-gpg-encrypt-to ; Encrypt to these users.
|
||||||
|
(cons (symbol-value 'user-mail-address) '())))
|
||||||
|
|
||||||
(recentf-max-saved-items 200) ; Keep this number of buffers in history.
|
:config (progn
|
||||||
|
;; read more data per chunk. LSP responses are large.
|
||||||
;; Preference of authentication sources.
|
|
||||||
(auth-sources '("~/.authinfo.gpg" "~/.authinfo" "~/.netrc"))
|
|
||||||
;; Encrypt to these users.
|
|
||||||
(auth-source-gpg-encrypt-to (cons (symbol-value 'user-mail-address) '()))
|
|
||||||
|
|
||||||
:config
|
|
||||||
;; Amount of data which is read from a process. LSP responses are large.
|
|
||||||
(setq read-process-output-max (* 1024 1024))
|
(setq read-process-output-max (* 1024 1024))
|
||||||
(defalias 'yes-or-no-p 'y-or-n-p) ; Just type y/n instead of yes/no.
|
(defalias 'yes-or-no-p 'y-or-n-p) ; Just type y/n instead of yes/no.
|
||||||
(savehist-mode t) ; Save minibuffer history.
|
(savehist-mode t) ; Save minibuffer history.
|
||||||
(global-auto-revert-mode t)) ; Auto-revert file if changed on disk.
|
(global-auto-revert-mode t) ; Auto-revert file if changed on disk.
|
||||||
|
;; Show manpages and error messages from compilers in English.
|
||||||
|
(setenv "LC_MESSAGES" "en_US.utf8")
|
||||||
|
(defvar slow-computer nil) ; Slow computers load fewer packages.
|
||||||
|
(if (member (system-name) '("steuerbeamter" "azimuth" "localhost"))
|
||||||
|
(setq slow-computer t)))) ; localhost is schnibble.
|
||||||
|
|
||||||
(provide 'basics/global-variables)
|
(provide 'basics/global-variables)
|
||||||
;;; global-variables.el ends here
|
;;; global-variables.el ends here
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; input.el --- Configure behaviour of input devices. -*- lexical-binding: t; -*-
|
;;; input.el --- Configure behaviour of input devices. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-02-11T17:46:36+0100>
|
;; Time-stamp: <2020-03-10T13:42:34+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Setup mouse & keyboard behaviour.
|
;; * Setup mouse & keyboard behaviour.
|
||||||
|
@ -10,39 +10,35 @@
|
||||||
|
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
:ensure nil
|
:ensure nil
|
||||||
|
:custom ((mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; Scroll 1 line.
|
||||||
:custom
|
|
||||||
(mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; Scroll 1 line at a time.
|
|
||||||
;; Paste text where the cursor is, not where the mouse is.
|
;; Paste text where the cursor is, not where the mouse is.
|
||||||
(mouse-yank-at-point t)
|
(mouse-yank-at-point t)
|
||||||
;; Reduce scroll lag significantly. <https://emacs.stackexchange.com/a/28746>
|
;; Reduce scroll lag. <https://emacs.stackexchange.com/a/28746>
|
||||||
(auto-window-vscroll nil)
|
(auto-window-vscroll nil))
|
||||||
|
:config (progn
|
||||||
:config
|
|
||||||
(delete-selection-mode t) ; Delete selection when you start to write.
|
(delete-selection-mode t) ; Delete selection when you start to write.
|
||||||
|
;; kill-region (cut) and kill-ring-save (copy) act on the current
|
||||||
;; kill-region (cut) and kill-ring-save (copy) act on the current line if no
|
;; line if no text is visually selected.
|
||||||
;; text is visually selected.
|
|
||||||
;; <https://www.emacswiki.org/emacs/WholeLineOrRegion>
|
;; <https://www.emacswiki.org/emacs/WholeLineOrRegion>
|
||||||
(put 'kill-ring-save 'interactive-form
|
(put 'kill-ring-save 'interactive-form
|
||||||
'(interactive
|
'(interactive
|
||||||
(if (use-region-p)
|
(if (use-region-p)
|
||||||
(list (region-beginning) (region-end))
|
(list (region-beginning) (region-end))
|
||||||
(list (line-beginning-position) (line-beginning-position 2)))))
|
(list (line-beginning-position)
|
||||||
|
(line-beginning-position 2)))))
|
||||||
(put 'kill-region 'interactive-form
|
(put 'kill-region 'interactive-form
|
||||||
'(interactive
|
'(interactive
|
||||||
(if (use-region-p)
|
(if (use-region-p)
|
||||||
(list (region-beginning) (region-end))
|
(list (region-beginning) (region-end))
|
||||||
(list (line-beginning-position) (line-beginning-position 2)))))
|
(list (line-beginning-position)
|
||||||
)
|
(line-beginning-position 2)))))))
|
||||||
|
|
||||||
(use-package bind-key
|
(use-package bind-key
|
||||||
:functions (my/delete-word my/backward-delete-word)
|
:functions (my/delete-word my/backward-delete-word)
|
||||||
|
:config (progn
|
||||||
:config
|
|
||||||
(defun my/delete-word (arg)
|
(defun my/delete-word (arg)
|
||||||
"Delete characters forward until encountering the end of a word.
|
"Delete characters forward until encountering the end of a word.
|
||||||
With argument, do this that many times."
|
With ARG, do it that many times."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (use-region-p)
|
(if (use-region-p)
|
||||||
(delete-region (region-beginning) (region-end))
|
(delete-region (region-beginning) (region-end))
|
||||||
|
@ -50,10 +46,9 @@ With argument, do this that many times."
|
||||||
|
|
||||||
(defun my/backward-delete-word (arg)
|
(defun my/backward-delete-word (arg)
|
||||||
"Delete characters backward until encountering the end of a word.
|
"Delete characters backward until encountering the end of a word.
|
||||||
With argument, do this that many times."
|
With ARG, do it that many times."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(my/delete-word (- arg)))
|
(my/delete-word (- arg)))
|
||||||
|
|
||||||
(bind-keys
|
(bind-keys
|
||||||
;; Reduce whitespace around cursor to 0 or 1, according to context.
|
;; Reduce whitespace around cursor to 0 or 1, according to context.
|
||||||
("C-S-<delete>" . fixup-whitespace)
|
("C-S-<delete>" . fixup-whitespace)
|
||||||
|
@ -64,48 +59,33 @@ With argument, do this that many times."
|
||||||
("C-<delete>" . my/delete-word)
|
("C-<delete>" . my/delete-word)
|
||||||
("C-<backspace>" . my/backward-delete-word)
|
("C-<backspace>" . my/backward-delete-word)
|
||||||
("C-q" . delete-frame)
|
("C-q" . delete-frame)
|
||||||
;; Insert next character with control characters. Like C-S-v in the shell.
|
;; Insert next character with control characters.
|
||||||
("C-S-v" . quoted-insert)
|
("C-S-v" . quoted-insert)
|
||||||
;; C-x C-f will be replaced with projectile-find-file.
|
;; C-x C-f will be replaced with projectile-find-file.
|
||||||
("C-x C-S-f" . find-file)
|
("C-x C-S-f" . find-file))))
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
; Multiple cursors.
|
; Multiple cursors.
|
||||||
(use-package multiple-cursors
|
(use-package multiple-cursors
|
||||||
:init
|
:init (global-unset-key (kbd "M-<down-mouse-1>"))
|
||||||
(global-unset-key (kbd "M-<down-mouse-1>"))
|
:bind (("C-x M-m" . mc/edit-lines)
|
||||||
|
("M-<mouse-1>" . mc/add-cursor-on-click)))
|
||||||
:bind
|
|
||||||
("C-x M-m" . mc/edit-lines)
|
|
||||||
("M-<mouse-1>" . mc/add-cursor-on-click)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Edit multiple regions in the same way simultaneously.
|
;; Edit multiple regions in the same way simultaneously.
|
||||||
(use-package iedit
|
(use-package iedit
|
||||||
:bind
|
:bind ("C-;" . iedit-mode))
|
||||||
("C-;" . iedit-mode)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Display available keybindings.
|
;; Display available keybindings.
|
||||||
(use-package which-key
|
(use-package which-key
|
||||||
:diminish which-key-mode
|
:diminish which-key-mode
|
||||||
|
:config (which-key-mode))
|
||||||
:config
|
|
||||||
(which-key-mode)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Navigate between windows with alt+arrows.
|
;; Navigate between windows with alt+arrows.
|
||||||
(use-package windmove
|
(use-package windmove
|
||||||
:config
|
:config (windmove-default-keybindings '(meta shift))
|
||||||
(windmove-default-keybindings '(meta shift))
|
:bind (([(meta shift left)] . windmove-left) ; Needed for Emacs-over-SSH. 🤷
|
||||||
|
|
||||||
:bind ; Needed for Emacs-over-SSH. 🤷
|
|
||||||
([(meta shift left)] . windmove-left)
|
|
||||||
([(meta shift right)] . windmove-right)
|
([(meta shift right)] . windmove-right)
|
||||||
([(meta shift up)] . windmove-up)
|
([(meta shift up)] . windmove-up)
|
||||||
([(meta shift down)] . windmove-down)
|
([(meta shift down)] . windmove-down)))
|
||||||
)
|
|
||||||
|
|
||||||
(provide 'basics/input)
|
(provide 'basics/input)
|
||||||
;;; input.el ends here
|
;;; input.el ends here
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
;;; misc.el --- Basic things that do not fit any other category. -*- lexical-binding: t; -*-
|
|
||||||
|
|
||||||
;; Time-stamp: <2020-02-11T17:33:45+0100>
|
|
||||||
|
|
||||||
;;; Commentary:
|
|
||||||
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
;; Hide minor-mode from modeline.
|
|
||||||
(use-package diminish)
|
|
||||||
|
|
||||||
(provide 'basics/misc)
|
|
||||||
;;; misc.el ends here
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; package-management.el --- Initialize package management. -*- lexical-binding: t; -*-
|
;;; package-management.el --- Initialize package management. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-03T03:45:02+0100>
|
;; Time-stamp: <2020-03-10T13:33:32+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Set up package sources and their priorities.
|
;; * Set up package sources and their priorities.
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
;; Always install packages if they are not present.
|
;; Always install packages if they are not present.
|
||||||
(use-package use-package
|
(use-package use-package
|
||||||
:custom (use-package-always-ensure t)
|
:custom (use-package-always-ensure t)
|
||||||
)
|
:config (use-package diminish)) ; Hide minor-mode from modeline.
|
||||||
|
|
||||||
;; Autocompile files on load.
|
;; Autocompile files on load.
|
||||||
(use-package auto-compile
|
(use-package auto-compile
|
||||||
|
@ -59,16 +59,14 @@
|
||||||
|
|
||||||
;; Only update keyring if atime (mtime with relatime) is > 1 week ago.
|
;; Only update keyring if atime (mtime with relatime) is > 1 week ago.
|
||||||
(if (> (- (time-to-seconds) my/keyring-last-access) (* 60 60 24 7))
|
(if (> (- (time-to-seconds) my/keyring-last-access) (* 60 60 24 7))
|
||||||
(gnu-elpa-keyring-update))
|
(gnu-elpa-keyring-update)))
|
||||||
)
|
|
||||||
|
|
||||||
;; Update packages if at least 7 days have passed.
|
;; Update packages if at least 7 days have passed.
|
||||||
(use-package auto-package-update
|
(use-package auto-package-update
|
||||||
:custom ((auto-package-update-delete-old-versions t)
|
:custom ((auto-package-update-delete-old-versions t)
|
||||||
(auto-package-update-interval 7)
|
(auto-package-update-interval 7)
|
||||||
(auto-package-update-hide-results nil))
|
(auto-package-update-hide-results nil))
|
||||||
:config (auto-package-update-maybe)
|
:config (auto-package-update-maybe))
|
||||||
)
|
|
||||||
|
|
||||||
;; Install Emacs packages directly from source.
|
;; Install Emacs packages directly from source.
|
||||||
(use-package quelpa
|
(use-package quelpa
|
||||||
|
@ -78,14 +76,13 @@
|
||||||
(quelpa-checkout-melpa-p nil)
|
(quelpa-checkout-melpa-p nil)
|
||||||
(quelpa-upgrade-interval 7))
|
(quelpa-upgrade-interval 7))
|
||||||
|
|
||||||
:hook (after-init . quelpa-upgrade-all-maybe)
|
:hook (after-init . quelpa-upgrade-all-maybe))
|
||||||
)
|
|
||||||
|
|
||||||
;; Use :quelpa in use-package configurations.
|
;; Use :quelpa in use-package configurations.
|
||||||
(use-package quelpa-use-package
|
(use-package quelpa-use-package
|
||||||
|
:after (use-package quelpa)
|
||||||
; Override `use-package-always-ensure' for quelpa-packages.
|
; Override `use-package-always-ensure' for quelpa-packages.
|
||||||
:config (quelpa-use-package-activate-advice)
|
:config (quelpa-use-package-activate-advice))
|
||||||
)
|
|
||||||
|
|
||||||
(provide 'basics/package-management)
|
(provide 'basics/package-management)
|
||||||
;;; package-management.el ends here
|
;;; package-management.el ends here
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
|
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-10T12:20:03+0100>
|
;; Time-stamp: <2020-03-10T14:08:16+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * treemacs
|
;; * treemacs
|
||||||
|
@ -13,108 +13,72 @@
|
||||||
:pin melpa ; We need > 2.6 for lsp-treemacs.
|
:pin melpa ; We need > 2.6 for lsp-treemacs.
|
||||||
:demand t
|
:demand t
|
||||||
:after (display-line-numbers)
|
:after (display-line-numbers)
|
||||||
|
:custom ((treemacs-project-follow-cleanup t) ; Collapse projects when leaving.
|
||||||
:custom
|
(treemacs-silent-refresh t)) ; No log message on refresh.
|
||||||
(treemacs-project-follow-cleanup t) ; Collapse projects when leaving.
|
|
||||||
(treemacs-silent-refresh t) ; No log message on refresh.
|
|
||||||
|
|
||||||
;; Remove after > 2.6 is out (treemacs-magit uses the old variable).
|
;; Remove after > 2.6 is out (treemacs-magit uses the old variable).
|
||||||
:config (define-obsolete-variable-alias
|
:config (define-obsolete-variable-alias
|
||||||
'treemacs--buffer-storage 'treemacs-buffer-storage)
|
'treemacs--buffer-storage 'treemacs-buffer-storage)
|
||||||
|
:bind (("<f8>" . treemacs-select-window) ; Focus treemacs.
|
||||||
:bind
|
|
||||||
("<f8>" . treemacs-select-window) ; Focus treemacs.
|
|
||||||
("C-<f8>" . treemacs) ; Toggle treemacs.
|
("C-<f8>" . treemacs) ; Toggle treemacs.
|
||||||
("M-<f8>" . treemacs-add-and-display-current-project) ; Add current project.
|
("M-<f8>" . treemacs-add-and-display-current-project)
|
||||||
(:map treemacs-mode-map
|
(:map treemacs-mode-map
|
||||||
("<mouse-1>" . treemacs-single-click-expand-action))
|
("<mouse-1>" . treemacs-single-click-expand-action)))
|
||||||
|
:hook (treemacs-mode . my/disable-line-numbers))
|
||||||
:hook
|
|
||||||
(treemacs-mode . my/disable-line-numbers)
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package treemacs-projectile
|
(use-package treemacs-projectile
|
||||||
:after (treemacs projectile)
|
:after (treemacs projectile))
|
||||||
)
|
|
||||||
|
|
||||||
(use-package treemacs-magit
|
(use-package treemacs-magit
|
||||||
:after (treemacs magit)
|
:after (treemacs magit))
|
||||||
)
|
|
||||||
|
|
||||||
;; Completion in many Emacs commands.
|
;; Completion in many Emacs commands.
|
||||||
(use-package ivy
|
(use-package ivy
|
||||||
:demand t
|
:demand t
|
||||||
:diminish ivy-mode
|
:diminish ivy-mode
|
||||||
|
:custom ((ivy-use-virtual-buffers t)
|
||||||
:custom
|
|
||||||
(ivy-use-virtual-buffers t)
|
|
||||||
(ivy-count-format "[%d/%d] ")
|
(ivy-count-format "[%d/%d] ")
|
||||||
(ivy-wrap t)
|
(ivy-wrap t))
|
||||||
|
:config (ivy-mode 1)
|
||||||
:config
|
:bind (("C-c C-r" . ivy-resume)
|
||||||
(ivy-mode 1)
|
|
||||||
|
|
||||||
:bind
|
|
||||||
("C-c C-r" . ivy-resume)
|
|
||||||
(:map ivy-minibuffer-map
|
(:map ivy-minibuffer-map
|
||||||
("M-<up>" . ivy-previous-history-element)
|
("M-<up>" . ivy-previous-history-element)
|
||||||
("M-<down>" . ivy-next-history-element)
|
("M-<down>" . ivy-next-history-element)
|
||||||
("S-<return>" . ivy-immediate-done) ; Ignore completion.
|
("S-<return>" . ivy-immediate-done)))) ; Ignore completion.
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Extensions for ivy
|
;; Extensions for ivy
|
||||||
(use-package counsel
|
(use-package counsel
|
||||||
:after (ivy)
|
:after (ivy)
|
||||||
:demand t
|
:demand t
|
||||||
|
:bind (("C-x C-f" . counsel-find-file)
|
||||||
:bind
|
("M-x" . counsel-M-x)))
|
||||||
("C-x C-f" . counsel-find-file)
|
|
||||||
("M-x" . counsel-M-x)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; Use icons in ivy.
|
;; Use icons in ivy.
|
||||||
(use-package all-the-icons-ivy
|
(use-package all-the-icons-ivy
|
||||||
:after (all-the-icons counsel)
|
:after (all-the-icons counsel)
|
||||||
|
:config (all-the-icons-ivy-setup))
|
||||||
:config
|
|
||||||
(all-the-icons-ivy-setup)
|
|
||||||
)
|
|
||||||
|
|
||||||
;; More information in ivy mini-buffers.
|
;; More information in ivy mini-buffers.
|
||||||
(use-package ivy-rich
|
(use-package ivy-rich
|
||||||
;; all-the-icons-ivy would override the ivy-rich switch-buffer improvements.
|
;; all-the-icons-ivy would override the ivy-rich switch-buffer improvements.
|
||||||
:after (all-the-icons-ivy counsel)
|
:after (all-the-icons-ivy counsel)
|
||||||
:config (ivy-rich-mode 1)
|
:config (ivy-rich-mode 1))
|
||||||
)
|
|
||||||
|
|
||||||
;; Use icons in ivy-rich.
|
;; Use icons in ivy-rich.
|
||||||
(use-package all-the-icons-ivy-rich
|
(use-package all-the-icons-ivy-rich
|
||||||
:after (all-the-icons ivy-rich)
|
:after (all-the-icons ivy-rich)
|
||||||
:config (all-the-icons-ivy-rich-mode 1)
|
:config (all-the-icons-ivy-rich-mode 1))
|
||||||
)
|
|
||||||
|
|
||||||
(use-package ivy-purpose
|
(use-package ivy-purpose
|
||||||
:after (window-purpose)
|
:after (window-purpose)
|
||||||
|
:config (ivy-purpose-setup)
|
||||||
:config
|
:bind (:map purpose-mode-map
|
||||||
(ivy-purpose-setup)
|
("C-x b" . ivy-switch-buffer)))
|
||||||
|
|
||||||
:bind
|
|
||||||
(:map purpose-mode-map
|
|
||||||
("C-x b" . ivy-switch-buffer)
|
|
||||||
;; ("C-x b" . ivy-purpose-switch-buffer-without-purpose)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package counsel-projectile
|
(use-package counsel-projectile
|
||||||
:after (projectile)
|
:after (projectile)
|
||||||
|
:custom ((counsel-projectile-mode t)
|
||||||
:custom
|
(projectile-switch-project-action 'my/switch-project))
|
||||||
(counsel-projectile-mode t) ; Turn on projectile-mode and enable keybindings.
|
:config (progn
|
||||||
(projectile-switch-project-action 'my/switch-project)
|
|
||||||
|
|
||||||
:config
|
|
||||||
(defun my/counsel-projectile-switch-project-action (project)
|
(defun my/counsel-projectile-switch-project-action (project)
|
||||||
"Call `my/switch-project'."
|
"Call `my/switch-project'."
|
||||||
(let ((projectile-switch-project-action 'my/switch-project))
|
(let ((projectile-switch-project-action 'my/switch-project))
|
||||||
|
@ -123,16 +87,7 @@
|
||||||
(counsel-projectile-modify-action
|
(counsel-projectile-modify-action
|
||||||
'counsel-projectile-switch-project-action
|
'counsel-projectile-switch-project-action
|
||||||
'((add ("Y" my/counsel-projectile-switch-project-action
|
'((add ("Y" my/counsel-projectile-switch-project-action
|
||||||
"open project in treemacs") 1)))
|
"open project in treemacs") 1)))))
|
||||||
)
|
|
||||||
|
|
||||||
;; Switch between named persistent window configurations.
|
|
||||||
(when (>= emacs-major-version 27)
|
|
||||||
(use-package tab-bar
|
|
||||||
:bind
|
|
||||||
("C-<prior>" . tab-bar-switch-to-prev-tab)
|
|
||||||
("C-<next>" . tab-bar-switch-to-next-tab)
|
|
||||||
))
|
|
||||||
|
|
||||||
;; Shows tabs of all visible buffers per window.
|
;; Shows tabs of all visible buffers per window.
|
||||||
(when (>= emacs-major-version 27)
|
(when (>= emacs-major-version 27)
|
||||||
|
@ -145,8 +100,7 @@
|
||||||
:background "grey10"
|
:background "grey10"
|
||||||
:foreground "grey70"))))
|
:foreground "grey70"))))
|
||||||
(tab-line-highlight ((t (:inherit tab-line-tab-current
|
(tab-line-highlight ((t (:inherit tab-line-tab-current
|
||||||
:foreground "white"))))
|
:foreground "white"))))))
|
||||||
))
|
|
||||||
|
|
||||||
(provide 'basics/ui)
|
(provide 'basics/ui)
|
||||||
;;; ui.el ends here
|
;;; ui.el ends here
|
||||||
|
|
14
init.el
14
init.el
|
@ -1,6 +1,6 @@
|
||||||
;;; init.el --- tastytea's Emacs init file. -*- lexical-binding: t; -*-
|
;;; init.el --- tastytea's Emacs init file. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-02-27T05:16:37+0100>
|
;; Time-stamp: <2020-03-10T14:31:51+0100>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; Requires at least Emacs 26. Most of it will probably work with Emacs 24 and
|
;; Requires at least Emacs 26. Most of it will probably work with Emacs 24 and
|
||||||
|
@ -8,20 +8,14 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
;; Set garbage collection threshold to 20 MiB to speed up init.
|
||||||
|
(setq gc-cons-threshold (* 20 1024 1024))
|
||||||
|
|
||||||
;; Add path to init files.
|
;; Add path to init files.
|
||||||
(push (concat user-emacs-directory "init.d") load-path)
|
(push (concat user-emacs-directory "init.d") load-path)
|
||||||
|
|
||||||
(require 'basics/package-management)
|
(require 'basics/package-management)
|
||||||
|
|
||||||
(require 'basics/global-variables)
|
(require 'basics/global-variables)
|
||||||
|
|
||||||
;; Set garbage collection threshold to 100 MiB (or 20 MiB) to speed up init.
|
|
||||||
;; It is reset at the end of the file.
|
|
||||||
(if slow-computer
|
|
||||||
(setq gc-cons-threshold (* 20 1024 1024))
|
|
||||||
(setq gc-cons-threshold (* 100 1024 1024)))
|
|
||||||
|
|
||||||
(require 'basics/misc)
|
|
||||||
(require 'basics/input)
|
(require 'basics/input)
|
||||||
(require 'basics/buffers)
|
(require 'basics/buffers)
|
||||||
(require 'basics/appearance)
|
(require 'basics/appearance)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user