Skip to content

Mohanbarman/g-worktree.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

g-worktree.nvim

A better git worktree integration for neovim

Installation

Packer

return require("packer").startup(function(use)
  use({ "Mohanbarman/g-worktree.nvim" })
end)

Setup

This is the default configuration

M.setup({
  -- this pattern is used while deciding the directory to use for worktree, it's relative to your main git repo's path
  base_dir_pattern = "../{git_dir_name}-wt/{branch_name}",
  post_create_cmd = "Explore .", -- you can use any vim cmd in this case default netrw window will open 
  change_dir_after_create = true, -- do you want to switch current directory after create ?
  clearjumps = true,
})

Usage

Creating worktree

require('g-worktree').create_worktree('<BRANCH_NAME>')

Switch to different worktree

require('g-worktree').switch_worktree('<BRANCH_NAME>')

Deleting a worktree

require('g-worktree').remove_worktree('<BRANCH_NAME>')

Telescope

require("telescope").load_extension("g_worktree") -- load telescope extension

-- switch worktree
require('telescope').extensions.g_worktree.list()

-- create worktree
require('telescope').extensions.g_worktree.create()

About

A better git worktree integration for neovim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages