feat(nvim pluigins): new nvim custom plugins
This commit is contained in:
parent
4a37a0a9b1
commit
9fb993f9da
|
@ -0,0 +1,8 @@
|
||||||
|
-- File: lua/custom/plugins/autopairs.lua
|
||||||
|
|
||||||
|
return {
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function()
|
||||||
|
require("nvim-autopairs").setup {}
|
||||||
|
end,
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
-- Unless you are still migrating, remove the deprecated commands from v1.x
|
||||||
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
|
||||||
|
return {
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
version = "*",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function ()
|
||||||
|
require('neo-tree').setup {}
|
||||||
|
end,
|
||||||
|
}
|
|
@ -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,
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
|
||||||
|
return {
|
||||||
|
'mrjones2014/op.nvim',
|
||||||
|
version = "*",
|
||||||
|
config = function ()
|
||||||
|
require('op').setup({
|
||||||
|
-- you can change this to a full path if `op`
|
||||||
|
-- is not on your $PATH
|
||||||
|
op_cli_path = 'op',
|
||||||
|
-- Whether to sign in on start.
|
||||||
|
signin_on_start = false,
|
||||||
|
-- show NerdFont icons in `vim.ui.select()` interfaces,
|
||||||
|
-- set to false if you do not use a NerdFont or just
|
||||||
|
-- don't want icons
|
||||||
|
use_icons = true,
|
||||||
|
-- command to use for opening URLs,
|
||||||
|
-- can be a function or a string
|
||||||
|
url_open_command = function()
|
||||||
|
if vim.fn.has('mac') == 1 then
|
||||||
|
return 'open'
|
||||||
|
elseif vim.fn.has('unix') == 1 then
|
||||||
|
return 'xdg-open'
|
||||||
|
end
|
||||||
|
return nil
|
||||||
|
end,
|
||||||
|
-- settings for op.nvim sidebar
|
||||||
|
sidebar = {
|
||||||
|
-- sections to include in the sidebar
|
||||||
|
sections = {
|
||||||
|
favorites = true,
|
||||||
|
secure_notes = true,
|
||||||
|
},
|
||||||
|
-- sidebar width
|
||||||
|
width = 40,
|
||||||
|
-- put the sidebar on the right or left side
|
||||||
|
side = 'right',
|
||||||
|
-- keymappings for the sidebar buffer.
|
||||||
|
-- can be a string mapping to a function from
|
||||||
|
-- the module `op.sidebar.actions`,
|
||||||
|
-- an editor command string, or a function.
|
||||||
|
-- if you supply a function, a table with the following
|
||||||
|
-- fields will be passed as an argument:
|
||||||
|
-- {
|
||||||
|
-- title: string,
|
||||||
|
-- icon: string,
|
||||||
|
-- type: 'header' | 'item'
|
||||||
|
-- -- data will be nil if type == 'header'
|
||||||
|
-- data: nil | {
|
||||||
|
-- uuid: string,
|
||||||
|
-- vault_uuid: string,
|
||||||
|
-- category: string,
|
||||||
|
-- url: string
|
||||||
|
-- }
|
||||||
|
-- }
|
||||||
|
mappings = {
|
||||||
|
-- if it's a Secure Note, open in op.nvim's Secure Notes editor;
|
||||||
|
-- if it's an item with a URL, open & fill the item in default browser;
|
||||||
|
-- otherwise, open in 1Password 8 desktop app
|
||||||
|
['<CR>'] = 'default_open',
|
||||||
|
-- open in 1Password 8 desktop app
|
||||||
|
['go'] = 'open_in_desktop_app',
|
||||||
|
-- edit in 1Password 8 desktop app
|
||||||
|
['ge'] = 'edit_in_desktop_app',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Custom formatter function for statusline component
|
||||||
|
statusline_fmt = function(account_name)
|
||||||
|
if not account_name or #account_name == 0 then
|
||||||
|
return '> 1Password: No active session'
|
||||||
|
end
|
||||||
|
|
||||||
|
return string.format('> 1Password: %s', account_name)
|
||||||
|
end
|
||||||
|
-- global_args accepts any arguments
|
||||||
|
-- listed under "Global Flags" in
|
||||||
|
-- `op --help` output.
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
Loading…
Reference in New Issue