diff options
author | Ahmed Khalf <[email protected]> | 2021-08-18 09:34:26 +0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-18 01:34:26 -0400 |
commit | b9b9c69615b469146e3cc75adcf9bd61047404eb (patch) | |
tree | e6b3ea906e1c1d2c6710deec6e16ae5f01799713 /lua/core/project.lua | |
parent | 21b621c95af592d0da46a29fe4dcc02e5d16c6eb (diff) |
[Refactor]: Remove vim-rooter and smart-cwd; then use project.nvim (#1315)
* Replace vim-rooter with project.nvim
* Implement stylua format
* Remove smart_cwd
* Implicitly update nvim-tree dir when project active
* Link datapath to cache
* Fix stylua
* Fix lint
* Fix telescope bug
* Fix telescope dependency
* Fix telescope once and for all
* Fix telescope once again
Diffstat (limited to 'lua/core/project.lua')
-rw-r--r-- | lua/core/project.lua | 48 |
1 files changed, 48 insertions, 0 deletions
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 |