Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whishlist: TestGoFiles, XTestGoFiles command wrappers #1346

Closed
vbauerster opened this issue Jul 8, 2017 · 2 comments
Closed

Whishlist: TestGoFiles, XTestGoFiles command wrappers #1346

vbauerster opened this issue Jul 8, 2017 · 2 comments

Comments

@vbauerster
Copy link

vbauerster commented Jul 8, 2017

There is :GoFiles command which lists the go files. I wish there to be similar commands for listing test files only, something like:
:GoTestFiles for go list -f '{{join .TestGoFiles "\n"}}'
:GoXTestFiles for go list -f '{{join .XTestGoFiles "\n"}}'

Default output of such listing commands is not very useful and not very readable. Therefore I propose to integrate such listing commands with fzf plugin seamlessly. For example, if fzf is installed, override :GoFiles to something like following and if there is no fzf, fallback to default.

command! FZFGoFiles call fzf#run(fzf#wrap({
    \ 'source': go#tool#Files(),
    \ 'options': '--preview "(highlight -O ansi {} || cat {}) 2> /dev/null | head -'.&lines.'"'
    \}))

(--preview option can be safely omitted)

@arp242
Copy link
Contributor

arp242 commented Jul 24, 2017

I don't think that adding new commands is a good solution since there are 16 filetypes that can be looped over.

Instead, I created a PR to make go#tool#Files() and :GoFiles accept an argument which specifies which filestypes to list; see #1372.


I'm not sure about the fzf integration... This seems like an entirely different thing? I'm not sure how this relates to listing test files etc.

@vbauerster
Copy link
Author

Sounds reasonable and good! Well integrating with fzf is optional, because who is familiar with fzf, can do integration manually.

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

No branches or pull requests

2 participants