Key map to add current file as context

I understand that it already reference the current file and have it labeled as “Current File” but when I navigate to a different file, I lose it. Is there a keymap to quickly add the current file that I’m on and have it stay even if I were to navigate away?

I mentioned keymap because to do I said before, I need to hit the + button and add it in manually. Wanted a quicker access way. Thanks!

11 Likes

Hi @simpleme ,

I am away from computer at the moment, but just a quick idea - I am assuming you are aware of the @ Symbols feature?

So you could type @, press Enter when the Files option is highlighted, and then the current file is most likely going to be the first file highlighted, so just click Enter again to select it.

When I get back to computer, I will have a look to see if the specific behaviour you described is already available.

1 Like

Is there a way to quickly add the currently selected file in the file view as context to the chat using keyboard shortcuts, instead of manually adding it through the chat interface?

1 Like

Hi @simpleme ,

I see, so you want the default ‘current file’ that is selected when pressing Ctrl + L in the Editor to be ‘pinned’ to the chat automatically so that when navigating to another file tab it doesn’t go away?

Or, alternatively, a keyboard shortcut to add the current file to the ‘pinned’ context of the chat?

I’ve taken a screenshot below to try and capture the current dynamic so that the devs can understand the dynamic more quickly.

Please let me know if my understanding is correct or not.

1 Like

This one.

Here is a user flow

  • The user wants to use the “Chat” feature for assistance.
  • They know which files they want to include as context for the Chat.
  • Their current process for adding files to the Chat context is: (a) Navigate to a file (b) Click the “+” in the Chat input field (c) Select the current file from the menu (this removes it) (d) Click “+” again (e) Select the current file again (this adds it back, but now “pinned”) They do this twice because:
    • The first time removes the default “Current file” from context
    • The second time adds it back as a “pinned” file, so it stays in context even when navigating away
  • They repeat step 3 for each file they want to include in the Chat context.
  • Finally, they ask their question to the Chat.

My ask: A keyboard shortcut to quickly add the current file to the “pinned” context of the chat

These suggestions aim to streamline their workflow and make it easier to set up the desired context for their Chat sessions.

1 Like

agree with this. Having a key command to pin it would be much better for workflow vs having to use the navigator. I also suggested in another post being able to click (or perhaps cmd+click since click opens the context) to pin it to the context with the ability to change files.

1 Like

Yeah, same here. I’m having a problem where I need to have three files always in context on the thread and I need a way to just keep them there while I save an update the files with cursor

1 Like

Zed has a very handy feature where you can type /tab and it will automatically add the current opened tab and /tab all where it adds all tabs to the context.

This is better than automatically having it in context because it’s not clear if it persists (as pointed out repeatedly in this thread).

2 Likes

bump; is there a keyboard shortcut for this now?

1 Like

This is still a much needed feature – it would remove friction, which is Cursor’s real competitive advantage.

1 Like

I mean there is already a context menu item, would be nice to have a hotkey, i want to open a file, add to chat, open other file on editor, also add to chat.. and so on, couldnt be that hard to add a hotkey to pin current open file to context?

I can even drag and drop the file in chat, but that adds also a @item to chat, when i delete it the file is also removed from context

2 Likes

Bump on this. Another relevant thread.

2 Likes

Bump!

1 Like

it would be incredibly useful to have a keyboard binding to add the active editor file to cursor chat. doing it through the navigator with the mouse 100x per day is time consuming. I’m attempting to map custom key bindings to this, but it does not exist as a command. I’m trying a hacky workaround to copy the active path, switch focus to chat, type @, paste the path, hit enter. it’s quite tedius and has the potential to create conflicts. it would be so natural and useful if this was a built in command and a default keyboard shortcut, please!

-thank you!

1 Like

in previous Cursor versions when you opened a Chat there always was the current file attached

need this feature back!

(as well as Manual mode)