nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

Conflicting styling for strikethrough and tables #532

Closed LukesterWad closed 1 year ago

LukesterWad commented 1 year ago

Describe the bug

When using tables with more than two columns, the + characters in the line between the column title and data are creating a strikethrough for the - characters in between.

This only occurs with additional vim regex highlighting enabled through the treesitter config.

Steps to reproduce

Create a table with more than two columns. E.g.:

| a | b | c |
|---+---+---|
| d | e | f |
| g | h | i |

Observe that the +---+ sequence is stricken through.

Expected behavior

No strikethrough should be present.

Emacs functionality

No response

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({
    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()

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

2023-03-22_21-11-47

OS / Distro

NixOS 22.11

Neovim version/commit

0.8.1

Additional context

No response

kristijanhusak commented 1 year ago

I cannot reproduce this. Are you sure you are not using any additional org plugin, like vim-orgmode?

LukesterWad commented 1 year ago

I cannot reproduce this. Are you sure you are not using any additional org plugin, like vim-orgmode?

The only other plug-ins I use are lualine, telescope, and nvim-cmp - none of which I would imagine could interfere with the formatting.

kristijanhusak commented 1 year ago

Can you open up the given file to reproduce this, and give me the output of :scriptnames command?

LukesterWad commented 1 year ago

Can you open up the given file to reproduce this, and give me the output of :scriptnames command?

  1: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/ftplugin.vim
  2: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/indent.vim
  3: /nix/store/n0mmy8z2z95j9f94mbqnwz9py398yw90-init.vim
  4: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/filetype.lua
  5: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/filetype.vim
  6: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/syntax/syntax.vim
  7: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/syntax/synload.vim
  8: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/gzip.vim
  9: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/health.vim
 10: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/matchit.vim
 11: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/pack/dist/opt/matchit/plugin/matchit.vim
 12: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/matchparen.vim
 13: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/netrwPlugin.vim
 14: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/rplugin.vim
 15: /nix/store/8mbkc7igf46fin1vyikgawfzkmdrbdab-neovim-0.8.1/rplugin.vim
 16: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/shada.vim
 17: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/spellfile.vim
 18: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/tarPlugin.vim
 19: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/tohtml.vim
 20: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/tutor.vim
 21: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/zipPlugin.vim
 22: /nix/store/d9wfkr5ap9zxaqigy0fbhq9akyjy461w-neovim-unwrapped-0.8.1/share/nvim/runtime/plugin/man.lua
 23: /nix/store/63mgjwlwz1gcv1jm1iqrvlq5j3pc1w01-lua5.1-nvim-cmp-2022-11-18/plugin/cmp.lua
 24: /nix/store/745agxmq68qgpy76mkpmzmmvhyfd1krp-vimplugin-nvim-treesitter-2022-11-19/plugin/nvim-treesitter.lua
 25: /nix/store/kn2x25xr4w5957pwh2026xaz7ax8ksmg-vimplugin-orgmode-2022-11-18/plugin/orgmode.vim
 26: /nix/store/r3nl9kaiwyfg6p45whhxy5lc4hxkfrn1-lua5.1-plenary.nvim-2022-10-01/plugin/plenary.vim
 27: /nix/store/cdghkwx69y4rbxvp5ah3y8wj71nz21m2-vimplugin-telescope.nvim-2022-11-11/plugin/telescope.lua
 28: /nix/store/3vnfkvppmhz30k3xh3ll93jfpcis5xv2-vimplugin-cmp-buffer-2022-08-10/after/plugin/cmp_buffer.lua
 29: /nix/store/6zj7zhm2v3vikgskdlc16awq553sbs20-vimplugin-cmp-cmdline-2022-11-13/after/plugin/cmp_cmdline.lua
 30: /nix/store/sgy03zh726s0rhjh1xj2v5klqarh0djv-vimplugin-cmp-path-2022-10-03/after/plugin/cmp_path.lua
 31: /nix/store/kn2x25xr4w5957pwh2026xaz7ax8ksmg-vimplugin-orgmode-2022-11-18/ftplugin/org.vim
 32: /nix/store/kn2x25xr4w5957pwh2026xaz7ax8ksmg-vimplugin-orgmode-2022-11-18/indent/org.vim
 33: /nix/store/kn2x25xr4w5957pwh2026xaz7ax8ksmg-vimplugin-orgmode-2022-11-18/syntax/org.vim
 34: /nix/store/kn2x25xr4w5957pwh2026xaz7ax8ksmg-vimplugin-orgmode-2022-11-18/syntax/org_legacy.vim
kristijanhusak commented 1 year ago

Last file in the list (syntax/org_legacy.vim) should not be loaded. This is loaded if you do not enable treesitter highlights, which are enabled in the minimal init. Can you provide whole nvim-treesitter setup that you have in your config?

LukesterWad commented 1 year ago

Last file in the list (syntax/org_legacy.vim) should not be loaded. This is loaded if you do not enable treesitter highlights, which are enabled in the minimal init. Can you provide whole nvim-treesitter setup that you have in your config?

Apologies, it seems the minimal init I provided was derived from a newer config. This is the one I used when experiencing the issue.

require("nvim-treesitter.configs").setup({
  highlight = {
    enable = true,
    disable = {"org"},
    additional_vim_regex_highlighting = {"org"},
  }
})
kristijanhusak commented 1 year ago

Removing disable = {"org"} should fix an issue for you.