Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cespare
Copy link
Contributor

@cespare cespare commented Dec 11, 2019

First, add ftdetect configuration to detect go.mod files as the 'gomod' filetype.

Then add syntax and indent files for this filetype.

The gomod syntax file is reused from the vim-go project under the terms of its 3-clause BSD license. The indent file is new work.

@myitcv
Copy link
Member

myitcv commented Dec 12, 2019

Thanks. Did you intend for this to also do something with respect to auto indenting in go.mod files?

For example, starting with:

module mod.com

go 1.14

require (_)

(which is typically a position I find myself in because I use auto-pairs) with the cursor at the position _, if I then hit <Enter> I get:

module mod.com

go 1.14

require (

    )

@cespare
Copy link
Contributor Author

cespare commented Dec 18, 2019

Sure, I can write an indent file. I agree it would be nice to have. Looks like vim-go doesn't have one, though.

@cespare cespare force-pushed the gomod-syntax branch 3 times, most recently from 9ba5982 to 2a8e571 Compare December 22, 2019 21:23
@cespare
Copy link
Contributor Author

cespare commented Dec 29, 2019

@myitcv I wrote a simple indent file for go.mod. I've never written an indent file before but this seems like a pretty basic filetype so hopefully this will cover all the important cases for now. PTAL.

@cespare cespare changed the title Detect go.mod as a 'gomod' filetype; add syntax Detect go.mod as a 'gomod' filetype; add syntax and indent Dec 29, 2019
Copy link
Member

@myitcv myitcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks. Tried it locally and all is 👍. We can follow up with a test some other time.

Just one comment/question about the position of the autocmd.

Then if you don't mind squashing the commits and providing a helpful commit message in the mould of previous commits https://github.com/govim/govim/commits/master. Use a prefix of cmd/govim to indicate this relates to the plugin.

First, add ftdetect configuration to detect go.mod files as the 'gomod'
filetype.

Then add syntax and indent files for this filetype.

The gomod syntax file is reused from the vim-go project under the terms
of its 3-clause BSD license. The indent file is new work.
@cespare
Copy link
Contributor Author

cespare commented Jan 7, 2020

Then if you don't mind squashing the commits and providing a helpful commit message in the mould of previous commits https://github.com/govim/govim/commits/master. Use a prefix of cmd/govim to indicate this relates to the plugin.

Done, though it seems like a strange convention to use cmd/govim to tag changes which are entirely distinct from the cmd/govim code and which do not touch the cmd/govim path.

@cespare cespare requested a review from myitcv January 7, 2020 20:57
@myitcv
Copy link
Member

myitcv commented Jan 8, 2020

though it seems like a strange convention to use cmd/govim to tag changes which are entirely distinct from the cmd/govim code and which do not touch the cmd/govim path.

There is some attempt at logic behind this rather strange approach.

github.com/govim/govim is a package in and of itself that should be used by people looking to write Vim plugins in Go.

github.com/govim/govim/cmd/govim is the plugin commonly known as govim.

Using the Go project convention here of using package paths for issue/PR prefixes, because this change relates to github.com/govim/govim/cmd/govim (albeit Vim files that live in parent directories) we use the cmd/govim prefix.

Not ideal when mixing repos like this, but that's the current logic FWIW.

Copy link
Member

@myitcv myitcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks very much for this contribution.

@myitcv
Copy link
Member

myitcv commented Jan 8, 2020

I'm going to merge this once #653 has landed.

@myitcv myitcv merged commit acb0572 into govim:master Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants