XVimProject / XVim

Xcode plugin for Vim keybindings
MIT License
5.16k stars 596 forks source link

:xccmd ex command #135

Closed tomlu closed 12 years ago

tomlu commented 12 years ago

ViEmu (the Vim emulator for Visual Studio) has this really cool thing where there is an ex command for issuing Visual Studio commands. This would allow nice mnemonic mappings like: vaci :vscmd VisualAssistX.CreateImplementation

If there is a way where we can predictably turn an arbitrary string into an Xcode menu command, we could do the same here.

JugglerShu commented 12 years ago

I think I can implement similar thing. Here's a link to actions which can be invoked from the XCode menu. https://github.com/JugglerShu/XVim/blob/master/Documents/Developers/MenuActionList.txt

Some ex commands use these actions. So just dispatching the specified action name will do what you are saying I think.

Is this what you intended?

JugglerShu commented 12 years ago

I implemented it. But user need to know the action names. So... We need help command or something to help this.

tomlu commented 12 years ago

Yes, this is exactly what I had in mind.

I think just the documentation more or less as is should be fine for this.

brendanjerwin commented 11 years ago

I'd like to be able to call other menu items. Things added by other plugins (View->Uncrustify in my case). Is this possible?

JugglerShu commented 11 years ago

So is it on in your menu? Theorically it can be called with xccmd command if you already know the name of action bound to the menu item.

If you know how to debug XVim( Actually its almost same as usual applications ) you can use traceMenu method in XVim/Logger.m to dump all the action names in menu.

Let me know if you don't know how.

brendanjerwin commented 11 years ago

No, not sure how to debug XVim. (Xcode hung when I tried to attach to xcode...)

JugglerShu commented 11 years ago

Is this what you installed ? https://github.com/benoitsan/BBUncrustifyPlugin-Xcode

As far as I read the source code the action name is "uncrustify" So "xccmd uncrustify" should work....

But it may not work because of the cursor forcusing problem. Let me know if its not working.

brendanjerwin commented 11 years ago

I did. It doesn't.

On Wed, Mar 27, 2013 at 1:19 AM, JugglerShu notifications@github.com wrote:

Is this what you installed ? https://github.com/benoitsan/BBUncrustifyPlugin-Xcode As far as I read the source code the action name is "uncrustify" So "xccmd uncrustify" should work.... But it may not work because of the cursor forcusing problem.

Let me know if its not working.

Reply to this email directly or view it on GitHub: https://github.com/JugglerShu/XVim/issues/135#issuecomment-15504895

JugglerShu commented 11 years ago

OK. Let me have some days to take a look into the problem.

JugglerShu commented 11 years ago

Here's title and action name list.

Title:Uncrustify Selected Files    Action:uncrustifySelectedFiles:
Title:Uncrustify Active File    Action:uncrustifyActiveFile:
Title:Uncrustify Selected Lines    Action:uncrustifySelectedLines: 

But this still does not work with xccmd. I'm doing further investigation. Please wait for a while.

UPDATE: They updated the actions here 4 days ago. So the list above is true for most recent version of the plugin.

brendanjerwin commented 11 years ago

Ok. Thx.

On Mon, Apr 1, 2013 at 1:31 PM, JugglerShu notifications@github.com wrote:

Here's title and action name list. Title:Uncrustify Selected Files Action:uncrustifySelectedFiles: Title:Uncrustify Active File Action:uncrustifyActiveFile: Title:Uncrustify Selected Lines Action:uncrustifySelectedLines:

But this still does not work with xccmd. I'm doing further investigation. Please wait for a while.

Reply to this email directly or view it on GitHub: https://github.com/JugglerShu/XVim/issues/135#issuecomment-15725886

JugglerShu commented 11 years ago

I have added some fix to refactoring branch and merged it into master. Now you can use following command :xccmd uncrustifyActiveFile

And also in visual mode you can use :'<,'>xccmd uncrustifySelectedLines

You do not use "uncrustifySelectedFiles" in source view context.

brendanjerwin commented 11 years ago

Thx. Works for me!

On Apr 2, 2013, at 10:04 AM, JugglerShu notifications@github.com wrote:

I have added some fix to refactoring branch and merged it into master. Now you can use following command :xccmd uncrustifyActiveFile

And also in visual mode you can use :'<,'>xccmd uncrustifySelectedLines

You do not use "uncrustifySelectedFiles" in source view context.

— Reply to this email directly or view it on GitHub.