iswap.nvim icon indicating copy to clipboard operation
iswap.nvim copied to clipboard

offer buffer-local and global runtime config

Open matu3ba opened this issue 2 years ago • 5 comments
trafficstars

Instead of having to use

  ensure_installed = { 'bash', 'c', 'cpp', 'julia', 'lua', 'python', 'rust', 'typescript', 'vim', 'vimdoc', 'zig' },
  auto_install = true,
  highlight = {
    enable = true,
    additional_vim_regex_highlighting = false,
    ..
    disable = { 'c', 'cpp', 'zig' },
  },
  incremental_selection = {
    enable = true,
    keymaps = {
      ..
      disable = { 'c', 'cpp', 'zig' }, -- slow, so opt-in
    },
  },
  indent = {
    enable = true,
    disable = { 'c', 'cpp', 'python', 'zig' }, -- broken
  },
}
require('iswap').setup {}

I would prefer

  ensure_installed = { 'bash', 'c', 'cpp', 'julia', 'lua', 'python', 'rust', 'typescript', 'vim', 'vimdoc', 'zig' },
  auto_install = true,
  highlight = {
    enable = true,
    additional_vim_regex_highlighting = false,
    ..
    disable = { 'c', 'cpp', 'zig' },
  },
  incremental_selection = {
    enable = true,
    keymaps = {
      ..
      disable = { 'c', 'cpp', 'zig' }, -- slow, so opt-in
    },
  },
  indent = {
    enable = true,
    disable = { 'c', 'cpp', 'python', 'zig' }, -- broken
  },
  iswap = {
    enable = true,
    disable = { 'c', 'cpp', 'zig' },
  },
}

Justification: nvim gcc/c-family/c-common.cc from git://gcc.gnu.org/git/gcc.git freezes editor due to treesitter and generally one must be able to workaround not well written parsers via run-time opt-in until nvim-treesitter can handle those cases of treesitter misbehaving. The user could hack around via checking file types, but that is a not good user experience.

matu3ba avatar May 17 '23 12:05 matu3ba

Note that the module system in nvim-treesitter will soon disappear, so it's not a good idea to try to integrate with it..

Ref: https://github.com/nvim-treesitter/nvim-treesitter/issues/4767

bew avatar May 17 '23 12:05 bew

Thanks, I did adjust the issue.

matu3ba avatar May 17 '23 12:05 matu3ba

thanks for filing this! so it seems we shouldn’t do it that way, but i can also provide a disable option with a table value (and potentially correspondly an enable option with table value). would that be preferred?

On Wed, May 17, 2023 at 5:16 AM Benoit de Chezelles < @.***> wrote:

Note that the module system in nvim-treesitter will soon disappear, so it's not a good idea to try to integrate with it..

Ref: nvim-treesitter/nvim-treesitter#4767 https://github.com/nvim-treesitter/nvim-treesitter/issues/4767

— Reply to this email directly, view it on GitHub https://github.com/mizlan/iswap.nvim/issues/77#issuecomment-1551287622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKSBU2KZ24C45NXDFEO4H7TXGS6TXANCNFSM6AAAAAAYE7YQTQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mizlan avatar May 17 '23 16:05 mizlan

I leave that to you as maintainer and code owner. ;-)

matu3ba avatar May 17 '23 18:05 matu3ba

what do you mean by buffer-local? You could have a filetype-specific autocommand, but I don't see how I could make my plugin buffer-local

mizlan avatar May 17 '23 19:05 mizlan