pocco81 / high-str.nvim Goto Github PK
View Code? Open in Web Editor NEW๐ฆ A NeoVim plugin for highlighting visual selections like in a normal document editor!
License: GNU General Public License v3.0
๐ฆ A NeoVim plugin for highlighting visual selections like in a normal document editor!
License: GNU General Public License v3.0
The HSRmHighlight
documentation states:
:HSRmHighlight <rm_all>
: If therm_all
argument is given, removes all the highlighting in the current buffer. If not, does the same but for every line in visual selection.
Removing all highlights works fine.
However visually selecting a range and runing the function throws the following error:
E481: No range allowed
I tried both visual line and line selections, and both throw the same error.
I just realized that it was an issue with the Highlight command as well: the command doesn't work on what is currently visually selected; but it works when nothing is selected, it will highlight what was last selected.
Reproduction steps:
:HSHighlight 1
(the command line should show :'<,'>HSHighlight 1
).E481: No range allowed
normal
mode at this point, run :HSHighlight 1
again.:HSRmHighlight
will apparently remove more than what was last selected:
Reproduction steps:
n
with color X (<S-v>
mapping).n + 1
with color Y:HSRmHighlight
without anything visually selected.n
(in color X). it should only have erased the last thing we selected (the last highlight, in color Y).Reproduction steps:
:HSRmHighlight
without anything visually selected.The relative position of the highlighted ranges does not matter.
It appears that the :HSRmHighlight
command also erases highlights from other plugins such as indent-blankline
, fortunately that's a temporary issue.
Hi,
If I export selected lines/words, close file and reopen it and import color selections, it's not complete, and I don't sure if it problem with my configuration, or doing some wrong.
-- HighStr.nvim -------------------------------------------------------------------------------------------------------------------------------------------
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
}
})
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
}
)
I have been highlighting my neorg notes, which works as expected. Then I am able to save them with the HSExport command, however, when I attempt to import them again, the highlights appear but seem to highlight more than what was saved. E.g if I highlight a word and save it with HSImport, then I exit the buffer and open it again and type HSImport, the word will be highlight and some of the spaces before it. In some cases it even highlights the entire line even though I selected one word. How can I fix this? Any help would be appreciated! @pocco81
Whenever I try to highlight a text, it throws this error
Undefined variable: v:lua
Could you please resolve this?
Is there a way to set up an autocmd (or something) to call HSHighlight when entering visual mode and then call HSRmHighlight when exiting visual mode? I have them mapped to F3/F4 as shown in the README but having 'the system' do it automatically would be even better.
Hello @pocco81, I would like to ask if this great project is still active in development.
Thank you ๐ .
neovim 0.5 only builds with lua 5.1 or compatible (i e luajit 2.1 ). Can probably remove the line completely as it is also impossible to build neovim 0.5 without lua 5.1 or luajit.
I find this plugin interesting.
However, there are some improvements I would find useful:
What do you think?
Example:
HSExport /path/to/file1.txt
HSExport /path/to/file2.txt
HSImport /path/to/file1.txt
Title.
on adding highlight maybe adding some entries in a file
and the file is read on plugin load to get a save state of markers
Hi, great plugin : )
in my case i cannot save the highlightings
I highlight something and then :HSExport path/
but it outputs E488: Trailing characters
I've tried with ~/path/path/
also creating the folder.
Probably doing something wrong on my side.
I[C]: in function 'nvim_buf_add_highlight'
^I...str/tools/tool-highlight/modules/highlight_selection.lua:58: in function 'highlight_visual_selection'
^I...ghStr.nvim/lua/high-str/tools/tool-highlight/service.lua:9: in function 'highlight'
^I...vim/lua/high-str/tools/tool-highlight/highlight/init.lua:9: in function 'highlight'
^I...vim/lua/high-str/tools/tool-highlight/highlight/init.lua:15: in function 'main'
^I...inuxmint/.vim/plugged/HighStr.nvim/lua/high-str/main.lua:13: in function <...inuxmint/.vim/plugged/HighStr.nvim/lua/high-str/main.lua:7> func
tion: builtin#18 ...str/tools/tool-highlight/modules/highlight_selection.lua:58: Line number outside range
Just for future reference and anyone wondering how to achieve removing all highlights in the open buffer in one go, see below for global function snippet.
function _G.highstr_highlight_remove_all()
local api = vim.api
local buffer_current_number = api.nvim_eval([[bufnr('%')]])
local line_last = vim.fn.line('$')
api.nvim_buf_clear_namespace(buffer_current_number, 0, 1 - 1, line_last)
end
You can call this function as follows: lua _G.highstr_highlight_remove_all()
Cheers for the great plugin !
E.g. Highlighting a selection of just one unicode symbol actually highlights nothing
It would be great to add those commands:
Hey there,
I've been using your plugin to finally fill in that void of being able to highlight lines persistently across buffers.
The export and import stuff is great too, helps me keep my place when trying to learn large code bases.
The only thing I feel is lacking here is a "jump to previous" and "jump to next" highlight feature.
The use case being, you're studying a large code base, and making highlights along the way, you export and some time later, you import. It would be nice if you did not have to remember where your highlights were and could cycle thru them, jogging your memory.
The default value for saving_path
is currently:
saving_path = "/tmp/highstr/"
But when configuring it like this in Windows:
saving_path = "C:\\Work\\"
then the cords.txt
file is created in the C:\tmp\highstr
directory.
Currently using with one dark theme, but the highlight is not highlighting texts in vim terminal for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.