Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Not compatible with neovim? #23

Open
Xunius opened this issue Jan 27, 2022 · 7 comments
Open

Not compatible with neovim? #23

Xunius opened this issue Jan 27, 2022 · 7 comments

Comments

@Xunius
Copy link

Xunius commented Jan 27, 2022

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

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

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

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

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

gorkunov commented Oct 14, 2023

@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
Copy link

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

fcying commented Mar 11, 2024

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
    }

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants