From 4c3c3f388557a182794bffdbf923129c66af885a Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Tue, 3 Aug 2021 18:10:54 +0200 Subject: feat: add lvim.lsp.smart_cwd (#1218) - Enable querying the language-server for the `root_dir` - Use `root_dir` to set the current working-directory (CWD) - Make vim-rooter configurable and add an option to disable it Inspired by "ahmedkhalf/lsp-rooter.nvim" --- lua/core/nvimtree.lua | 6 ++++++ lua/core/rooter.lua | 15 +++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 lua/core/rooter.lua (limited to 'lua/core') diff --git a/lua/core/nvimtree.lua b/lua/core/nvimtree.lua index e29168e9..1a0de0b8 100644 --- a/lua/core/nvimtree.lua +++ b/lua/core/nvimtree.lua @@ -117,4 +117,10 @@ M.toggle_tree = function() end end -- +function M.change_tree_dir(dir) + if vim.g.loaded_tree then + require("nvim-tree.lib").change_dir(dir) + end +end +-- return M diff --git a/lua/core/rooter.lua b/lua/core/rooter.lua new file mode 100644 index 00000000..8ebdf7cc --- /dev/null +++ b/lua/core/rooter.lua @@ -0,0 +1,15 @@ +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 -- cgit v1.2.3