-
Notifications
You must be signed in to change notification settings - Fork 90
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
C++ Support #33
Comments
Could you describe what kind of support you'd like? I don't really write C++, so I can't tell what would be useful. For instance, take a look at the recent pull request that adds C support, #36. Are some of these things useful to you? If clauses
Function calls
|
Hi Andrew, That would do it in 90% of the cases, I imagine. In fact, I think it would work with a number of other languages as well, such as Java etc. [Related to this: It would be nice to be able to activate SplitJoin for a particular filetype on another filetype (e.g., use "C/C++"-mode SplitJoin in a Java file) for cases like this: maybe I should submit this as a separate issue?] The only C++-specific thing I could add, if I were to be greedy, is for initializer lists in constructors: Initializer ListsFrom:
To:
But, as I said, that is me being greedy. The pull request you reference really would be quite serviceable for most folks for most of the cases. |
Technically, you can re-use splitters and joiners. If you take a look at the if !exists('b:splitjoin_split_callbacks')
let b:splitjoin_split_callbacks = [
\ 'sj#c#SplitIfClause',
\ 'sj#c#SplitFuncall',
\ ]
endif
if !exists('b:splitjoin_join_callbacks')
let b:splitjoin_join_callbacks = [
\ 'sj#c#JoinFuncall',
\ 'sj#c#JoinIfClause',
\ ]
endif The two variables just hold a list of functions to attempt for splitting and joining. They can be overridden by users if some callbacks should be excluded or for the sake of adding custom callbacks. So, if you'd like to get the same things to work for java, you could just create an Of course, this does require a little bit Vimscript knowledge. Still, I can't think of a good way to share the definitions and keep the simplicity of the ftplugin setup at the same time. As for the initializer lists, I'll see what I can do. |
Hi Andrew, was not aware of this. This does make custom application of logic very flexible. Thank you! |
its been ~8 years since last message here, wanted to know if anyone is working on it? |
@ViRu-ThE-ViRuS Do you mean the initializer list? I haven't worked on it, I'm afraid. I don't write C++ myself. I think I gave it a shot at the time, but ran into problems parsing the content. I could try it again, see how far I can take it -- is this the feature you're looking for? Maybe you could share a few more examples so I can have an idea of edge cases I might run into? |
Hey @AndrewRadev! this is the feature im looking for, but its okay if it doesn't exist yet. I just feel the lack of a plugin which can easily collapse single line if/else blocks, and also split them to make adding additional lines to each block easier. |
Is it possible to have this? Thanks,
The text was updated successfully, but these errors were encountered: