Skip to content

Commit

Permalink
Merge pull request #97 from eatgrass/main
Browse files Browse the repository at this point in the history
ft: added `:AddProject` to add current directory manually
  • Loading branch information
ahmedkhalf authored Feb 26, 2023
2 parents 685bc8e + 52ec990 commit 1c2e9c9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lua/project_nvim/project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,11 @@ function M.on_buf_enter()
M.set_pwd(root, method)
end

function M.add_project_manually()
local current_dir = vim.fn.expand("%:p:h", true)
M.set_pwd(current_dir, 'manual')
end

function M.init()
local autocmds = {}
if not config.options.manual_mode then
Expand All @@ -261,6 +266,7 @@ function M.init()

vim.cmd([[
command! ProjectRoot lua require("project_nvim.project").on_buf_enter()
command! AddProject lua require("project_nvim.project").add_project_manually()
]])

autocmds[#autocmds + 1] =
Expand Down

0 comments on commit 1c2e9c9

Please sign in to comment.