Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Vim keybindings #241

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hootanht
Copy link

Fixes #238

Add support for Vim keybindings to the text editor.

  • BuiltinShortcuts:

    • Add Vim keybindings to BuiltinShortcuts in src/Apps/NetPad.Apps.App/App/src/core/@application/shortcuts/builtin-shortcuts.ts.
    • Include keybindings for common Vim commands like Escape, :w, :q, and :wq.
  • ITextEditorService:

    • Update ITextEditorService interface in src/Apps/NetPad.Apps.App/App/src/core/@application/editor/itext-editor-service.ts to include methods for enabling and disabling Vim mode.
  • TextEditor:

    • Implement methods to enable and disable Vim mode in TextEditor class in src/Apps/NetPad.Apps.App/App/src/core/@application/editor/text-editor.ts.
    • Use monaco-vim library to integrate Vim keybindings with Monaco editor.

Fixes tareqimbasher#238

Add support for Vim keybindings to the text editor.

* **BuiltinShortcuts**:
  - Add Vim keybindings to `BuiltinShortcuts` in `src/Apps/NetPad.Apps.App/App/src/core/@application/shortcuts/builtin-shortcuts.ts`.
  - Include keybindings for common Vim commands like `Escape`, `:w`, `:q`, and `:wq`.

* **ITextEditorService**:
  - Update `ITextEditorService` interface in `src/Apps/NetPad.Apps.App/App/src/core/@application/editor/itext-editor-service.ts` to include methods for enabling and disabling Vim mode.

* **TextEditor**:
  - Implement methods to enable and disable Vim mode in `TextEditor` class in `src/Apps/NetPad.Apps.App/App/src/core/@application/editor/text-editor.ts`.
  - Use `monaco-vim` library to integrate Vim keybindings with Monaco editor.
@tareqimbasher
Copy link
Owner

tareqimbasher commented Aug 12, 2024

Thank you for the contribution @hootanht. There are a few items that are missing however that we'll need to address. The few that I see so far:

  1. An indicator needs to be added (possibly in the status bar) that indicates the current vim mode (normal, insert, command). We'll also have to add/re-use some component to act as the command prompt for vim commands unless this is handled by the monaco-vim lib itself.
  2. The PR currently does not handle what happens when vim commands like :w (save) and :wq (save and close tab) are entered
  3. The monaco-vim library looks fine but it also doesn't seem to be actively maintained. Do we have other options?
  4. This is a straight forward one but I thought I'd note it since I'm listing: the monaco-vim library should be added to the package.json file and we need to resolve a couple compilation errors

I could use the work you've put in here as a starting point, your efforts are much appreciated!

@tareqimbasher
Copy link
Owner

Update: I've made some progress here and I have a working version. Currently trying to figure out the best spot to put the edit status indicator and command input in the statusbar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Vim keybindings
2 participants