Skip to content

tabstop and list settings are ignored on cat mode #35

Open

Description

@tamirzb

Currently when printing tabs on cat mode, nvimpager ignores tabstop and list settings and just prints the tabs as is. This is different from pager mode, where those settings are used as expected. I was wondering if it's possible to add support for them for cat mode, so the output of cat mode and pager mode would be the same.

Activity

  1. lucc commented on Oct 30, 2020

    @lucc
    Owner

    Interesting idea.

    Interpreting ts in cat mode might involve keeping track of the current (virtual) position in the line to know where the next tabstop should start. There is also tabs(1) to handle tabstop definitions on the terminal side of things. Maybe it is as easy as calling system("tabs -".&ts). But as ts is buffer-local we have to do this in an BufferLoad auto command or so.

    Reading the docs of &listchar it might be some work to implement the rendering with &list on. Especially the different possibilities for a tab. That might make the tabs(1) solution from above unsuitable.

    Currently I am working on replacing the AnsiEsc plugin in the poc/ansi2syntax branch. So it might take some time before I get to this but I'm happy to explore and discuss this.

  2. lucc commented on Jan 17, 2021

    @lucc
    Owner

    Currently I can not find the time to work on this but I am open for PRs.

  3. lucc commented on Mar 1, 2021

    @lucc
    Owner

    @tamirzb today I had some time and started to implement this. Have a look at the feature/listchars branch. Tabs are still missing and the extends and precedes listchar settings are not applicable in cat mode. And for the listchar conceal setting I still have to figure out how it interacts with the general conceal setting. But eol, space nbsp and tailing spaces are implemented.

  4. tamirzb commented on Mar 2, 2021

    @tamirzb
    Author

    Cool! Will take a look soon

  5. lucc commented on Jun 5, 2021

    @lucc
    Owner

    Please check out 6b0733e. I have implemented rendering of listchars in cat mode for spaces, trailing spaces, nbsp and EOL. Tabs are more complicated and have been skipped for now. They can be added later.

  6. added a commit that references this issue on Jun 6, 2021
  7. lucc commented on Jun 7, 2021

    @lucc
    Owner

    I released 0.10 which contains the above commit.

    @tamirzb I was thinking about the tabs for some time again. I think it might be nice to only render tabs as the correct number of spaces if &expandtab is set. Normally the option is only used in insert mode, so it has no meaning in nvimpagers cat mode. So we can use it to decide if we should turn tags into the correct number of spaces to honour &ts or just print plain tab characters ad let the terminal handle it all. What do you think?

  8. added
    cat moderelated to the cat mode of nvimpager or the conversion of highlight groups to ansi escape sequences
    on Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cat moderelated to the cat mode of nvimpager or the conversion of highlight groups to ansi escape sequencesenhancementhelp wanted

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions