summaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'emacs')
-rw-r--r--emacs/init.el35
1 files changed, 29 insertions, 6 deletions
diff --git a/emacs/init.el b/emacs/init.el
index 0dee210..6aaa74e 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -19,6 +19,25 @@
;; To disable collection of benchmark data after init is done.
(add-hook 'after-init-hook 'benchmark-init/deactivate))
+
+(defvar surround-keys '("(" "{" "[" "$" "\"" "'"))
+(defun my/wrap-pair ()
+ "Ensure the region is active and then insert-pair."
+ (interactive)
+ (activate-mark)
+ (insert-pair))
+
+(eval
+ `(define-keymap
+ :full nil
+ :name "Surround"
+ :prefix 'surround-prefix
+
+ ,@(mapcan
+ (lambda (key) (list key ''my/wrap-pair))
+ surround-keys
+ )))
+
(defun my/toggle-frame-transparency ()
"Toggle transparency."
(interactive)
@@ -569,7 +588,9 @@ given keymap or in the global keymap."
(haskell-process-type 'cabal-repl)
:hook (haskell-mode . interactive-haskell-mode))
(use-package opam-switch-mode
- :config (opam-switch-set-switch "default"))
+ :config
+ (when (file-exists-p "~/.opam")
+ (opam-switch-set-switch "default")))
(use-package tuareg
:after opam-switch-mode)
(use-package ocp-indent
@@ -742,9 +763,7 @@ changes."
(defun my/mute () (interactive) (start-process "" nil "pactl" "set-sink-mute" "@DEFAULT_SINK@" "toggle"))
(defun my/voldown () (interactive) (start-process "" nil "pactl" "set-sink-volume" "@DEFAULT_SINK@" "-5%"))
(defun my/volup () (interactive) (start-process "" nil "pactl" "set-sink-volume" "@DEFAULT_SINK@" "+5%"))
-
- (exwm-randr-mode)
- (exwm-systemtray-mode)
+
(push ?\C-\\ exwm-input-prefix-keys) ;;C-\ to switch input method
(push ?\C-u exwm-input-prefix-keys) ;; send C-u to all windows too
(push ?\M-L exwm-input-prefix-keys)
@@ -753,6 +772,8 @@ changes."
;; (display-time-mode 1)
;; (display-battery-mode 1)
;; (ednc-mode 1)
+ ;; (exwm-randr-mode)
+ ;; (exwm-systemtray-mode)
)
:hook
(exwm-update-class . my/exwm-set-buffer-name)
@@ -898,8 +919,9 @@ changes."
(progn ; comfy scratch buffer
(require 'iimage)
(setq inhibit-startup-screen t)
- (setq initial-scratch-message (concat (propertize ";; " 'invisible t)
- "</home/tmu/.emacs.d/splashLaputa.png>
+ (setq initial-scratch-message
+ (concat (propertize ";; " 'invisible t)
+ "</home/tmu/.emacs.d/splashLaputa.png>
;; scratch for lisp evaluation and unsaved text
"))
@@ -942,6 +964,7 @@ changes."
(add-to-list 'emulation-mode-map-alists
'((my/keys-mode . my/keys-keymap)))
+(keymap-set my/keys-mode-map "M-S" 'surround-prefix)
(keymap-set my/keys-mode-map "C-x C-C" 'save-buffers-kill-terminal)
(keymap-set my/keys-mode-map "C-x C-c" 'my/close-or-kill)
(keymap-set my/keys-mode-map "M-w" 'copy-region-as-kill) ; make copying not flash cursor