spacemacs/layers/+misc/nlinum/packages.el
syl20bnr ebe4c60264 Revert "Defer packages by default using use-package-always-defer"
This reverts commit 29c78ce841 and all other fixes
that have been made afterwards.

The motivation is that use-package is seen by many as a replacement for
`require`. Is use-package always defer the loading of packages then is breaks
this use case, this does not respect POLA so even if it was making Spacemacs
loading faster (up to 3s faster on some startup on my machine) we just cannot
use it, it would be irresponsible. Spacemacs should be easy to use, loading
performance will come with time but it is not a priority.
2018-03-03 23:40:10 -05:00

51 lines
1.6 KiB
EmacsLisp

;;; packages.el --- nlinum Layer packages File
;;
;; Copyright (c) 2012-2018 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
(defconst nlinum-packages
'(
(linum :excluded t)
(linum-relative :excluded t)
nlinum
nlinum-relative
))
(defun nlinum/init-nlinum ()
(use-package nlinum
:init
(spacemacs|add-toggle line-numbers
:mode nlinum-mode
:documentation "Show the line numbers."
:evil-leader "tn")
:config
(progn
(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"))))
(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)
(when (or (eq dotspacemacs-line-numbers 'relative)
(and (listp dotspacemacs-line-numbers)
(car (spacemacs/mplist-get dotspacemacs-line-numbers
:relative))))
(nlinum-relative-setup-evil)
(add-hook 'nlinum-mode-hook 'nlinum-relative-on))
(spacemacs/set-leader-keys "tr" 'spacemacs/nlinum-relative-toggle))))