Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 557352 - app-editors/neovim /etc/vim/nvimrc contains crummy default autocommand to strip whitespace on write
Summary: app-editors/neovim /etc/vim/nvimrc contains crummy default autocommand to str...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Normal minor (vote)
Assignee: Vim Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-12 09:19 UTC by Michael Rose
Modified: 2015-08-14 09:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Rose 2015-08-12 09:19:05 UTC
" Strip trailing spaces on write
autocmd BufWritePre * :%s/\s\+$//e

Aside from the fact that it it sometimes appropriate and necessary to leave whitespace at the end of a line this actually moves the cursor to the spot in question on write.

Writing to disk should not move the cursor.

This is the sort of change that should be left to the user not stuck in /etc to annoy the user every time they update the neovim package.
Comment 1 Michael Rose 2015-08-12 09:34:04 UTC
Commit that added this

https://cgit.gentoo.org/dev/yngwin.git/diff/app-editors/neovim/files/nvimrc?id=2790cee3c2c6bcabaaa674ffd1c2c58857a46248

Note the lines

-" We attempt to change as little as possible from Vim's defaults,
-" deviating only where it makes sense

+" Strip trailing spaces on write
+autocmd BufWritePre * :%s/\s\+$//e

How appropriate
Comment 2 Ben de Groot (RETIRED) gentoo-dev 2015-08-14 09:42:46 UTC
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e11e10747b61731a547e3389719a0d17e0962b91

While I hold it is a good default to have, I can understand some users not appreciating it. I have refactored the whole default nvimrc that we install, and changed the stripping whitespace functionality to apply to ebuilds and eclasses only, and to be easily turned off with a configuration switch.