Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Is there any insert mode mapping? #100

Open
yyq123 opened this issue Jul 29, 2020 · 4 comments
Open

Is there any insert mode mapping? #100

yyq123 opened this issue Jul 29, 2020 · 4 comments

Comments

@yyq123
Copy link

yyq123 commented Jul 29, 2020

Hi @machakann ,

I am wondering if there is a way to insert pairs of surroundings in insert mode?

Like insert mode mapping on <C-G>s and <C-S> of vim-surround:
https://github.com/tpope/vim-surround/blob/f51a26d3710629d031806305b6c8727189cd1935/doc/surround.txt#L82

Thanks

@machakann
Copy link
Owner

No, since I haven't used it. Could it be useful?

@yyq123
Copy link
Author

yyq123 commented Aug 2, 2020

I am writing a blog post about vim-sandwich in Chinese.

I want to show some examples based on vim-surround experience. In the other words, I would like to fulfill some vim-surround functions in vim-sandwich way, so I can do comparison between these two plugins easily.

For example, the below text
'Hello World'

Using vim-surround command cS'<p> will replace ' with tag <p> and a new line:
<p>
Hello World
</p>

How to do the same thing using vim-sandwich?

Please advice. Thank you.

@HagaiHargil
Copy link

I'm not the package author, but you can achieve almost the same behavior using sr'Tp. It will change 'Hello' to <p>Hello</p>, without the newline. I'm not sure how to add this newline automatically.

@itainoam
Copy link

itainoam commented Jan 2, 2021

Useful for autoclosing functionality.
With vim surround you could:

provides Ctrl-s (same line surrounds) and Ctrl-s-s (spread over three lines) when in insert mode to add surrounds.
Some examples in insert mode, vertical line is cursor:

Ctrl-s ( --> (|)

Ctrl-s [ --> [ | ]

Ctrl-s ] --> [|]

Ctrl-s

-->
|

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

No branches or pull requests

4 participants