Remove relative line numbers

Use evil motion via ace-jump-line-mode instead
This commit is contained in:
syl20bnr 2014-09-23 21:40:52 -04:00
parent a2955d659d
commit f13920259f
3 changed files with 2 additions and 39 deletions

View File

@ -489,8 +489,7 @@ Some UI indicators can be toggled on and off (toggles start with `t`):
------------------|------------------------------------------------------------
`<SPC> t 8` | display a mark on the 80th column
`<SPC> t f` | toggle display of the fringe
`<SPC> t n` | show the line numbers (relative to current position)
`<SPC> t N` | show the absolute line numbers
`<SPC> t n` | show the absolute line numbers
### Minor Modes

View File

@ -143,8 +143,7 @@
"t8" 'toggle-fill-column-indicator
"tF" 'fringe-mode
"tf" 'toggle-fullscreen
"tN" 'global-linum-mode
"tn" 'cofi/evil-toggle-relative-lines
"tn" 'global-linum-mode
"tw" 'toggle-read-only)
;; window ---------------------------------------------------------------------
;; (evil-leader/set-key "wb" 'evenly-split-window-right)

View File

@ -128,37 +128,6 @@ which require an initialization must be listed explicitly in the list."
;; Initialization of packages
(defun spacemacs/init-evil ()
;; relative line number for operator state
;; inspired by https://github.com/cofi/dotfiles/blob/master/emacs.d/config/cofi-evil.el
(defvar cofi/current-line 0
"Stores the current line before linum numbers the lines.")
(defadvice linum-update (before set-current-line activate)
(setq cofi/current-line (line-number-at-pos)))
(defun cofi/relative-line (line-number)
(let ((relative (abs (- line-number cofi/current-line))))
(propertize (format "%2d" relative) 'face (if (= relative 0)
'linum-current-line
'linum))))
(defun cofi/evil-toggle-relative-lines ()
(interactive)
(if (eq linum-format #'cofi/relative-line)
(progn
(linum-mode -1)
(setq linum-format #'cofi/linum-dynamic-lines))
(progn
(linum-mode t)
(setq linum-format #'cofi/relative-line)))
(linum-update-current))
(defun cofi/linum-dynamic-lines (line-number)
(let ((width (ceiling (log (count-lines (point-min) (point-max)) 10))))
(propertize (format (format "%%%dd" width) line-number)
'face (if (= cofi/current-line line-number)
'linum-current-line
'linum))))
(setq linum-format #'cofi/linum-dynamic-lines)
;; evil mode init ------------------------------------------------------------
(use-package evil
:init
(progn
@ -179,10 +148,6 @@ which require an initialization must be listed explicitly in the list."
(set-default-evil-insert-state-cursor)
(set-default-evil-visual-state-cursor)
(set-default-evil-motion-state-cursor)
(setq evil-mode-line-format 'before)
(add-to-hooks #'cofi/evil-toggle-relative-lines
'(evil-operator-state-entry-hook
evil-operator-state-exit-hook))
;; I prefer to stay on the original character when leaving insert mode
;; (initiated with 'i').
(setq evil-move-cursor-back nil)