Highlight should already be done automatocally. This highlight is not desirable because it breaks `n` and `N` search of occurences and it breaks `:nohl:` as well making it impossible to revert an highlighted word. These drawbacks were maybe intentional since it was about highlighting _permanently_ but it goes against principle of least astonishement, users will be consufed about an highlight that cannot be reverted whatsoever. We need an highlighting facility in Spacemacs, there was one at some point with the package `hl-anything` but at the time it was buggy and removed from Spacemacs (see layer spacemacs-editing-visual). Maybe we could try it again.
591 lines
23 KiB
EmacsLisp
591 lines
23 KiB
EmacsLisp
;;; packages.el --- Spacemacs Navigation Layer packages File
|
|
;;
|
|
;; Copyright (c) 2012-2017 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
|
|
|
|
(setq spacemacs-navigation-packages
|
|
'(ace-link
|
|
auto-highlight-symbol
|
|
(centered-cursor :location local)
|
|
(doc-view :location built-in)
|
|
flx-ido
|
|
golden-ratio
|
|
info+
|
|
neotree
|
|
open-junk-file
|
|
paradox
|
|
restart-emacs
|
|
(smooth-scrolling :location built-in)
|
|
winum
|
|
))
|
|
|
|
(defun spacemacs-navigation/init-ace-link ()
|
|
(use-package ace-link
|
|
:commands spacemacs/ace-buffer-links
|
|
:init
|
|
(progn
|
|
(define-key spacemacs-buffer-mode-map "o" 'spacemacs/ace-buffer-links)
|
|
(with-eval-after-load 'info
|
|
(define-key Info-mode-map "o" 'ace-link-info))
|
|
(with-eval-after-load 'help-mode
|
|
(define-key help-mode-map "o" 'ace-link-help))
|
|
(with-eval-after-load 'eww
|
|
(define-key eww-link-keymap "o" 'ace-link-eww)
|
|
(define-key eww-mode-map "o" 'ace-link-eww)))
|
|
:config
|
|
(progn
|
|
(defvar spacemacs--link-pattern "~?/.+\\|\s\\[")
|
|
(defun spacemacs//collect-spacemacs-buffer-links ()
|
|
(let ((end (window-end))
|
|
points)
|
|
(save-excursion
|
|
(goto-char (window-start))
|
|
(while (re-search-forward spacemacs--link-pattern end t)
|
|
(push (+ (match-beginning 0) 1) points))
|
|
(nreverse points))))
|
|
(defun spacemacs/ace-buffer-links ()
|
|
"Ace jump to links in `spacemacs' buffer."
|
|
(interactive)
|
|
(let ((res (avy-with spacemacs/ace-buffer-links
|
|
(avy--process
|
|
(spacemacs//collect-spacemacs-buffer-links)
|
|
#'avy--overlay-pre))))
|
|
(when res
|
|
(goto-char (1+ res))
|
|
(widget-button-press (point))))))))
|
|
|
|
(defun spacemacs-navigation/init-auto-highlight-symbol ()
|
|
(use-package auto-highlight-symbol
|
|
:defer t
|
|
:init
|
|
(progn
|
|
(setq ahs-case-fold-search nil
|
|
ahs-default-range 'ahs-range-whole-buffer
|
|
;; by default disable auto-highlight of symbol
|
|
;; current symbol can always be highlighted with `SPC s h'
|
|
ahs-idle-timer 0
|
|
ahs-idle-interval 0.25
|
|
ahs-inhibit-face-list nil
|
|
spacemacs--symbol-highlight-transient-state-doc
|
|
"
|
|
%s [_n_] next [_N_/_p_] previous [_r_] change range [_R_] reset [_e_] iedit
|
|
%s [_d_/_D_] next/previous definition")
|
|
|
|
;; since we are creating our own maps,
|
|
;; prevent the default keymap from getting created
|
|
(setq auto-highlight-symbol-mode-map (make-sparse-keymap))
|
|
|
|
(spacemacs|add-toggle automatic-symbol-highlight
|
|
:status (timerp ahs-idle-timer)
|
|
:on (progn
|
|
(auto-highlight-symbol-mode)
|
|
(setq ahs-idle-timer
|
|
(run-with-idle-timer ahs-idle-interval t
|
|
'ahs-idle-function)))
|
|
:off (when (timerp ahs-idle-timer)
|
|
(auto-highlight-symbol-mode)
|
|
(cancel-timer ahs-idle-timer)
|
|
(setq ahs-idle-timer 0))
|
|
:documentation "Automatic highlight of current symbol."
|
|
:evil-leader "tha")
|
|
(spacemacs/add-to-hooks 'auto-highlight-symbol-mode '(prog-mode-hook
|
|
markdown-mode-hook)))
|
|
:config
|
|
(progn
|
|
(spacemacs|hide-lighter auto-highlight-symbol-mode)
|
|
(defvar-local spacemacs-last-ahs-highlight-p nil
|
|
"Info on the last searched highlighted symbol.")
|
|
(defvar-local spacemacs--ahs-searching-forward t)
|
|
|
|
(with-eval-after-load 'evil
|
|
(define-key evil-motion-state-map (kbd "*")
|
|
'spacemacs/enter-ahs-forward)
|
|
(define-key evil-motion-state-map (kbd "#")
|
|
'spacemacs/enter-ahs-backward))
|
|
|
|
(spacemacs/set-leader-keys
|
|
"sh" 'spacemacs/symbol-highlight
|
|
"sH" 'spacemacs/goto-last-searched-ahs-symbol)
|
|
|
|
;; micro-state to easily jump from a highlighted symbol to the others
|
|
(dolist (sym '(ahs-forward
|
|
ahs-forward-definition
|
|
ahs-backward
|
|
ahs-backward-definition
|
|
ahs-back-to-start
|
|
ahs-change-range))
|
|
(let* ((advice (intern (format "spacemacs/%s" (symbol-name sym)))))
|
|
(eval `(defadvice ,sym (around ,advice activate)
|
|
(spacemacs/ahs-highlight-now-wrapper)
|
|
ad-do-it
|
|
(spacemacs/ahs-highlight-now-wrapper)
|
|
(setq spacemacs-last-ahs-highlight-p (ahs-highlight-p))))))
|
|
|
|
;; transient state
|
|
(spacemacs|define-transient-state symbol-highlight
|
|
:title "Symbol Highlight Transient State"
|
|
:dynamic-hint (spacemacs//symbol-highlight-ts-doc)
|
|
:before-exit (spacemacs//ahs-ms-on-exit)
|
|
:bindings
|
|
("d" ahs-forward-definition)
|
|
("D" ahs-backward-definition)
|
|
("e" spacemacs/ahs-to-iedit :exit t)
|
|
("n" spacemacs/quick-ahs-forward)
|
|
("N" spacemacs/quick-ahs-backward)
|
|
("p" spacemacs/quick-ahs-backward)
|
|
("R" ahs-back-to-start)
|
|
("r" ahs-change-range)
|
|
("q" nil :exit t)))))
|
|
|
|
(defun spacemacs-navigation/init-centered-cursor ()
|
|
(use-package centered-cursor-mode
|
|
:commands (centered-cursor-mode
|
|
global-centered-cursor-mode)
|
|
:init
|
|
(progn
|
|
(spacemacs|add-toggle centered-point
|
|
:mode centered-cursor-mode
|
|
:documentation
|
|
"Keep point at the center of the window."
|
|
:evil-leader "t-")
|
|
(spacemacs|add-toggle centered-point-globally
|
|
:mode global-centered-cursor-mode
|
|
:documentation
|
|
"Keep point at the center of the window globally."
|
|
:evil-leader "t C--"))
|
|
:config
|
|
(progn
|
|
(setq ccm-recenter-at-end-of-file t
|
|
ccm-ignored-commands '(mouse-drag-region
|
|
mouse-set-point
|
|
widget-button-click
|
|
scroll-bar-toolkit-scroll
|
|
evil-mouse-drag-region))
|
|
(spacemacs|diminish centered-cursor-mode " ⊝" " -"))))
|
|
|
|
(defun spacemacs-navigation/init-doc-view ()
|
|
(use-package doc-view
|
|
:defer t
|
|
:init
|
|
(evilified-state-evilify doc-view-mode doc-view-mode-map
|
|
"/" 'spacemacs/doc-view-search-new-query
|
|
"?" 'spacemacs/doc-view-search-new-query-backward
|
|
"gg" 'doc-view-first-page
|
|
"G" 'spacemacs/doc-view-goto-page
|
|
"gt" 'doc-view-goto-page
|
|
"h" 'doc-view-previous-page
|
|
"j" 'doc-view-next-line-or-next-page
|
|
"k" 'doc-view-previous-line-or-previous-page
|
|
"K" 'doc-view-kill-proc-and-buffer
|
|
"l" 'doc-view-next-page
|
|
"n" 'doc-view-search
|
|
"N" 'doc-view-search-backward
|
|
(kbd "C-d") 'doc-view-scroll-up-or-next-page
|
|
(kbd "C-k") 'doc-view-kill-proc
|
|
(kbd "C-u") 'doc-view-scroll-down-or-previous-page)
|
|
:config
|
|
(progn
|
|
(defun spacemacs/doc-view-search-new-query ()
|
|
"Initiate a new query."
|
|
(interactive)
|
|
(doc-view-search 'newquery))
|
|
|
|
(defun spacemacs/doc-view-search-new-query-backward ()
|
|
"Initiate a new query."
|
|
(interactive)
|
|
(doc-view-search 'newquery t))
|
|
|
|
(defun spacemacs/doc-view-goto-page (&optional count)
|
|
(interactive (list
|
|
(when current-prefix-arg
|
|
(prefix-numeric-value current-prefix-arg))))
|
|
(if (null count)
|
|
(doc-view-last-page)
|
|
(doc-view-goto-page count)))
|
|
|
|
;; fixed a weird issue where toggling display does not
|
|
;; swtich to text mode
|
|
(defadvice doc-view-toggle-display
|
|
(around spacemacs/doc-view-toggle-display activate)
|
|
(if (eq major-mode 'doc-view-mode)
|
|
(progn
|
|
ad-do-it
|
|
(text-mode)
|
|
(doc-view-minor-mode))
|
|
ad-do-it)))))
|
|
|
|
(defun spacemacs-navigation/init-flx-ido ()
|
|
(use-package flx-ido
|
|
:init (flx-ido-mode 1)))
|
|
|
|
(defun spacemacs-navigation/init-golden-ratio ()
|
|
(use-package golden-ratio
|
|
:defer t
|
|
:init
|
|
(progn
|
|
(setq spacemacs-window-manipulation-transient-state-add-bindings
|
|
'(("g" spacemacs/toggle-golden-ratio)))
|
|
(spacemacs|add-toggle golden-ratio
|
|
:status golden-ratio-mode
|
|
:on (golden-ratio-mode) (golden-ratio)
|
|
:off (golden-ratio-mode -1) (balance-windows)
|
|
:documentation "Resize the focused window using the golden ratio."
|
|
:evil-leader "tg"))
|
|
:config
|
|
(progn
|
|
;; golden-ratio-exclude-modes
|
|
(dolist (m '("bs-mode"
|
|
"calc-mode"
|
|
"ediff-mode"
|
|
"dired-mode"
|
|
"gud-mode"
|
|
"gdb-locals-mode"
|
|
"gdb-registers-mode"
|
|
"gdb-breakpoints-mode"
|
|
"gdb-threads-mode"
|
|
"gdb-frames-mode"
|
|
"gdb-inferior-io-mode"
|
|
"gdb-disassembly-mode"
|
|
"gdb-memory-mode"
|
|
"speedbar-mode"
|
|
))
|
|
(add-to-list 'golden-ratio-exclude-modes m))
|
|
|
|
(add-to-list 'golden-ratio-exclude-buffer-regexp "^\\*[hH]elm.*")
|
|
|
|
;; golden-ratio-extra-commands
|
|
(dolist (f '(ace-window
|
|
ace-delete-window
|
|
ace-select-window
|
|
ace-swap-window
|
|
ace-maximize-window
|
|
avy-pop-mark
|
|
buf-move-left
|
|
buf-move-right
|
|
buf-move-up
|
|
buf-move-down
|
|
evil-avy-goto-word-or-subword-1
|
|
evil-avy-goto-line
|
|
evil-window-delete
|
|
evil-window-split
|
|
evil-window-vsplit
|
|
evil-window-left
|
|
evil-window-right
|
|
evil-window-up
|
|
evil-window-down
|
|
evil-window-bottom-right
|
|
evil-window-top-left
|
|
evil-window-mru
|
|
evil-window-next
|
|
evil-window-prev
|
|
evil-window-new
|
|
evil-window-vnew
|
|
evil-window-rotate-upwards
|
|
evil-window-rotate-downwards
|
|
evil-window-move-very-top
|
|
evil-window-move-far-left
|
|
evil-window-move-far-right
|
|
evil-window-move-very-bottom
|
|
quit-window
|
|
winum-select-window-0-or-10
|
|
winum-select-window-1
|
|
winum-select-window-2
|
|
winum-select-window-3
|
|
winum-select-window-4
|
|
winum-select-window-5
|
|
winum-select-window-6
|
|
winum-select-window-7
|
|
winum-select-window-8
|
|
winum-select-window-9
|
|
windmove-left
|
|
windmove-right
|
|
windmove-up
|
|
windmove-down))
|
|
(add-to-list 'golden-ratio-extra-commands f))
|
|
|
|
;; golden-ratio-exclude-buffer-names
|
|
(dolist (n '(" *NeoTree*"
|
|
"*LV*"
|
|
" *which-key*"))
|
|
(add-to-list 'golden-ratio-exclude-buffer-names n))
|
|
|
|
(add-to-list 'golden-ratio-inhibit-functions
|
|
'spacemacs/no-golden-ratio-guide-key)
|
|
|
|
(spacemacs|diminish golden-ratio-mode " ⓖ" " g"))))
|
|
|
|
(defun spacemacs-navigation/init-info+ ()
|
|
(use-package info+
|
|
:defer t
|
|
:init
|
|
(progn
|
|
(with-eval-after-load 'info
|
|
(require 'info+))
|
|
(setq Info-fontify-angle-bracketed-flag nil))))
|
|
|
|
(defun spacemacs-navigation/init-neotree ()
|
|
(use-package neotree
|
|
:defer t
|
|
:commands neo-global--window-exists-p
|
|
:init
|
|
(progn
|
|
(setq neo-window-width 32
|
|
neo-create-file-auto-open t
|
|
neo-banner-message "Press ? for neotree help"
|
|
neo-show-updir-line nil
|
|
neo-mode-line-type 'neotree
|
|
neo-smart-open t
|
|
neo-dont-be-alone t
|
|
neo-persist-show nil
|
|
neo-show-hidden-files t
|
|
neo-auto-indent-point t
|
|
neo-modern-sidebar t
|
|
neo-vc-integration nil)
|
|
|
|
(spacemacs|define-transient-state neotree
|
|
:title "NeoTree Key Hints"
|
|
:doc "
|
|
Navigation^^^^ Actions^^ Visual actions/config^^^
|
|
───────^^^^─────────────── ───────^^──────── ───────^^^────────────────
|
|
[_L_] next sibling^^ [_c_] create [_TAB_] shrink/enlarge
|
|
[_H_] previous sibling^^ [_C_] copy [_|_] vertical split
|
|
[_J_] goto child^^ [_d_] delete [_-_] horizontal split
|
|
[_K_] goto parent^^ [_r_] rename [_gr_] refresh^
|
|
[_l_] open/expand^^ [_R_] change root [_s_] hidden:^^^ %s(if neo-buffer--show-hidden-file-p \"on\" \"off\")
|
|
[_h_] up/collapse^^ ^^ ^^^
|
|
[_j_] line down^^ ^^ ^^^
|
|
[_k_] line up^^ ^^ ^^
|
|
[_'_] quick look ^^ ^^
|
|
[_RET_] open ^^^^ [_?_] close hints
|
|
"
|
|
:bindings
|
|
("RET" neotree-enter)
|
|
("TAB" neotree-stretch-toggle)
|
|
("|" neotree-enter-vertical-split)
|
|
("-" neotree-enter-horizontal-split)
|
|
("?" nil :exit t)
|
|
("'" neotree-quick-look)
|
|
("c" neotree-create-node)
|
|
("C" neotree-copy-node)
|
|
("d" neotree-delete-node)
|
|
("gr" neotree-refresh)
|
|
("h" spacemacs/neotree-collapse-or-up)
|
|
("H" neotree-select-previous-sibling-node)
|
|
("j" neotree-next-line)
|
|
("J" neotree-select-down-node)
|
|
("k" neotree-previous-line)
|
|
("K" neotree-select-up-node)
|
|
("l" spacemacs/neotree-expand-or-open)
|
|
("L" neotree-select-next-sibling-node)
|
|
("r" neotree-rename-node)
|
|
("R" neotree-change-root)
|
|
("s" neotree-hidden-file-toggle))
|
|
|
|
(defun spacemacs//neotree-key-bindings ()
|
|
"Set the key bindings for a neotree buffer."
|
|
(evilified-state-evilify-map neotree-mode-map
|
|
:mode neotree-mode
|
|
:bindings
|
|
(kbd "TAB") 'neotree-stretch-toggle
|
|
(kbd "RET") 'neotree-enter
|
|
(kbd "|") 'neotree-enter-vertical-split
|
|
(kbd "-") 'neotree-enter-horizontal-split
|
|
(kbd "'") 'neotree-quick-look
|
|
(kbd "c") 'neotree-create-node
|
|
(kbd "C") 'neotree-copy-node
|
|
(kbd "d") 'neotree-delete-node
|
|
(kbd "gr") 'neotree-refresh
|
|
(kbd "h") 'spacemacs/neotree-collapse-or-up
|
|
(kbd "H") 'neotree-select-previous-sibling-node
|
|
(kbd "j") 'neotree-next-line
|
|
(kbd "J") 'neotree-select-down-node
|
|
(kbd "k") 'neotree-previous-line
|
|
(kbd "K") 'neotree-select-up-node
|
|
(kbd "l") 'spacemacs/neotree-expand-or-open
|
|
(kbd "L") 'neotree-select-next-sibling-node
|
|
(kbd "q") 'neotree-hide
|
|
(kbd "r") 'neotree-rename-node
|
|
(kbd "R") 'neotree-change-root
|
|
(kbd "?") 'spacemacs/neotree-transient-state/body
|
|
(kbd "s") 'neotree-hidden-file-toggle))
|
|
|
|
(spacemacs/set-leader-keys
|
|
"ft" 'neotree-toggle
|
|
"fT" 'neotree-show
|
|
"pt" 'neotree-find-project-root))
|
|
:config
|
|
(spacemacs//neotree-key-bindings)))
|
|
|
|
(defun spacemacs-navigation/init-open-junk-file ()
|
|
(use-package open-junk-file
|
|
:defer t
|
|
:commands (open-junk-file)
|
|
:init
|
|
(setq open-junk-file-format (concat spacemacs-cache-directory "junk/%Y/%m/%d-%H%M%S."))
|
|
(defun spacemacs/open-junk-file (&optional arg)
|
|
"Open junk file using helm or ivy.
|
|
|
|
Interface choice depends on whether the `ivy' layer is used or
|
|
not.
|
|
|
|
When ARG is non-nil search in junk files."
|
|
(interactive "P")
|
|
(let* ((fname (format-time-string open-junk-file-format (current-time)))
|
|
(rel-fname (file-name-nondirectory fname))
|
|
(junk-dir (file-name-directory fname))
|
|
(default-directory junk-dir))
|
|
(cond ((and arg (configuration-layer/layer-usedp 'ivy))
|
|
(spacemacs/counsel-search dotspacemacs-search-tools nil junk-dir))
|
|
((configuration-layer/layer-usedp 'ivy)
|
|
(require 'counsel)
|
|
(counsel-find-file rel-fname))
|
|
(arg
|
|
(require 'helm)
|
|
(let (helm-ff-newfile-prompt-p)
|
|
(spacemacs/helm-files-smart-do-search)))
|
|
(t
|
|
(require 'helm)
|
|
(let (helm-ff-newfile-prompt-p)
|
|
(helm-find-files-1 fname))))))
|
|
(spacemacs/set-leader-keys "fJ" 'spacemacs/open-junk-file)))
|
|
|
|
(defun spacemacs-navigation/init-paradox ()
|
|
(use-package paradox
|
|
:commands paradox-list-packages
|
|
:init
|
|
(progn
|
|
(setq paradox-execute-asynchronously nil)
|
|
(defun spacemacs/paradox-list-packages ()
|
|
"Load depdendencies for auth and open the package list."
|
|
(interactive)
|
|
(require 'epa-file)
|
|
(require 'auth-source)
|
|
(when (and (not (boundp 'paradox-github-token))
|
|
(file-exists-p "~/.authinfo.gpg"))
|
|
(let ((authinfo-result (car (auth-source-search
|
|
:max 1
|
|
:host "github.com"
|
|
:port "paradox"
|
|
:user "paradox"
|
|
:require '(:secret)))))
|
|
(let ((paradox-token (plist-get authinfo-result :secret)))
|
|
(setq paradox-github-token (if (functionp paradox-token)
|
|
(funcall paradox-token)
|
|
paradox-token)))))
|
|
(paradox-list-packages nil))
|
|
|
|
(evilified-state-evilify paradox-menu-mode paradox-menu-mode-map
|
|
"H" 'paradox-menu-quick-help
|
|
"J" 'paradox-next-describe
|
|
"K" 'paradox-previous-describe
|
|
"L" 'paradox-menu-view-commit-list
|
|
"o" 'paradox-menu-visit-homepage)
|
|
(spacemacs/set-leader-keys
|
|
"ak" 'spacemacs/paradox-list-packages))))
|
|
|
|
(defun spacemacs-navigation/init-restart-emacs()
|
|
(use-package restart-emacs
|
|
:defer t
|
|
:init
|
|
(defun spacemacs/restart-emacs (&optional args)
|
|
"Restart emacs."
|
|
(interactive)
|
|
(setq spacemacs-really-kill-emacs t)
|
|
(restart-emacs args))
|
|
(defun spacemacs/restart-emacs-resume-layouts (&optional args)
|
|
"Restart emacs and resume layouts."
|
|
(interactive)
|
|
(spacemacs/restart-emacs (cons "--resume-layouts" args)))
|
|
(defun spacemacs/restart-emacs-debug-init (&optional args)
|
|
"Restart emacs and enable debug-init."
|
|
(interactive)
|
|
(spacemacs/restart-emacs (cons "--debug-init" args)))
|
|
(defun spacemacs/restart-stock-emacs-with-packages (packages &optional args)
|
|
"Restart emacs without the spacemacs configuration, enable
|
|
debug-init and load the given list of packages."
|
|
(interactive
|
|
(progn
|
|
(unless package--initialized
|
|
(package-initialize t))
|
|
(let ((packages (append (mapcar 'car package-alist)
|
|
(mapcar 'car package-archive-contents)
|
|
(mapcar 'car package--builtins))))
|
|
(setq packages (mapcar 'symbol-name packages))
|
|
(let ((val (completing-read-multiple "Packages to load (comma separated): "
|
|
packages nil t)))
|
|
`(,val)))))
|
|
(let ((load-packages-string (mapconcat (lambda (pkg) (format "(use-package %s)" pkg))
|
|
packages " ")))
|
|
(spacemacs/restart-emacs-debug-init
|
|
(append (list "-q" "--execute"
|
|
(concat "(progn (package-initialize) "
|
|
"(require 'use-package)"
|
|
load-packages-string ")"))
|
|
args))))
|
|
(spacemacs/set-leader-keys
|
|
"qd" 'spacemacs/restart-emacs-debug-init
|
|
"qD" 'spacemacs/restart-stock-emacs-with-packages
|
|
"qr" 'spacemacs/restart-emacs-resume-layouts
|
|
"qR" 'spacemacs/restart-emacs)))
|
|
|
|
(defun spacemacs-navigation/init-smooth-scrolling ()
|
|
(setq scroll-preserve-screen-position t
|
|
scroll-margin 0
|
|
scroll-conservatively (if dotspacemacs-smooth-scrolling 101 0))
|
|
(spacemacs|add-toggle smooth-scrolling
|
|
:status (= 101 scroll-conservatively)
|
|
:on (spacemacs/enable-smooth-scrolling)
|
|
:off (spacemacs/disable-smooth-scrolling)
|
|
:documentation "Smooth scrolling."
|
|
:evil-leader "tv"))
|
|
|
|
(defun spacemacs-navigation/init-winum ()
|
|
(use-package winum
|
|
:config
|
|
(progn
|
|
(defun spacemacs//winum-assign-func ()
|
|
"Custom number assignment for neotree."
|
|
(when (and (boundp 'neo-buffer-name)
|
|
(string= (buffer-name) neo-buffer-name)
|
|
;; in case there are two neotree windows. Example: when
|
|
;; invoking a transient state from neotree window, the new
|
|
;; window will show neotree briefly before displaying the TS,
|
|
;; causing an error message. the error is eliminated by
|
|
;; assigning 0 only to the top-left window
|
|
(eq (selected-window) (frame-first-window)))
|
|
0))
|
|
(setq winum-auto-assign-0-to-minibuffer nil
|
|
winum-assign-func 'spacemacs//winum-assign-func
|
|
winum-auto-setup-mode-line nil
|
|
winum-ignored-buffers '(" *which-key*"))
|
|
(spacemacs/set-leader-keys
|
|
"`" 'winum-select-window-by-number
|
|
"²" 'winum-select-window-by-number
|
|
"0" 'winum-select-window-0-or-10
|
|
"1" 'winum-select-window-1
|
|
"2" 'winum-select-window-2
|
|
"3" 'winum-select-window-3
|
|
"4" 'winum-select-window-4
|
|
"5" 'winum-select-window-5
|
|
"6" 'winum-select-window-6
|
|
"7" 'winum-select-window-7
|
|
"8" 'winum-select-window-8
|
|
"9" 'winum-select-window-9)
|
|
(define-key winum-keymap (kbd "M-0") 'winum-select-window-0-or-10)
|
|
(define-key winum-keymap (kbd "M-1") 'winum-select-window-1)
|
|
(define-key winum-keymap (kbd "M-2") 'winum-select-window-2)
|
|
(define-key winum-keymap (kbd "M-3") 'winum-select-window-3)
|
|
(define-key winum-keymap (kbd "M-4") 'winum-select-window-4)
|
|
(define-key winum-keymap (kbd "M-5") 'winum-select-window-5)
|
|
(define-key winum-keymap (kbd "M-6") 'winum-select-window-6)
|
|
(define-key winum-keymap (kbd "M-7") 'winum-select-window-7)
|
|
(define-key winum-keymap (kbd "M-8") 'winum-select-window-8)
|
|
(define-key winum-keymap (kbd "M-9") 'winum-select-window-9)
|
|
(winum-mode))))
|