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

Support fzf on GoDecls[Dir] #1437

Merged
merged 5 commits into from
Sep 25, 2017
Merged

Support fzf on GoDecls[Dir] #1437

merged 5 commits into from
Sep 25, 2017

Conversation

fsouza
Copy link
Contributor

@fsouza fsouza commented Sep 11, 2017

Revisiting #976.

This introduces a new configuration option (g:go_decls_mode). It's still missing documentation, but I wanted to open the PR anyway so I can get feedback on the implementation before moving forward with the documentation.

@fsouza
Copy link
Contributor Author

fsouza commented Sep 11, 2017

I just added some documentation, please also review that :D

@arp242
Copy link
Contributor

arp242 commented Sep 20, 2017

Thanks 👍 Seems to work well in my testing.


Using :GoDecls gives me:

vim-go: ctrlp.vim plugin is not installed. Please install from: https://github.com/ctrlpvim/ctrlp.vim

This message is somewhat confusing, since it should be more like "please install ctrlp.vim, fzf, or unite.vim" (unite.vim support was added in #1391, would be nice if g:go_decls_mode would also support unite.vim btw).

Actually, the best would be to autodetect one of those plugins and just use it, and have g:go_decls_mode only if you want to force using one of those plugins (in case you have multiple installed).

@fsouza
Copy link
Contributor Author

fsouza commented Sep 20, 2017

@Carpetsmoker Unite is supported through a different command, GoDecls can only use fzf or ctrlp.vim.

I'll update the PR so it detects the tool and use it, preferring ctrlp.vim so we can keep the current behavior.

Thanks for the feedback!

@arp242
Copy link
Contributor

arp242 commented Sep 20, 2017

Unite is supported through a different command, GoDecls can only use fzf or ctrlp.vim.

Wouldn't it be possible to have :GoDecls call :Unite decls if unite.vim is installed or if the g:go_decls_mode is set to unite?

I have no idea if this makes sense; I don't use any of these plugins myself :-) But it seems to me that this would make this command easier to use for people who have unite.vim installed?

let cmd = get({'ctrl-x': 'split',
\ 'ctrl-v': 'vertical split',
\ 'ctrl-t': 'tabe'}, a:str[0], 'e')
execute cmd filepath
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to escape this with fnameescape(filepath), otherwise it will break if the path contains characters (see :help fnameescape()).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh, nice to know, thank you!

I've updated the code.

@fsouza
Copy link
Contributor Author

fsouza commented Sep 22, 2017

@Carpetsmoker I think the integration with Unite exists to support people that use Unite (and therefore Unite decls), it's "the Unite way", so I don't think it makes sense to make GoDecls call Unite, but I can do it if you think that's the best approach.

I just finished the logic for automatically picking between fzf and ctrlp. Please let me know what you think.

Thanks for the feedback!

Otherwise a path such as `~/go/src/a/space path/a.go` will error out.

Also:

- add `abort` to all functions so they will stop when an error occurs;
- tweak docs a bit;
- while I'm here update the ChangeLog.
@arp242
Copy link
Contributor

arp242 commented Sep 24, 2017

Okay, did some more testing and works well; I did still encounter some problems when using paths with spaces in it. I fixed that in the above commit. I also tweaked the docs a wee bit in that.

Unite decls is "the Unite way", so I don't think it makes sense to make GoDecls call Unite, but I can do it if you think that's the best approach.

If that's the standard way then it's fine 👍

@fsouza
Copy link
Contributor Author

fsouza commented Sep 24, 2017

@Carpetsmoker awesome, thank you very much!

@arp242 arp242 merged commit 78b7db1 into fatih:master Sep 25, 2017
@fsouza fsouza deleted the decls-fzf branch September 25, 2017 13:00
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