Fujjitive is a Vim plugin for Jujutsu (jj), the Git-compatible VCS. Based on Tim Pope's legendary fugitive.vim, it's "so awesome, it should be illegal". That's why it's called Fujjitive.
The crown jewel of Fujjitive is :JJ (or just :J), which calls any
arbitrary Jujutsu command. If you know how to use jj at the command line, you
know how to use :JJ. It's vaguely akin to :!jj but with numerous
improvements:
-
The default behavior is to directly echo the command's output. Quiet commands avoid the dreaded "Press ENTER or type command to continue" prompt.
-
:JJ describe,:JJ split, and other commands that invoke an editor do their editing in the current Vim instance. -
:JJ diff,:JJ log, and other verbose, paginated commands have their output loaded into a temporary buffer. Force this behavior for any command with:JJ --paginateor:JJ -p. -
:JJ file annotateuses a temporary buffer with maps for additional triage. Press enter on a line to view the commit where the line changed, org?to see other available maps. -
Called with no arguments,
:JJopens a summary window with modified files. Pressg?to bring up a list of maps for numerous operations including diffing, splitting, committing, rebasing, and more.Key concept: Since Jujutsu has no staging area, the
skey in the summary buffer triggersjj split(to split changes into a new commit), andutriggersjj squash(to merge changes back). This is the JJ equivalent of Git's stage/unstage workflow. -
This command (along with all other commands) always uses the current buffer's repository, so you don't need to worry about the current working directory.
Additional commands are provided for higher level operations:
- View any blob, tree, commit, or tag in the repository with
:Gedit(and:Gsplit, etc.). :Gdiffsplit(or:Gvdiffsplit) brings up a diff view of the file.:Greadrestores the file from the parent revision.:Gwritewrites changes to the working copy.:Ggrepis:grepfor file searching.:Glgrepis:lgrepfor the same.:GMovedoes a file move and changes the buffer name to match.:GRenamedoes the same with a destination filename relative to the current file's directory.:GDeletedeletes the current file and simultaneously deletes the buffer.:GRemovedoes the same but leaves the (now empty) buffer open.:GBrowseto open the current file on the web front-end of your favorite hosting provider, with optional line range (try it in visual mode).
Add %{FujjitiveStatusline()} to 'statusline' to get an indicator
with the current change ID in your statusline.
For more information, see :help fujjitive.
Fujjitive adapts fugitive.vim's Git-centric workflow to Jujutsu's model:
| Git (fugitive) | JJ (fujjitive) | Notes |
|---|---|---|
git commit |
jj commit |
Describe current change and start new one |
git add (stage) |
jj split |
Split current change into two |
git reset (unstage) |
jj squash |
Squash changes back into parent |
git stash |
jj new |
Just create a new empty change |
git checkout |
jj edit |
Edit an existing change |
git branch |
jj bookmark |
Manage bookmarks (branches) |
git blame |
jj file annotate |
Annotate file history |
git push |
jj git push |
Push to remote via Git |
git fetch |
jj git fetch |
Fetch from remote via Git |
git rebase |
jj rebase |
Rebase changes |
Install using your favorite package manager, or use Vim's built-in package support.
{
"zenibako/vim-fujjitive",
}mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://github.com/zenibako/vim-fujjitive.git
vim -u NONE -c "helptags fujjitive/doc" -c q
Set g:fujjitive_jj_executable to customize the jj binary path:
let g:fujjitive_jj_executable = '/usr/local/bin/jj'
This project supports AI-assisted development via OpenCode. You can trigger OpenCode assistance by:
- Commenting
/opencodeor/ocon any issue or pull request - Including
/opencodeor/ocin a pull request review comment
OpenCode will help with code reviews, bug fixes, feature implementation, and documentation updates.
Based on fugitive.vim by Tim Pope. Copyright (c) Tim Pope. Distributed under
the same terms as Vim itself. See :help license.