Giter Club home page Giter Club logo

high-str.nvim's People

Contributors

pocco81 avatar yangxingwu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

high-str.nvim's Issues

The `HSRmHighlight` command (without arguments) doesn't behave as expected / documented

Immediate issue

The HSRmHighlight documentation states:

: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.

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:

  1. Visually select anything.
  2. Run :HSHighlight 1 (the command line should show :'<,'>HSHighlight 1).
  3. E481: No range allowed

  4. You should be back in normal mode at this point, run :HSHighlight 1 again.
  5. What was previsouly selected is now properly highlighted.

Other unexpected behavior

:HSRmHighlight will apparently remove more than what was last selected:

Removing line-wise highlights

Reproduction steps:

  1. Highlight line n with color X (<S-v> mapping).
  2. Highlight line n + 1 with color Y
  3. Run :HSRmHighlight without anything visually selected.
  4. Both lines should be erased except the first character of line n (in color X). it should only have erased the last thing we selected (the last highlight, in color Y).

Removing "regular" highlights

Reproduction steps:

  1. Highlight a few characters on a line with color X.
  2. Highlight some other characters on that line with color Y.
  3. Run :HSRmHighlight without anything visually selected.
  4. The entire line highlights are erased. Both X and Y colors.

The relative position of the highlighted ranges does not matter.


Bonus

It appears that the :HSRmHighlight command also erases highlights from other plugins such as indent-blankline, fortunately that's a temporary issue.

Defected imported selections

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
    }
)

ps_20210816184107
ps_20210816184314

Highlights not saved

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

Undefined variable: v:lua

Whenever I try to highlight a text, it throws this error
Undefined variable: v:lua

Could you please resolve this?

how to auto-enable/disable when entering/exiting visual mode

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.

"Lua ver. >= 5.3" in readme must be wrong

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.

[ Feature Req ] Accept text object, and normal mode

I find this plugin interesting.
However, there are some improvements I would find useful:

  • Allowing highlight using text-motions would be interesting.
  • Allow, in normal mode, unhighlight the highlighting under cursor.
  • As in another feature request, ability to jump to the next or previous highlighting.

What do you think?

Cannot export the higlighting

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.

error

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

Removing all highlights in open buffer at once

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 !

[Feature] Highlight all instances of selected word/text

It would be great to add those commands:

  • Add/remove highlight to all of the instances of the selected word (normal mode) or string (visual mode)
  • In current buffer only
  • In all buffers
  • Jump to the next/previous string belonging to the same highlight group
  • In current buffer only
  • In all buffers

[ Feature Req ] Jump to Highlights

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.

Highlight not working

Currently using with one dark theme, but the highlight is not highlighting texts in vim terminal for me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.