2015-09-08 01:16:15 +00:00
|
|
|
;;; keybindings.el --- Spacemacs Core Layer key-bindings File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; instantly display current keystrokes in mini buffer
|
2014-08-05 13:49:09 +00:00
|
|
|
(setq echo-keystrokes 0.02)
|
2014-09-21 03:08:58 +00:00
|
|
|
;; auto-indent on RET
|
|
|
|
(define-key global-map (kbd "RET") 'newline-and-indent)
|
2015-05-28 04:05:29 +00:00
|
|
|
|
|
|
|
;; improve delete-other-windows
|
2015-08-23 01:47:30 +00:00
|
|
|
(define-key global-map (kbd "C-x 1") 'spacemacs/toggle-maximize-buffer)
|
2015-05-28 04:05:29 +00:00
|
|
|
|
2015-06-12 16:21:08 +00:00
|
|
|
;; replace `dired-goto-file' with `helm-find-files', since `helm-find-files'
|
|
|
|
;; can do the same thing and with fuzzy matching and other features.
|
2015-06-15 02:35:53 +00:00
|
|
|
(eval-after-load 'dired
|
|
|
|
'(progn
|
|
|
|
(evil-define-key 'normal dired-mode-map "J" 'spacemacs/helm-find-files)
|
|
|
|
(define-key dired-mode-map "j" 'spacemacs/helm-find-files)))
|
2015-06-12 16:21:08 +00:00
|
|
|
|
2014-10-22 18:23:10 +00:00
|
|
|
;; alternate binding to search next occurrence with isearch without
|
|
|
|
;; exiting isearch
|
|
|
|
(define-key isearch-mode-map (kbd "S-<return>") 'isearch-repeat-forward)
|
|
|
|
(define-key isearch-mode-map (kbd "M-S-<return>") 'isearch-repeat-backward)
|
2015-03-31 11:51:08 +00:00
|
|
|
;; Escape from isearch-mode("/" and "?" in evil-mode) like vim
|
|
|
|
(define-key isearch-mode-map (kbd "<escape>") 'isearch-cancel)
|
2014-10-04 04:28:42 +00:00
|
|
|
|
2014-12-10 15:57:45 +00:00
|
|
|
;; Make <escape> quit as much as possible
|
|
|
|
(define-key minibuffer-local-map (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
(define-key evil-visual-state-map (kbd "<escape>") 'keyboard-quit)
|
|
|
|
(define-key minibuffer-local-ns-map (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
(define-key minibuffer-local-completion-map (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
(define-key minibuffer-local-must-match-map (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
(define-key minibuffer-local-isearch-map (kbd "<escape>") 'keyboard-escape-quit)
|
|
|
|
|
2015-03-26 05:48:16 +00:00
|
|
|
;; linum margin bindings-------------------------------------------------------
|
|
|
|
(global-set-key (kbd "<left-margin> <down-mouse-1>") 'spacemacs/md-select-linum)
|
|
|
|
(global-set-key (kbd "<left-margin> <mouse-1>") 'spacemacs/mu-select-linum)
|
|
|
|
(global-set-key (kbd "<left-margin> <double-mouse-1>") 'spacemacs/select-current-block)
|
|
|
|
(global-set-key (kbd "<left-margin> <drag-mouse-1>") 'spacemacs/mu-select-linum)
|
|
|
|
|
2014-09-01 16:18:34 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; evil-leader key bindings
|
|
|
|
;; ---------------------------------------------------------------------------
|
2013-01-17 19:17:38 +00:00
|
|
|
|
2014-10-29 02:16:30 +00:00
|
|
|
;; Universal argument ---------------------------------------------------------
|
|
|
|
(evil-leader/set-key "u" 'universal-argument)
|
2015-09-08 10:30:18 +00:00
|
|
|
(when (memq dotspacemacs-editing-style '(vim hybrid))
|
|
|
|
(define-key universal-argument-map
|
|
|
|
(kbd (concat dotspacemacs-leader-key " u"))
|
|
|
|
'universal-argument-more))
|
2014-09-04 03:46:07 +00:00
|
|
|
;; shell command -------------------------------------------------------------
|
2014-10-23 00:58:57 +00:00
|
|
|
(evil-leader/set-key "!" 'shell-command)
|
2013-01-17 19:17:38 +00:00
|
|
|
;; applications ---------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2014-07-15 03:28:39 +00:00
|
|
|
"ac" 'calc-dispatch
|
2014-04-14 01:23:54 +00:00
|
|
|
"ad" 'dired
|
|
|
|
"ap" 'proced
|
2014-09-04 03:46:07 +00:00
|
|
|
"au" 'undo-tree-visualize)
|
2013-01-17 19:17:38 +00:00
|
|
|
;; buffers --------------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-04-16 07:27:40 +00:00
|
|
|
"bd" 'kill-this-buffer
|
2014-12-25 00:57:13 +00:00
|
|
|
"TAB" 'spacemacs/alternate-buffer
|
2015-03-26 05:11:37 +00:00
|
|
|
"bh" 'spacemacs/home
|
2014-11-23 05:38:56 +00:00
|
|
|
"be" 'spacemacs/safe-erase-buffer
|
2015-08-23 01:47:30 +00:00
|
|
|
"bK" 'spacemacs/kill-other-buffers
|
2014-04-14 01:23:54 +00:00
|
|
|
"bk" 'ido-kill-buffer
|
2015-08-23 01:47:30 +00:00
|
|
|
"b C-k" 'spacemacs/kill-matching-buffers-rudely
|
|
|
|
"bP" 'spacemacs/copy-clipboard-to-whole-buffer
|
2015-04-13 19:29:46 +00:00
|
|
|
"bn" 'spacemacs/next-useful-buffer
|
|
|
|
"bp" 'spacemacs/previous-useful-buffer
|
2014-11-23 05:38:56 +00:00
|
|
|
"bR" 'spacemacs/safe-revert-buffer
|
2015-08-23 01:47:30 +00:00
|
|
|
"bY" 'spacemacs/copy-whole-buffer-to-clipboard
|
2015-04-26 05:49:06 +00:00
|
|
|
"bw" 'read-only-mode)
|
2013-11-26 05:24:50 +00:00
|
|
|
;; Cycling settings -----------------------------------------------------------
|
2014-11-30 14:51:19 +00:00
|
|
|
(evil-leader/set-key "Tn" 'spacemacs/cycle-spacemacs-theme)
|
2014-10-29 14:02:28 +00:00
|
|
|
;; describe functions ---------------------------------------------------------
|
2015-04-09 01:50:33 +00:00
|
|
|
(defmacro spacemacs||set-helm-key (keys func)
|
2015-03-22 03:51:04 +00:00
|
|
|
"Define a key bindings for FUNC using KEYS.
|
|
|
|
Ensure that helm is required before calling FUNC."
|
|
|
|
(let ((func-name (intern (format "spacemacs/%s" (symbol-name func)))))
|
|
|
|
`(progn
|
|
|
|
(defun ,func-name ()
|
2015-06-16 01:34:02 +00:00
|
|
|
,(format "Wrapper to ensure that `helm' is loaded before calling %s."
|
|
|
|
(symbol-name func))
|
2015-03-22 03:51:04 +00:00
|
|
|
(interactive)
|
|
|
|
(require 'helm)
|
|
|
|
(call-interactively ',func))
|
|
|
|
(evil-leader/set-key ,keys ',func-name))))
|
2015-04-26 16:39:06 +00:00
|
|
|
(spacemacs||set-helm-key "hdb" describe-bindings)
|
2015-04-09 01:50:33 +00:00
|
|
|
(spacemacs||set-helm-key "hdc" describe-char)
|
|
|
|
(spacemacs||set-helm-key "hdf" describe-function)
|
|
|
|
(spacemacs||set-helm-key "hdk" describe-key)
|
|
|
|
(spacemacs||set-helm-key "hdm" describe-mode)
|
|
|
|
(spacemacs||set-helm-key "hdp" describe-package)
|
2015-08-01 04:49:13 +00:00
|
|
|
(evil-leader/set-key "hds" 'spacemacs/describe-system-info)
|
2015-04-09 01:50:33 +00:00
|
|
|
(spacemacs||set-helm-key "hdt" describe-theme)
|
|
|
|
(spacemacs||set-helm-key "hdv" describe-variable)
|
2015-08-16 02:27:06 +00:00
|
|
|
(spacemacs||set-helm-key "hL" helm-locate-library)
|
2015-04-10 17:55:49 +00:00
|
|
|
;; search functions -----------------------------------------------------------
|
|
|
|
(spacemacs||set-helm-key "sww" helm-wikipedia-suggest)
|
|
|
|
(spacemacs||set-helm-key "swg" helm-google-suggest)
|
2013-02-07 16:36:01 +00:00
|
|
|
;; errors ---------------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-02-10 23:03:06 +00:00
|
|
|
"en" 'spacemacs/next-error
|
|
|
|
"ep" 'spacemacs/previous-error
|
|
|
|
"eN" 'spacemacs/previous-error)
|
2013-06-05 11:34:55 +00:00
|
|
|
;; file -----------------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-07-05 04:18:42 +00:00
|
|
|
"fc" 'spacemacs/copy-file
|
2015-08-23 01:47:30 +00:00
|
|
|
"fD" 'spacemacs/delete-current-buffer-file
|
|
|
|
"fei" 'spacemacs/find-user-init-file
|
|
|
|
"fed" 'spacemacs/find-dotfile
|
|
|
|
"feD" 'spacemacs/ediff-dotfile-and-template
|
2015-04-19 03:40:24 +00:00
|
|
|
"feR" 'dotspacemacs/sync-configuration-layers
|
2015-01-01 04:53:38 +00:00
|
|
|
"fev" 'spacemacs/display-and-copy-version
|
2015-08-28 06:13:40 +00:00
|
|
|
"fCd" 'spacemacs/unix2dos
|
|
|
|
"fCu" 'spacemacs/dos2unix
|
2015-02-23 05:14:12 +00:00
|
|
|
"fg" 'rgrep
|
2015-01-14 06:10:13 +00:00
|
|
|
"fj" 'dired-jump
|
2015-07-23 12:28:34 +00:00
|
|
|
"fl" 'find-file-literally
|
2015-01-10 15:13:09 +00:00
|
|
|
"fo" 'spacemacs/open-in-external-app
|
2015-08-23 01:47:30 +00:00
|
|
|
"fR" 'spacemacs/rename-current-buffer-file
|
2015-06-16 02:56:55 +00:00
|
|
|
"fS" 'evil-write-all
|
2015-06-16 16:02:49 +00:00
|
|
|
"fs" 'spacemacs/write-file
|
2015-08-23 01:47:30 +00:00
|
|
|
"fy" 'spacemacs/show-and-copy-buffer-filename)
|
2013-05-07 00:59:13 +00:00
|
|
|
;; insert stuff ---------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-07-05 04:18:42 +00:00
|
|
|
"iJ" 'spacemacs/insert-line-below-no-indent
|
|
|
|
"iK" 'spacemacs/insert-line-above-no-indent
|
2015-08-23 01:47:30 +00:00
|
|
|
"ik" 'spacemacs/evil-insert-line-above
|
|
|
|
"ij" 'spacemacs/evil-insert-line-below)
|
2013-07-09 19:30:59 +00:00
|
|
|
;; format ---------------------------------------------------------------------
|
2014-11-17 01:38:09 +00:00
|
|
|
;; <SPC> j k key binding for a frequent action: go and indent line below the point
|
2014-09-10 14:45:10 +00:00
|
|
|
;; <SPC> J split the current line at point and indent it
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2014-12-11 04:46:35 +00:00
|
|
|
"J" 'sp-split-sexp
|
2015-03-24 02:42:25 +00:00
|
|
|
"jj" 'sp-newline
|
2015-04-26 17:26:21 +00:00
|
|
|
"jo" 'open-line
|
2015-03-25 07:32:57 +00:00
|
|
|
"j=" 'spacemacs/indent-region-or-buffer
|
2015-03-24 02:42:25 +00:00
|
|
|
"jJ" 'spacemacs/split-and-new-line
|
2015-08-23 01:47:30 +00:00
|
|
|
"jk" 'spacemacs/evil-goto-next-line-and-indent)
|
2015-03-25 07:32:57 +00:00
|
|
|
|
2013-12-18 15:30:56 +00:00
|
|
|
;; navigation -----------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2014-12-11 04:46:35 +00:00
|
|
|
"jh" 'spacemacs/push-mark-and-goto-beginning-of-line
|
|
|
|
"jl" 'spacemacs/push-mark-and-goto-end-of-line)
|
2013-11-26 02:04:18 +00:00
|
|
|
;; Compilation ----------------------------------------------------------------
|
2014-12-05 05:02:26 +00:00
|
|
|
(evil-leader/set-key "cC" 'compile)
|
|
|
|
(evil-leader/set-key "cr" 'recompile)
|
2013-01-29 15:28:06 +00:00
|
|
|
;; narrow & widen -------------------------------------------------------------
|
2015-04-03 02:43:21 +00:00
|
|
|
(evil-leader/set-key
|
|
|
|
"nr" 'narrow-to-region
|
|
|
|
"np" 'narrow-to-page
|
|
|
|
"nf" 'narrow-to-defun
|
|
|
|
"nw" 'widen)
|
2013-01-31 15:05:57 +00:00
|
|
|
;; toggle ---------------------------------------------------------------------
|
2015-01-30 05:18:48 +00:00
|
|
|
(spacemacs|add-toggle highlight-current-line-globally
|
2015-07-25 13:14:53 +00:00
|
|
|
:status global-hl-line-mode
|
|
|
|
:on (global-hl-line-mode)
|
|
|
|
:off (global-hl-line-mode -1)
|
2015-08-27 06:58:05 +00:00
|
|
|
:documentation "Globally highlight the current line."
|
2015-07-25 13:14:53 +00:00
|
|
|
:evil-leader "thh")
|
2015-01-29 05:08:48 +00:00
|
|
|
(spacemacs|add-toggle truncate-lines
|
2015-07-25 13:14:53 +00:00
|
|
|
:status nil
|
|
|
|
:on (toggle-truncate-lines)
|
2015-08-27 06:58:05 +00:00
|
|
|
:documentation "Truncate long lines (no wrap)."
|
2015-07-25 13:14:53 +00:00
|
|
|
:evil-leader "tl")
|
2015-01-29 05:08:48 +00:00
|
|
|
(spacemacs|add-toggle visual-line-navigation
|
2015-07-25 13:14:53 +00:00
|
|
|
:status visual-line-mode
|
2015-08-13 18:40:38 +00:00
|
|
|
:on (progn
|
|
|
|
(visual-line-mode)
|
|
|
|
(define-key evil-motion-state-map "j" 'evil-next-visual-line)
|
|
|
|
(define-key evil-motion-state-map "k" 'evil-previous-visual-line)
|
|
|
|
(when (bound-and-true-p evil-escape-mode)
|
|
|
|
(evil-escape-mode -1)
|
|
|
|
(setq evil-escape-motion-state-shadowed-func nil)
|
|
|
|
(define-key evil-motion-state-map "j" 'evil-next-visual-line)
|
|
|
|
(define-key evil-motion-state-map "k" 'evil-previous-visual-line)
|
|
|
|
(evil-escape-mode)))
|
|
|
|
:off (progn
|
|
|
|
(visual-line-mode -1)
|
|
|
|
(define-key evil-motion-state-map "j" 'evil-next-line)
|
|
|
|
(define-key evil-motion-state-map "k" 'evil-previous-line)
|
|
|
|
(when (bound-and-true-p evil-escape-mode)
|
|
|
|
(evil-escape-mode -1)
|
|
|
|
(setq evil-escape-motion-state-shadowed-func nil)
|
|
|
|
(define-key evil-motion-state-map "j" 'evil-next-line)
|
|
|
|
(define-key evil-motion-state-map "k" 'evil-previous-line)
|
|
|
|
(evil-escape-mode)))
|
2015-07-25 13:14:53 +00:00
|
|
|
:documentation "Move point according to visual lines."
|
|
|
|
:evil-leader "tL")
|
2015-01-29 05:08:48 +00:00
|
|
|
(spacemacs|add-toggle line-numbers
|
2015-07-25 13:14:53 +00:00
|
|
|
:status linum-mode
|
|
|
|
:on (global-linum-mode)
|
|
|
|
:off (global-linum-mode -1)
|
|
|
|
:documentation "Show the line numbers."
|
|
|
|
:evil-leader "tn")
|
2015-03-08 04:09:37 +00:00
|
|
|
(spacemacs|add-toggle auto-fill-mode
|
2015-07-25 13:14:53 +00:00
|
|
|
:status auto-fill-function
|
|
|
|
:on (auto-fill-mode)
|
|
|
|
:off (auto-fill-mode -1)
|
|
|
|
:documentation "Break line beyond `current-fill-column` while editing."
|
|
|
|
:evil-leader "tF")
|
2015-03-08 04:52:03 +00:00
|
|
|
(spacemacs|add-toggle debug-on-error
|
2015-07-25 13:14:53 +00:00
|
|
|
:status nil
|
|
|
|
:on (toggle-debug-on-error)
|
|
|
|
:documentation "Toggle display of backtrace when an error happens."
|
|
|
|
:evil-leader "tD")
|
2015-04-10 14:30:46 +00:00
|
|
|
(spacemacs|add-toggle fringe
|
2015-07-25 13:14:53 +00:00
|
|
|
:status (not (equal fringe-mode 0))
|
|
|
|
:on (call-interactively 'fringe-mode)
|
|
|
|
:off (fringe-mode 0)
|
|
|
|
:documentation "Display the fringe in GUI mode."
|
|
|
|
:evil-leader "Tf")
|
2015-04-10 14:30:46 +00:00
|
|
|
(spacemacs|add-toggle fullscreen-frame
|
2015-07-25 13:14:53 +00:00
|
|
|
:status nil
|
|
|
|
:on (spacemacs/toggle-frame-fullscreen)
|
|
|
|
:documentation "Display the current frame in full screen."
|
|
|
|
:evil-leader "TF")
|
2015-04-10 14:30:46 +00:00
|
|
|
(spacemacs|add-toggle maximize-frame
|
2015-07-25 13:14:53 +00:00
|
|
|
:if (version< "24.3.50" emacs-version)
|
|
|
|
:status nil
|
|
|
|
:on (toggle-frame-maximized)
|
|
|
|
:documentation "Maximize the current frame."
|
|
|
|
:evil-leader "TM")
|
2015-05-16 18:40:31 +00:00
|
|
|
(spacemacs|add-toggle mode-line
|
2015-07-25 13:14:53 +00:00
|
|
|
:status hidden-mode-line-mode
|
|
|
|
:on (hidden-mode-line-mode)
|
|
|
|
:off (hidden-mode-line-mode -1)
|
|
|
|
:documentation "Toggle the visibility of modeline."
|
|
|
|
:evil-leader "tmt")
|
2015-04-10 14:30:46 +00:00
|
|
|
(spacemacs|add-toggle transparent-frame
|
2015-07-25 13:14:53 +00:00
|
|
|
:status nil
|
|
|
|
:on (spacemacs/toggle-transparency)
|
|
|
|
:documentation "Make the current frame non-opaque."
|
|
|
|
:evil-leader "TT")
|
2015-01-29 05:08:48 +00:00
|
|
|
(spacemacs|add-toggle tool-bar
|
2015-07-25 13:14:53 +00:00
|
|
|
:if window-system
|
|
|
|
:status tool-bar-mode
|
|
|
|
:on (tool-bar-mode)
|
|
|
|
:off (tool-bar-mode -1)
|
|
|
|
:documentation "Display the tool bar in GUI mode."
|
|
|
|
:evil-leader "Tt")
|
2015-01-29 05:08:48 +00:00
|
|
|
(spacemacs|add-toggle menu-bar
|
2015-07-25 13:14:53 +00:00
|
|
|
:if (or window-system (version<= "24.3.1" emacs-version))
|
|
|
|
:status menu-bar-mode
|
|
|
|
:on (menu-bar-mode)
|
|
|
|
:off (menu-bar-mode -1)
|
|
|
|
:documentation "Display the menu bar."
|
|
|
|
:evil-leader "Tm")
|
2015-04-15 22:57:31 +00:00
|
|
|
(spacemacs|add-toggle semantic-stickyfunc
|
2015-07-25 13:14:53 +00:00
|
|
|
:status semantic-stickyfunc-mode
|
|
|
|
:on (semantic-stickyfunc-mode)
|
|
|
|
:off (semantic-stickyfunc-mode -1)
|
|
|
|
:documentation "Enable semantic-stickyfunc."
|
|
|
|
:evil-leader "Ts")
|
2015-08-27 06:58:05 +00:00
|
|
|
(spacemacs|add-toggle semantic-stickyfunc-globally
|
2015-07-25 13:14:53 +00:00
|
|
|
:status global-semantic-stickyfunc-mode
|
|
|
|
:on (global-semantic-stickyfunc-mode)
|
|
|
|
:off (global-semantic-stickyfunc-mode -1)
|
|
|
|
:documentation "Enable semantic-stickyfunc globally."
|
|
|
|
:evil-leader "T C-s")
|
2014-12-12 22:59:49 +00:00
|
|
|
;; quit -----------------------------------------------------------------------
|
|
|
|
(evil-leader/set-key
|
2015-01-29 16:19:55 +00:00
|
|
|
"qs" 'spacemacs/save-buffers-kill-emacs
|
|
|
|
"qq" 'spacemacs/prompt-kill-emacs
|
|
|
|
"qQ" 'spacemacs/kill-emacs
|
|
|
|
"qz" 'spacemacs/frame-killer)
|
2013-02-06 15:43:36 +00:00
|
|
|
;; window ---------------------------------------------------------------------
|
2014-12-24 05:08:56 +00:00
|
|
|
(defun split-window-below-and-focus ()
|
|
|
|
"Split the window vertically and focus the new window."
|
|
|
|
(interactive)
|
|
|
|
(split-window-below)
|
|
|
|
(windmove-down)
|
|
|
|
(when (and (boundp 'golden-ratio-mode)
|
|
|
|
(symbol-value golden-ratio-mode))
|
|
|
|
(golden-ratio)))
|
|
|
|
|
|
|
|
(defun split-window-right-and-focus ()
|
|
|
|
"Split the window horizontally and focus the new window."
|
|
|
|
(interactive)
|
|
|
|
(split-window-right)
|
|
|
|
(windmove-right)
|
|
|
|
(when (and (boundp 'golden-ratio-mode)
|
|
|
|
(symbol-value golden-ratio-mode))
|
|
|
|
(golden-ratio)))
|
|
|
|
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-08-23 01:47:30 +00:00
|
|
|
"w2" 'spacemacs/layout-double-columns
|
|
|
|
"w3" 'spacemacs/layout-triple-columns
|
|
|
|
"wb" 'spacemacs/switch-to-minibuffer-window
|
2015-03-04 15:00:10 +00:00
|
|
|
"wc" 'delete-window
|
2015-08-23 01:47:30 +00:00
|
|
|
"wd" 'spacemacs/toggle-current-window-dedication
|
2014-04-14 01:23:54 +00:00
|
|
|
"wH" 'evil-window-move-far-left
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <S-left>" 'evil-window-move-far-left
|
2014-04-14 01:23:54 +00:00
|
|
|
"wh" 'evil-window-left
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <left>" 'evil-window-left
|
2014-04-14 01:23:54 +00:00
|
|
|
"wJ" 'evil-window-move-very-bottom
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <S-down>" 'evil-window-move-very-bottom
|
2014-04-14 01:23:54 +00:00
|
|
|
"wj" 'evil-window-down
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <down>" 'evil-window-down
|
2014-04-14 01:23:54 +00:00
|
|
|
"wK" 'evil-window-move-very-top
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <S-up>" 'evil-window-move-very-top
|
2014-04-14 01:23:54 +00:00
|
|
|
"wk" 'evil-window-up
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <up>" 'evil-window-up
|
2014-04-14 01:23:54 +00:00
|
|
|
"wL" 'evil-window-move-far-right
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <S-right>" 'evil-window-move-far-right
|
2014-04-14 01:23:54 +00:00
|
|
|
"wl" 'evil-window-right
|
2015-08-30 08:33:02 +00:00
|
|
|
"w <right>" 'evil-window-right
|
2015-08-23 01:47:30 +00:00
|
|
|
"wm" 'spacemacs/toggle-maximize-buffer
|
|
|
|
"wM" 'spacemacs/toggle-maximize-centered-buffer
|
2014-12-05 01:54:05 +00:00
|
|
|
"wo" 'other-frame
|
2015-08-23 01:47:30 +00:00
|
|
|
"wR" 'spacemacs/rotate-windows
|
2014-12-03 05:20:18 +00:00
|
|
|
"ws" 'split-window-below
|
2014-12-24 05:08:56 +00:00
|
|
|
"wS" 'split-window-below-and-focus
|
2014-12-14 14:53:37 +00:00
|
|
|
"w-" 'split-window-below
|
2014-04-14 01:23:54 +00:00
|
|
|
"wU" 'winner-redo
|
|
|
|
"wu" 'winner-undo
|
2014-12-03 05:20:18 +00:00
|
|
|
"wv" 'split-window-right
|
2014-12-24 05:08:56 +00:00
|
|
|
"wV" 'split-window-right-and-focus
|
2015-03-04 15:00:10 +00:00
|
|
|
"ww" 'other-window
|
2015-03-17 06:06:49 +00:00
|
|
|
"w/" 'split-window-right
|
|
|
|
"w=" 'balance-windows)
|
2013-02-20 19:08:23 +00:00
|
|
|
;; text -----------------------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-06-04 00:23:16 +00:00
|
|
|
"xaa" 'align
|
2015-08-23 01:47:30 +00:00
|
|
|
"xar" 'spacemacs/align-repeat
|
|
|
|
"xam" 'spacemacs/align-repeat-math-oper
|
|
|
|
"xa." 'spacemacs/align-repeat-decimal
|
|
|
|
"xa," 'spacemacs/align-repeat-comma
|
|
|
|
"xa;" 'spacemacs/align-repeat-semicolon
|
|
|
|
"xa:" 'spacemacs/align-repeat-colon
|
|
|
|
"xa=" 'spacemacs/align-repeat-equal
|
|
|
|
"xa&" 'spacemacs/align-repeat-ampersand
|
|
|
|
"xa|" 'spacemacs/align-repeat-bar
|
|
|
|
"xa(" 'spacemacs/align-repeat-left-paren
|
|
|
|
"xa)" 'spacemacs/align-repeat-right-paren
|
2014-04-14 01:23:54 +00:00
|
|
|
"xdw" 'delete-trailing-whitespace
|
2015-08-27 22:17:16 +00:00
|
|
|
"xls" 'spacemacs/sort-lines
|
|
|
|
"xlu" 'spacemacs/uniquify-lines
|
2014-04-14 01:23:54 +00:00
|
|
|
"xtc" 'transpose-chars
|
|
|
|
"xtl" 'transpose-lines
|
|
|
|
"xtw" 'transpose-words
|
|
|
|
"xU" 'upcase-region
|
|
|
|
"xu" 'downcase-region
|
2015-08-23 01:47:30 +00:00
|
|
|
"xwC" 'spacemacs/count-words-analysis
|
2014-04-14 01:23:54 +00:00
|
|
|
"xwc" 'count-words-region)
|
2013-11-25 05:18:28 +00:00
|
|
|
;; google translate -----------------------------------------------------------
|
2014-04-14 01:23:54 +00:00
|
|
|
(evil-leader/set-key
|
2015-08-23 01:47:30 +00:00
|
|
|
"xgl" 'spacemacs/set-google-translate-languages)
|
2015-03-26 06:04:35 +00:00
|
|
|
;; shell ----------------------------------------------------------------------
|
|
|
|
(eval-after-load "shell"
|
|
|
|
'(progn
|
|
|
|
(evil-define-key 'insert comint-mode-map [up] 'comint-previous-input)
|
|
|
|
(evil-define-key 'insert comint-mode-map [down] 'comint-next-input)))
|
2015-02-12 05:00:23 +00:00
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
;; Micro-states
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
2015-03-30 03:31:39 +00:00
|
|
|
;; Buffer micro state
|
2015-03-26 05:15:16 +00:00
|
|
|
|
2015-03-30 03:31:39 +00:00
|
|
|
(spacemacs|define-micro-state buffer
|
2015-05-17 02:09:52 +00:00
|
|
|
:doc "[n]ext [p]revious [K]ill [q]uit"
|
2015-03-26 05:15:16 +00:00
|
|
|
:disable-evil-leader t
|
|
|
|
:evil-leader "b."
|
|
|
|
:bindings
|
2015-04-16 07:27:40 +00:00
|
|
|
("K" kill-this-buffer)
|
2015-04-13 19:29:46 +00:00
|
|
|
("n" spacemacs/next-useful-buffer)
|
2015-05-17 02:09:52 +00:00
|
|
|
("N" spacemacs/previous-useful-buffer)
|
|
|
|
("p" spacemacs/previous-useful-buffer)
|
2015-05-18 05:38:14 +00:00
|
|
|
("q" nil :exit t))
|
2015-03-30 03:31:39 +00:00
|
|
|
|
|
|
|
;; end of Buffer micro state
|
2015-03-26 05:15:16 +00:00
|
|
|
|
2015-02-12 05:00:23 +00:00
|
|
|
;; Window Manipulation Micro State
|
|
|
|
|
|
|
|
(defun spacemacs/shrink-window-horizontally (delta)
|
|
|
|
"Wrap `spacemacs/shrink-window-horizontally'."
|
|
|
|
(interactive "p")
|
|
|
|
(shrink-window delta t))
|
|
|
|
|
|
|
|
(defun spacemacs/shrink-window (delta)
|
|
|
|
"Wrap `spacemacs/shrink-window'."
|
|
|
|
(interactive "p")
|
|
|
|
(shrink-window delta))
|
|
|
|
|
|
|
|
(defun spacemacs/enlarge-window (delta)
|
|
|
|
"Wrap `spacemacs/enlarge-window'."
|
|
|
|
(interactive "p")
|
|
|
|
(enlarge-window delta))
|
|
|
|
|
|
|
|
(defun spacemacs/enlarge-window-horizontally (delta)
|
|
|
|
"Wrap `spacemacs/enlarge-window-horizontally'."
|
|
|
|
(interactive "p")
|
|
|
|
(enlarge-window delta t))
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-full-doc ()
|
|
|
|
"Full documentation for window manipulation micro-state."
|
|
|
|
"
|
2015-02-13 02:48:56 +00:00
|
|
|
[?] display this help
|
2015-02-12 05:00:23 +00:00
|
|
|
[0,9] go to numbered window
|
2015-04-18 07:54:44 +00:00
|
|
|
[-] [/] [s] [v] [S] [V] split windows below|right and focus
|
2015-02-12 05:00:23 +00:00
|
|
|
[c] [C] close current|other windows
|
|
|
|
[g] toggle golden-ratio
|
|
|
|
[h] [j] [k] [l] go to left|bottom|top|right
|
|
|
|
[H] [J] [K] [L] move windows to far/very left|bottom|top|right
|
2015-04-21 02:41:56 +00:00
|
|
|
[[] []] [{] [}] shrink/enlarge horizontally and vertically respectively
|
2015-02-12 05:00:23 +00:00
|
|
|
[o] [w] other frame|window
|
|
|
|
[R] rotate windows
|
|
|
|
[u] [U] restore previous|next window layout")
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-move-doc ()
|
|
|
|
"Help string for moving between windows"
|
|
|
|
(concat "[h] [j] [k] [l] to move focus, "
|
|
|
|
"[H] [J] [K] [L] to move window, "
|
|
|
|
"[R]otate windows, other [f]rame, other [w]indow"))
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-resize-doc ()
|
|
|
|
"Dynamic help string when resizing windows."
|
|
|
|
(format
|
|
|
|
(concat "[%sx%s] Resize window: [[] []] shrink/enlarge horizontally, "
|
|
|
|
"[{] [}] shrink/enlarge vertically.")
|
|
|
|
(window-total-width) (window-total-height)))
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-split-doc ()
|
|
|
|
"Help string for moving between windows"
|
|
|
|
(concat "[-], [s] to split horizontally, [/], [v] to split vertically, "
|
|
|
|
"[S], [V] to split and focus"))
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-number-doc ()
|
|
|
|
"Help string for selecting window with number."
|
|
|
|
(format "(selected window #%s) press [0,9] to select the corresponding numbered window."
|
|
|
|
(window-numbering-get-number-string)))
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-layout-doc ()
|
|
|
|
"Help string for layout manipulation"
|
|
|
|
(concat "[c]lose window, [C]lose other windows, "
|
|
|
|
"[u]ndo window layout, [U] redo window layout."))
|
|
|
|
|
|
|
|
(defun spacemacs//window-manipulation-gratio-doc ()
|
|
|
|
"Help string for golden ratio"
|
|
|
|
(format "(golden-ration %s) toggle with [g]"
|
|
|
|
(if (symbol-value golden-ratio-mode) "enabled" "disabled")))
|
|
|
|
|
|
|
|
(spacemacs|define-micro-state window-manipulation
|
2015-02-13 02:48:56 +00:00
|
|
|
:doc "[?] for help"
|
2015-02-24 04:28:23 +00:00
|
|
|
:evil-leader "w."
|
2015-08-30 07:07:24 +00:00
|
|
|
:use-minibuffer t
|
2015-02-12 05:00:23 +00:00
|
|
|
:bindings
|
2015-02-15 01:02:14 +00:00
|
|
|
("?" nil :doc (spacemacs//window-manipulation-full-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("0" select-window-0 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("1" select-window-1 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("2" select-window-2 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("3" select-window-3 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("4" select-window-4 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("5" select-window-5 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("6" select-window-6 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("7" select-window-7 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("8" select-window-8 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("9" select-window-9 :doc (spacemacs//window-manipulation-number-doc))
|
|
|
|
("-" split-window-below-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
|
|
|
("/" split-window-right-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
|
|
|
("[" spacemacs/shrink-window-horizontally :doc (spacemacs//window-manipulation-resize-doc))
|
|
|
|
("]" spacemacs/enlarge-window-horizontally :doc (spacemacs//window-manipulation-resize-doc))
|
|
|
|
("{" spacemacs/shrink-window :doc (spacemacs//window-manipulation-resize-doc))
|
|
|
|
("}" spacemacs/enlarge-window :doc (spacemacs//window-manipulation-resize-doc))
|
|
|
|
("c" delete-window :doc (spacemacs//window-manipulation-layout-doc))
|
|
|
|
("C" delete-other-windows :doc (spacemacs//window-manipulation-layout-doc))
|
|
|
|
("g" spacemacs/toggle-golden-ratio :doc (spacemacs//window-manipulation-gratio-doc))
|
|
|
|
("h" evil-window-left :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<left>" evil-window-left :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("j" evil-window-down :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<down>" evil-window-down :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("k" evil-window-up :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<up>" evil-window-up :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("l" evil-window-right :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<right>" evil-window-right :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("H" evil-window-move-far-left :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<S-left>" evil-window-move-far-left :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("J" evil-window-move-very-bottom :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<S-down>" evil-window-move-very-bottom :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("K" evil-window-move-very-top :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<S-up>" evil-window-move-very-top :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("L" evil-window-move-far-right :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 08:33:02 +00:00
|
|
|
("<S-right>" evil-window-move-far-right :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("o" other-frame :doc (spacemacs//window-manipulation-move-doc))
|
2015-08-30 07:07:24 +00:00
|
|
|
("R" spacemacs/rotate-windows :doc (spacemacs//window-manipulation-move-doc))
|
2015-02-12 05:00:23 +00:00
|
|
|
("s" split-window-below :doc (spacemacs//window-manipulation-split-doc))
|
|
|
|
("S" split-window-below-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
|
|
|
("u" winner-undo :doc (spacemacs//window-manipulation-layout-doc))
|
|
|
|
("U" winner-redo :doc (spacemacs//window-manipulation-layout-doc))
|
|
|
|
("v" split-window-right :doc (spacemacs//window-manipulation-split-doc))
|
|
|
|
("V" split-window-right-and-focus :doc (spacemacs//window-manipulation-split-doc))
|
|
|
|
("w" other-window :doc (spacemacs//window-manipulation-move-doc)))
|
|
|
|
|
|
|
|
;; end of Window Manipulation Micro State
|
2015-03-30 02:15:17 +00:00
|
|
|
|
|
|
|
;; text Manipulation Micro State
|
|
|
|
|
|
|
|
(defun spacemacs/scale-up-or-down-font-size (direction)
|
|
|
|
"Scale the font. If DIRECTION is positive or zero the font is scaled up,
|
|
|
|
otherwise it is scaled down."
|
|
|
|
(interactive)
|
|
|
|
(let ((scale 0.5))
|
|
|
|
(if (eq direction 0)
|
|
|
|
(text-scale-set 0)
|
|
|
|
(if (< direction 0)
|
|
|
|
(text-scale-decrease scale)
|
|
|
|
(text-scale-increase scale)))))
|
|
|
|
|
|
|
|
(defun spacemacs/scale-up-font ()
|
|
|
|
"Scale up the font."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs/scale-up-or-down-font-size 1))
|
|
|
|
|
|
|
|
(defun spacemacs/scale-down-font ()
|
|
|
|
"Scale up the font."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs/scale-up-or-down-font-size -1))
|
|
|
|
|
|
|
|
(defun spacemacs/reset-font-size ()
|
|
|
|
"Reset the font size."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs/scale-up-or-down-font-size 0))
|
|
|
|
|
|
|
|
(spacemacs|define-micro-state scale-font
|
2015-05-17 02:09:52 +00:00
|
|
|
:doc "[+] scale up [-] scale down [=] reset font [q]uit"
|
2015-03-30 02:15:17 +00:00
|
|
|
:evil-leader "zx"
|
|
|
|
:bindings
|
|
|
|
("+" spacemacs/scale-up-font)
|
|
|
|
("-" spacemacs/scale-down-font)
|
2015-05-17 02:09:52 +00:00
|
|
|
("=" spacemacs/reset-font-size)
|
2015-05-18 05:38:14 +00:00
|
|
|
("q" nil :exit t))
|
2015-03-30 02:15:17 +00:00
|
|
|
|
|
|
|
;; end of Text Manipulation Micro State
|
2015-06-24 06:57:20 +00:00
|
|
|
|
|
|
|
;; Transparency micro-state
|
|
|
|
|
|
|
|
(defun spacemacs/toggle-transparency ()
|
|
|
|
"Toggle between transparent or opaque display."
|
|
|
|
(interactive)
|
|
|
|
;; Define alpha if it's nil
|
|
|
|
(if (eq (frame-parameter (selected-frame) 'alpha) nil)
|
|
|
|
(set-frame-parameter (selected-frame) 'alpha '(100 100)))
|
|
|
|
;; Do the actual toggle
|
|
|
|
(if (/= (cadr (frame-parameter (selected-frame) 'alpha)) 100)
|
|
|
|
(set-frame-parameter (selected-frame) 'alpha '(100 100))
|
|
|
|
(set-frame-parameter (selected-frame) 'alpha
|
|
|
|
(list dotspacemacs-active-transparency
|
|
|
|
dotspacemacs-inactive-transparency)))
|
|
|
|
;; Immediately enter the micro-state, but also keep toggle
|
|
|
|
;; accessible from helm-spacemacs
|
|
|
|
(spacemacs/scale-transparency-micro-state))
|
|
|
|
|
|
|
|
(defun spacemacs/increase-transparency ()
|
|
|
|
"Increase transparency of current frame."
|
|
|
|
(interactive)
|
|
|
|
(let* ((current-alpha (car (frame-parameter (selected-frame) 'alpha)))
|
|
|
|
(increased-alpha (- current-alpha 5)))
|
|
|
|
(when (>= increased-alpha frame-alpha-lower-limit)
|
|
|
|
(set-frame-parameter (selected-frame) 'alpha (list increased-alpha increased-alpha)))))
|
|
|
|
|
|
|
|
(defun spacemacs/decrease-transparency ()
|
|
|
|
"Decrease transparency of current frame."
|
|
|
|
(interactive)
|
|
|
|
(let* ((current-alpha (car (frame-parameter (selected-frame) 'alpha)))
|
|
|
|
(decreased-alpha (+ current-alpha 5)))
|
|
|
|
(when (<= decreased-alpha 100)
|
|
|
|
(set-frame-parameter (selected-frame) 'alpha (list decreased-alpha decreased-alpha)))))
|
|
|
|
|
|
|
|
(spacemacs|define-micro-state scale-transparency
|
|
|
|
:doc "[+] increase [-] decrease [T] toggle transparency [q] quit"
|
|
|
|
:bindings
|
|
|
|
("+" spacemacs/increase-transparency)
|
|
|
|
("-" spacemacs/decrease-transparency)
|
|
|
|
("T" spacemacs/toggle-transparency)
|
|
|
|
("q" nil :exit t))
|
|
|
|
|
|
|
|
;; end of Transparency Micro State
|