Skip to content

Command to share given file within chat #641

Answered by sobanieca
sobanieca asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to your suggestions @olimorris I've implemented following custom command:

vim.api.nvim_create_user_command('Cga', function(opts)
  require("codecompanion").last_chat().References:add({
    id = opts.args,
    path = opts.args,
    source = "codecompanion.strategies.chat.slash_commands.file",
    opts = {
      pinned = true
    }
  })
end, { nargs = 1 });

Now this is extremely useful for me, because I can just navigate on nvim tree and press . which is a shortcut for providing command with file path already provided and I can just type Cga (ChatGPT add :P) and I'm there. Many thanks for help!

Replies: 7 comments 12 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@olimorris
Comment options

@sobanieca
Comment options

Comment options

You must be logged in to vote
7 replies
@olimorris
Comment options

@sobanieca
Comment options

@ravitemer
Comment options

@sobanieca
Comment options

@GitMurf
Comment options

Answer selected by sobanieca
Comment options

You must be logged in to vote
1 reply
@daliusd
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@hanipcode
Comment options

@hanipcode
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
tip: config Useful tip for your configuration
7 participants