Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlanJui/5379bdea401458f6844a6c69d48989d4 to your computer and use it in GitHub Desktop.
Save AlanJui/5379bdea401458f6844a6c69d48989d4 to your computer and use it in GitHub Desktop.

近日,每當在 Neovim 使用 neogit 插件,進行檔案變更後納管作業時,總會看到一道「快閃即過」的警示訊息!

由於不具備:一目瞭然,可以速讀的本事,對此一閃即過的警示訊息,我能補捉到的概廓,好像在說:「Neogit 易主了...!」

本想不理,但... 每當想要 commit 變更後的檔案,欲將之存檔時,那道警示便會又再閃現。感覺煩了,今天好好調查一下......

Neogit for Neovim官網

哦~~~!Neovim 可用的 Neogit 插件「搬家」了。

解決那個惱人的警示,方法很簡單:只需變更插件載入的網址即可。

return {
  -- A work-in-progress Magit clone for Neovim that is geared toward the Vim philosophy.
  {
    "NeogitOrg/neogit",
    dependencies = {
      "nvim-lua/plenary.nvim",
      "sindrets/diffview.nvim",
    },
    cmd = "Neogit",
    keys = {
      {
        "<leader>gn",
        "<cmd>Neogit<cr>",
        desc = "Neogit",
      },
    },
    config = function()
      local neogit = require("neogit")
      neogit.setup({
        -- disable_signs = false,
        -- disable_context_highlighting = false,
        disable_commit_confirmation = true,
        integrations = {
          diffview = true,
        },
        -- customize displayed signs
        signs = {
          -- { CLOSED, OPENED }
          section = { "", "" },
          item = { "", "" },
          hunk = { "", "" },
        },
      })

      -- Notification Highlighting
      vim.cmd([[
      hi NeogitNotificationInfo guifg=#80ff95
      hi NeogitNotificationWarning guifg=#fff454
      hi NeogitNotificationError guifg=#c44323
      ]])

      -- Contextual Highlighting
      vim.cmd([[
      hi def NeogitDiffAddHighlight guibg=#404040 guifg=#859900
      hi def NeogitDiffDeleteHighlight guibg=#404040 guifg=#dc322f
      hi def NeogitDiffContextHighlight guibg=#333333 guifg=#b2b2b2
      hi def NeogitHunkHeader guifg=#cccccc guibg=#404040
      hi def NeogitHunkHeaderHighlight guifg=#cccccc guibg=#4d4d4d
      ]])
    end,
  },
  ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment