Open fredysan opened 3 years ago
Since the MoveQuoteMatch
function inside the motions.js
file only search for a singular char to match quotes, I added extra code to search for optional characters when the initial quote character is not found.
let quoteMatcher = new QuoteMatcher(this.charToMatch, text);
let start = quoteMatcher.findOpening(position.character);
let end = quoteMatcher.findClosing(start + 1);
if (start === -1 || end === -1 || end === start || end < position.character) {
quoteMatcher = new QuoteMatcher('"', text);
start = quoteMatcher.findOpening(position.character);
end = quoteMatcher.findClosing(start + 1);
}
if (start === -1 || end === -1 || end === start || end < position.character) {
quoteMatcher = new QuoteMatcher('`', text);
start = quoteMatcher.findOpening(position.character);
end = quoteMatcher.findClosing(start + 1);
}
@fredysan it seems this was implemented for vim.targets
now via the smartQuotes
setting.
The q
motion works with " " | ` ` | ' '
quotes using those settings:
"vim.targets.enable": true,
"vim.targets.smartQuotes.enable": true,
Based on https://github.com/beloglazov/vim-textobj-quotes
The goal is to just need to press cq, dq, yq, or vq to operate on the text in single ('), double ("), or back (`) quotes.
It would be great to see this featured implemented and I can help with code if you point me out to some examples of how text objects are currently implemented.
As a workaround I mapped q to single quotes and Q to double quotes