Skip to content

Latest commit

 

History

History
78 lines (61 loc) · 1.74 KB

README.md

File metadata and controls

78 lines (61 loc) · 1.74 KB

telescope-jj.nvim

A Telescope picker for Jujutsu repos.

Setup

Using lazy.nvim

'zschreur/telescope-jj.nvim'

Using vim-plug

Plug 'zschreur/telescope-jj.nvim'

Using dein

call dein#add('zschreur/telescope-jj.nvim')

Using packer.nvim

use {
  'zschreur/telescope-jj.nvim'
}

Load the extension in your config with:

telescope.load_extension("jj")

Example

{
    "zschreur/telescope-jj.nvim",
    config = function()
        telescope.load_extension "jj"
    end,
},

Usage

-- opts is optional telescope picker options

telescope.extensions.jj.conflict(opts) -- list files with conflicts
telescope.extensions.jj.diff(opts) -- list files with differences (like jj status)
telescope.extensions.jj.files(opts) -- list all files in repo

Git fallback

The example below includes a fallback to the default git_files picker if the jj picker fails.

local builtin = require("telescope.builtin")
local telescope = require("telescope")

telescope.load_extension("jj")

local vcs_picker = function(opts)
    local jj_pick_status, jj_res = pcall(telescope.extensions.jj.files, opts)
    if jj_pick_status then
        return
    end

    local git_files_status, git_res = pcall(builtin.git_files, opts)
    if not git_files_status then
        error("Could not launch jj/git files: \n" .. jj_res .. "\n" .. git_res)
    end
end

vim.keymap.set("n", "<C-p>", vcs_picker, {})