Interactive fzf+git for Neovim. I remembered the git commands so you wont forget.
GPL-3.0 License
Interactive git commands with fzf.
An elevator pitch:
pull
or push
? Your 'c' key bind is commit
or checkout
?Highlights
Wenxuan Zhang
Gfr
for git fetch; git rebase
You need
set rtp+=/usr/share/vim/vimfiles
runtime! plugin/fzf.vim
git ls_file
delta
git-forgit
to your PATH.https://user-images.githubusercontent.com/1681295/207864539-ec65b9c4-d8a0-4509-b13f-bd2192f742d9.mp4
Plug 'ray-x/guihua.lua' "lua GUI lib
Plug 'ray-x/forgit.nvim'
require'forgit'.setup({
debug = false, -- enable debug logging default path is ~/.cache/nvim/forgit.log
diff_pager = 'delta', -- you can use `diff`, `diff-so-fancy`
diff_cmd = '', -- you can use `DiffviewOpen`, `Gvdiffsplit` or `!git diff`, auto if not set
fugitive = false, -- git fugitive installed?
abbreviate = false, -- abvreviate some of the commands e.g. gps -> git push
git_alias = true, -- git command extensions see: Git command alias
show_result = 'quickfix', -- show cmd result in quickfix or notify
shell_mode = true, -- set to true if you using zsh/bash and can not run forgit commands
height_ratio = 0.6, -- height ratio of floating window when split horizontally
width_ratio = 0.6, -- width ratio of floating window when split vertically
cmds_list = {} -- additional commands to show in Forgit command list
-- e.g. cmd_list = {text = 'Gs get_hunks', cmd = 'Gitsigns get_hunks'}
})
Command | Action |
---|---|
Ga{!} | Interactive git add generator, bang! will unstage files |
Glo | Interactive git log generator |
Gi | Interactive .gitignore generator |
Gd | Interactive git diff viewer |
Grh | Interactive git reset HEAD <file> selector |
Gcf | Interactive git checkout <file> selector |
Gcb | Interactive git checkout <branch> selector |
Gbd | Interactive git branch -D <branch> selector |
Gct | Interactive git checkout <tag> selector |
Gco | Interactive git checkout <commit> selector |
Grc | Interactive git revert <commit> selector |
Gss | Interactive git stash viewer |
Gsp | Interactive git stash push selector |
Gclean | Interactive git clean selector |
Gcp | Interactive git cherry-pick selector |
Grb | Interactive git rebase -i selector |
Gbl | Interactive git blame selector |
Gfu | Interactive git commit --fixup && git rebase -i --autosquash selector |
Command | Action |
---|---|
Gac | Interactive git add generator, if file staged, run 'git commit' |
Gfz | run git fuzzy , sub commands supports, e.g. Gfz status
|
Gbc | Interactive git branch && checkout generator |
Gbc! | Interactive git branch -r && checkout generator |
Gde | Interactive git diff --name-only & edit selected file generator |
Gde! | Interactive git diff master/main --name-only & edit selected file generator |
Gdd | Interactive git diff --name-only & OpendiffView selected file generator |
Gdd! | Interactive git diff master/main --name-only & DiffviewOpen generator |
Gbc | Interactive git branch --sort=-committerdate && checkout generator, The preview is graphic view of git log |
Gdc | Interactive git log commit_hash & show diff against current & checkout generator |
Gldt | Interactive git log commit_hash & difftool hash of selected filename generator |
Gldt! | Interactive git log commit_hash & difftool hash of all files generator |
Gbdo | Interactive git branch & DiffviewOpen selected branch with diffview.nvim generator |
Gldo | Interactive git log commit_hash & DiffviewOpen current file with diffview.nvim generator |
Gldo! | Interactive git log commit_hash & DiffviewOpen all diff files with diffview.nvim generator |
Grlg | Interactive git rev-list & git grep generator |
Key | Action |
---|---|
Enter | Confirm |
Tab | Toggle mark and move up |
Shift - Tab | Toggle mark and move down |
? | Toggle preview window |
Alt - W | Toggle preview wrap |
Ctrl - S | Toggle sort |
Ctrl - R | Toggle selection |
Ctrl - Y | Copy commit hash* |
Ctrl - K / P | Selection move up |
Ctrl - J / N | Selection move down |
Alt - K / P | Preview move up |
Alt - J / N | Preview move down |
Command | Action |
---|---|
Gaa | git add --all |
Gap | git add -pu |
Gash | git stash |
Gasha | git stash apply |
Gashp | git stash pop |
Gashu | git stash --include-untracked |
Gau | git add -u |
Gbs | git bisect |
Gbsb | git bisect bad |
Gbsg | git bisect good |
Gbsr | git bisect reset |
Gbss | git bisect start |
Gc | git commit, if -m not specify, will prompt a ui.input |
Gce | git clean |
Gcef | git clean -fd |
Gcl | git clone |
Gdf | git diff -- |
Gdnw | git diff -w -- |
Gdw | git diff --word-diff |
Gdmn | git diff master/main --name-only | fzf |
Gdn | git diff --name-only | fzf |
Gf | git fetch |
Gfa | git fetch --all |
Gfr | git fetch; and git rebase |
Glg | git log --graph --decorate |
Gm | git merge |
Gmff | git merge --ff |
Gmnff | git merge --no-ff |
Gopen | git config --get remote.origin.url |
Gpl | git pull |
Gplr | git pull --rebase |
Gpla | git pull --autostash |
Gps | git push |
Gpsf | git push --force-with-lease |
Gr | git remote -v |
Grb | git rebase |
Grbi | git rebase -i |
Grbc | git rebase --continue |
Grba | git rebase --abort |
Grs | git reset -- |
Grsh | git reset --hard |
Grsl | git reset HEAD~ |
Gs | git status |
Gsh | git show |
Gt | git tag |
Gtop | git rev-parse --show-toplevel |
Gurl | git config --get remote.origin.url |
Forgit
command allows you to list all commands in a floating windows and you can fuzzy search and run any command you want.
delta
/ diff-so-fancy
: For better human readable diffs.
bat
: Syntax highlighting for gitignore
.
emoji-cli
: Emoji support for git log
.
git fugitive