project.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. ---@usage patterns used to detect root dir, when **"pattern"** is in detection_methods
  20. patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json", "pom.xml" },
  21. ---@ Show hidden files in telescope when searching for files in a project
  22. show_hidden = false,
  23. ---@usage When set to false, you will get a message when project.nvim changes your directory.
  24. -- When set to false, you will get a message when project.nvim changes your directory.
  25. silent_chdir = true,
  26. ---@usage list of lsp client names to ignore when using **lsp** detection. eg: { "efm", ... }
  27. ignore_lsp = {},
  28. ---@type string
  29. ---@usage path to store the project history for use in telescope
  30. datapath = get_cache_dir(),
  31. }
  32. end
  33. function M.setup()
  34. local status_ok, project = pcall(require, "project_nvim")
  35. if not status_ok then
  36. return
  37. end
  38. project.setup(lvim.builtin.project)
  39. if lvim.builtin.project.on_config_done then
  40. lvim.builtin.project.on_config_done(project)
  41. end
  42. end
  43. return M