Home

Awesome

🤺 tabs-vs-spaces.nvim

Hint and fix deviating indentation.

<br>

https://user-images.githubusercontent.com/34311583/226349494-edd8da2a-f533-404a-956c-93e0318674d7.mov

<br>

Ideally, leading and trailing spaces are taken care of by a project-specific formatter. Nevertheless, commits and codebases with indentation styles that deviate from a project defaults continue to exist.

There are several reasons why indentation styles might get mixed up.

For all these and similar occasions, this tool shall serve as a guide.

Installation

E.g., using a plugin manager like packer.nvim

use "tenxsoydev/tabs-vs-spaces.nvim"

-- ..
-- Then load it in a preferred location.
require("tabs-vs-spaces").setup()

When using lazy.nvim it suffices to add this line to your lazy.setup() to use the plugin with it's default config.

{ "tenxsoydev/tabs-vs-spaces.nvim", config = true },

⚙️ Config

require("tabs-vs-spaces").setup {
  -- Preferred indentation. Possible values: "auto"|"tabs"|"spaces".
  -- "auto" detects the dominant indentation style in a buffer and highlights deviations.
  indentation = "auto",
  -- Use a string like "DiagnosticUnderlineError" to link the `TabsVsSpace` highlight to another highlight.
  -- Or a table valid for `nvim_set_hl` - e.g. { fg = "MediumSlateBlue", undercurl = true }.
  highlight = "DiagnosticUnderlineHint",
  -- Priority of highight matches.
  priority = 20,
  ignore = {
    filetypes = {},
    -- Works for normal buffers by default.
    buftypes = {
      "acwrite",
      "help",
      "nofile",
      "nowrite",
      "quickfix",
      "terminal",
      "prompt",
    },
  },
  standartize_on_save = false,
  -- Enable or disable user commands see Readme.md/#Commands for more info.
  user_commands = true,
}

 ›  Commands

Command args work with completion.

🤝 Complementary Tools