project.nvim
project.nvim copied to clipboard
Manually add project
So I have a couple of typescript projects that are git initialised, and for some reason they don't want to get added to the list of projects. They reside in a subdirectory of a subversion folder (mapped to a drive). I tried using the drive, the actual folder, or symlinked the actual project elsewhere, I assumed that maybe there is some sort of conflict between .svn and .git (even though they far apart) and still nothing. I don't want to spend long debugging this, as I don't have bandwith for it at the moment, I wanted to make sure if there is a way to forcefully add the cwd to the list in any way? (ProjectRoot didn't do the trick)
I think you can try adding the path to the historyfile manually.
Find your historyfile by running :lua print(require("project_nvim.utils.path").historyfile)
.
In my case it's: ~/.cache/nvim/project_nvim/project_history
+1 for manually add/remove project
Can't get :ProjectRoot to work either. Is this a bug?
I also wanted this feature. Here is how I implemented it:
function _ADD_CURR_DIR_TO_PROJECTS()
local historyfile = require("project_nvim.utils.path").historyfile
local curr_directory = vim.fn.expand("%:p:h")
vim.cmd("!echo " .. curr_directory .. " >> " .. historyfile)
end
vim.cmd("command! ProjectAddMuanually lua _ADD_CURR_DIR_TO_PROJECTS()")
Simply add this to your init.lua
or wherever you have your project_nvim config.
To use, just type :ProjectAddManually
while on a file at the base of your project.
I would like to share my solution to this problem.
Instead of relying on locating .git, .svn or others to identify project root folder, I am only relying in a custom file.
In the project plugin setup I added this:
patterns = { ".project.nvim" }
So wherever I want to select root project folder, I simply place an empty file named ".project.nvim" there. Thats all.
PR #75 adds this functionality. Waiting for it to get merged.