Skip to content

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonwilliams committed Jan 15, 2024
1 parent 638b961 commit 33fe4fb
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
<img src="./docs/img/Visual_Studio_Code_1.35_icon.png" width=18%>
</div>
<br />
This is a fork of an older Helix extension which in itself was a fork of the VSCode Vim extension. So there are still a lot of references to Vim in this source code. It is a work in progress.
This is a Visual Studio Code implementation of [Helix](https://docs.helix-editor.com) Keybindings and Commands. I created this because I wanted to use Helix in VS Code and was frustrated with the built-in commands not being ergonomic. I didn't want to move fully unto helix and lose the benefits of VS Code, so I decided to create this extension.

It is a work in progress, feel free to raise issues or contribute on the issue tracker.

## Commands

Expand All @@ -29,6 +31,12 @@ For added performance, you can try adding the following [setting](https://github

## Differences

There will be some differences between this extension and native Helix, these will be due:

- Both are visually different and offer different features (such as VS Code having multiple windows and tabs rather than buffers)
- VS Code not having TreeSitter or an AST, so we need to find other ways of achieving the same action.
- Additional keybindings to match more how VS Code works

### Window Mode

Due to VS Code having tabs I've needed to add some new windows modes on top of the current Helix ones, these commands are based
Expand All @@ -42,6 +50,7 @@ around movements, (i.e moving the editor from one window to another).
| `ctrl + w, m, w` | Move editor out into a new window (experimental) |
| `ctrl + w, m, j` | Rejoin editor with main window (experimental) |
| `ctrl + w, c` | Close window (alias to ctrl + w, q) |
| `ctrl + w, n` | New untitled editor (prev ctrl+n/cmd+n in VS Code) |

Most of the differences will be related to the fact VSCode doesn't have TreeSitter or have access to an AST. So we often need to find other ways of achieving the same action.

Expand All @@ -62,3 +71,7 @@ Feel free to pick up any of these if you wanted to contribute.

- [#3](https://github.com/jasonwilliams/vscode-helix/issues/3) Commit checkpoints, extensions don't have access to VS Code's back/forward stack. So it would need to have its own stack in memory which can be manipulated.
- [#4](https://github.com/jasonwilliams/vscode-helix/issues/4) Custom keymaps, currently keymaps are matching Helix

## Insert Mode

- `ctrl + k` (delete to end of line) needs to be `ctrl + l` instead due to it conflicting with VS Code's chord mode which extensions can't turn off.
37 changes: 36 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-helix-emulation",
"version": "0.4.3",
"version": "0.5.0",
"displayName": "Helix For VS Code",
"description": "Helix emulation for Visual Studio Code",
"publisher": "jasew",
Expand Down Expand Up @@ -230,6 +230,41 @@
"key": "alt+.",
"command": "extension.helixKeymap.repeatLastMotion",
"when": "editorTextFocus && extension.helixKeymap.normalMode"
},
{
"key": "ctrl+w",
"command": "deleteWordLeft",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
},
{
"key": "alt+d",
"command": "deleteWordRight",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
},
{
"key": "alt+d",
"command": "deleteWordRight",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
},
{
"key": "ctrl+u",
"command": "deleteAllLeft",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
},
{
"key": "ctrl+l",
"command": "deleteAllRight",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
},
{
"key": "ctrl+d",
"command": "deleteRight",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
},
{
"key": "ctrl+h",
"command": "deleteLeft",
"when": "editorTextFocus && extension.helixKeymap.insertMode"
}
],
"configuration": {
Expand Down
5 changes: 5 additions & 0 deletions src/actions/windowMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,9 @@ export const windowActions: Action[] = [
commands.executeCommand('workbench.action.moveActiveEditorGroupRight');
enterNormalMode(helixState);
}),

parseKeysExact(['n'], [Mode.Window], (helixState) => {
commands.executeCommand('workbench.action.files.newUntitledFile');
enterNormalMode(helixState);
}),
];

0 comments on commit 33fe4fb

Please sign in to comment.