Giter Site home page Giter Site logo

Cannot use vim-surround about lunarvim HOT 19 CLOSED

lunarvim avatar lunarvim commented on July 22, 2024 2
Cannot use vim-surround

from lunarvim.

Comments (19)

saimonmoore avatar saimonmoore commented on July 22, 2024 5

Has anyone got this to work? I've always used vim-surround in vim and badly miss it. I'm trying out lunarvim but there's no way to get it to work properly.

I tried out your suggestion @rosborn . Didn't have any effect. (I'm trying to do cs"')

@ChristianChiarulli not sure if this is high on your todolist but would appreciate any pointers that helps me understand the underlying issue so I can maybe debug it myself.

Also tried a number of suggestions from here: #1525 to no avail.

from lunarvim.

fairulazmin avatar fairulazmin commented on July 22, 2024 3

Thanks @pviniciusfm. I changed the timeoutlen to 1000 and it works perfectly fine.

from lunarvim.

pviniciusfm avatar pviniciusfm commented on July 22, 2024 2

@fairulazmin In my case, it was caused by this property https://github.com/ChristianChiarulli/nvim/blob/master/general/settings.vim#L35 after I increased it everything worked fine.

from lunarvim.

rebuilt avatar rebuilt commented on July 22, 2024 2

@martisj specifying the keys attribute makes it so vim-surround does not start when neovim starts. Instead, it will be lazy loaded until certain keys are pressed. I've found it to be more reliable to not lazy load vim-surround.

{ "tpope/vim-surround" },

This is my complete config if you're curious. https://github.com/rebuilt/lvim/blob/master/lua/user/plugins.lua

I've updated the docs to remove the lazy loading statement.

from lunarvim.

ChristianChiarulli avatar ChristianChiarulli commented on July 22, 2024 1

I don't think I have vim surround working right now. I'll leave this open until I fix it.

from lunarvim.

sundy-li avatar sundy-li commented on July 22, 2024 1

@fairulazmin Yes, it works, but space leader key cause too much time to respond.
I have tried many times(binary search), and I decide to change it to 285, which is suit for my speed...

from lunarvim.

martisj avatar martisj commented on July 22, 2024 1

Do I need to include all the keys that vim-surround supports for this to work?
I have

  {
    "tpope/vim-surround",
    keys = { 'd', 'c', 'y' },
  },

and set timeoutlen? is set to 2000.
However ysiw" does not work in normal mode. I expect it to surround the current inner word with ".

from lunarvim.

riolly avatar riolly commented on July 22, 2024

Me too have this issue. Is it because I using WSL2?

from lunarvim.

ChristianChiarulli avatar ChristianChiarulli commented on July 22, 2024

tracking solution to issue here: liuchengxu/vim-which-key#158

from lunarvim.

rafamadriz avatar rafamadriz commented on July 22, 2024

Closing because of inactivity.

from lunarvim.

rosborn avatar rosborn commented on July 22, 2024

Encountered this same problem. The fix that worked for me was setting keys properly when loading the plugin. For some reason this page suggests the wrong mapping for keys. Here is the correct mapping which should give you the behavior you are looking for.

 keys = {
  { 'n', 'ds' },
  { 'n', 'cs' },
  { 'n', 'cS' },
  { 'n', 'ys' },
  { 'n', 'yS' },
  { 'n', 'yss' },
  { 'n', 'ySs' },
  { 'n', 'ySS' },
  { 'x', 'S' },
  { 'x', 'gS' },
  { 'i', '<C-S>' },
  { 'i', '<C-G>s' },
  { 'i', '<C-G>S' }
}

from lunarvim.

ryudice avatar ryudice commented on July 22, 2024

It worked for me for some time with @rosborn suggestion, but now it's not working again. It's a shame because everything else works so well.

from lunarvim.

rebuilt avatar rebuilt commented on July 22, 2024

Earlier versions of Lunarvim had timeoutlen set very low. This made it impossible to type out all the vim-surround keybinds within the specified time. I'm not sure which version of Lunarvim you're using but check your timeoutlen with:

set timeoutlen? 

The default is 1000 which gives you 1 second to type everything out.

You can set the timeoutlen with:

vim.opt.timeoutlen = 1000

from lunarvim.

ryudice avatar ryudice commented on July 22, 2024

I have already set it to that unfortunately, and no luck

from lunarvim.

saimonmoore avatar saimonmoore commented on July 22, 2024

That does work for me (occasionally). I'll play with it some more.

from lunarvim.

saimonmoore avatar saimonmoore commented on July 22, 2024

(I set it to 2000)

from lunarvim.

lucasgit13 avatar lucasgit13 commented on July 22, 2024

I was getting the same issue and after setting timeoutlen = 300, everything is working now even netrw.

from lunarvim.

martisj avatar martisj commented on July 22, 2024

Can someone share their working lvim config? I simply can't get vim-surround to work.

from lunarvim.

martisj avatar martisj commented on July 22, 2024

@martisj specifying the keys attribute makes it so vim-surround does not start when neovim starts. Instead, it will be lazy loaded until certain keys are pressed. I've found it to be more reliable to not lazy load vim-surround.

{ "tpope/vim-surround" },

This is my complete config if you're curious. rebuilt/lvim@master/lua/user/plugins.lua

I've updated the docs to remove the lazy loading statement.

Thank you so much for sharing! Turns out, removing keys was all that was needed. The plugin was not installed with keys in my config 🤔 No wonder it didn't work 😅

from lunarvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.