I am trying to setup Emacs to have relative line numbering enabled by default via this plugin.
According to the readme file
Relative line numbering should already be enabled by default (by installing this package), following linum-on
I have included (linum-on)
in my .emacs
file but it doesn't work. M-x linum-relative-mode
works, but I have to do it every time.
My full .emacs
file at present is below:
(if (display-graphic-p)
(progn
(setq initial-frame-alist
'((tool-bar-lines . 0)
(width . 106)
(height . 60)))
(setq default-frame-alist
'((tool-bar-lines . 0)
(width . 106)
(height . 60))))
(progn
(setq initial-frame-alist '((tool-bar-lines . 0)))
(setq default-frame-alist '((tool-bar-lines . 0)))))
(setq package-list
'(use-package evil helm js2-mode monokai-theme linum-relative org
powerline rainbow-delimiters projectile helm-projectile flycheck))
(require 'package)
(setq package-archives '(("melpa" . "http://melpa.org/packages/")
("MELPA stable" . "https://stable.melpa.org/packages/")
("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")))
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(dolist (package package-list)
(unless (package-installed-p package) (package-install package)))
(setq evil-want-C-u-scroll t)
(require 'evil)
(evil-mode 1)
;; Use `display-line-number-mode` as linum-mode's backend for smooth performance
(setq linum-relative-backend 'display-line-numbers-mode)
(require 'linum-relative)
(linum-on)
(require 'helm-config)
(set-face-attribute 'default nil :height 140)
(load-theme 'monokai t)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(require 'powerline)
(powerline-default-theme)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(linum-relative-mode)
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
(flycheck rainbow-delimiters powerline linum-relative doom-themes moe-theme cyberpunk-theme monokai-theme helm evil))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
display-line-numbers-mode
. (It is a lot more efficient thanlinum-mode
). (setq display-line-numbers-type 'relative) ;; Make relative line numbers appear for all programming buffers. (add-hook 'prog-mode-hook 'display-line-numbers-mode)