intitni / CopilotForXcode

The missing GitHub Copilot, Codeium and ChatGPT Xcode Source Editor Extension

Home Page:https://copilotforxcode.intii.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Key bindings for most common commands?

KieranConlon opened this issue · comments

Having just installed and configured the CoPilotForXcode extension all works great but my experience is that I had to always select the menu options to get CoPilot suggestions/actions (maybe I did not setup everything correctly??).

Could creating some default keybindings help with this?
For some, keybindings are a very personal choice as they are often customised but I found these worked pretty well and did not conflict with any existing/standard Xcode keybindings.

CoPilot -> Get Suggestions: ⌥?
CoPilot -> Accept Suggestion: ⌥}
CoPilot -> Reject Suggestion: ⌥{
CoPilot -> Next Suggestion: ⌥>
CoPilot -> Previous Suggestion: ⌥<

Essentially using ⌥⇧ as the "access" key combination for all bindings.

Xcode-CoPilot_KeyBindings_Settings

Xcode-CoPilot_KeyBindings

Thanks for sharing, I don't think we can add default key bindings to commands, but will add this recommendation to readme.

A key binding section is added to README.md with your recommendation.

Snipaste_2023-03-02_19-09-16

Suggesting another set of key bindings...
commented

With the recent addition of the OpenAI chat feature, I suggest a couple of key bindings for the chat-specific feature.

CoPilot -> Chat with Selection: ⌥"
CoPilot -> Explain Selection: ⌥|

Again, using ⌥⇧ as the "access" key combination for these bindings.

The rationale for these bindings...
Chat: Using the 'quote' symbol for starting an OpenAI chat session has an analogy to starting a conversation with OpenAI where the initial question is about the selected (or quoted) text.
Explain: Using the 'pipe' symbol for starting an OpenAI session to explain the selected code has an analogy with command line tools (e.g. grep) for 'piping' text to another command so that additional processing of the code/selection can happen.

image

These bindings do not seem to conflict with standard key bindings used on Xcode.

image

I am using an English-UK keyboard layout, so the keys used may not be suitable for all languages/regions.

@intitni Do you think this could be added to the README?

commented

i think add this key bindings is very helpful for me, thanks @KieranConlon and hope can add into README

They are now added to readme

xcode setting did not show the CoPilot key bindings. Anyone know Why? and my codeium works well , i just cant search copilot in setting keybindings

@13088992520 Please make sure you have enabled the source editor extension https://github.com/intitni/CopilotForXcode#enable-the-extension

Hey guys! Just installed copilot for Xcode. I followed the recommended key bindings but whenever I use option + shift + }, it gives me a single quote. I have an external keyboard but it has a Mac toggle if that makes a difference. Thank you for any tips! I am new to the Mac world to learn swift so I am not sure if I am doing something wrong haha. Windows user most of my life.

@lisbonc1987 Make sure that you have setup the shortcuts in Xcode's Key Bindings as that will override the default key press.
To be honest, it doesn't matter if you have an external keyboard (I use an external keyboard 99% of the time with my MacBook Pro).

BTW welcome to developing with a Mac. As they say, once you go Mac you never go back!
Next thing you will discover Homebrew and get all the command line tools and libraries that you never knew you needed!!! :)