diff --git a/autoload/publish_helper.vim b/autoload/publish_helper.vim index f766c27..129e7b6 100644 --- a/autoload/publish_helper.vim +++ b/autoload/publish_helper.vim @@ -1,9 +1,9 @@ " File: autoload/publish_helper.vim " Author: Alexey Radkov -" Version: 0.15.2 +" Version: 0.16 " Description: autoload functions for plugin/publish_helper.vim -" next Xterm2rgb... conversion functions are adopted from plugin Colorizer.vim +" Xterm2rgb... converters were adopted from plugin Colorizer.vim fun! s:Xterm2rgb16(color) " 16 basic colors let r=0 @@ -220,6 +220,7 @@ fun! s:split_synids(fst_line, last_line, ts, ...) let sk_trans = synIDtrans(hlID('SpecialKey')) while cursor[1] <= a:last_line let old_synId = '^' + let old_trans = 0 let old_start = cursor[2] let cols = col('$') if linenr >= 0 @@ -248,8 +249,8 @@ fun! s:split_synids(fst_line, last_line, ts, ...) else let [synIdNmb, len] = [synID(line('.'), col('.'), 1), 1] endif - let synId = synIDattr(synIdNmb, 'name') let trans = synIDtrans(synIdNmb) + let synId = synIDattr(trans, 'name') if len == 0 let len = line('$') - line('.') endif diff --git a/doc/publish_helper.txt b/doc/publish_helper.txt index ba33c01..8383ecd 100644 --- a/doc/publish_helper.txt +++ b/doc/publish_helper.txt @@ -1,10 +1,10 @@ -*publish_helper.txt* For Vim version 7.3 and above Last change: 2024 May 19 +*publish_helper.txt* For Vim version 7.3 and above Last change: 2024 May 24 ------------------------------ Publish Helper (HTML and TeX) ------------------------------ - version 0.15.2 + version 0.16 Author: Alexey Radkov @@ -582,15 +582,19 @@ Christian Brabandt for plugin Colorizer and Xterm2rgb translation functions. *publish_helper-changes* A. Change History~ -0.15 - 0.15.2 +0.16 - fixed handling colors when 'termguicolors' is set - - escape single quotes in command MakeHtmlCodeHighlight + - fixes in script lua/publish-helper.lua, now it also has support for + Neovim 0.10 - set b:current_syntax in syntax/shelloutput.vim which fixes rendering shelloutput in Neovim via the treesitter fallback - - disable TOhtml rendering engine in Neovim 0.10 because plugin TOhtml was - rewritten in this version of Neovim in a non-compatible way - - vimhl 0.3.0.0 - 0.3.2.0: many improvements (see release notes at github) - - update the sample .vimrc.pandoc to use with Neovim + - disable TOhtml rendering engine in Neovim 0.10 because plugin TOhtml + was rewritten in this version of Neovim in a non-compatible way + - extend the sample .vimrc.pandoc to use with Neovim + +0.15 + - vimhl 0.3.0.0 - 0.3.2.0: a few improvements and optimizations + - escape single quotes in command MakeHtmlCodeHighlight 0.14 - startup optimization: all functions were moved to autoload/ directory diff --git a/lua/publish-helper.lua b/lua/publish-helper.lua index c4f6426..9e192f3 100644 --- a/lua/publish-helper.lua +++ b/lua/publish-helper.lua @@ -33,25 +33,18 @@ function M.get_node_hl(bufnr, row, col) local iter = query:query():iter_captures(root, bufnr, row0, row0 + 1) - for capture, node, _ in iter do - local hl = vim.fn.has('nvim-0.10') == 1 - and query:get_hl_from_capture(capture) - or query.hl_cache[capture] - - if hl and ts.is_in_node_range(node, row0, col0) then - local c = query._query.captures[capture] - if c ~= nil and c ~= '' then - local cur_hlid = 0 - cur_hlid = vim.fn.hlID(c) - if cur_hlid ~= 0 then - local _, _, end_row, end_col = ts.get_node_range(node) - hlid = cur_hlid - len = end_row > row0 and 0 or end_col - col0 - end + for capture, node, _, _ in iter do + if ts.is_in_node_range(node, row0, col0) then + hlid = vim.fn.has('nvim-0.10') == 1 + and query:get_hl_from_capture(capture) + or query.hl_cache[capture] + if hlid ~= 0 then + local _, _, end_row, end_col = ts.get_node_range(node) + len = end_row > row0 and 0 or end_col - col0 end end end - end, true) + end) end if hlid == 0 and vim.b.current_syntax ~= nil then diff --git a/pandoc/.vimrc.pandoc b/pandoc/.vimrc.pandoc index 6c725b7..39077d2 100644 --- a/pandoc/.vimrc.pandoc +++ b/pandoc/.vimrc.pandoc @@ -25,7 +25,9 @@ if has('nvim') colorscheme gruvbox-material if g:VimhlNvimUseTreesitter lua require'nvim-treesitter.configs'.setup - \ { highlight = { enable = true } } + \ { highlight = { + \ enable = true, + \ additional_vim_regex_highlighting = false } } runtime plugin/nvim-treesitter.lua let g:PhHighlightEngine = 'treesitter' endif diff --git a/plugin/publish_helper.vim b/plugin/publish_helper.vim index f083d86..0c2027d 100644 --- a/plugin/publish_helper.vim +++ b/plugin/publish_helper.vim @@ -1,6 +1,6 @@ " File: plugin/publish_helper.vim " Author: Alexey Radkov -" Version: 0.15.2 +" Version: 0.16 " Description: two commands for publishing highlighted code in HTML or TeX " (optionally from pandoc as highlighting engine from filter " vimhl.hs)