Open hbarcelos opened 2 years ago
I made some progress with Text object for inner code block with this:
\ {
\ 'buns': ['```', '```'],
\ 'motionwise': ['line'],
\ 'cursor': 'headend',
\ 'nesting': 0,
\ 'linewise': 1,
\ 'kind': ['add', 'replace'],
\ 'action': ['add'],
\ 'filetype': ['markdown'],
\ 'input': ['G'],
\ },
\ {
\ 'buns': ['```\w*\s*\n', '\n```'],
\ 'regex': 1,
\ 'nesting': 0,
\ 'linewise': 1,
\ 'kind': ['delete', 'replace', 'textobj'],
\ 'action': ['delete'],
\ 'filetype': ['markdown'],
\ 'input': ['G'],
\ },
However because of 'motionwise': ['line']
, when I press sr`G, I get:
G() => {#console.log('foo') }G
As for the text object, probably the option skip_break
will work.
\ {
\ 'buns': ['```\w*', '```'],
\ 'regex': 1,
\ 'nesting': 0,
\ 'linewise': 1,
\ 'kind': ['delete', 'replace', 'textobj'],
\ 'action': ['delete'],
\ 'skip_break': 1,
\ 'input': ['G']
\ },
For replacing inline code with a code block operation, it might be a bug. I will check it later.
I'm trying to figure out how to bend
vim-sandwich
to my will. I spent a couple of hours in the docs already, but I'm having a hard time figuring this out.Currently I have:
What is already working
Adding a code block
After I press saipG, I get:
From there, if I want to specify the syntax for the block code I can go to intert mode with a.
Deleting a code block surrounding
Also if I have:
After I press sdG:
What is not working properly
Replacing inline code with a code block
If I have this inline code:
When I press sr`G, I get:
However I'd like the surrounding replacement to include the required line breaks:
Text object for inner code block
When I press disG, I get:
However I'd like to keep the line breaks: