Skip to content

mcauley-penney/visual-whitespace.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 

Repository files navigation

🔎 visual-whitespace.nvim

Reveal whitespace characters in visual mode, similar to VSCode.

visual-ws

GIF: Highlighting in charwise-visual and linewise-visual

Installation and configuration

To install the plugin with the default settings using Lazy:

  {
    'mcauley-penney/visual-whitespace.nvim',
    config = true
  }

visual-whitespace comes with the following default settings:

    opts = {
      highlight = { link = "Visual" },
      space_char = '·',
      tab_char = '',
      nl_char = '',
      cr_char = '',
      enabled = true,
      excluded = {
        filetypes = {},
        buftypes = {}
      }
    },

Highlighting

visual-whitespace defines the VisualNonText highlight group. In the configuration, the highlighting settings you provide will constitute this highlight group. The highlight can also be set using Neovim's Lua API:

-- vim.api.nvim_set_hl(0, "VisualNonText", { fg = "#5D5F71", bg = "#24282d"})
-- vim.api.nvim_set_hl(0, "VisualNonText", { link = "Visual" })

Functions

visual-whitespace affords the following user-facing functions:

Lua Description
require("visual-whitespace").toggle() Turn visual-whitespace.nvim off (toggles the enabled cfg flag)

Use them in keymaps like:

init = function()
    vim.keymap.set('n', "<leader>vw", require("visual-whitespace").toggle, {})
end

Credit

About

Imitate VSCode's "Render Whitespace" feature in visual mode

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages