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

How to switch between ".h" and ".cpp"? #2

Open
zhuzelong opened this issue Apr 16, 2020 · 5 comments
Open

How to switch between ".h" and ".cpp"? #2

zhuzelong opened this issue Apr 16, 2020 · 5 comments

Comments

@zhuzelong
Copy link

In my project, the source file are *.h and *.cpp. How to switch between them?

@Yohannfra
Copy link
Owner

It was not possible before this commit, I didn't think about that use case.

Now it's fix, as the README says just add this line to your .vimrc to be able to switch between ".cpp" and ".h"

let g:goto_header_associate_cpp_h = 1

@another-pjohnson
Copy link

@Yohannfra Unfortunately you would need to do something similar to support ".h" -> ".cpp". Some projects use cc instead of cpp.

@rafaelrojasmiliani
Copy link

rafaelrojasmiliani commented Dec 3, 2023

@another-pjohnson is right. This issue should not be closed before fixing this. I think that it would be possible to change this string by a regular expression.

rafaelrojasmiliani added a commit to rafaelrojasmiliani/Vim-Goto-Header that referenced this issue Dec 3, 2023
rafaelrojasmiliani added a commit to rafaelrojasmiliani/Vim-Goto-Header that referenced this issue Dec 3, 2023
@Yohannfra Yohannfra reopened this Dec 3, 2023
@Yohannfra
Copy link
Owner

You are right, thanks for reminding me of this issue. What I did with the goto_header_associate_cpp_h variable was a quick hack but it is not a proper solution. There are people using .h, .hh, .hpp, .h++ and many more. I can't hard code a solution like this.

A few months ago I started to write a solution to this problem in this repository : https://github.com/Yohannfra/Vim-Quick-Switch but I still have a lot of modifications not commited on my computer and didn't have the time to finish it back then. I'll try to do it asap and merge it back in this plugin.

Thanks for your interest and contribution.

@Yohannfra
Copy link
Owner

I will merge #2 for now since it's a fix for your use case but this is still a hacky solution that will be removed when I'll merge the new algorithm.

Yohannfra added a commit that referenced this issue Dec 3, 2023
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

4 participants