feat(nvim pluigins): new nvim custom plugins
This commit is contained in:
parent
4a37a0a9b1
commit
9fb993f9da
4 changed files with 134 additions and 0 deletions
32
lua/custom/plugins/octo.lua
Normal file
32
lua/custom/plugins/octo.lua
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
|
||||
return {
|
||||
'pwntester/octo.nvim',
|
||||
version = "*",
|
||||
dependencies = {
|
||||
-- 1Password plugin for Neovim
|
||||
'mrjones2014/op.nvim',
|
||||
-- another plugin to make the UI a bit nicer
|
||||
'stevearc/dressing.nvim',
|
||||
},
|
||||
config = function ()
|
||||
require('octo').setup({
|
||||
gh_env = function()
|
||||
-- the 'op.api' module provides the same interface as the CLI
|
||||
-- each subcommand accepts a list of arguments
|
||||
-- and returns a list of output lines.
|
||||
-- use it to retrieve the GitHub access token from 1Password
|
||||
local github_token = require('op.api').item.get({ 'GitHub', '--fields', 'token' })[1]
|
||||
if not github_token or not vim.startswith(github_token, 'ghp_') then
|
||||
error('Failed to get GitHub token.')
|
||||
end
|
||||
|
||||
-- the values in this table will be provided to the
|
||||
-- GitHub CLI as environment variables when invoked,
|
||||
-- with the table keys (e.g. GITHUB_TOKEN) being the
|
||||
-- environment variable name, and the values (e.g. github_token)
|
||||
-- being the variable value
|
||||
return { GITHUB_TOKEN = github_token }
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue