kylechui / nvim-surround

Add/change/delete surrounding delimiter pairs with ease. Written with :heart: in Lua.
MIT License
3.19k stars 62 forks source link

Feature: Surround current line (yss) #19

Closed ranjithshegde closed 2 years ago

ranjithshegde commented 2 years ago

Feature description

press yss to initiate add-surround for the current line.

Feature advantages

  1. saves keypresses. Without this, to get the same behaviour it requires something similar to this sequence 0ys$"C-o
  2. Muscle memory for many users of vim-surround

Goes without saying, thank you for your excellent work.

kylechui commented 2 years ago

@ranjithshegde Would you want this feature to select the entire line? Or not including leading whitespace?

ranjithshegde commented 2 years ago

@kylechui Thanks for taking an interest in this feature!

I dont know how other users feel, but I am fairly used to vim-surround's way of handing it. It does not include leading or trailing whitespaces. So I would prefer no leading/training whitespaces. Unless you see an advantage in including them.

kylechui commented 2 years ago

I've taken a look at how vim-surround does it and it seems that tpope added a whole other keymap in order to implement the feature. I wonder if it might be better for it to be a user setting, e.g. nmap ys ^ysg_.

ranjithshegde commented 2 years ago

Yes that works as a solution for me. Thanks.

Shall I close the issue?

kylechui commented 2 years ago

I think we can close this for now, but I'll try to remember to add a list of "recommended" mappings (or something like that) to the README/wiki

kylechui commented 2 years ago

@ranjithshegde Just as a heads up, I decided to add this feature as a default keybinding, so you can configure it in the setup table now!

ranjithshegde commented 2 years ago

Thank you!