summaryrefslogtreecommitdiff
path: root/.emacs.d/init.el
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r--.emacs.d/init.el182
1 files changed, 104 insertions, 78 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index a7831c3..a28c2b4 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -1,34 +1,8 @@
;; -*- lexical-binding: t; -*-
-(custom-set-variables
- ;; custom-set-variables was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- '(c-backspace-function (quote backward-delete-char))
- '(c-default-style
- (quote
- ((java-mode . "java")
- (awk-mode . "awk")
- (other . "bsd"))))
- '(org-support-shift-select t)
- '(package-selected-packages
- (quote
- (perspective wanderlust magit helm-exwm helm-ext undo-tree which-key paredit helm exwm)))
- '(sentence-end-double-space nil)
- '(undo-tree-enable-undo-in-region t)
- '(wdired-allow-to-change-permissions t))
-(custom-set-faces
- ;; custom-set-faces was added by Custom.
- ;; If you edit it by hand, you could mess it up, so be careful.
- ;; Your init file should contain only one such instance.
- ;; If there is more than one, they won't work right.
- )
-
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
-(package-install-selected-packages)
;; Helpers
@@ -60,7 +34,7 @@
(add-hook (intern (concat (symbol-name mode) "-mode-hook")) fun)))
(defun align-setq ()
- "Align the setq expression at point. Note that this removes all comments."
+ "Align `setq' expression at point. Note that this removes all comments."
(interactive)
(let ((sexp (list-at-point)))
(unless (string-prefix-p "set" (prin1-to-string (car sexp)))
@@ -101,11 +75,21 @@
(delete-window)) ; TODO: Function for opening X program with
; associated command output buffer.
+(defun customize-setq ()
+ "Customize variable according to `setq' expression at point."
+ (interactive)
+ (let ((sexp (list-at-point)))
+ (unless (symbol-value))))
+
(defun kill-buffer-now ()
"Kill the current buffer immediately."
(interactive)
(kill-buffer))
+(defun launch-program (command)
+ (interactive (list (read-shell-command "Launch program: ")))
+ (start-process-shell-command command nil command))
+
(defun sort-config-paragraphs ()
(interactive)
(save-excursion
@@ -134,12 +118,13 @@
(set-keys "C-M-&" async-shell-command-here
"C-§" delete-other-windows
- "C-<" helm-global-mark-ring
"C-x C-b" ibuffer
+ "C-x K" kill-buffer-now
"C-c s c" sort-config-paragraphs
"C-c s f" sort-fields
"C-c s l" sort-lines
- "C-c s p" sort-paragraphs)
+ "C-c s p" sort-paragraphs
+ "C-z" nil)
;;; EXWM
(require 'exwm)
@@ -156,19 +141,26 @@
([?\M-v] . [prior])
([?\C-v] . [next])
([?\C-d] . [delete])
- ([?\C-k] . [S-end delete])))
+ ([?\C-k] . [S-end delete])
+ ([?\M-w] . [C-insert])
+ ([?\C-y] . [S-insert])
+ ([?\M-f] . [C-right])
+ ([?\M-b] . [C-left])))
+(setq exwm-input-global-keys '(("" . exwm-input-send-next-key)))
+(setq exwm-manage-force-tiling t)
(exwm-enable)
;;; Helm
(require 'helm)
(require 'helm-ext)
-(set-keys "M-x" helm-M-x
- "M-s o" helm-occur
- "C-x b" helm-multi-files
- "C-x M-b" helm-exwm
- "C-x C-f" helm-find-files
- "C-x r b" helm-filtered-bookmarks
- "C-M-y" helm-show-kill-ring)
+(set-keys "M-x" helm-M-x
+ "M-s o" helm-occur
+ "C-x b" helm-multi-files
+ "C-x C-SPC" helm-global-mark-ring
+ "C-x M-b" helm-exwm
+ "C-x C-f" helm-find-files
+ "C-x r b" helm-filtered-bookmarks
+ "C-M-y" helm-show-kill-ring)
(setq helm-ff-DEL-up-one-level-maybe t
helm-allow-mouse t
;; helm-completion-style 'emacs
@@ -194,46 +186,54 @@
;; (add-to-list 'ibuffer-never-show-predicates "^magit-")
;;; Layouts
-(defun layout-jump-to-fun (reg)
+(defvar *layout-stack* (list) "Window layout stack")
+(defvar *active-layout* -1 "Active window layout")
+(defun layout-load-fun (reg)
+ (lambda ()
+ (interactive)
+ (when (not (= *active-layout* reg))
+ (set-register *active-layout* (current-window-configuration))
+ (set-window-configuration (get-register reg))
+ (when *active-layout*
+ (push *layout-stack* *active-layout*))
+ (setq *active-layout* reg)
+ (message (format-message "Loaded layout %c." reg)))))
+(defun layout-save-fun (reg)
+ (lambda ()
+ (interactive)
+ (when (not (= *active-layout* reg))
+ (setq *active-layout* reg)
+ (message (format-message "Saved layout %c." reg)))))
+(defun which-layout ()
(interactive)
- (lambda () (interactive)
- (jump-to-register reg)))
-(defun layout-save ()
- (interactive)
- (window-configuration-to-register ?§))
-(defun layout-save-to-fun (reg)
- (interactive)
- (lambda () (interactive)
- (window-configuration-to-register reg)))
-(defun layout-swap ()
- (interactive)
- (let ((reg (get-register ?§)))
- (window-configuration-to-register ?½)
- (jump-to-register ?§)
- (set-register ?§ (get-register ?½))
- (set-register ?½ nil)))
-(set-keys "C-c W" layout-save
- "C-c w" layout-swap
- "C-c 1" (layout-jump-to-fun ?1)
- "C-c M-1" (layout-save-to-fun ?1)
- "C-c 2" (layout-jump-to-fun ?2)
- "C-c M-2" (layout-save-to-fun ?2)
- "C-c 3" (layout-jump-to-fun ?3)
- "C-c M-3" (layout-save-to-fun ?3)
- "C-c 4" (layout-jump-to-fun ?4)
- "C-c M-4" (layout-save-to-fun ?4)
- "C-c 5" (layout-jump-to-fun ?5)
- "C-c M-5" (layout-save-to-fun ?5)
- "C-c 6" (layout-jump-to-fun ?6)
- "C-c M-6" (layout-save-to-fun ?6)
- "C-c 7" (layout-jump-to-fun ?7)
- "C-c M-7" (layout-save-to-fun ?7)
- "C-c 8" (layout-jump-to-fun ?8)
- "C-c M-8" (layout-save-to-fun ?8)
- "C-c 9" (layout-jump-to-fun ?9)
- "C-c M-9" (layout-save-to-fun ?9)
- "C-c 0" (layout-jump-to-fun ?0)
- "C-c M-0" (layout-save-to-fun ?0))
+ (message (format-message "Current layout: %c" *active-layout*)))
+(set-keys "C-c §" which-layout
+ "C-c 1" (layout-load-fun ?1)
+ "C-c M-1" (layout-save-fun ?1)
+ "C-c 2" (layout-load-fun ?2)
+ "C-c M-2" (layout-save-fun ?2)
+ "C-c 3" (layout-load-fun ?3)
+ "C-c M-3" (layout-save-fun ?3)
+ "C-c 4" (layout-load-fun ?4)
+ "C-c M-4" (layout-save-fun ?4)
+ "C-c 5" (layout-load-fun ?5)
+ "C-c M-5" (layout-save-fun ?5)
+ "C-c 6" (layout-load-fun ?6)
+ "C-c M-6" (layout-save-fun ?6)
+ "C-c 7" (layout-load-fun ?7)
+ "C-c M-7" (layout-save-fun ?7)
+ "C-c 8" (layout-load-fun ?8)
+ "C-c M-8" (layout-save-fun ?8)
+ "C-c 9" (layout-load-fun ?9)
+ "C-c M-9" (layout-save-fun ?9)
+ "C-c 0" (layout-load-fun ?0)
+ "C-c M-0" (layout-save-fun ?0))
+ ; In a way, the only thing
+ ; that is needed is to hook
+ ; into the "create other
+ ; window" hook and save the
+ ; previous layout and the new
+ ; layout.
;;; Lisp
(autoload #'enable-paredit-mode "paredit" nil t)
@@ -263,8 +263,8 @@
; to mouse wheel scrolling.
;;; Perspective
-(require 'perspective)
-(persp-mode)
+;; (require 'perspective)
+;; (persp-mode)
;;; Undo-tree
(require 'undo-tree)
@@ -320,3 +320,29 @@
;;; Which-key
(require 'which-key)
(which-key-mode 1)
+
+(custom-set-variables
+ ;; custom-set-variables was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ '(c-backspace-function (quote backward-delete-char))
+ '(c-default-style
+ (quote
+ ((java-mode . "java")
+ (awk-mode . "awk")
+ (other . "bsd"))))
+ '(helm-always-two-windows t)
+ '(org-support-shift-select t)
+ '(package-selected-packages
+ (quote
+ (perspective wanderlust magit helm-exwm helm-ext undo-tree which-key paredit helm exwm)))
+ '(sentence-end-double-space nil)
+ '(undo-tree-enable-undo-in-region t)
+ '(wdired-allow-to-change-permissions t))
+(custom-set-faces
+ ;; custom-set-faces was added by Custom.
+ ;; If you edit it by hand, you could mess it up, so be careful.
+ ;; Your init file should contain only one such instance.
+ ;; If there is more than one, they won't work right.
+ )