๐ŸฆŽ A NeoVim plugin for highlighting visual selections like in a normal document editor!

Overview

๐ŸฆŽ HighStr.nvim

A NeoVim plugin for highlighting visual selections like in a normal document editor!

Repository's starts Issues License
Say thanks Latest commit GitHub repository size

Demo


TL;DR

HighStr.nvim is a NeoVim plugin written in Lua that aims to provide a the simple functionality of highlighting text like one would do in a normal document editor. To use it, install it with your favorite plugin manager, select something in visual mode and then run :HSHighlight. You can also add keybindings to the commands.

๐ŸŒฒ Table of Contents

๐ŸŽ Features

  • Highlight visual selection in any given pre-defined color.
  • Remove highlighting from lines in visual selection.
  • Users can set up foreground and background of any color.
  • Has a "smart" option to set foreground based on background.
  • Users can add any amount of colors.
  • Produce a verbose output for debugging (optional).
  • Export and import highlights!

๐Ÿ“บ Notices

Checkout the CHANGELOG.md file for more information on the notices below:

  • 16-08-21: Fixed #6: properly highlight imported highlights.
  • 30-07-21: Feat #1: import and export highlights!
  • 26-05-21: Fixed bug that prevented adding new colors and added option to remove all highlighting from the current buffer
  • 25-05-21: Just released!

๐Ÿ“ฆ Installation

Prerequisites

  • NeoVim nightly (>=v0.5.0)
  • A nice color scheme to complement your experience ;)

Adding the plugin

You can use your favorite plugin manager for this. Here are some examples with the most popular ones:

Vim-plug

Plug 'Pocco81/HighStr.nvim'

Packer.nvim

use "Pocco81/HighStr.nvim"

Vundle

Plugin 'Pocco81/HighStr.nvim'

NeoBundle

NeoBundleFetch 'Pocco81/HighStr.nvim'

Setup (configuration)

As it's stated in the TL;DR, there are already some sane defaults that you may like, however you can change them to match your taste. These are the defaults:

verbosity = 0,
saving_path = "/tmp/highstr/",
highlight_colors = {
	color_0 = {"#0c0d0e", "smart"},	-- Cosmic charcoal
	color_1 = {"#e5c07b", "smart"},	-- Pastel yellow
	color_2 = {"#7FFFD4", "smart"},	-- Aqua menthe
	color_3 = {"#8A2BE2", "smart"},	-- Proton purple
	color_4 = {"#FF4500", "smart"},	-- Orange red
	color_5 = {"#008000", "smart"},	-- Office green
	color_6 = {"#0000FF", "smart"},	-- Just blue
	color_7 = {"#FFC0CB", "smart"},	-- Blush pink
	color_8 = {"#FFF9E3", "smart"},	-- Cosmic latte
	color_9 = {"#7d5c34", "smart"},	-- Fallow brown
}

The way you setup the settings on your config varies on whether you are using vimL for this or Lua.

For init.lua

local high_str = require("high-str")

high_str.setup({
	verbosity = 0,
	saving_path = "/tmp/highstr/",
	highlight_colors = {
		-- color_id = {"bg_hex_code",<"fg_hex_code"/"smart">}
		color_0 = {"#0c0d0e", "smart"},	-- Cosmic charcoal
		color_1 = {"#e5c07b", "smart"},	-- Pastel yellow
		color_2 = {"#7FFFD4", "smart"},	-- Aqua menthe
		color_3 = {"#8A2BE2", "smart"},	-- Proton purple
		color_4 = {"#FF4500", "smart"},	-- Orange red
		color_5 = {"#008000", "smart"},	-- Office green
		color_6 = {"#0000FF", "smart"},	-- Just blue
		color_7 = {"#FFC0CB", "smart"},	-- Blush pink
		color_8 = {"#FFF9E3", "smart"},	-- Cosmic latte
		color_9 = {"#7d5c34", "smart"},	-- Fallow brown
	}
})

For init.vim

lua << EOF
local high_str = require("high-str")


high_str.setup({
	verbosity = 0,
	saving_path = "/tmp/highstr/",
	highlight_colors = {
		-- color_id = {"bg_hex_code",<"fg_hex_code"/"smart">}
		color_0 = {"#0c0d0e", "smart"},	-- Cosmic charcoal
		color_1 = {"#e5c07b", "smart"},	-- Pastel yellow
		color_2 = {"#7FFFD4", "smart"},	-- Aqua menthe
		color_3 = {"#8A2BE2", "smart"},	-- Proton purple
		color_4 = {"#FF4500", "smart"},	-- Orange red
		color_5 = {"#008000", "smart"},	-- Office green
		color_6 = {"#0000FF", "smart"},	-- Just blue
		color_7 = {"#FFC0CB", "smart"},	-- Blush pink
		color_8 = {"#FFF9E3", "smart"},	-- Cosmic latte
		color_9 = {"#7d5c34", "smart"},	-- Fallow brown
	}
})
EOF

For instructions on how to configure the plugin, check out the configuration section.

Updating

This depends on your plugin manager. If, for example, you are using Packer.nvim, you can update it with this command:

:PackerUpdate

๐Ÿค– Usage (commands)

All the commands follow the camel casing naming convention and have the HS prefix so that it's easy to remember that they are part of the HighStr.nvim plugin. These are all of them:

Default

  • :HSHighlight <integer>: highlights current visual selection and receives an <integer> that indicates which colors to use from the highlight_colors = {} table; if none is given, HighStr.nvim will pick color_1.
  • :HSRmHighlight <rm_all>: If the rm_all argument is given, removes all the highlighting in the current buffer. If not, does the same but for every line in visual selection.
  • :HSExport: exports highlights from the current session to <saving_path>. This command overrides previously saved highlights, so you may also use it for clearing them.
  • :HSImport: imports highlights from <saving_path>.

๐Ÿฌ Configuration

Although settings already have self-explanatory names, here is where you can find info about each one of them and their classifications!

General

This settings are unrelated to any group and are independent.

  • verbosity: (Integer) if greater that zero, enables verbose output (print what it does when you execute any of the two command).
  • saving_path: (String) path to a directory for saving the highlights when they get exported. The directory shouldn't necessarily exist, however, the only condition is that it must end with a forward slash the path you give (/).

Highlight Colors

The table highlight_colors = {} contains all of the colors HighStr.nvim will use when you highlight something. The convention is simple: color_<a_number>. Each color is a table in which the first element represents the background of the color (the highlight it self), and the second one represents the foreground (the color of the text that's being highlighted). The second parameter may also be the word "smart", to change the color of the foreground based on the background in order to get a better contrast (e.g. if background is white, set foreground to black). Here is an example:

color_1 = {"#FFF9E3", "smart"}

Here we are setting a cool color called Cosmic Latte (looks like white), that we are assigning to color_1 and we are giving its parameters to a table: the first one is the highlight itself ("#FFF9E3") and in the second one ("smart") we are telling it to set a foreground that will make contrast with the background (black in this case).

Conditions:

  • The numbers that are assigned to the colors (e.g. color_2) should not be repeated, because it's what you'll use to "call" that highlight color.
  • The color it self (argument one in a color's table) should be in its hex value.

๐Ÿงป Key-bindings

There are no default key-bindings. However, you can set them on your own as you'd normally do! Here is an example mapping <F3> to highlight stuff and <F4> to remove the highlighting:

For init.lua

vim.api.nvim_set_keymap(
    "v",
    "<F3>",
    ":<c-u>HSHighlight 1<CR>",
    {
        noremap = true,
        silent = true
    }
)

vim.api.nvim_set_keymap(
    "v",
    "<F4>",
    ":<c-u>HSRmHighlight<CR>",
    {
        noremap = true,
        silent = true
    }
)

For init.vim

vnoremap <silent> <f3> :<c-u>HSHighlight 1<CR>
vnoremap <silent> <f4> :<c-u>HSRmHighlight<CR>

๐Ÿ™‹ FAQ

  • Q: "What if I repeat a color's number?"

  • A: There would a conflict when calling :HSHighlight, however it will try and call any of those colors.

  • Q: "How can I view the doc from NeoVim?"

  • A: Use :help HighStr.nvim

๐Ÿซ‚ Contribute

Pull Requests are welcomed as long as they are properly justified and there are no conflicts. If your PR has something to do with the README or in general related with the documentation, I'll gladly merge it! Also, when writing code for the project you must use the .editorconfig file on your editor so as to "maintain consistent coding styles". For instructions on how to use this file refer to EditorConfig's website.

๐Ÿ’ญ Inspirations

The following projects inspired the creation of HighStr.nvim. If possible, go check them out to see why they are so amazing :]

๐Ÿ“œ License

HighStr.nvim is released under the GPL v3.0 license. It grants open-source permissions for users including:

  • The right to download and run the software freely
  • The right to make changes to the software as desired
  • The right to redistribute copies of the software
  • The right to modify and distribute copies of new versions of the software

For more convoluted language, see the LICENSE file.

๐Ÿ“‹ TO-DO

High Priority

  • Store and Restore highlights on a per-file basis

Low Priority

  • Add tab completion to get more than 10 numbers.

Enjoy!

Owner
Pocco81
Under dev dev
Pocco81
A Telegram Bot Written In Python To Upload Medias To telegra.ph

Telegraph-Uploader A Telegram Bot Written In Python To Upload Medias To telegra.ph DEPLOY YOU CAN SIMPLY DEPLOY ON HEROKU BY CLICKING THE BUTTON BELOW

Rithunand 31 Dec 03, 2022
Helping you manage your data science projects sanely.

PyDS CLI Helping you manage your data science projects sanely. Requirements Anaconda/Miniconda/Miniforge/Mambaforge (Mambaforge recommended!) git on y

Eric Ma 16 Apr 25, 2022
A Python script for finding a food-truck based on latitude and longitude coordinates that you can run in your shell

Food Truck Finder Project Description This repository contains a Python script for finding a food-truck based on latitude and longitude coordinates th

1 Jan 22, 2022
Wordle-solver - A tool that helps people who struggle with vocabulary to enjoy the famous game of WORDLE

Wordle-Solver Wordle-Solver helps people who struggle with vocabulary to enjoy t

Jason Chao 104 Dec 31, 2022
bsp_tool provides a Command Line Interface for analysing .bsp files

bsp_tool Python library for analysing .bsp files bsp_tool provides a Command Line Interface for analysing .bsp files Current development is focused on

Jared Ketterer 64 Dec 28, 2022
A Simple Python CLI Lockpicking Tool

Cryptex a simple CLI lockpicking tool What can it do: Encode / Decode Hex Encode / Decode Base64 Break Randomly :D Requirements: Python3 Linux as your

Alex Kollar 23 Jul 04, 2022
Powerful yet easy command line calculator.

Powerful yet easy command line calculator.

Cruisen 1 Jul 22, 2022
Gitfetch is a simple tool to get github user details

Gitfetch Just a (cli?) tool to get github user details ๐Ÿ™‚ Installation ๐Ÿ“‚ Install Gitfetch via pypi pip install gitfetch or pip install git+https://g

I'm Not A Bot #Left_TG 7 Jan 23, 2022
Terminal Colored Text for Python

Terminal Colored Text for Python

R3CKhi-**75 3 Sep 10, 2022
texel - Command line interface for reading spreadsheets inside terminal

texel - Command line interface for reading spreadsheets inside terminal. Sometimes, you have to deal with spreadsheets. Those are sad times. Fortunate

128 Dec 19, 2022
Rover is a command line interface application that allows through browse through mission data, images, metadata from the NASA Official Website

๐Ÿค– rover Rover is a command line interface application that allows through browse through mission data, images, metadata from the NASA Official Websit

Saketha Ramanjam 4 Jan 19, 2022
Pyrdle - Play Wordle in the CLI. Write an algorithm to play Wordle for you. Ruin all of the fun you've been having

Pyrdle - Play Wordle in the CLI. Write an algorithm to play Wordle for you. Ruin all of the fun you've been having

Charles Tapley Hoyt 11 Feb 11, 2022
Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20)

x64-shellcode-encoder Custom 64 bit shellcode encoder that evades detection and removes some common badchars (\x00\x0a\x0d\x20) Usage Using a generato

Cole Houston 2 Jan 26, 2022
MasterDuel Image Recognition Translation Command Line Tool

MasterDuelTranslate(Use Ygo Card DataBase,belong win32 window shot & image match)

PatchouliTC 77 Dec 01, 2022
WA Terminal is a CLI application that allows us to login and send message with WhatsApp with a single command.

WA Terminal is a CLI application that allows us to login and send message with WhatsApp with a single command.

Aziz Fikri 15 Apr 15, 2022
Command line tool for interacting and testing warehouse components

Warehouse debug CLI Example usage for Zumo debugging See all messages queued and handled. Enable by compiling the zumo-controller with -DDEBUG_MODE_EN

1 Jan 03, 2022
Shellcode runner to execute malicious payload and bypass AV

buffshark-shellcode-runner Python Shellcode Runner to execute malicious payload and bypass AV This script utilizes mmap(for linux) and win api wrapper

Momo Lenard 9 Dec 29, 2022
Wappalyzer CLI tool to find Web Technologies

Wappalyzer CLI tool to find Web Technologies

GOKUL A.P 17 Dec 15, 2022
AlienFX is a CLI and GUI utility to control the lighting effects of your Alienware computer.

AlienFX is a Linux utility to control the lighting effects of your Alienware computer. At present there is a CLI version (alienfx) and a gtk GUI versi

Stephen Harris 218 Dec 26, 2022
spid-sp-test is a SAML2 SPID/CIE Service Provider validation tool that can be executed from the command line.

spid-sp-test spid-sp-test is a SAML2 SPID/CIE Service Provider validation tool that can be executed from the command line. This tool was born by separ

Developers Italia 30 Nov 08, 2022