Skip to content

Commit 390ab11

Browse files
committed
publish
1 parent baf6348 commit 390ab11

File tree

4 files changed

+47
-9
lines changed

4 files changed

+47
-9
lines changed

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
11
# Flash Jump
22

3-
Flash jump to anywhere in the editor. Highly inspired by the [neovim flash extension](https://github.com/folke/flash.nvim)
3+
Flash jump to anywhere in the editor. Inspired by the [neovim flash extension](https://github.com/folke/flash.nvim)
4+
5+
<video controls muted>
6+
<source src="https://github.com/bzy-debug-orgnization/vscode-extension-flash/raw/refs/heads/main/assets/example.mp4" type="video/mp4"/>
7+
</video>
8+
9+
## Features
10+
11+
- `flash-jump.flash`: start flash jump
12+
- `flash-jump.cancel`: cancel flash jump during input, biding to `escape` by default
13+
14+
## For vscode vim users
15+
16+
1. If you find this extension does not work, add following to your `settings.json`:
17+
18+
```json
19+
"extensions.experimental.affinity": {
20+
"vscodevim.vim": 1
21+
},
22+
```
23+
24+
This setting also [improves vscode vim's performance](https://github.com/VSCodeVim/Vim?tab=readme-ov-file#-faq), you might find it helpful to enable it even if you don't use this extension
25+
26+
1. If you find that `escape` shortcut of `flash-jump.cancel` does not work, app following to the end of your `keybindings.json`:
27+
28+
```json
29+
{
30+
"key": "escape",
31+
"command": "flash-jump.cancel",
32+
"when": "editorTextFocus && flash-jump.active"
33+
},
34+
```
35+
36+
The order matters here since the latter keybindings have higher priorities.

assets/example.mp4

842 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
"commands": [
2323
{
2424
"command": "flash-jump.flash",
25-
"title": "Flash: start"
25+
"title": "Flash Jump: start"
2626
},
2727
{
2828
"command": "flash-jump.cancel",
29-
"title": "Flash: cancel"
29+
"title": "Flash Jump: cancel"
3030
}
3131
],
3232
"keybindings": [

src/extension.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function placeholder(char: string): vscode.TextEditorDecorationType {
88
return vscode.window.createTextEditorDecorationType({
99
before: {
1010
contentText: char,
11-
backgroundColor: "rgb(60, 179, 113)",
11+
backgroundColor: "rgb(255, 105, 180)",
1212
color: "rgb(255, 255, 255)",
1313
textDecoration: `none; z-index: 1; position: absolute`,
1414
},
@@ -73,6 +73,11 @@ async function flash(editor: vscode.TextEditor) {
7373
vscode.TextEditorRevealType.InCenter,
7474
);
7575
};
76+
if (lastPlaceholders.length === 1 && text === "\n") {
77+
jump(lastPlaceholders[0].position);
78+
cancel();
79+
return;
80+
}
7681
for (const ph of lastPlaceholders) {
7782
if (ph.char === text) {
7883
jump(ph.position);
@@ -117,11 +122,11 @@ async function flash(editor: vscode.TextEditor) {
117122
}
118123
}
119124
}
120-
if (ranges.length === 1) {
121-
jump(ranges[0].end);
122-
cancel();
123-
return;
124-
}
125+
// if (ranges.length === 1) {
126+
// jump(ranges[0].end);
127+
// cancel();
128+
// return;
129+
// }
125130
if (ranges.length === 0) {
126131
cancel();
127132
return;

0 commit comments

Comments
 (0)