this post was submitted on 08 Jul 2023
7 points (100.0% liked)

Neovim

1726 readers
1 users here now

Neovim is a modal text editor forked off of Vim in 2014. Being modal means that you do not simply type text on screen, but the behavior and functionality of the editor changes entirely depending on the mode.

The most common and most used mode, the "normal mode" for Neovim is to essentially turn your keyboard in to hotkeys with which you can navigate and manipulate text. Several modes exist, but two other most common ones are "insert mode" where you type in text directly as if it was a traditional text editor, and "visual mode" where you select text.

Neovim seeks to enable further community participation in its development and to make drastic changes without turning it in to something that is "not Vim". Neovim also seeks to enable embedding the editor within GUI applications.

The Neovim logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

founded 3 years ago
MODERATORS
 

I’ve tried all the surround plugins but what I really want is just the simple flow of: make a selection -> press “, ( etc to surround. Is that not possible with vim?

top 6 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 1 year ago (1 children)

I have also struggled to remember how the heck to use vim-surround. It doesn’t help that the documentation for pope’s plugins are always sparse and aimed towards experienced people.

[–] [email protected] 4 points 1 year ago

There is a alternative called vim-sandwich which has better documentation and better defaults (IMO).

[–] [email protected] 4 points 1 year ago* (last edited 1 year ago)

It's possible but would be awkward without making significant changes to default key mapping. ", , and ( are all motions by default, using them with a selection means "move one end of the selection to there".
Even "selection-first" editors like kakoune and helix binds the surround command with a prefix (select → surround operator → symbol). It just works better that way.

[–] [email protected] 4 points 1 year ago

I would recommend just learning the default surround behavior since it's more versatile. For example surround -> text-object -> character, siw) (surround word in parentheses) can be repeated with . (dot).

[–] [email protected] 3 points 1 year ago

" already means something though (leader to pick a register)

Try the which-key plugin, and/or make up silly stories for your bindings e.g. "you surround a word "

[–] [email protected] 3 points 1 year ago

Have you tried mini.surround module from the most wonderful mini.nvim?

my config for it makes it behaves with the exact same keybinds as tpope’s vim surround with extra goodies (highlighting surrounds and lua bracket strings).

P.S. I highly recommend checking out the modules in mini.nvim, the maintainer is a great coder and very nice and all hoa modules are top quality and far from “mini” in functionality.

load more comments
view more: next ›