-
Notifications
You must be signed in to change notification settings - Fork 349
vimdiff
comes as a pre-configured merge tool for jj
and can be used with jj resolve
out of the box. However, the default configuration for
vimdiff
as a diff editor (for jj split
, etc.) is barely useable.
To more conveniently use Vim as a difftool for jj
, try one of the following setups:
-
Install the
DirDiff
Vim plugin. -
Create a script in your
PATH
namedvimdirdiff
, with the following contents:
#!/bin/bash
# On Mac OS, you may need to replace `/bin/bash` with `/bin/zsh`.
# Shell-escape each path:
DIR1=$(printf '%q' "$1"); shift
DIR2=$(printf '%q' "$1"); shift
# The colorscheme is only important on Vim versions older than 9.0
vim "$@" -c "colorscheme murphy | DirDiff $DIR1 $DIR2"
- Make that script executable:
chmod +x vimdirdiff
. - In your
.jjconfig.toml
, setui.diff-editor="vimdirdiff"
.
-
Make sure you have Python installed. Optionally, check your Python version by running
python --version
. -
Install
vimtabdiff.py
as described here. Use the command for python <3.10 if you are not sure what your version of Python is.Make sure it is in your
PATH
and that you ranchmod +x
on it. -
In your
.jjconfig.toml
, setui.diff-editor="vimtabdiff.py"
.
- The UI if
DirDiff
is better if you have many files to compare, while thevimtabdiff.py
is better for fewer files - vimtabdiff.py requires having Python installed, while DirDiff doesn't.
- DirDiff requires installing a Vim plugin, while vimtabdiff.py doesn't.
The vim-jjdescription
Vim plugin
provides highlighting of .jjdescription
files that jj
uses to edit commit messages.
You can set Neovim to be your editor for describe
and other commands with the following config:
ui.editor = "nvim"
This pairs well with vim-jjdescription
Vim plugin as described above.
flatten.nvim allows you to un-nest Neovim instances. For example, running jj describe
in a :terminal
will open in the parent Neovim instance.
jj
expects the editor to wait until the file is closed to save. This can be achieved by using:
ui.editor = ["nvim", "--cmd", "let g:flatten_wait=1"]
zschreur/telescope-jj.nvim
is a Neovim plugin to provide you with similar behavior to Telescope's builtin.git_files
and builtin.git_status
functions, as well listing conflicts.
Cretezy/neo-tree-jj.nvim
is a Neovim plugin to provide you with similar behavior to Neo-tree's git_status
source. It can add a tab to Neo-tree to display the current status of a jj repo.
You can use AstroCommunity (even without using AstroNvim) to configure all these plugins at once. Import the jj pack in your Lazy.nvim config:
{
"AstroNvim/astrocommunity",
{ import = "astrocommunity.pack.jj" },
}
The jj-diffconflicts
plugin provides an interface to resolve merge conflicts. It can be configured to be invoked through jj resolve
.