project.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. local M = {}
  2. function M.config()
  3. lvim.builtin.project = {
  4. ---@usage set to false to disable project.nvim.
  5. --- This is on by default since it's currently the expected behavior.
  6. active = true,
  7. on_config_done = nil,
  8. ---@usage set to true to disable setting the current-woriking directory
  9. --- Manual mode doesn't automatically change your root directory, so you have
  10. --- the option to manually do so using `:ProjectRoot` command.
  11. manual_mode = false,
  12. ---@usage Methods of detecting the root directory
  13. --- Allowed values: **"lsp"** uses the native neovim lsp
  14. --- **"pattern"** uses vim-rooter like glob pattern matching. Here
  15. --- order matters: if one is not detected, the other is used as fallback. You
  16. --- can also delete or rearangne the detection methods.
  17. -- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
  18. detection_methods = { "pattern" },
  19. -- All the patterns used to detect root dir, when **"pattern"** is in
  20. -- detection_methods
  21. patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" },
  22. -- Table of lsp clients to ignore by name
  23. -- eg: { "efm", ... }
  24. ignore_lsp = {},
  25. -- Don't calculate root dir on specific directories
  26. -- Ex: { "~/.cargo/*", ... }
  27. exclude_dirs = {},
  28. -- Show hidden files in telescope
  29. show_hidden = false,
  30. -- When set to false, you will get a message when project.nvim changes your
  31. -- directory.
  32. silent_chdir = true,
  33. -- What scope to change the directory, valid options are
  34. -- * global (default)
  35. -- * tab
  36. -- * win
  37. scope_chdir = "global",
  38. ---@type string
  39. ---@usage path to store the project history for use in telescope
  40. datapath = get_cache_dir(),
  41. }
  42. end
  43. function M.setup()
  44. local status_ok, project = pcall(require, "project_nvim")
  45. if not status_ok then
  46. return
  47. end
  48. project.setup(lvim.builtin.project)
  49. if lvim.builtin.project.on_config_done then
  50. lvim.builtin.project.on_config_done(project)
  51. end
  52. end
  53. return M