Giter VIP home page Giter VIP logo

forgit's Introduction

πŸ’€ forgit

Utility tool for using git interactively. Powered by junegunn/fzf.

pre-commit Contributors

This tool is designed to help you use git more efficiently. It's lightweight and easy to use.

πŸ“₯ Installation

Make sure you have fzf installed.

# for zplug
zplug 'wfxr/forgit'

# for zgen
zgen load 'wfxr/forgit'

# for antigen
antigen bundle 'wfxr/forgit'

# for fisher (requires fisher v4.4.3 or higher)
fisher install wfxr/forgit

# for omf
omf install https://github.com/wfxr/forgit

# for zinit
zinit load wfxr/forgit

# for oh-my-zsh
git clone https://github.com/wfxr/forgit.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/forgit

# manually
# Clone the repository and source it in your shell's rc file or put bin/git-forgit into your $PATH

Homebrew

To install using brew

brew install forgit

Then add the following to your shell's config file:

# Fish:
# ~/.config/fish/config.fish:
[ -f $HOMEBREW_PREFIX/share/forgit/forgit.plugin.fish ]; and source $HOMEBREW_PREFIX/share/forgit/forgit.plugin.fish

# Zsh:
# ~/.zshrc:
[ -f $HOMEBREW_PREFIX/share/forgit/forgit.plugin.zsh ] && source $HOMEBREW_PREFIX/share/forgit/forgit.plugin.zsh

# Bash:
# ~/.bashrc:
[ -f $HOMEBREW_PREFIX/share/forgit/forgit.plugin.sh ] && source $HOMEBREW_PREFIX/share/forgit/forgit.plugin.sh

Fig

Fig adds apps, shortcuts, and autocomplete to your existing terminal.

Install forgit in just one click.

Install with Fig

Arch User Repository

AUR packages, maintained by the developers of forgit, are available. Install the forgit package for the latest release or forgit-git to stay up to date with the latest commits from the master branch of this repository.

πŸ“ Features

  • Interactive git add selector (ga)

screenshot

  • Interactive git log viewer (glo)

screenshot

The log graph can be disabled by option FORGIT_LOG_GRAPH_ENABLE (see discuss in issue #71).

  • Interactive .gitignore generator (gi)

screenshot

  • Interactive git diff viewer (gd)

  • Interactive git reset HEAD <file> selector (grh)

  • Interactive git checkout <file> selector (gcf)

  • Interactive git checkout <branch> selector (gcb)

  • Interactive git branch -D <branch> selector (gbd)

  • Interactive git checkout <tag> selector (gct)

  • Interactive git checkout <commit> selector (gco)

  • Interactive git revert <commit> selector (grc)

  • Interactive git stash viewer (gss)

  • Interactive git stash push selector (gsp)

  • Interactive git clean selector (gclean)

  • Interactive git cherry-pick selector (gcp)

  • Interactive git rebase -i selector (grb)

  • Interactive git blame selector (gbl)

  • Interactive git commit --fixup && git rebase -i --autosquash selector (gfu)

⌨ Keybindings

Key Action
Enter Confirm
Tab Toggle mark and move down
Shift - Tab Toggle mark and move up
? Toggle preview window
Alt - W Toggle preview wrap
Ctrl - S Toggle sort
Ctrl - R Toggle selection
Ctrl - Y Copy commit hash/stash ID*
Ctrl - K / P Selection move up
Ctrl - J / N Selection move down
Alt - K / P Preview move up
Alt - J / N Preview move down
Alt - E Open file in default editor (when possible)

* Available when the selection contains a commit hash or a stash ID. For Linux users FORGIT_COPY_CMD should be set to make copy work. Example: FORGIT_COPY_CMD='xclip -selection clipboard'.

βš™ Options

Options can be set via environment variables. They have to be exported in order to be recognized by forgit.

For instance, if you want to order branches in gcb by the last committed date you could:

export FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS='--sort=-committerdate'

shell aliases

You can change the default aliases by defining these variables below. (To disable all aliases, Set the FORGIT_NO_ALIASES flag.)

forgit_log=glo
forgit_diff=gd
forgit_add=ga
forgit_reset_head=grh
forgit_ignore=gi
forgit_checkout_file=gcf
forgit_checkout_branch=gcb
forgit_branch_delete=gbd
forgit_checkout_tag=gct
forgit_checkout_commit=gco
forgit_revert_commit=grc
forgit_clean=gclean
forgit_stash_show=gss
forgit_stash_push=gsp
forgit_cherry_pick=gcp
forgit_rebase=grb
forgit_blame=gbl
forgit_fixup=gfu

git integration

You can use forgit as a sub-command of git by making git-forgit available in $PATH:

# after `forgit` was loaded
PATH="$PATH:$FORGIT_INSTALL_DIR/bin"

Some plugin managers can help do this.

Then, any forgit command will be a sub-command of git:

git forgit log
git forgit add
git forgit diff

Optionally you can add aliases in git:

git config --global alias.cf 'forgit checkout_file'

And use forgit functions via a git alias:

git cf

git options

If you want to customize git's behavior within forgit there is a dedicated variable for each forgit command. These are passed to the according git calls.

Command Option
ga FORGIT_ADD_GIT_OPTS
glo FORGIT_LOG_GIT_OPTS
gd FORGIT_DIFF_GIT_OPTS
grh FORGIT_RESET_HEAD_GIT_OPTS
gcf FORGIT_CHECKOUT_FILE_GIT_OPTS
gcb FORGIT_CHECKOUT_BRANCH_GIT_OPTS, FORGIT_CHECKOUT_BRANCH_BRANCH_GIT_OPTS
gbd FORGIT_BRANCH_DELETE_GIT_OPTS
gct FORGIT_CHECKOUT_TAG_GIT_OPTS
gco FORGIT_CHECKOUT_COMMIT_GIT_OPTS
grc FORGIT_REVERT_COMMIT_GIT_OPTS
gss FORGIT_STASH_SHOW_GIT_OPTS
gsp FORGIT_STASH_PUSH_GIT_OPTS
gclean FORGIT_CLEAN_GIT_OPTS
grb FORGIT_REBASE_GIT_OPTS
gbl FORGIT_BLAME_GIT_OPTS
gfu FORGIT_FIXUP_GIT_OPTS
gcp FORGIT_CHERRY_PICK_GIT_OPTS

pagers

Forgit will use the default configured pager from git (core.pager, pager.show, pager.diff) but can be altered with the following environment variables:

Use case Option Fallbacks to
common pager FORGIT_PAGER git config core.pager or cat
pager on git show FORGIT_SHOW_PAGER git config pager.show or $FORGIT_PAGER
pager on git diff FORGIT_DIFF_PAGER git config pager.diff or $FORGIT_PAGER
pager on git blame FORGIT_BLAME_PAGER git config pager.blame or $FORGIT_PAGER
pager on gitignore FORGIT_IGNORE_PAGER bat -l gitignore --color always or cat
git log format FORGIT_GLO_FORMAT %C(auto)%h%d %s %C(black)%C(bold)%cr%reset

fzf options

You can add default fzf options for forgit, including keybindings, layout, etc. (No need to repeat the options already defined in FZF_DEFAULT_OPTS)

export FORGIT_FZF_DEFAULT_OPTS="
--exact
--border
--cycle
--reverse
--height '80%'
"

Customizing fzf options for each command individually is also supported:

Command Option
ga FORGIT_ADD_FZF_OPTS
glo FORGIT_LOG_FZF_OPTS
gi FORGIT_IGNORE_FZF_OPTS
gd FORGIT_DIFF_FZF_OPTS
grh FORGIT_RESET_HEAD_FZF_OPTS
gcf FORGIT_CHECKOUT_FILE_FZF_OPTS
gcb FORGIT_CHECKOUT_BRANCH_FZF_OPTS
gbd FORGIT_BRANCH_DELETE_FZF_OPTS
gct FORGIT_CHECKOUT_TAG_FZF_OPTS
gco FORGIT_CHECKOUT_COMMIT_FZF_OPTS
grc FORGIT_REVERT_COMMIT_FZF_OPTS
gss FORGIT_STASH_FZF_OPTS
gsp FORGIT_STASH_PUSH_FZF_OPTS
gclean FORGIT_CLEAN_FZF_OPTS
grb FORGIT_REBASE_FZF_OPTS
gbl FORGIT_BLAME_FZF_OPTS
gfu FORGIT_FIXUP_FZF_OPTS
gcp FORGIT_CHERRY_PICK_FZF_OPTS

Complete loading order of fzf options is:

  1. FZF_DEFAULT_OPTS (fzf global)
  2. FORGIT_FZF_DEFAULT_OPTS (forgit global)
  3. FORGIT_CMD_FZF_OPTS (command specific)

Examples:

  • ctrl-d to drop the selected stash but do not quit fzf (gss specific).
export FORGIT_STASH_FZF_OPTS='
--bind="ctrl-d:reload(git stash drop $(cut -d: -f1 <<<{}) 1>/dev/null && git stash list)"
'
  • ctrl-e to view the logs in a vim buffer (glo specific).
export FORGIT_LOG_FZF_OPTS='
--bind="ctrl-e:execute(echo {} |grep -Eo [a-f0-9]+ |head -1 |xargs git show |vim -)"
'

other options

Option Description Default
FORGIT_LOG_FORMAT git log format %C(auto)%h%d %s %C(black)%C(bold)%cr%Creset
FORGIT_PREVIEW_CONTEXT lines of diff context in preview mode 3
FORGIT_FULLSCREEN_CONTEXT lines of diff context in full-screen mode 10
FORGIT_DIR_VIEW command used to preview directories tree if available, otherwise find

πŸ“¦ Optional dependencies

Completions

Bash

  • Put completions/git-forgit.bash in ~/.local/share/bash-completion/completions to have bash tab completion for git forgit and configured git aliases.
  • Source completions/git-forgit.bash explicitly to have bash tab completion for forgit shell functions and aliases (e.g., gcb <tab> completes branches).

Zsh

  • Put completions/_git-forgit in a directory in your $fpath (e.g., /usr/share/zsh/site-functions) to have zsh tab completion for git forgit and configured git aliases, as well as shell command aliases, such as forgit::add and ga

If you're having issues after updating, and commands such as forgit::add or aliases ga aren't working, remove your completions cache and restart your shell.

> rm ~/.zcompdump
> zsh

πŸ’‘ Tips

  • Most of the commands accept optional arguments (e.g., glo develop, glo f738479..188a849b -- main.go, gco master).
  • gd supports specifying revision(e.g., gd HEAD~, gd v1.0 README.md).
  • Call gi with arguments to get the wanted .gitignore contents directly(e.g., gi cmake c++).

πŸ“ƒ License

MIT (c) Wenxuan Zhang

forgit's People

Contributors

abheyogy avatar arikdavidov avatar benavern avatar boidolr avatar carlfriedrich avatar carlosedp avatar ccoveille avatar cjappl avatar congee avatar doronbehar avatar equineontology avatar folliehiyuki avatar gerrit-k avatar hyperupcall avatar ibayramli avatar indianboy42 avatar jsfaint avatar laggardkernel avatar mirsella avatar nothingelsematters avatar oakninja avatar p00f avatar pablombg avatar petertriho avatar rlanore avatar sandr01d avatar sohkai avatar tapayne88 avatar wfxr avatar wren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

forgit's Issues

alias method

The way to set up alias is seem very unconventional, is there a reason to not use the alias command instead ?

forgit_log=glo
forgit_diff=gd
forgit_add=ga
forgit_reset_head=grh
forgit_ignore=gi
forgit_restore=gcf
forgit_clean=gclean
forgit_stash_show=gss

alias glo='forgit::log'
alias gd='forgit::diff'
alias ga='forgit::add'
alias grh='forgit::reset_head'
alias gi='forgit::ignore'
alias gcf='forgit::restore'
alias gclean='forgit::clean'
alias gss='forgit::stash_show'

Preview not working in sub-directories

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

Related with issue #29 and #39
There is now preview when you are in a subdirectory.
After searching where the solution for #29 changed, I found it was removed in PR #58.

It this the expected behavior? Am I missing something?

[BUG] - fish throw an "hash" error

Hi, on an up to date Void Linux system, fish, version 3.0.2
using "source ~/.config/forgit/forgit.plugin.fish" in ~/.config/fish/config.fish

I get

~/.config/forgit/forgit.plugin.fish (ligne 16)Β :
if not hash fzf > /dev/null 2>&1
^
du fichier source /.config/forgit/forgit.plugin.fish
appelΓ© Γ  la ligne 331 du fichier '
/.config/fish/config.fish'

du fichier source ~/.config/fish/config.fish
appelΓ© pendant le dΓ©marrage

~/.config/forgit/forgit.plugin.fish (ligne 32)Β :
hash emojify >/dev/null 2>&1 && set forgit_emojify '|emojify'
^
du fichier source /.config/forgit/forgit.plugin.fish
appelΓ© Γ  la ligne 331 du fichier '
/.config/fish/config.fish'

du fichier source ~/.config/fish/config.fish
appelΓ© pendant le dΓ©marrage

Indeed hash is not a builtin command and does not exist otherwise in my system

Thanks

Bash syntax error when executing `ga`

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

I added source (curl -sSL git.io/forgit.fish | psub) to my fish config file and trying the commands to explore forgit. When I try command ga, I get the below error.
Screen Shot 2020-06-20 at 2 37 59 PM

The other commands are working fine.

Show content of untracked files when previewing with `ga`

Hi,

Thank you for making this tool!

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

  1. Create a new file named foo that contains hello
  2. Type ga
  3. The file foo appears in the list but the preview for it is empty, it does not show hello

It would be nice to have this because once I type ga and see a new untracked file I can decide whether I need to add it or ignore it in .gitignore.

I can see why this can be an issue: What would be the expected behaviour when adding a new untracked folder? Maybe ga should list all the untracked files and not just their parent directory?

image

XDG default folder

export FORGIT_GI_REPO=~/.forgit/gi/repos/dvcs/gitignore # https://github.com/dvcs/gitignore.git

Could we change this so that it will use $XDG_CONFIG_HOME if it's set and otherwise use the home directory?

Thanks for a great program!

Add support for viewing stashes

Any way support could be added for viewing stashes? Currently I hate viewing stashes in SourceTree, and git's cli is suboptimal for it.

glo: doesn't display proper diffs with commit history slice

Environment info

  • OS
    • Linux
  • Shell
    • zsh

Problem / Steps to reproduce

glo first_ref..last_ref

e.g.: glo 188a849b..73e5ca0d

Expected behavior:

Shows the commits only including that slice, and each diff is separate.

Actual behavior:

Shows the commits only including that slice, but if you hover over any of them, it shows the diff of the whole slice itself, not each separate commit.

`ga` does not seem to work or load anything

First, thanks for this awesome tool! I just discovered it and already wished to have used it for the past months!

However the ga which is correctly setup as which ga shows that it's the forgit function does not trigger/show anything. It seems to either return or swallow an error.

Any idea on if that's a problem with ga itself or how I can debug more?

Thanks!

[Question] Interact with selection

Hi,
Thank you for this awesome plugin.
But one question, while I select a stash, is there any way to delete it? like a keybinding or so?

Thanks

git log --graph edges point the wrong way

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

The git log viewer calls git log --graph. Because the commits are shown bottom-up, the graph edges point the wrong way. See for example the log of forgit itself:

Schermafdruk van 2020-01-29 15-34-26

I don't think it is possible to have git output a reverse graph (--graph and --reverse are mutually exclusive). Maybe --graph should be omitted from the git log command?

zsh:7: parse error near `|'

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

I just have pulled the latest repository and tried ga. This is the output:

CleanShot 2020-02-20 at 21 48 35@2x

Not sure where's this coming from. Any ideas?

Support for fish?

Just getting in to FZF and found this! It looks killer.

Any chance of supporting fish in the future? I'm sure it'd unlock even more users!

Add fish shell support

Hello
I've noticed that zsh is supported. Are there plans to support fish shell, too?

Change default mapping of select all to ctrl+a?

Just wondering if there is a reason it's ctrl+r, I think ctrl+a is a little more common, and may be more intuitive

set FORGIT_FZF_DEFAULT_OPTS "
$FZF_DEFAULT_OPTS
--ansi
...
--bind='ctrl-r:toggle-all'    <------
...
$FORGIT_FZF_DEFAULT_OPTS
"

Support pager program specified in global git config

forgit should be able to use whatever program is specified by the git config core.pager.

I use delta as my git pager, and I work around the lack of support in forgit quite well by adding a faux diff-so-fancy shell script to my path that calls delta.

Add command for git clean

Hi,

Since git clean does not currently have inclusion filter, is there any chance you might add some convenient helpers for git clean? :)

Failed to read /dev/tty when trying to execute "glo"

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

This is what happens when I try to execute glo alias.

➜  dawidd6/homebrew-tap master βœ—  glo
echo {} |grep -Eo '[a-f0-9]+' |head -1 |xargs -I% git show --color=always %  | diff-so-fancy | less --tabs=4 -RFX
Failed to read /dev/tty
➜  dawidd6/homebrew-tap master βœ—  [3;1R

Does not happen with gd and ga for example.

Adding multiple files without quitting?

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

Is there a way to ga multiple files without exiting back to the shell? I looked through the scripts and nothing jumped out, but maybe I'm missing something!

Support for options to pass to `git diff`

Hello and thank you for forgit. I think I am starting to like it.

But I didn't find diff-so-fancy (which you suggest in the README) to my particular liking so I removed it.

My git df alias uses -w to suppress white space changes to increase the content-wise SNR, and --word-diff=color to avoid excess lines in my diffs. I would like ga to show the same. Likewise others may have other diff preferences.

ga needn't do anything specific to support each option, but if you provide some mechanism to pass our desired options to git diff, such as from an environment variable FORGIT_DIFF_OPTIONS (similar to existing FORGIT_FZF_DEFAULT_OPTS) then it would be useful.

Thanks!

Feature request: support diff origin

Hello there,

Could we have support for the git diff origin command?
Something like gd origin would be perfect.

Motivation:
git diff will only show the difference between what was committed and what is not committed.
When working with different branches, it is common workflow to commit locally, thus git diff will show no difference.

xargs: realpath: No such file or directory

Just installed forgit using zplug. When running gd i get the following error. How can I debug this? other forgit commands seem to work fine

xargs: realpath: No such file or directory

Feature request: branches

First of all thank you very much for providing this plugin. Super useful!

It would also be great to include an interactive branch selection.

For example: expect gbr to interactively search through all branches.

ga - patch mode

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

Irrelevant

Feature

Add a new command, or extand ga for patch mode (git add --patch).

Remove explicitly untracked files from ga

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

With the recent introduction of untracked files preview in PR #67 there is a problem concerning showing untracked files even if the user explicitly disabled that functionality in .git/config with this configuration:

[status]
  showUntrackedFiles = no

My use-case - I have a repo for my home directory that I use for my dotfiles. I've explicitly disabled untracked files in status as my entire home directory contents will be flagged as untracked. With that recent change ga will have to load 400k files before it present me with fzf picker which makes it unusable.

Solution - remove --untracked-files argument from both git status commands in forgit::add() function. It should work as before but it will allow people to disable them from git config.

Diff doesn't work in subdirectories

Description

When I have changes in a sub-subdirectory, switch into the intermediate subdirectory and run gd, the diff preview from diff-so-fancy is empty (see screenshots below). The files are listed, but the paths are probably incorrect. Notice that although I've cd'ed into the subdirectory, the files listed in fzf still have the path related to the git root. Not sure though, if this is an issue with forgit or diff-so-fancy.

View from the root directory:

image

View from the subdirectory:

image

FISH: gcf doesn't respect tab to multi select, will only checkout first file

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS

    • Mac OS X
  • Shell

    • bash
    • zsh
    • fish

Problem / Steps to reproduce

When using gcf on fish with tab to multi-select, it will only select the first file, not multiple.

Multi select is working in ga, so just need to investigate why it's not working with the other

@wfxr when you get a chance, would you double check zsh and make sure this problem isn't there too?

fzf preview bat error

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

i have constantly the same result: [bat error]: '[M] modified-file-name': No such file or directory (os error 2)

Improve git color process logic.

Color process logic in forgit::add is ugly and buggy. #3

It will not work on ANSI 256-color(like 228), 24-bit RGB color(like #ff0ab3), and complex color names(like blue reverse).

Forgit should start from the "top down" to allow users to tab through their options

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Feature Request

When adding many files with ga, for example, it is nice to tab and add many of them at once.

Unfortunately when forgit starts, it begins at the bottom of the list, so the user must go all the way to the top of the list to tab down through the options

Screen Shot 2020-07-01 at 9 41 31 AM

It would be nice if the cursor started at the top of the list, so the user just pushes "tab" multiple times to get through the whole list.

One option is to add
--reverse

to the FORGIT_FZF_DEFAULT_OPTS, but that reverses the whole layout. I'm not sure if we can just either switch the order of how tab works, or start at the top of the list!

git-fixup integration

So I currently use https://github.com/keis/git-fixup to list a number of commits that might be the commit that I'm aiming to fixup.

Is there anyway I can pass that list of commits to forgit and have it git show them in the widget?

TLDR; is there a way I can pass forgit a list of SHAs manually?

Why do you use incompatible :: in functions' names

As the title of this issue suggests, I noticed that functions named forgit::fzf for example can't be used in /bin/sh:

sh-5.0$ forgit::fzf () {
> echo hello
> }
sh: `forgit::fzf': not a valid identifier
sh-5.0$

I know that in the past you've had 2 files for Bash/sh and for ZSH and that some-when you've made them symlinks. I agree that having just a single file is better but why use functions with names such as these and not use underscores?

I could send a patch to fix this but I wanted to ask first.

As once mentioned in a previous discussion we've had, This really bothers me because I use forgit in Git's shell aliases as explained in the linked comment from #12 . From some reason Git is also giving me the error not a valid identifier when I try to use forgit with it's shell aliases.

[BUG] - FZF not found

Describe the bug
I have this in my ~/.zshrc

# fzf & forgit
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
which fzf
hash fzf &>/dev/null || echo "hey I am working!"
[ -f ~/.forgit/forgit.plugin.zsh ] && source ~/.forgit/forgit.plugin.zsh

but when I restart my terminal here is the outpout:

/home/zezen/.fzf/bin/fzf
hey I am working!
[Warn] FZF not found and is requried for forgit

To Reproduce
I don't see anything I could have done wrong ...

Expected behavior
That it works (as they say)

Screenshots

Desktop (please complete the following information):

  • OS:
Operating System: elementary OS 5.0 Juno
          Kernel: Linux 4.15.0-70-generic
    Architecture: x86-64
  • Shell: zsh
  • Shell Version: zsh 5.4.2 (x86_64-ubuntu-linux-gnu)
  • Any other terminal config? antigen in zsh but not using it for fzf or forgit

gd - unknown action: c |LESS='-R' less)

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

gd or gd <directory> gives the unknown action: c |LESS='-R' less) error.

Fish use of unsupported command chaining like "&&" and "||"

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Steps to reproduce

  • Copy & Paste forgit.plugin.fisher to ~/.config/fish/forgit.plugin.fish
  • add source ~/.config/fish/forgit.plugin.fish to the fisher config
  • reload terminal
  • also happens when using the "online" version source (curl -Ss https://raw.githubusercontent.com/wfxr/forgit/master/forgit.plugin.fish | psub)

Problem

Use of unsupported command chaining. When reloading the terminal I get the following errors:

~/.config/fish/forgit.plugin.fish (line 27): Unsupported use of '&&'. In fish, please use 'COMMAND; and COMMAND'.
type -q emojify >/dev/null 2>&1 && set forgit_emojify '|emojify'
                                 ^
from sourcing file ~/.config/fish/forgit.plugin.fish
	called on line 35 of file ~/.config/fish/config.fish

from sourcing file ~/.config/fish/config.fish
	called on line 1 of file -

in function β€œreload”
	called on standard input

source: Error while reading file β€œ/home/fullname/.config/fish/forgit.plugin.fish”

I decided to do a quick&dirty fix by replacing all && with a ; with vim. I wanted to see if this was the only problem, even though it would probably break the functionality of the script. Then I got the following error:

~/.config/fish/forgit.plugin.fish (line 31): Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
    forgit::inside_work_tree || return 1
                              ^
from sourcing file ~/.config/fish/forgit.plugin.fish
	called on line 35 of file ~/.config/fish/config.fish

from sourcing file ~/.config/fish/config.fish
	called on line 1 of file -

in function β€œreload”
	called on standard input

source: Error while reading file β€œ/home/fullname/.config/fish/forgit.plugin.fish”

Applying another dirty fix by replacing || with ; I got the follwing message:

~/.config/fish/forgit.plugin.fish (line 47): Expected a command, but instead found end of the statement
    eval "git log --graph --color=always --format='%C(auto)%h%d %s %C(black)%C(bold)%cr' $argv $forgit_emojify" |
        env FZF_DEFAULT_OPTS="$opts" fzf
                                                                                                                 ^
from sourcing file ~/.config/fish/forgit.plugin.fish
	called on line 35 of file ~/.config/fish/config.fish

from sourcing file ~/.config/fish/config.fish
	called during startup

source: Error while reading file β€œ/home/fullname/.config/fish/forgit.plugin.fish”
.v: No such file or directory

You can fix those by

  • removing the new line character after the pipe
  • add a \ to the end of line

Errors occourd on line

  • 47
  • 71
  • 87 and following
  • 193

As expected I removed all interpretation errors, but broke the program. ga simply exits with the return code 1

Fuzzy search not working

I don't know if it is intentional or not, but can not use fuzzy search on any window created by forgit. Only matching exactly file name works bringing correct results.

Thanks for your work. I've been using for some weeks and it is really helping my workflow.

Relative paths for other commands

Similarly to #29 I noticed that grh (git reset head) and ga (git add) were also lacking support for relative paths. Since your fix for #29 was easier than I expected, I thought I'll give it a try myself. I'll submit the PR shortly, looking forward to your feedback.

Can we simplify the issue template?

@cjappl Thank you for your excellent work to add issue templates for the project. I like it very much.

Now I have a suggestion that can we do some simplification on it considering the size and type of this project?

Maybe we can take fzf's template as the template of our issue template. It's simpler and more suitable for this project. What do you think?

gi crashing in bash.

Check list

  • [x ] I have read through the README
  • [ x] I have the latest version of forgit
  • [ x] I have searched through the existing issues

Environment info

  • OS
    • [x ] Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • [x ] bash
    • zsh
    • fish

Problem / Steps to reproduce

I wrote

gi

in a git repository and instead of showing options to add .gitignore stuff it crashed to this

 npm ERR! code ENOENT                                                  ╰─                                                                                                                                                                   ─╯
                      npm ERR! syscall open
                                           npm ERR! path /home/penguin/proje

                                                                                                                                                                                                                                             s/package.json'
             npm ERR! enoent This is related to npm not being able to find

gd with one file

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

When running gd with one changed file, the diff editor does not open. Instead, you just see the "list" of changed files.

glo: looking at a specific commit renders mouse unusable

  • OS
    • Linux
  • Shell
    • zsh

Problem / Steps to reproduce

  1. glo ref
  2. press enter to select a commit ref
  3. try selecting text with mouse for copy
  4. can't select the text

So if you actually use git show ref, you are able to select text in the less output, but not with glo...

Feature request: add icdiff support

First, this script is so cool.

It would be great it can optionally support icdiff as a side by side viewer.

Essentially the code change would be some thing like:

cmd="git diff --color=always $commit -- {} $forgit_fancy"

to

cmd="git icdiff --color=always $commit -- {}

Thanks

Problems on displaying items on tmux

Check list

  • I have read through the README
  • I have the latest version of forgit
  • I have searched through the existing issues

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

On tmux when i call forgit::add i got some errors on displaying files and no preview window on fzf
image

If i call outside tmux error does not happens
image

I already tried changing $TERM variable, using tmux without any config file but no success. I know it's probably related to my configs, just wanted to know if this happens to you and if you know how to solve it.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.