Skip to content

Latest commit

 

History

History
134 lines (98 loc) · 3.55 KB

README.md

File metadata and controls

134 lines (98 loc) · 3.55 KB

nvim-sluice

Sluice:

A trough to channel water from a distance.

A neovim plugin that provides vertical channels along the sides of your window:

  • minimap of the +signs and extmarks for the side of the window.
  • replacement for the signcolumn: customize the width and contents of the column to your liking!

Install

You can install this plugin using a variety of plugin managers.

Plug:

Plug 'dsummersl/nvim-sluice'

Lazy:

{
  "dsummersl/nvim-sluice",
  config = function()
    require("sluice").setup({
      ... override any defaults ...
    })
  end
},

Default configuration:

{
  enable = true,
  gutters = { {
      plugins = { "viewport", "search" },
      window = {
        default_gutter_hl = "SluiceColumn",
        enabled_fn = 'sluice.config.default_enabled_fn',
        width = 1
      }
    }, {
      plugins = { "viewport", "signs" },
      window = {
        count_method = "",
        default_gutter_hl = "SluiceColumn",
        enabled_fn = 'sluice.config.default_enabled_fn',
        width = 1
      }
    } },
  throttle_ms = 150
}

Configuration

You can configure nvim-sluice to create custom gutters on either the left or the right side of the screen. Each gutter can be configured to display specific symbols and have a custom width. You can also specify which groups to include or exclude from the gutter.

Example configuration with left and right gutters:

{
  enable = true,
  gutters = {
    left = { -- Define a gutter on the left side
      plugins = { "gitsigns", "lsp" },
      window = {
        default_gutter_hl = "SluiceGutter",
        enabled_fn = <function 1>,
        width = 2,
        whitelist = { "GitSignsAdd", "GitSignsChange", "LspDiagnosticsSignError" },
        blacklist = { "GitSignsDelete" }
      }
    },
    right = { -- Define a gutter on the right side (existing functionality)
      plugins = { "viewport", "search" },
      window = {
        default_gutter_hl = "SluiceColumn",
        enabled_fn = <function 2>,
        width = 1
      }
    }
  },
  throttle_ms = 150
}

In the above example, the left gutter is configured to show signs from gitsigns and LSP messages, with a width of 2 cells. It includes only the specified whitelist groups and excludes the blacklist groups. The right gutter remains as previously configured.

Screenshot

asciicast

See this asciinema screencast for a demonstration.

Commands

SluiceEnable/SluiceDisable/SluiceToggle.

Development

Run tests:

make test

Pre commit hooks:

pip install requirements-dev.txt
pre-commit install

Notes

Thanks to nvim-treesitter-context which I based the lua windowing that this plugin uses.

The idea behind this project is based on vim-sluice -- a buggier and more feature-ful version of this plugin for vim/gvim.

Features

With the new configuration options, you can:

  • Define gutters on both the left and right sides of the screen.
  • Configure the symbols and width of each gutter.
  • Whitelist or blacklist specific highlight groups to fine-tune what is displayed in the gutters.
  • Create dedicated gutters for specific plugins like gitsigns or LSP messages.

These features provide greater flexibility in how you view and interact with different signs and messages within Neovim.