Open
Description
Describe the bug
The highlight for the dollar sign $
is improper
Steps to reproduce
- open the following example org file
test.org
#+title: Test
example 1: the verbatim should be respected
=$= the text should not be highlighted =$=
example 2: text surrounded by dolloar signs that are distanced by over 2 lines should not be highlighted
$2 billion
hello
oh not good
$3 billion
Expected behavior
- when
$
is closed by two=
, i.e=$=
then verbatim should be respected. i.e there should be no syntax highlight - when two
$
are distanced by more two lines, text between them should not be highlighted.
Emacs functionality
see description here
https://orgmode.org/manual/LaTeX-fragments.html
Text within the usual LaTeX math delimiters. To avoid conflicts with currency specifications, single ‘$’ characters are only recognized as math delimiters if the enclosed text contains at most two line breaks, is directly attached to the ‘$’ characters with no whitespace in between, and if the closing ‘$’ is followed by whitespace, punctuation or a dash. For the other delimiters, there is no such restriction, so when in doubt, use ‘(...)’ as inline math delimiters.
Minimal init.lua
vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.cmd [[set packpath=/tmp/nvim/site]]
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
local function load_plugins()
require('packer').startup {
{
'wbthomason/packer.nvim',
{ 'nvim-treesitter/nvim-treesitter' },
{ 'kristijanhusak/orgmode.nvim', branch = 'master' },
},
config = {
package_root = package_root,
compile_path = install_path .. '/plugin/packer_compiled.lua',
},
}
end
_G.load_config = function()
require('orgmode').setup_ts_grammar()
require('nvim-treesitter.configs').setup {
ensure_installed = { 'latex' },
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'org' },
},
}
vim.cmd [[packadd nvim-treesitter]]
vim.cmd [[runtime plugin/nvim-treesitter.lua]]
vim.cmd [[TSUpdateSync org]]
-- Close packer after install
if vim.bo.filetype == 'packer' then
vim.api.nvim_win_close(0, true)
end
require('orgmode').setup {
org_highlight_latex_and_related = 'native',
}
-- Reload current file if it's org file to reload tree-sitter
if vim.bo.filetype == 'org' then
vim.cmd [[edit!]]
end
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path }
load_plugins()
require('packer').sync()
vim.cmd [[autocmd User PackerCompileDone ++once lua load_config()]]
else
load_plugins()
load_config()
end
Screenshots and recordings
OS / Distro
macOS 12.6
Neovim version/commit
0.8.1
Additional context
No response