• palordrolap@fedia.io
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    The italic text in Vim threw me for a loop. But I realised it makes sense.

    Syntax highlighting already exists in editors. Terminal based ones often implement this in terms of terminal escapes or similar. Most modern terminal emulators support the enable-italic escape. Thus, some combination of these can effectively emulate markdown.

    What I do note is that my root Linux consoles (Ctrl+Alt+F[1-6]), and LMDE) don’t support italics, suggesting the Vim instance is running in a full-screen terminal emulator under some windowing system or another.

    That seems like overkill just for italics in an otherwise text-only interface, but maybe I’m missing something (patience being one possibility).

    • flubba86@lemmy.world
      link
      fedilink
      English
      arrow-up
      8
      ·
      edit-2
      1 day ago

      The answer is right there in the fist paragraph, and in more detail if you read the whole article.

      The author uses kmscon, that is a usermode console with proper graphics drivers, hi res rendering, and UTF8 font support. There is no desktop environment used.

      I suspect that is where the italics support is coming from. Makes me want to try it out.

      https://en.wikipedia.org/wiki/Kmscon

    • tal@lemmy.today
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 day ago

      suggesting the Vim instance is running in a full-screen terminal emulator under some windowing system or another.

      Courtesy of this post, here’s a test script to show a terminal’s capabilities:

      #!/bin/bash
      echo -e "\e[1mbold\e[0m"
      echo -e "\e[3mitalic\e[0m"
      echo -e "\e[3m\e[1mbold italic\e[0m"
      echo -e "\e[4munderline\e[0m"
      echo -e "\e[9mstrikethrough\e[0m"
      echo -e "\e[31mHello World\e[0m"
      echo -e "\x1B[31mHello World\e[0m"
      

      I thought that it might be them using fbterm (a more-sophisticated userspace framebuffer virtual terminal emulator that’s an alternative to fbcon, the built-in Linux kernel virtual terminal emulator), but at least on my system, fbterm doesn’t seem to show italics.

      EDIT: Ah, saw @zloubida@sh.itjust.works’s comment about kmscon. It looks like they’re using kmscon, a different userspace framebuffer virtual terminal emulator, and explicitly say so in the article.

      EDIT2: If you install it, looks like on Debian it gets used by default on next boot as the new console virtual terminal emulator. Note that unlike fbcon and fbterm, you apparently need to use Control-Alt-FKey rather than just Alt-Fkey to switch terminals when you’re inside kmscon, same as if you’re in Xorg or Wayland.

      • MonkderVierte@lemmy.zip
        link
        fedilink
        English
        arrow-up
        3
        arrow-down
        1
        ·
        edit-2
        22 hours ago

        Better use tput instead. The escape sequences depend heavily on the emulated terminal used.

    • frongt@lemmy.zip
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 day ago

      I’m surprised vim supports italics. Is there any terminal standard for that, like colors and bold text?

      • tal@lemmy.today
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        1 day ago

        Apparently there are escape sequences for it; see my response to the parent post.

        Even if there weren’t, if a given terminal supported either the older Sixel or the newer KiTTY graphics protocol, it can outright display arbitrary images.

        Mainline tmux doesn’t support either protocol, though there’s a fork that does do Sixel. They’re using tmux, so I assume that that’s not the route used.

      • AHemlocksLie@lemmy.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 day ago

        I wouldn’t be surprised if support comes from a plugin rather than Vim itself. Plugins can do a LOT in Vim.

        Of course, Vim also has a crazy base feature set, so I guess I wouldn’t be all that surprised if it did have base support.