forked from VSCodeVim/Vim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make format operator (=) consistent with Vim8/NeoVim. - Format operator now operates on complete lines. - Cursor ends on first non-blank character instead of column 0. fix VSCodeVim#1574
- Loading branch information
Showing
2 changed files
with
73 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { ModeName } from '../../src/mode/mode'; | ||
import { getTestingFunctions, ITestObject } from '../testSimplifier'; | ||
import { cleanUpWorkspace, setupWorkspace } from './../testUtils'; | ||
|
||
suite('format operator', () => { | ||
let { newTest, newTestOnly } = getTestingFunctions(); | ||
|
||
setup(async () => { | ||
await setupWorkspace(undefined, '.ts'); | ||
}); | ||
|
||
teardown(cleanUpWorkspace); | ||
|
||
newTest({ | ||
title: '== formats current line', | ||
start: [' |let a;', ' let b;'], | ||
keysPressed: '==', | ||
end: ['|let a;', ' let b;'], | ||
}); | ||
|
||
newTest({ | ||
title: '=$ formats entire line', | ||
start: [' function f() {|let a;', 'let b;', '}'], | ||
keysPressed: '=$', | ||
end: ['|function f() {', ' let a;', 'let b;', '}'], | ||
}); | ||
|
||
newTest({ | ||
title: '=j formats two lines', | ||
start: [' |let a;', ' let b;', ' let c;'], | ||
keysPressed: '=j', | ||
end: ['|let a;', 'let b;', ' let c;'], | ||
}); | ||
|
||
newTest({ | ||
title: '3=k formats three lines', | ||
start: [' let a;', ' let b;', '| let c;'], | ||
keysPressed: '3=k', | ||
end: ['|let a;', 'let b;', 'let c;'], | ||
}); | ||
|
||
newTest({ | ||
title: '=gg formats to top of file', | ||
start: [' let a;', ' let b;', '| let c;'], | ||
keysPressed: '=gg', | ||
end: ['|let a;', 'let b;', 'let c;'], | ||
}); | ||
|
||
newTest({ | ||
title: '=G formats to bottom of file', | ||
start: ['| let a;', ' let b;', ' let c;'], | ||
keysPressed: '=G', | ||
end: ['|let a;', 'let b;', 'let c;'], | ||
}); | ||
|
||
newTest({ | ||
title: '=ip formats paragraph', | ||
start: [' function f() {', '|let a;', ' }', '', ' let b;'], | ||
keysPressed: '=ip', | ||
end: ['|function f() {', ' let a;', '}', '', ' let b;'], | ||
}); | ||
|
||
newTest({ | ||
title: 'format in visual mode', | ||
start: [' function f() {', 'let a;', '| }', '', ' let b;'], | ||
keysPressed: 'vkk=', | ||
end: ['|function f() {', ' let a;', '}', '', ' let b;'], | ||
}); | ||
}); |