Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: separate editor for git actions (blocking) vs files (non-blocking editor) #889

Closed
avivey opened this issue Jan 23, 2019 · 13 comments · Fixed by #1098
Closed

Comments

@avivey
Copy link

avivey commented Jan 23, 2019

(This might be a little niche...)

It might make sense to allow different EDITOR selection for "edit file" action then for "edit commit message" action.
My reasoning here is that "edit commit" (and probably all of git actions that require editor) is a blocking action - git waits for the editing to complete before continuing. "Edit a file", OTOH, might be a long operation - open the file in my IDE in a separate window, and continue whatever it was I was doing in tig in this terminal - like maybe open a couple more files from the same diff.

(In my case, I use Notepad++ for "long edits" and Nano for "short" ones, because it's hard to setup N++ to "blocking" mode).

@yegorich
Copy link

@avivey how have you setup tig to open files at line in N++? The command line parameter differ in VIM and N++.

@avivey
Copy link
Author

avivey commented Sep 23, 2019

@yegorich I disabled opt_editor_line_number, but it's easy to write a wrapper for N++ that can handle that.

@yegorich
Copy link

@avivey thanks.

@MartyLake
Copy link

MartyLake commented Mar 31, 2021

Bumping this as I come across the same requirement.

Right now, I have a blocking vim editor for git, as it has to be blocking. Then when I want to talk to git ("which part of this big file was modified recently?"), I get to this part answer using tig, then I memorize the file and line number, and then I navigate to it using nvim-qt.

I wish I could skip the memorize+navigate step, for example binding "e" to a non-blocking nvim-qt, and leave the other git operations (git commit for example) to a blocking simple vim.

EDIT: I will try to bind non blocking edit to tig, and realize my git operations outside of tig using the terminal to see how it feels.

koutcher added a commit to koutcher/tig that referenced this issue Mar 31, 2021
@koutcher
Copy link
Collaborator

Adding a TIG_EDITOR variable wouldn't be complicated. I almost forgot about it but I made an attempt when the issue was created. Try koutcher@127cbf7.

@avivey
Copy link
Author

avivey commented Mar 31, 2021

Hi @koutcher, you may be thinking about a different ticket - I don't see how $TIG_EDITOR solves this request.

@avivey avivey changed the title Feature request: separate editor for git actions vs files Feature request: separate editor for git actions (blocking) vs files (non-blocking editor) Mar 31, 2021
@avivey
Copy link
Author

avivey commented Mar 31, 2021

@koutcher: Ok, thinking about it some more, it makes sense:

When invoking git actions, tig doesn't control the editor - git does, so it would ignore TIG_EDITOR and run $GIT_EDITOR or whatever.
Tig's open_editor() is only applicable for editing files (?), so if I set TIG_EDITOR to non-blocking, it will only effect files editing.

Neat.

@MartyLake
Copy link

MartyLake commented Apr 4, 2021

I would love to try koutcher’s patch, but I don’t know how to build for win32.

I have tried to install gnu32 make + deps and gnu32 automake, add the bin directories to the path, and run "make configure", without success. I have cryptic errors like

C:/dev/gnu-make/bin/make.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

Ok, the deps are not shipped with gnu32. after installing https://sourceforge.net/projects/gnuwin32/files/make/3.81/make-3.81-dep.zip/download?use_mirror=kumisystems&download= , I get the following errors

$ make configure
Fichier introuvable - *-test
Fichier introuvable - *-test
Fichier introuvable - *-test
Fichier introuvable - *-test
       GEN  configure
Can't locate Automake/Config.pm in @INC (you may need to install the Automake::Config module) (@INC contains: c /progra~1/AutoMake/share/automake-1.9 /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /c/dev/gnu-automake/bin/aclocal line 36.
BEGIN failed--compilation aborted at /c/dev/gnu-automake/bin/aclocal line 36.
make: *** [configure] Erreur 2

@krobelus
Copy link
Contributor

krobelus commented Apr 5, 2021

Automake doesn't really support windows. Can you use WSL?
Otherwise maybe use Cygwin, with something like this:

choco install cygwin
choco install--source=cygwin git gcc-core make automake pkg-config libiconv-devel libncurses-devel
$Env:PKG_CONFIG_PATH = "C:\tools\cygwin\lib\pkgconfig"
$Env:PATH = "C:\tools\cygwin\bin;" + $Env:PATH
git -c core.autocrlf=false -c core.eol=lf clone https://github.com/jonas/tig
cd tig
make configure
sh configure
make

@MartyLake
Copy link

Thanks @krobelus ! Have compiled with Cygwin, added the Cygwin bin to my path, and it just works great ! Thanks !

@blayz3r
Copy link

blayz3r commented Jun 30, 2021

@MartyLake How did you set up your TIG_EDITOR?

@MartyLake
Copy link

@blayz3r I have it setup like this in my bashrc

if [[ "$OSTYPE" = "msys" ]];then
  # win32
  export TIG_EDITOR="gvim.bat --remote"
  export LESSEDIT="gvim.bat --remote"
  export VISUAL="gvim.bat --nofork"
  export EDITOR="$VISUAL"
fi

when I hit e to edit a file, it calls gvim --remote so it is non blocking for tig ! on the other hand, I have the --nofork for normal git operations. works like a charm.

@blayz3r
Copy link

blayz3r commented Jun 30, 2021

@MartyLake Thanks that works great!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants