Skip to content

Commit

Permalink
fix: Add telescope_create_worktree mappings from the worktree picker
Browse files Browse the repository at this point in the history
This means that a user can create a worktree when there is none, so allow
for an empty worktree list by not returning early if #results == 0.
  • Loading branch information
rbmarliere committed Sep 15, 2024
1 parent 4b2854b commit 0092aa5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lua/telescope/_extensions/git_worktree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ local telescope_git_worktree = function(opts)
parse_line(line)
end

if #results == 0 then
return
end
-- if #results == 0 then
-- return
-- end

local displayer = require('telescope.pickers.entry_display').create {
separator = ' ',
Expand Down Expand Up @@ -275,6 +275,12 @@ local telescope_git_worktree = function(opts)
attach_mappings = function(_, map)
action_set.select:replace(switch_worktree)

map('i', '<m-c>', function()
telescope_create_worktree {}
end)
map('n', '<m-c>', function()
telescope_create_worktree {}
end)
map('i', '<c-d>', delete_worktree)
map('n', '<c-d>', delete_worktree)
map('i', '<c-f>', toggle_forced_deletion)
Expand Down

0 comments on commit 0092aa5

Please sign in to comment.