summaryrefslogtreecommitdiff
path: root/lua/plugins/fugitive.lua
blob: ce5e173d91a5a7f7ff9223a7589e3c13e1d20768 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
return {
  lazy = false,
  "tpope/vim-fugitive",
  dependencies = "tpope/vim-rhubarb",
  config = function()

    local handle = io.popen('git rev-parse --is-inside-work-tree 2> /dev/null')
    if handle then
      local result = handle:read('*a')
      handle:close()
      if result and result:match('true') then
        vim.cmd([[Gcd]])
      end
    end

  end,
  -- Only load when using one of the following commands:
  keys = {
    { "<leader>gs", "<cmd>G<CR>" }, -- G.it S.tatus
    { "<leader>gd", "<cmd>G difftool<CR>" }, -- G.it D.iff
    { "<leader>gm", "<cmd>Gvdiffsplit!<CR>" }, -- G.it M.erge
    { "<leader>gc", "<cmd>G commit<CR>" }, -- G.it C.ommit
    { "<leader>gu", "<cmd>G push<CR>" }, -- G.it push U.pstream
    { "<leader>gp", "<cmd>G pull<CR>" }, -- G.it P.ull
    { "<leader>gf", "<cmd>G fetch<CR>" }, -- G.it F.etch
  },
}