mbox series

[v2,0/2] vim: configuration and sharness syntax

Message ID 20201209065537.48802-1-felipe.contreras@gmail.com (mailing list archive)
Headers show
Series vim: configuration and sharness syntax | expand

Message

Felipe Contreras Dec. 9, 2020, 6:55 a.m. UTC
After investigating alternatives for exrc I found too many, doing a wide
range of irrelevant stuff, many unmaintained, others requiring multiple
dependencies, and some loaded the configuration too late.

The only one that seemed to fit the bill is vim-addon-local-vimrc, which
does work straightofrwardly, but hasn't been updated since 2015.

Instead I chose to simply vim-addon-local-vimrc, and take advantage of
git ('git rev-parse --show-toplevel' saves us a lot of the complexity of
these loaders).

The result is a very simple loader which is also secure, since it cannot
do anything unless you manually whitelist the project(s) you want load
.vimrc files from.

And since I already created some files in 'contrib/vim' I decided to put
the sharness syntax file there too.


Felipe Contreras (2):
  Add project-wide .vimrc configuration
  contrib: vim: add sharness syntax file

 .vimrc                          | 23 ++++++++++++++++++++++
 contrib/vim/plugin/gitvimrc.vim | 21 ++++++++++++++++++++
 contrib/vim/syntax/sharness.vim | 34 +++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 .vimrc
 create mode 100644 contrib/vim/plugin/gitvimrc.vim
 create mode 100644 contrib/vim/syntax/sharness.vim

Comments

Jeff King Dec. 9, 2020, 5:11 p.m. UTC | #1
On Wed, Dec 09, 2020 at 12:55:35AM -0600, Felipe Contreras wrote:

> After investigating alternatives for exrc I found too many, doing a wide
> range of irrelevant stuff, many unmaintained, others requiring multiple
> dependencies, and some loaded the configuration too late.

I'm not opposed to this solution, but I probably wouldn't use it myself.
I wonder if it would be sufficient to just say "here are some sensible
vim options", coupled with human-readable instructions for how to
integrate them into your .vimrc, along with some path-selection.

It's perhaps not quite as turnkey. On the other hand, it's easy for
people who are even moderate vim users to understand what each line
does. In the plugin solution, there are more lines dedicated to loading
the config than there are actual config lines.

I dunno.

> And since I already created some files in 'contrib/vim' I decided to put
> the sharness syntax file there too.

This part I like very much. The actual policy logic is sufficiently
complex that I hope people will be able to contribute back small fixes.

-Peff
Felipe Contreras Dec. 10, 2020, 3:25 a.m. UTC | #2
On Wed, Dec 9, 2020 at 11:11 AM Jeff King <peff@peff.net> wrote:
>
> On Wed, Dec 09, 2020 at 12:55:35AM -0600, Felipe Contreras wrote:
>
> > After investigating alternatives for exrc I found too many, doing a wide
> > range of irrelevant stuff, many unmaintained, others requiring multiple
> > dependencies, and some loaded the configuration too late.
>
> I'm not opposed to this solution, but I probably wouldn't use it myself.
> I wonder if it would be sufficient to just say "here are some sensible
> vim options", coupled with human-readable instructions for how to
> integrate them into your .vimrc, along with some path-selection.
>
> It's perhaps not quite as turnkey. On the other hand, it's easy for
> people who are even moderate vim users to understand what each line
> does. In the plugin solution, there are more lines dedicated to loading
> the config than there are actual config lines.

If they only code for Git, it's straightforward to tell them how to
configure vim.

But if the user contributes to two projects with two different
code-styles it gets to get tricky to tell them what to do. And when
you get to three, my bet is that the vast majority of people wouldn't
know what's the best solution for the user.

This is the most non-intrusive solution.

Cheers.