Skip to content

Commit

Permalink
feat(neogit): enable neogit integrations if they are available (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter authored Jul 18, 2023
1 parent 5ffae06 commit 3102b7c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 10 deletions.
13 changes: 10 additions & 3 deletions lua/astrocommunity/git/diffview-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
return {
"sindrets/diffview.nvim",
event = "User AstroGitFile",
cmd = { "DiffviewOpen" },
{
"sindrets/diffview.nvim",
event = "User AstroGitFile",
cmd = { "DiffviewOpen" },
},
{
"NeogitOrg/neogit",
optional = true,
opts = { integrations = { diffview = true } },
},
}
25 changes: 21 additions & 4 deletions lua/astrocommunity/git/neogit/init.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@
local utils = require "astronvim.utils"
local prefix = "<leader>g"
local maps = { n = {} }
local icon = vim.g.icons_enabled and "󰰔 " or ""
maps.n[prefix] = { desc = icon .. "Neogit" }
require("astronvim.utils").set_mappings(maps)
utils.set_mappings { n = { [prefix] = { desc = icon .. "Neogit" } } }

local fold_signs = { utils.get_icon "FoldClosed", utils.get_icon "FoldOpened" }
return {
{
"NeogitOrg/neogit",
dependencies = {
{ "nvim-lua/plenary.nvim" },
},
event = "User AstroGitFile",
opts = {},
opts = function(_, opts)
return utils.extend_tbl(opts, {
disable_builtin_notifications = utils.is_available "nvim-notify",
telescope_sorter = function()
if utils.is_available "telescope-fzf-native.nvim" then
return require("telescope").extensions.fzf.native_fzf_sorter()
end
end,
integrations = { telescope = utils.is_available "telescope.nvim" },
signs = { section = fold_signs, item = fold_signs },
})
end,
keys = {
{ prefix .. "nt", "<cmd>Neogit<CR>", desc = "Open Neogit Tab Page" },
{ prefix .. "nc", "<cmd>Neogit commit<CR>", desc = "Open Neogit Commit Page" },
{ prefix .. "nd", ":Neogit cwd=", desc = "Open Neogit Override CWD" },
{ prefix .. "nk", ":Neogit kind=", desc = "Open Neogit Override Kind" },
},
},
{
"catppuccin/nvim",
optional = true,
opts = { integrations = { neogit = true } },
},
}
13 changes: 10 additions & 3 deletions lua/astrocommunity/utility/telescope-fzy-native-nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-telescope/telescope-fzy-native.nvim" },
opts = function() require("telescope").load_extension "fzy_native" end,
{
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-telescope/telescope-fzy-native.nvim" },
opts = function() require("telescope").load_extension "fzy_native" end,
},
{
"NeogitOrg/neogit",
optional = true,
opts = { telescope_sorter = function() return require("telescope").extensions.fzy_native.native_fzy_sorter() end },
},
}

0 comments on commit 3102b7c

Please sign in to comment.