Draft
Conversation
- The initial start of developing the vim mode key bindings
Enable 'o', 'a', 'i' for insert mode with vim
- Allow h, j, k, l, keys for vim like movement in normal mode. - Update cursor on vim movement. - Display block style cursor when in normal mode. - Allow block cursor selection with mouse. - Ensure insert works with the current selection
- Add half page down command. - Add page down command. - Add move to start of the line command. - Add move to end of the line command. **Other features are there but still have bugs so they are commented out**
- Add extra checks to determine if vim mode is on or is in insertMode
- If vim mode is on all the other keybindings will listen in. - If not they will be ignored. - There are some bugs in it like deleting on an empty space will make the widget tree panic. - The checks for vimMode all over files ensure that if the vim option is off. - The user won't be affected with normal text.
- Ctrl+b for bold is a shortcut in vim to scroll a page for example
- Update keyboard shortcuts to work with current changes.
- The idea is to bind catch key events within the shortcuts layer
- The '0' key shortcut was conflicting with vim_fsm logic. Moved it from vim.dart into vim_fsm to handle key behavior directly. - In escape_command only set vim.NormalMode if Vim mode is enabled.
- State was becoming difficult to track in vim.dart
- This test is for 'move cursor to start' in vim mode
- Most of the keys in vim.dart were relying on the ShortcutEvents main loop. Which resulted in accidental text edits. - Removing the vim.dart from the shortcuts file, allowed vim_fsm.dart to work properly. - Any other key that is not listed or captured in vim_fsm.dart is ignored.
- Since keys are being intercepted directly best to move them in one location.
- These keys '0' is similar to 'Home' & '$' is similar to 'End'
- In previous commits spamming the 'escape' key resulted in the cursor disappearing from the screen.
- Handle 'o' in Normal Mode which creates a new line and allows input. - Handle 'a' in Normal Mode which allows insert on next character in the same line. - Handle 'w' which navigates the cursor forward by a 'word'.
- By using the vim state class we can ensure that no key sequence is missed by both the user and flutter tests. - Also makes it easier to add/remove key handlers.
- The redo only happens for 1 step. It would require looking into enhancing it. - Removed some keys from vim.dart and put them in vim_fsm.dart
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is meant to support Vim Mode in the main AppFlowy app. It does not conflict with the main editor and can be toggled on/off easily.
The documentation for it is a WIP and can be found at here.
Checklist:
[h, j, k, l]4j,10l)