gp.nvim icon indicating copy to clipboard operation
gp.nvim copied to clipboard

1Password support for multiple accounts

Open ERElli opened this issue 1 year ago • 2 comments

Hey there, I'm attempting to get my openai_api_key from 1password but I'm having an issue with a flag (--account) being recognized. This flag works when used in the command line directly but is failing when used in the gp.nvim config.

I need to use this flag because I have multiple 1password accounts

This is my lazy.nvim config

return {
	"robitx/gp.nvim",
	lazy=false,
	config = function()
		local conf = {
			openai_api_key = {
				"op",
				"read",
				"op://vault/item/field",
				"--account <account url here>",
			},
		}
		require("gp").setup(conf)
	end
}

This is a screenshot of the error I get after <C-g><C-g> to generate a response image

This an example of a the op read command failing without the account flag and passing with the account flag image

Thanks!

ERElli avatar Oct 04 '24 12:10 ERElli

Just a guess, but you might need to split the parameters to op read into individual strings:

			openai_api_key = {
				"op",
				"read",
				"op://vault/item/field",
				"--account",
				"<account_url_here>"
			},

ken-lauer avatar Dec 06 '24 17:12 ken-lauer

Just a guess, but you might need to split the parameters to op read into individual strings:

			openai_api_key = {
				"op",
				"read",
				"op://vault/item/field",
				"--account",
				"<account_url_here>"
			},

This worked for me. Thanks!

martinmose avatar Jan 05 '25 19:01 martinmose