Smarter delete-traiing-whitespace
This commit is contained in:
parent
dc5faf7691
commit
1d574bf3aa
1 changed files with 8 additions and 0 deletions
|
@ -69,6 +69,14 @@
|
|||
(add-hook! before-save 'delete-trailing-whitespace)
|
||||
(add-hook! eldoc-mode (diminish 'eldoc-mode " ?"))
|
||||
|
||||
(defadvice delete-trailing-whitespace (around delete-trailing-whitespace-ignore-line activate)
|
||||
"Don't delete trailing whitespace on current line, if in insert mode."
|
||||
(let ((spaces (current-column))
|
||||
(first-col (1+ (save-excursion (evil-first-non-blank) (current-column)))))
|
||||
ad-do-it
|
||||
(when (= spaces first-col)
|
||||
(insert (make-string (abs spaces) ? )))))
|
||||
|
||||
;; Line wrapping
|
||||
(add-hook! text-mode 'narf|enable-hard-wrap)
|
||||
(add-hook! prog-mode 'narf|enable-comment-hard-wrap)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue