2016-05-21 03:57:32 +00:00
|
|
|
;;; packages.el --- nlinum Layer packages File
|
|
|
|
;;
|
2017-01-06 03:51:13 +00:00
|
|
|
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
|
2016-05-21 03:57:32 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(defconst nlinum-packages
|
|
|
|
'(
|
|
|
|
(linum :excluded t)
|
|
|
|
(linum-relative :excluded t)
|
|
|
|
nlinum
|
|
|
|
nlinum-relative
|
|
|
|
))
|
|
|
|
|
|
|
|
(defun nlinum/init-nlinum ()
|
|
|
|
(use-package nlinum
|
|
|
|
:init
|
2016-11-04 18:33:40 +00:00
|
|
|
(spacemacs|add-toggle line-numbers
|
|
|
|
:mode nlinum-mode
|
|
|
|
:documentation "Show the line numbers."
|
|
|
|
:evil-leader "tn")
|
|
|
|
:config
|
2016-05-21 03:57:32 +00:00
|
|
|
(progn
|
2016-11-04 18:33:40 +00:00
|
|
|
(if (or (eq dotspacemacs-line-numbers t)
|
|
|
|
(eq dotspacemacs-line-numbers 'relative))
|
|
|
|
(progn
|
|
|
|
(add-hook 'prog-mode-hook 'nlinum-mode)
|
|
|
|
(add-hook 'text-mode-hook 'nlinum-mode))
|
|
|
|
(add-hook 'after-change-major-mode-hook 'spacemacs/nlinum-maybe-on))
|
|
|
|
(setq nlinum-format "%4d"))))
|
2016-05-21 03:57:32 +00:00
|
|
|
|
|
|
|
(defun nlinum/init-nlinum-relative ()
|
|
|
|
(use-package nlinum-relative
|
|
|
|
:commands (nlinum-relative-toggle nlinum-relative-on)
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(setq nlinum-relative-current-symbol ""
|
|
|
|
nlinum-relative-redisplay-delay 0)
|
2017-02-06 13:54:48 +00:00
|
|
|
(when (or (eq dotspacemacs-line-numbers 'relative)
|
|
|
|
(car (spacemacs/mplist-get dotspacemacs-line-numbers
|
|
|
|
:relative)))
|
2016-05-21 03:57:32 +00:00
|
|
|
(nlinum-relative-setup-evil)
|
|
|
|
(add-hook 'nlinum-mode-hook 'nlinum-relative-on))
|
2016-11-06 11:08:47 +00:00
|
|
|
(spacemacs/set-leader-keys "tr" 'spacemacs/nlinum-relative-toggle))))
|