Re:An opinionated approach to GNU Make
by godshatter on Tuesday December 17, 2019 @02:59PM
(#21818058)
I ":set expandtab" in vim by default, I don't like mixing tabs and spaces. People have different opinions on this, I get it. So when I pop on over to the Makefile buffer, I have to remember to either ":set noexpandtab" or to copy a previous target down and edit it directly. Now I'll just swap out ">" instead of using tabs, which will make things simpler.
[ Parent
| on HN ]
I have the same setting, but vim automatically sets `noexpandtab` when editing a file named Makefile. I don't have any explicit setting to do that, nor any Makefile-related plugin.
Re:An opinionated approach to GNU Make
by alwillis on Tuesday December 17, 2019 @05:52PM
(#21819839)
>I have the same setting, but vim automatically sets `noexpandtab` when editing a file named Makefile.
Yes, you can see this in the make filetype plugin in Vim’s $VIMRUNTIME directory, which is usually
/usr/share/vim/vim81
which contains all of the plugins, syntax definition files, etc. that come with Vim. The file for make is located at $VIMRUNTIME/ftplugin/make.vim.
It’s pretty straight forward to override any default behavior you’d like to change; this is a great article on how all of this works [1].
Re:An opinionated approach to GNU Make
by godshatter on Tuesday December 17, 2019 @04:49PM
(#21819291)
That's interesting, I didn't know that. I think I might be shooting myself in the foot by saving a session and doing "vim -S" to load it again with expandtab set or something. I load multiple buffers associated with a project and use :b to move from file to file. I know it expands the tab when I move to the Makefile buffer, because I have to kick myself and remember to set noexpandtab when it inevitably puts in spaces. Or maybe putting expandtab in my .vimrc overrides the normal behavior.