-
Notifications
You must be signed in to change notification settings - Fork 752
Fish shell
For setting up completions, see https://jj-vcs.github.io/jj/latest/install-and-setup/#command-line-completion. The new (dynamic) completions are recommended; they work very well with Fish.
Update/Note: Since fish 4.0, a basic jj prompt is shipped with fish out of the box: https://github.com/fish-shell/fish-shell/blob/master/share/functions/fish_jj_prompt.fish. You may still be interested in replacing the default fish_jj_prompt function with something more elaborate.
There are multiple prompts that people have written for fish, each with their own benefits. They slot into the existing fish_vcs_prompt function right before fish_git_prompt, so that colocated jj repositories will print the jj prompt.
Community members have written some example prompts:
- hroi has written a prompt which will print a significant amount of information, good for those that like double-line prompts:
- example:
(main "Allow bookmarks to be a…" sl 0) - https://gist.github.com/hroi/d0dc0e95221af858ee129fd66251897e/
- example:
- strega-nil has written a prompt which will print significantly less information, good for those who prefer smaller prompts:
You can change fish functions with the funced command, which will bring up the current source of that function in your configured editor. First, you should add the fish_jj_prompt function:
> funced fish_jj_prompt
> # (copy in the code from one of the links)
> funcsave fish_jj_prompt
Then, you can edit the fish_vcs_prompt the same way; you want to add a line calling fish_jj_prompt:
function fish_vcs_prompt --description 'Print all vcs prompts'
# If a prompt succeeded, we assume that it's printed the correct info.
# This is so we don't try svn if git already worked.
- fish_git_prompt $argv
+ fish_jj_prompt $argv
+ or fish_git_prompt $argv
or fish_hg_prompt $argv
or fish_fossil_prompt $argv
# The svn prompt is disabled by default because it's quite slow on common svn repositories.
# To enable it uncomment it.
# You can also only use it in specific directories by checking $PWD.
# or fish_svn_prompt
end