winston0410/range-highlight.nvim

github github
colors plugin
star 84
stars
alert-circle 1
open issues
users 3
subscribers
git-branch 2
forks
CREATED

2021-05-15

UPDATED

3 months ago

packer

require('packer').startup(function()
  use 'winston0410/range-highlight.nvim'
end)

paq

require "paq" { 
  'winston0410/range-highlight.nvim'
}

range-highlight.nvim

An extremely lightweight plugin (~ 120loc) that hightlights ranges you have entered in commandline.

Demo for using range-highlight

Features

  • Single line range highlight (:10)

  • Absolute range highlight (:20,15)

  • Semicolon separated range highlight (:20;15)

  • Backward range highlight (:20,15)

  • Shorthand range highlight (:,15)

  • Relative range highlight (:+5,-2)

  • Multiple relative range highlight (:10+5--,5+3-2)

  • Mark range highlight (:'a,20)

  • Dot range highlight (:.,-2, :5,.)

  • Last line and whole file highlight (:4,$, :%)

  • Pattern range highlight (:/hello/d, ?world?d)

Installation

range-highlight.nvim requires a minimum version of NeoVim 0.5.0.

You can install it using any standard Vim/NeoVim package manager. For example:

paq.nvim

paq{'winston0410/cmd-parser.nvim'}
paq{'winston0410/range-highlight.nvim'}
require'range-highlight'.setup{}

Configuration

This is the default configuration. It is likely that you don't need to change anything.

require("range-highlight").setup {
    highlight = "Visual",
    highlight_with_out_range = {
        d = true,
        delete = true,
        m = true,
        move = true,
        y = true,
        yank = true,
        c = true,
        change = true,
        j = true,
        join = true,
        ["<"] = true,
        [">"] = true,
        s = true,
        subsititue = true,
        sno = true,
        snomagic = true,
        sm = true,
        smagic = true,
        ret = true,
        retab = true,
        t = true,
        co = true,
        copy = true,
        ce = true,
        center = true,
        ri = true,
        right = true,
        le = true,
        left = true,
        sor = true,
        sort = true
    }
}

Range highlight not working for your command?

If the range highlight doesn't work for your command, you can contribute it into the above list

Acknowledgement

Thank you folks from gitters for helping me out with this plugin.