-
Notifications
You must be signed in to change notification settings - Fork 72
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
doesn't play nicely with git #11
Comments
On Wed, May 25, 2011 at 06:54:53AM -0700, Vampire wrote:
Hi Vampire, I use vimpager with git all the time. For "git diff" mostly. What are some examples of how and why it doesn't work well with git? What would you like to see changed to make it work better with git? We can detect git as a parent process if necessary. |
vimpager doesn't show the color codes git is emitting |
On 5/25/2011 2:58 PM, Vampire wrote:
I don't get the color codes from git for some reason, neither on linux There is no way to display ANSI color codes in vim. There is a patch I |
Set "color.ui" git config option. e. g. to "auto". |
One issue I'm seeing when using vimpager as pager for Git is that when |
Now this I can easily fix, it annoys me too :) I'll do it later today and will let you know. On Wednesday, June 22, 2011 at 10:17 AM, akahn wrote:
|
Just added checking for zero length files in 1.5.3, try it out. On Wednesday, June 22, 2011 at 10:17 AM, akahn wrote:
|
Keeping this issue open in case anyone has ideas on how to do highlighting and hiding of ANSI color codes in vim. |
I found this today and remembered this issue: https://github.com/vim-scripts/AnsiEsc.vim http://www.vim.org/scripts/script.php?script_id=302 I just tried it, it works great! |
On 12/10/2011 5:48 PM, Jacobo de Vera wrote:
Unfortunately this requires patching vim... when there's a solution that |
The patch was applied upstream in 7.2, I think. I tried it with stock 7.3 and worked beautifully. |
On 12/11/2011 4:47 AM, Jacobo de Vera wrote:
Oh really? Cool, thanks! So now we have to figure out how to integrate it. So far I have been distributing vimpager as an executable script, I'd Also I'd have to monitor the upstream for this script for changes, which |
How about not bundling it, but simply supporting it if the user has it installed? vimpager can continue to be a one file only thing, the docs can reflect that if AnsiEsc is avaiable it will be used. However, this would mean that plugins would have to be enabled for this to work, which is not necessarily good if the user´s vim is havily customised. Perhaps there could be a ~/.vimpager dir that could be added to the runtimepath of the vim that vimpager starts, and we could have vimpager only stuff there. These are just a couple of ideas, maybe we can think of something else to avoid having to bundle the plugin. |
How about if the user defines |
I am a believer in zero-configuration solutions. Here is what I was thinking, you guys chime in and let me know if you agree. First, we bundle AnsiEsc into vimpager as a function that writes it out to a temp file into our temp directory. The input file or stdin will be scanned for ansi sequences, then we will test the user's vim to see if he has a version of the AnsiEsc plugin already installed. If he/she does, then we just add :AnsiEsc to the list of commands. If not, then the bundled AnsiEsc will be written out to the temp directory, a command will be added to add the temp directory to the plugin path, another command to load the plugin, then the :AnsiEsc itself. The whole thing should be relatively fast and not add much to the loading time. |
That sounds pretty cool |
Any news on this one? all my git logs are plain white and sad... :( |
Really? vim has some native highlighting for git logs that should kick in for you, here's what I see: http://www.cachemiss.com/files/vim_git_log.png If you do: :set ft=git do you still see no highlighting? If you create an empty .vimpagerrc does it fix the issue? As for the ANSI escape support, I haven't gotten to doing this yet, the plugin bundling stuff is going to be painful, I'll try to work on it soon though... |
g5pw for git I just don't use vimpager currently. |
Actually, I chose to use AnsiEsc and modified the script as msabramo said ;) Thanks! |
rkitover: sorry, I forgot to answer you! Yes, normally the highlighting does fine! I sometimes use a modified log format that of course breaks the vim's syntax highlighting... |
Guys, I think my plan to use AnsiEsc isn't going to work out. For one thing, it requires the conceal feature which defaults to off (my macports vim shows -conceal in :version, the default OSX vim has -conceal, though the debian vim has +conceal which is good.) Also, AnsiEsc is broken at the moment. When I try to source the .vba I get this: Error detected while processing function vimball#Vimball: I'm going to submit an issue to AnsiEsc (it's on github, hasn't been updated in 2 years.) Suggestions? |
I ran into the same issue today. When I do |
http://www.drchip.org/astronaut/vim/index.html#ANSIESC has a newer version of AnsiEsc (v13d), maybe that works better for you? |
Hm, at the moment it isn't even possible to make use of the (13d version of) AnsiEsc, since all the escape sequences are filtered out. Could there be an option for the user to disable this? Maybe with a kind of warning:
|
+1 to what @nasenatmer; this is a sticky issue for you, which is completely understandable … and I understand the desire to make the general-use-case zero-conf. But if you could please add a quick configurable for those of us who are willing to do some-conf and get this set up for ourselves, it'd be truly excellent. (= |
For some reason, most of my colors display fine in vimpager (git log, git diff, etc.) except it doesn't work for this command from https://stackoverflow.com/questions/1057564/pretty-git-branch-graphs/9074343#9074343: git log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all |
That's because when you use vimpager with git logs, diffs etc. it's just vim's filetype detection and syntax code recognizing the default ones. But in this case you're using a custom format, and it does not have any detection or syntax files for it. |
One thing you can do that helps, add let vimpager_passthrough = 1 to your .vimrc, and then if you need just the first page of the git output, run the git command through head git log ... | head and then git's ansi colors will come through, and without the pager. Of course this is only if you need a bit of the output. |
I have a command 'git hist' that uses custom color codes to display the git log. To get this command to work properly I changed the pager for just this command using: |
Thanks a lot. I'll try it out as soon as I can! |
I'm getting an error when using with git (by just using it as PAGER): |
Mmmm, this only happens when |
@leandro-lucarella-sociomantic I cannot reproduce this, can you do a bit of debugging for me please? There is a block of code at the top of vimcat which tries to find bash or ksh, it should ideally find bash, the shell it finds is saved in $_MY_SHELL. In the cases where you get this error, can you echo $_MY_SHELL and exit, and see why bash is not being found on your system. You'll need to repackage vimpager to install any modifications to vimcat you make for debugging, just run make. |
Instead of checking for ansi/overstrike in every line, check at the end when printing the short content.
On Tue, Apr 07, 2015 at 10:30:26AM -0700, Rafael Kitover wrote:
This is what happens adding set -x:
It seems like bash is detected properly (and the script is being re-run |
Wait, I actually changed vimpager, vimcat doesn't have any shell detection and any |
It's there close to the top, the code is the same as in vimpager just slightly indented. NOTE: you have to run make to rebuild vimpager with your updated vimcat |
On Thu, Apr 09, 2015 at 05:33:25AM -0700, Rafael Kitover wrote:
OK, I guess I was looking at something else. I changed vimcat, rebuilt
(I just updated the git repo so this is with the current HEAD) |
The exported variables set when a shell is found in the prologue have to be removed before invoking vimcat which has the same shell finding code. All of this has to be more extensively rewritten, this is temporary fix.
@leandro-lucarella-sociomantic Thank you very much for the trace, this helped me realize what the problem was and I committed a temporary fix. I'll need to rewrite some of this code more extensively for the next stable release. Please let me know if the issue is gone or is still there. As for the spacing issue, the crude hack of replacing tabs with 8 spaces helps things line up usually but I need to write a proper retab that takes the concealed items into account to really fix this. |
The fix worked. Thank you for the quick answer and fix! (and the nice tool too 😁) |
Passthrough mode now preserves extra vim commands, like enabling man page highlighting for small man pages and uses the filename when available to choose a syntax as well. Multiple -c and --cmd options are now supported in both vimpager and vimcat, as well as the -u option for the .vimrc.
Add the ConcealRetab command to correct spacing in files with tabs when using AnsiEsc to display files with ansi escape sequences.
I wrote the ConcealRetab command to fix spacing in files with tabs when using AnsiEsc. That should take care of all the most glaring AnsiEsc issues. I am going to finally cut a stable release now. I'll leave this issue open for another week in case anyone has any comments or bugs, then I will close it. Four year issue, finally done! |
@rkitover This is a bit of a long Issue; a summary of the outcome (added either to the original post via edit, or as a new post by yourself at the bottom) might be useful. (= |
More issues with AnsiEsc in #105, will hold off on closing. |
I've found the simplest solution is simply to turn off colour output for Git, and let Vim do its own syntax detection and highlighting. This even results in vastly better coloured output than Git's own.
|
I used @pvaibhav's suggestion for a while and noticed that this disabled all colours, even the ones where the pager isn't used (e.g., |
I have a custom color format with When I start to scrolling down and up the page (with holding |
@wlisrausr if you share your custom git format, I may be able to see if there are things in AnsiEsc that are causing the performance issues. |
Sure thing @rkitover, here it is.
|
@rkitover is replacing tabs by an arbitrary amount of spaces really the best solution? This defamiliarizes the displayed content, doesn't it? Tabs could be mixed with spaces with an arbitrary tab with width setting. So whatever tab width you choose it might be wrong and it is better when the user can change the tab width for the currently displayed content. This is not possible if you replaced the tabs with spaces. Also if you copy stuff e. g. from a displayed diff and paste it somewhere, you copy the manipulated content. |
@rkitover hm, and I just tried the latest version now, it displays colors, whohoo, but I get the following:
The input only has 386 lines |
@Vampire you have the old AnsiEsc plugin somewhere in your plugin dir, try removing it, vimpager ships with our fork which should work with anything else that needs the plugin. About the tabs thing, I can't really do anything else right now because conceal mode in vim is broken with tabs. I just did what was possible so that e.g. |
@Vampire, I had to actually install the latest version of AnsiEsc from the creator in my I'm running on Mac OS Sierra, installed vimpager through brew (up-to-date) |
vimpager as pager doesn't work nicely with git. Maybe git is just too less specific implemented and there is no other option than making git use less instead of pager. I know the configuration option core.pager of git where I can supply any pager I want and it works if I set less there. I just thought I mention here that it doesn't play nicely in case you can and want do something about it. One good example is "git grep something", especially if it gives less results than screen lines. Then the different behaviour in paging, exiting and coloring between less and vimpager is seen best.
The text was updated successfully, but these errors were encountered: