aboutsummaryrefslogtreecommitdiffstats
path: root/lua/plugins/note.lua
blob: e2b5db3d6f2bb863622adf5f7ee9a629186f1443 (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
28
29
30
31
32
return {
  {
    "jellydn/my-note.nvim",
    dependencies = { "MunifTanjim/nui.nvim" },
    keys = {
      {
        "<leader>mn",
        "<cmd>MyNote<cr>",
        desc = "Open MyNote",
      },
      {
        "<leader>mg",
        "<cmd>MyNote global<cr>",
        desc = "Open MyNote Global",
      },
    },
    opts = {
      files = {
        -- Using the parent .git folder as the cwd
        cwd = function()
          local bufPath = vim.api.nvim_buf_get_name(0)
          -- Use native vim.fs.find instead of lspconfig.util
          local cwd = vim.fs.find(".git", {
            path = bufPath,
            upward = true,
          })[1]
          return cwd and vim.fs.dirname(cwd) or vim.fn.getcwd()
        end,
      },
    },
  },
}