diff options
Diffstat (limited to 'lua/core')
| -rw-r--r-- | lua/core/dashboard.lua | 11 | ||||
| -rw-r--r-- | lua/core/nvimtree.lua | 6 | ||||
| -rw-r--r-- | lua/core/project.lua | 48 | ||||
| -rw-r--r-- | lua/core/rooter.lua | 15 | ||||
| -rw-r--r-- | lua/core/telescope.lua | 3 | 
5 files changed, 61 insertions, 22 deletions
| diff --git a/lua/core/dashboard.lua b/lua/core/dashboard.lua index 649be14c..423cddd8 100644 --- a/lua/core/dashboard.lua +++ b/lua/core/dashboard.lua @@ -31,19 +31,16 @@ M.config = function()          description = { "  Find File          " },          command = "Telescope find_files",        }, -      b = { +      -- b is reserved for the core.project module +      c = {          description = { "  Recently Used Files" },          command = "Telescope oldfiles",        }, -      -- c = { -      --   description = { "  Load Last Session  " }, -      --   command = "SessionLoad", -      -- }, -      c = { +      d = {          description = { "  Find Word          " },          command = "Telescope live_grep",        }, -      d = { +      e = {          description = { "  Settings           " },          command = ":e " .. USER_CONFIG_PATH,        }, diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index 7c99a91e..737f248e 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -60,6 +60,12 @@ M.setup = function()      g["nvim_tree_" .. opt] = val    end +  -- Implicitly update nvim-tree when project module is active +  if lvim.builtin.project.active then +    vim.g.nvim_tree_update_cwd = 1 +    vim.g.nvim_tree_respect_buf_cwd = 1 +  end +    local tree_cb = nvim_tree_config.nvim_tree_callback    if not g.nvim_tree_bindings then diff --git a/lua/core/project.lua b/lua/core/project.lua new file mode 100644 index 00000000..650f2924 --- /dev/null +++ b/lua/core/project.lua @@ -0,0 +1,48 @@ +local M = {} +-- +function M.config() +  lvim.builtin.project = { +    --- This is on by default since it's currently the expected behavior. +    ---@usage set to false to disable project.nvim. +    active = true, + +    -- Manual mode doesn't automatically change your root directory, so you have +    -- the option to manually do so using `:ProjectRoot` command. +    manual_mode = false, + +    -- Methods of detecting the root directory. **"lsp"** uses the native neovim +    -- lsp, while **"pattern"** uses vim-rooter like glob pattern matching. Here +    -- order matters: if one is not detected, the other is used as fallback. You +    -- can also delete or rearangne the detection methods. +    detection_methods = { "lsp", "pattern" }, + +    -- All the patterns used to detect root dir, when **"pattern"** is in +    -- detection_methods +    patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" }, + +    -- When set to false, you will get a message when project.nvim changes your +    -- directory. +    silent_chdir = true, +  } +end +-- +function M.setup() +  local settings = lvim.builtin.project + +  -- Table of lsp clients to ignore by name +  -- eg: { "efm", ... } +  settings["ignore_lsp"] = {} + +  -- Path where project.nvim will store the project history for use in +  -- telescope +  settings["datapath"] = CACHE_PATH + +  require("project_nvim").setup(settings) + +  lvim.builtin.dashboard.custom_section["b"] = { +    description = { "  Recent Projects    " }, +    command = "Telescope projects", +  } +end +-- +return M diff --git a/lua/core/rooter.lua b/lua/core/rooter.lua deleted file mode 100644 index 8ebdf7cc..00000000 --- a/lua/core/rooter.lua +++ /dev/null @@ -1,15 +0,0 @@ -local M = {} -function M.config() -  lvim.builtin.rooter = { -    --- This is on by default since it's currently the expected behavior. -    ---@usage set to false to disable vim-rooter. -    active = true, -    silent_chdir = 1, -    manual_only = 0, -  } -end -function M.setup() -  vim.g.rooter_silent_chdir = lvim.builtin.rooter.silent_chdir -  vim.g.rooter_manual_only = lvim.builtin.rooter.manual_only -end -return M diff --git a/lua/core/telescope.lua b/lua/core/telescope.lua index e72727a4..5d9263d7 100644 --- a/lua/core/telescope.lua +++ b/lua/core/telescope.lua @@ -119,6 +119,9 @@ function M.setup()      return    end    telescope.setup(lvim.builtin.telescope) +  if lvim.builtin.project.active then +    pcall(require("telescope").load_extension, "projects") +  end  end  return M | 
