Home

Awesome

<h1 align="center">๐ŸฆŽ HighStr.nvim</h1> <p align="center"> A NeoVim plugin for highlighting visual selections like in a normal document editor! </p> <p align="center"> <a href="https://github.com/Pocco81/HighStr.nvim/stargazers" ><img src="https://img.shields.io/github/stars/Pocco81/HighStr.nvim" alt="Repository's starts" /></a> <a href="https://github.com/Pocco81/HighStr.nvim/issues" ><img src="https://img.shields.io/github/issues-raw/Pocco81/HighStr.nvim" alt="Issues" /></a> <a href="https://github.com/Pocco81/HighStr.nvim/blob/main/LICENSE" ><img src="https://img.shields.io/github/license/Pocco81/HighStr.nvim" alt="License" /><br /> <a href="https://saythanks.io/to/Pocco81%40gmail.com" ><img src="https://img.shields.io/badge/say-thanks-modal.svg" alt="Say thanks"/></a ></a> <a href="https://github.com/Pocco81/whid.nvim/commits/main" <a href="https://github.com/Pocco81/HighStr.nvim/commits/main" ><img src="https://img.shields.io/github/last-commit/Pocco81/HighStr.nvim/dev" alt="Latest commit" /></a> <a href="https://github.com/Pocco81/HighStr.nvim" ><img src="https://img.shields.io/github/repo-size/Pocco81/HighStr.nvim" alt="GitHub repository size" /></a> </p>

<kbd><img src ="https://i.imgur.com/khiAyHd.gif"></kbd>

<p align="center"> Demo </p><hr>

TL;DR

<div style="text-align: justify"> 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. </div>

๐ŸŒฒ Table of Contents

๐ŸŽ Features

๐Ÿ“บ Notices

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

๐Ÿ“ฆ Installation

Prerequisites

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.

<details> <summary>For init.lua</summary> <p>
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
	}
})
<br /> </details> <details> <summary>For init.vim</summary> <p>
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
<br /> </details>

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

๐Ÿฌ 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.

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:

๐Ÿงป 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

๐Ÿซ‚ 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:

For more convoluted language, see the LICENSE file.

๐Ÿ“‹ TO-DO

High Priority

Low Priority

<hr> <p align="center"> Enjoy! </p>