Giter Site home page Giter Site logo

Comments (12)

dandavison avatar dandavison commented on May 5, 2024 2

@meandmymind Would it help if I added something like this to the README? (which maybe should become a user manual one day) I'm not implying that you need all these definitions explained! Trying to make it clear to as many people as possible.

Glossary

  • terminal emulator: a graphical application that mimics an old-fashioned text terminal. You run a shell in a terminal emulator (e.g. iTerm2, Terminal.app, Windows Terminal, Gnome Terminal, Konsole, Alacritty, are terminal emulators)
  • shell: an application that displays a prompt, at which you can run command line applications (e.g. bash is an example shell)
  • command-line application: an application that you run by typing its name at a shell prompt with some arguments. It takes in text, and outputs text. Sometimes the text can have special color codes in it to make the terminal emulator print the text in color.
  • pager: a command line application for displaying any sort of text one screenful at a time (e.g. less is a pager)
  • less: the standard pager that is used in linux and unix environments. less is suitable for paging any sort of input.
  • bat: a command line program for displaying source code with syntax highlighting. bat sends its output to less for paging
  • delta: a command line program for displaying specialist file formats such as git, diff, grep, and git blame output, with code syntax highlighting. delta also sends its output to less for paging
  • environment variable: a variable that you can set in your shell session
  • PAGER: an environment variable that can be used to specify the way you want programs to call less, when those programs need to do paging. For example you could do export PAGER="less -R" to set this variable: -R tells less to display colors when its input contains color codes.
  • BAT_PAGER: an environment variable that you can set to tell bat to call less differently from the way other programs call less
  • DELTA_PAGER: an environment variable that you can set to tell delta to call less differently from the way other programs call less
  • LESS: an environment variable that you can set to specify the default arguments less should be called with. (Yes, at this point things have got a bit convoluted! You probably want to ignore this one.)

Tips

  • You don't need to set any environment variables unless doing so fixes a problem for you!
  • Type env to print out a list of the environment variables you have set, to check that PAGER, BAT_PAGER, DELTA, LESS are not set or, if they are set, that they have sensible values.

from delta.

dandavison avatar dandavison commented on May 5, 2024

If we added a command line option allowing the user to specify how many columns they want delta to use when filling right to the edge of the terminal, do you think that would solve your problem? I haven't fully thought it through, but I did skim your so-fancy/diff-so-fancy#271. Are you seeing the same problem with the background colors extending onto the next line, or just the ruler?

from delta.

alok avatar alok commented on May 5, 2024

The background colors also run.

I think it would fix it. I'd be willing to test it out, since I use Rust and can install a branch from git to try it.

from delta.

dandavison avatar dandavison commented on May 5, 2024

OK great, it's on the list. (This would also make a good first issue for anyone who wants a fairly doable Rust task.)

from delta.

dandavison avatar dandavison commented on May 5, 2024

Hi @alok, this should be fixed in master: the background colors now adapt dynamically to the terminal width (see 5b26209) and the horizontal decoration lines now respect the --width option.

from delta.

lainisourgod avatar lainisourgod commented on May 5, 2024

I'm still having this.

Have bat as $PAGER and $DELTA_PAGER

when I do git diff | delta | bat it's ok
image

when I do just git diff with delta set as pager, line is shifted by this line number column
image

from delta.

dandavison avatar dandavison commented on May 5, 2024

Hi @meandmymind, you can solve this by setting delta width to a negative value, which means auto-detected width minus $value, e.g.

[delta]
    width = -9

I'm sorry this wasn't documented. The reason was slightly ridiculous -- somehow the wrong sort of comments had got onto two lines of the cli.rs modules, so that the relevant two lines of documentation didn't appear in the --help output... So thanks for alerting me to that. Fixed in 5ea8dfc and --help output is in README.

from delta.

lainisourgod avatar lainisourgod commented on May 5, 2024

hi @dandavison that's cool!

but why is it happening? I don't have any less and bat configuration in my system, so "minusing 7" should be default behaviour?

from delta.

dandavison avatar dandavison commented on May 5, 2024

It's because you've got DELTA_PAGER=bat. I didn't say anything because I thought it was deliberate, but tbh I did think it was a strange choice :) If you have PAGER=bat then you should set DELTA_PAGER to something like less -R.

from delta.

lainisourgod avatar lainisourgod commented on May 5, 2024

@dandavison ok it means I don't understand this paging stuff but changing DELTA_PAGER to less -R worked :))) thanks

from delta.

dandavison avatar dandavison commented on May 5, 2024

So to be explicit, what the above glossary is meant to show is that it doesn't make sense to set DELTA_PAGER=bat for the following reason: that would mean that delta sends its output to bat. But delta's output is (typically) in a format which is like diff format but maybe with extra boxes and lines and things, and the code has already been syntax highlighted, whereas bat is expecting source code in some programming language. So bat won't do anything helpful with delta's output. But will bat do anything undesirable with delta's output? Not if you call it as bat --plain, but by default bat will put delta's output inside ruled margins with line numbers, and that is unlikely to be what you want. In conclusion, less is the appropriate program to use for DELTA_PAGER. But delta uses less by default so you don't need to set DELTA_PAGER unless you have a particular problem that it would solve.

from delta.

lainisourgod avatar lainisourgod commented on May 5, 2024

@dandavison It just wasn't clear to me the relation between delta and bat. Now with your explanations it's much clearear. Thanks!

from delta.

Related Issues (20)

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.