Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Rollback to Revision 2
Source Link
D. Ben Knoble
  • 27.7k
  • 3
  • 31
  • 68

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... (mapping formatting My initial try was to use something like this -> I(I use NvChad)

Solved mostly with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[1][0] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

This is assuming I don't change the workspace after launching vim.But that doesn't seem to do anything and Neogit uses workspace1/.. anyway :/

Any ideas?

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... (mapping formatting -> I use NvChad)

Solved mostly with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[1] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

This is assuming I don't change the workspace after launching vim.

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... My initial try was to use something like this (I use NvChad):

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[0] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

But that doesn't seem to do anything and Neogit uses workspace1/.. anyway :/

Any ideas?

added 77 characters in body
Source Link

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... (mapping formatting -> I use NvChad)

Solved mostly with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[1] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

This is assuming I don't change the workspace after launching vim.

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... (mapping formatting -> I use NvChad)

Solved with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[1] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... (mapping formatting -> I use NvChad)

Solved mostly with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[1] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

This is assuming I don't change the workspace after launching vim.

deleted 102 characters in body
Source Link

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... My initial try was to use something like this   (Imapping formatting -> I use NvChad)

Solved with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[0][1] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

But that doesn't seem to do anything and Neogit uses workspace1/.. anyway :/

Any ideas?

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/... My initial try was to use something like this (I use NvChad):

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[0] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}

But that doesn't seem to do anything and Neogit uses workspace1/.. anyway :/

Any ideas?

I'm trying to setup Neogit to open in my workspace directory instead of cwd. The problem is that I use multi root workspaces, so I usually set my cwd to be workspace1/...  (mapping formatting -> I use NvChad)

Solved with:

M.neovim = {
  n = {
    ["<leader>gg"] = {
      function()
          local neovim = require("neogit");
          neovim.open({ cwd = vim.lsp.buf.list_workspace_folders()[1] })
      end,
      "Open Neogit in lsp cwd",
    },
  }
}
modify snipet
Source Link
Loading
Source Link
Loading