project.nvim icon indicating copy to clipboard operation
project.nvim copied to clipboard

Manually add project

Open kishikaisei opened this issue 2 years ago • 6 comments

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)

kishikaisei avatar Nov 08 '21 19:11 kishikaisei

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

grdl avatar Nov 29 '21 14:11 grdl

+1 for manually add/remove project

FuGangqiang avatar Jan 19 '22 04:01 FuGangqiang

Can't get :ProjectRoot to work either. Is this a bug?

Snow-0 avatar May 08 '22 01:05 Snow-0

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.

Alex23rodriguez avatar Jun 05 '22 19:06 Alex23rodriguez

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.

magidc avatar Aug 14 '22 22:08 magidc

PR #75 adds this functionality. Waiting for it to get merged.

pspiagicw avatar Aug 30 '22 08:08 pspiagicw