Get rid of linum width jitter at low line number counts by setting a

minimum linum width
This commit is contained in:
Ivan Malison 2016-01-05 14:04:33 -08:00
parent 0a01c89ac7
commit b54fd3c8aa
3 changed files with 16 additions and 3 deletions

View File

@ -723,6 +723,7 @@ The current directory is assumed to be the project's root otherwise."
(setq tramp-default-method "scp")) (setq tramp-default-method "scp"))
(use-package shackle (use-package shackle
:disabled t
:config :config
(progn (progn
(diminish 'shackle-mode) (diminish 'shackle-mode)
@ -2467,13 +2468,25 @@ items follow a style that is consistent with other prog-modes."
(let ((new-height (read-face-attribute 'default :height (selected-frame)))) (let ((new-height (read-face-attribute 'default :height (selected-frame))))
(set-face-attribute 'default nil :height new-height))) (set-face-attribute 'default nil :height new-height)))
(defvar imalison:linum-format)
(make-variable-buffer-local 'imalison:linum-format)
(defun imalison:linum-before-numbering-hook ()
(setq imalison:linum-format
(concat "%" (number-to-string
(max (length (number-to-string (count-lines (point-min) (point-max)))) 3)) "d")))
(defun imalison:format-linum (line-text)
(propertize (format imalison:linum-format line-text) 'face 'linum))
(defun imalison:remove-fringe-and-hl-line-mode (&rest stuff) (defun imalison:remove-fringe-and-hl-line-mode (&rest stuff)
(interactive) (interactive)
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1)) (if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1)) (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1)) (if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
;; (set-fringe-mode 0) ;; Lets reenable fringes. They seem useful ;; (set-fringe-mode 0) ;; Lets reenable fringes. They seem useful
(defvar-setq linum-format 'dynamic) (defvar-setq linum-format 'imalison:format-linum)
(add-hook 'linum-before-numbering-hook 'imalison:linum-before-numbering-hook)
(setq left-margin-width 0) (setq left-margin-width 0)
(defvar-setq hl-line-mode nil)) (defvar-setq hl-line-mode nil))

View File

@ -15,7 +15,7 @@ function _setup_env {
hash brew 2>/dev/null && idem_add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin" hash brew 2>/dev/null && idem_add_to_front_of_path "$(brew --prefix coreutils)/libexec/gnubin"
idem_add_to_front_of_path "/usr/local/bin" idem_add_to_front_of_path "/usr/local/bin"
idem_add_to_front_of_path `python -c 'import sysconfig; print sysconfig.get_path("scripts")'` idem_add_to_back_of_path `python -c 'import sysconfig; print sysconfig.get_path("scripts")'`
if is_osx; then if is_osx; then
export CFLAGS=-Qunused-arguments export CFLAGS=-Qunused-arguments

View File

@ -369,7 +369,7 @@ function timestamp {
} }
function parse_timestamp { function parse_timestamp {
date -d "@$(echo $1 | cut -c -10)" date -d "@$(echo $1 | cut -c -10)" -Iseconds
} }
function clear_path { function clear_path {