Skip to content

Commit

Permalink
Change curly brace surround
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukaii committed Apr 26, 2020
1 parent 9bcacef commit 2a28a9d
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions keymap/vim.js
Original file line number Diff line number Diff line change
Expand Up @@ -2842,11 +2842,13 @@
if (typeof mirroredPairs[character] === 'boolean') {
openC = closeC = character
} else {
let pairs = mirroredPairs[character] ? mirroredPairs : multilinePairs

if (openCs.includes(character)) {
openC = character
closeC = mirroredPairs[character]
closeC = pairs[character]
} else {
openC = mirroredPairs[character]
openC = pairs[character]
closeC = character
}
}
Expand Down Expand Up @@ -2882,8 +2884,20 @@
cm.replaceRange(text, openPos, closePos)
}

function replaceMultilineSurround () {

function replaceCharacterAt (cm, character, position) {
var pos = {
ch: position.ch + 1,
line: position.line
}
cm.replaceRange(character, position, pos)
}

function replaceMultilineSurround (cm, searchCharacter, replaceCharacter) {
var tmp = selectCompanionObject(cm, cursor, searchCharacter, true)
const replacePair = transformCharacterPair(replaceCharacter)

replaceCharacterAt(cm, replacePair[0], tmp.start)
replaceCharacterAt(cm, replacePair[1], { ch: tmp.end.ch - 1, line: tmp.end.line })
}

if (mirroredPairs[actionArgs.search]) {
Expand Down

0 comments on commit 2a28a9d

Please sign in to comment.