Skip to content

Latest commit

 

History

History
47 lines (41 loc) · 1.16 KB

README.md

File metadata and controls

47 lines (41 loc) · 1.16 KB

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()