emacs config

..

I use Emacs in console. The linum-mode displays the line numbers just well. However, in the console, there is no space between the line numbers and the text content, which makes it a little messy some times. How to add a space between the line numbers and text content in Emacs?

 If you are using the linum-mode for displaying the line numbers, you can define your own linum-format to specify the format by adding the space in your ~/.emacs:
(require 'linum)
(global-linum-mode t)
;; use customized linum-format: add a addition space after the line number
(setq linum-format (lambda (line) (propertize (format (let ((w (length (number-to-string (count-lines (point-min) (point-max)))))) (concat "%"
                                                                                                                                           (number-to-string w) "d ")) line) 'face 'linum)))

(require 'package)
(setq package-archives '(("gnu"   . "http://mirrors.cloud.tencent.com/elpa/gnu/")
                         ("melpa" . "http://mirrors.cloud.tencent.com/elpa/melpa/")))
(package-initialize)


(setq make-backup-files nil)

(use-package counsel
  :ensure t
  :config
  (counsel-mode 1)
  )

(use-package recentf
  :ensure t
  :config
  (recentf-mode 1)
  (setq recentf-max-saved-items 100)
  :bind
  ("C-x C-r" . recentf-open-files)
  )

(use-package which-key
  :ensure t
  :init (which-key-mode)
  )

(use-package multiple-cursors
  :ensure t
  )


(use-package rainbow-mode
  :ensure t
  :config
  (rainbow-mode 1)
  )
(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
    (counsel which-key use-package rainbow-mode multiple-cursors))))
(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.
 )

 

posted @ 2022-12-21 16:08  voh99800  阅读(16)  评论(0编辑  收藏  举报