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

Add csd and dsd #727

Closed
kiryph opened this issue Mar 19, 2017 · 4 comments
Closed

Add csd and dsd #727

kiryph opened this issue Mar 19, 2017 · 4 comments

Comments

@kiryph
Copy link
Contributor

kiryph commented Mar 19, 2017

One cannot change or delete a surrounding delimiter without an additional plugin.

Example $ \left( E = (mc^2) \right) $

Would you consider adding csd and dsd to your plugin as well since ds$, dse, dsc, cse, csc already exist?

Using sandwich.vim with following configuration

" enable surround.vim style mappings
runtime macros/sandwich/keymap/surround.vim
"nmap ds <Plug>(operator-sandwich-delete)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-query-a)
"nmap dss <Plug>(operator-sandwich-delete)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-auto-a)
"nmap cs <Plug>(operator-sandwich-replace)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-query-a)
"nmap css <Plug>(operator-sandwich-replace)<Plug>(operator-sandwich-release-count)<Plug>(textobj-sandwich-auto-a)
" and modify a tex rule to use the letter `d`
let b:sandwich_recipes[26].input = ['ma', 'd']

gives you already the mappings csd and dsd. However, the rules might be different between both plugins.

@lervag
Copy link
Owner

lervag commented Mar 20, 2017

Yes, you are right. I'll add these.

lervag added a commit that referenced this issue Mar 20, 2017
@lervag
Copy link
Owner

lervag commented Mar 20, 2017

I've added first version of csd. Have to go to bed now, but I'll add dsd when I have the time. It requires some more work, because as of now, csd doesn't care about surrounding modifiers, only the actual delimiters. But dsd should also remove modifiers if they are present.

@lervag
Copy link
Owner

lervag commented Mar 21, 2017

Was easier than expected. Now it remains to add documentation.

lervag added a commit that referenced this issue Mar 21, 2017
@lervag
Copy link
Owner

lervag commented Mar 21, 2017

I guess that wasn't so hard.

@lervag lervag closed this as completed Mar 21, 2017
lervag added a commit that referenced this issue Mar 21, 2017
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

2 participants