Emacs: Move lambda to 'spawn-terminal' and add evil binding

master
Pierre Neidhardt 2017-05-23 19:06:06 +02:00
parent b2b41bc497
commit d8904ce70b
3 changed files with 21 additions and 7 deletions

View File

@ -401,6 +401,15 @@ Do not fold case with \\[universal-argument] or non-nil ARG."
(delete-duplicate-lines (region-beginning) (region-end))
(sort-lines nil (region-beginning) (region-end)))))
(defun spawn-terminal ()
"Spawn terminal asynchronously.
The SHELL_CD environement variable is set to `default-directory'.
The shell can use it to automatically change directory to it."
(interactive)
(let ((term (or (getenv "TERMCMD") "xterm")))
(when (executable-find term)
(start-process "dummy" nil "env" (concat "SHELL_CD=" default-directory) term))))
(defun swap-windows ()
"If 2 windows are up, swap them."
(interactive)

View File

@ -190,13 +190,8 @@
;; (if (>= emacs-major-version 24)
;; (electric-pair-mode 1))
;; Run terminal asynchronously in current `default-directory'.
;; This requires SHELL_CD to be used in the shell config.
(define-key mickey-minor-mode-map (kbd "C-x M-RET")
(lambda () (interactive)
(let ((term (getenv "TERMCMD")))
(when (executable-find term)
(start-process "dummy" nil "env" (concat "SHELL_CD=" default-directory) term)))))
;; Spawn terminal shortcut: WM's binding is s+RET.
(define-key mickey-minor-mode-map (kbd "C-x M-RET") 'spawn-terminal)
;; Calendar ISO display.
(setq calendar-week-start-day 1)
@ -302,6 +297,15 @@
;; Just like git commits.
(with-editor-mode))))
;; Fish commandline editing.
(add-hook
'find-file-hook
(lambda ()
(when (and (string-match "/tmp/tmp\..*\.fish" (buffer-file-name))
(require 'with-editor nil t))
;; Just like git commits.
(with-editor-mode))))
;; Arch Linux PKGBUILD.
(add-to-list 'auto-mode-alist '("PKGBUILD" . sh-mode))

View File

@ -25,6 +25,7 @@
;; TODO: dired/info can not super <SPC> as leader. Use ',' as leader key?
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"RET" 'spawn-terminal
"\\" 'toggle-window-split
"b" 'buffer-menu
"e" 'find-file