feat(nvim): add git worktree plugin

This commit is contained in:
Stefan Imhoff
2022-10-02 13:58:53 +02:00
parent f437578868
commit 2437b5b056
6 changed files with 27 additions and 7 deletions

View File

@@ -10,4 +10,4 @@
.bundle/
m~
tags
.worktrees

View File

@@ -0,0 +1,9 @@
-- git-worktree.nvim https://github.com/ThePrimeagen/git-worktree.nvim
local cmp_status_ok, worktree = pcall(require, "git-worktree")
if not cmp_status_ok then
return
end
vim.g.git_worktree_log_level = "error"
worktree.setup()

View File

@@ -13,13 +13,10 @@ project.setup({
},
patterns = {
".git",
"_darcs",
".hg",
".bzr",
".svn",
"Makefile",
".gitignore",
"package.json",
"!node_modules",
},
show_hidden = false,
silent_chdir = true,

View File

@@ -15,11 +15,12 @@ telescope.load_extension("node_modules")
telescope.load_extension("file_browser")
telescope.load_extension("frecency")
telescope.load_extension("lsp_handlers")
telescope.load_extension("fzf")
telescope.load_extension("fzy_native")
telescope.load_extension("harpoon")
telescope.load_extension("projects")
telescope.load_extension("heading")
telescope.load_extension("gh")
telescope.load_extension("git_worktree")
-- Keymaps
keymap("n", "<C-p>", [[<Cmd>Telescope find_files<CR>]], opts)
@@ -34,6 +35,8 @@ keymap("n", "<leader>fa", [[<Cmd>Telescope find_files hidden=true<CR>]], opts)
keymap("n", "<leader>fb", [[<Cmd>Telescope file_browser<CR>]], opts)
keymap("n", "<leader>gb", [[<Cmd>Telescope git_branches<CR>]], opts)
keymap("n", "<leader>gs", [[<Cmd>Telescope git_status<CR>]], opts)
keymap("n", "<leader>gwc", [[<Cmd>Telescope git_worktree create_git_worktree<CR>]], opts)
keymap("n", "<leader>gww", [[<Cmd>Telescope git_worktree git_worktrees<CR>]], opts)
keymap("n", "<leader>ht", [[<Cmd>Telescope help_tags<CR>]], opts)
keymap("n", "<leader>km", [[<Cmd>Telescope keymaps<CR>]], opts)
keymap("n", "<leader>m", [[<Cmd>Telescope marks<CR>]], opts)
@@ -129,6 +132,12 @@ telescope.setup({
},
},
extensions = {
fzy_native = {
fuzzy = true,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
fzf = {
fuzzy = true,
override_generic_sorter = true,

View File

@@ -92,7 +92,7 @@ return packer.startup(function(use)
use("nvim-telescope/telescope-node-modules.nvim") -- node_modules packages
use("gbrlsnchs/telescope-lsp-handlers.nvim") -- LSP handlers
use("crispgm/telescope-heading.nvim") -- Jump between headings
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make" })
use("nvim-telescope/telescope-fzy-native.nvim") -- FZY style sorter that is compiled
use({ "nvim-telescope/telescope-frecency.nvim", requires = { "tami5/sqlite.lua" } }) -- Frequency and recency
use("nvim-telescope/telescope-github.nvim") -- GitHub CLI
use("nvim-telescope/telescope-symbols.nvim") -- Symbols
@@ -105,6 +105,7 @@ return packer.startup(function(use)
-- File/Window Management
use("ThePrimeagen/harpoon") -- Getting you where you want
use("ThePrimeagen/git-worktree.nvim") -- Git Worktree
use("lewis6991/gitsigns.nvim") -- Git decorations
use("kyazdani42/nvim-web-devicons") -- Icons and colors for file types
use("kyazdani42/nvim-tree.lua") -- A File Explorer

4
zshrc
View File

@@ -391,6 +391,10 @@ alias gu='git up'
alias gw='git whatchanged'
alias gwp='git whatchanged -p'
alias lg='lazygit'
alias gw='git worktree'
alias gwl='git worktree list'
alias gwa='git worktree add' # <folder> <branch/hash>
alias gwr='git worktree remove' # <path/name>
# Vim
alias v='vim'