terryma / vim-expand-region

Vim plugin that allows you to visually select increasingly larger regions of text using the same key combination.
MIT License
1.1k stars 46 forks source link

Not compatible with neovim? #23

Open Xunius opened 2 years ago

Xunius commented 2 years ago

Hi, Thanks for creating this tool. I've been using it for a long time.

I'm migrating over to neovim, and noticed that it doesn't work in my setup. Below are the relevant lines in my config:

call plug#begin(stdpath('config') . '/plugged')
Plug 'terryma/vim-expand-region'
call plug#end()

nnoremap <space> <Plug>(expand_region_expand)

I'm wondering whether it is known to be incompatible with neovim, or something is wrong with my setup?

vaaaaanquish commented 2 years ago

I have the same issue. I updated neovim and now it doesn't work.

I'm trying to figure out which version stops working.

CharlesARoy commented 1 year ago

Did either of you solve this?

I started this discussion on the Nvim plugin manager Packer's GitHub page.

I haven't had time to digest all of this information yet, but I suspect that the answer is found somewhere in the following resources: http://vimcasts.org/episodes/meet-neovim/ https://vi.stackexchange.com/questions/12794/how-to-share-config-between-vim-and-neovim https://vi.stackexchange.com/questions/613/how-do-i-install-a-plugin-in-vim-vi https://github.com/nanotee/nvim-lua-guide :h using-scripts :h usr_41.txt

I will update this when I get it working.

ifyouseewendy commented 1 year ago

Hey guys, I ran into the same problem. I found a temporary approach which is to use nvim-treesitter with the incremental selection settings,

require'nvim-treesitter.configs'.setup {
  ...
  incremental_selection = {
    enable = true,
    keymaps = {
      init_selection = "vv",
      node_incremental = "vv",
      node_decremental = "vV",
    },
  },
  ...
}
CharlesARoy commented 1 year ago

Thanks @ifyouseewendy!

It's too bad that the Treesitter option doesn't support as fine-grained expansions. If anyone learns of a Neovim port for vim-expand-region please share!

gorkunov commented 11 months ago

@CharlesARoy try this one https://github.com/gorkunov/smartpairs.vim (yes it's old) but it works well in nvim. By default it inits selection with vv then type v to expand selection and CTRL+v to shrink. Install with lazy.nvim:

  {
    "gorkunov/smartpairs.vim",
    event = "BufEnter",
  },
Jurollet commented 8 months ago

Plugin is currently working on my side, though I can't find out which module name to require to change the mapping.

Using lazy.vim, desperately tested require("vim-expand-region") // require("vim_expand_region") // require("expand-region") // require("expand_region") 😅

fcying commented 6 months ago

In my case, it works fine with nvim. Below is the lazy config

   {
        "terryma/vim-expand-region",
        event = "VeryLazy",
        keys = {
            { "v", mode = { "x" }, "<Plug>(expand_region_expand)", desc = "expand_region_expand" },
            { "V", mode = { "x" }, "<Plug>(expand_region_shrink)", desc = "expand_region_shrink" },
        },
        init = function()
            vim.cmd([[
            let g:expand_region_text_objects = {
                    \ 'iw'  :0,
                    \ 'iW'  :0,
                    \ 'i"'  :0,
                    \ 'i''' :0,
                    \ 'i]'  :1,
                    \ 'ib'  :1,
                    \ 'iB'  :1,
                    \ 'il'  :1,
                    \ 'ii'  :1,
                    \ 'ip'  :0,
                    \ 'ie'  :0,
                    \ }
            ]])
        end
    }