All notable changes to the ModalEdit extension will be documented in this file.
- Initial release
- Added
selectTillMatchargument tomodalEdit.searchcommand. - Editor does not automatically revert back to normal mode when changing window.
- Added
startInNormalModesetting, resolving issue #1
- Incremental search now returns to insert mode, if it was invoked from there #4
- Added new command
modaledit.typeNormalKeyswhich can be used to "call" key bindings. Also fixes issue #3 - Added new argument
typeAfterAccepttomodaledit.searchcommand. This invokes normal mode key bindings (usingmodaledit.typeNormalKeys) after successful search. The argument can be used to enter insert mode, or clear selection after search, for example.
- Fixed few issues with
modaledit.searchcommand. - You can use
__selectionvariable in JS expressions to access currently selected text.
Update that was sparked by issue #6. Contains multiple new features:
repeatattribute added to commands with parameters.- Keymaps can contain key ranges.
- Support for recursive keymaps.
- New
__keySequencevariable added to JS expressions. Contains the key sequence that was used to invoke a command. - New property
helpadded to keymaps. The help string is shown in the status bar when the associated keymap is active. - Added ModalEdit log to output window.
- Semi-large refactoring of type definitions in the actions module.
- New command
modaledit.selectBetweenselects text between two delimiter strings. Especially useful when combined with the key ranges and recursive keymaps introduced in version 1.5. - Added a shorter alias
__keysto the__keySequencevariable available in JS expressions.
Two "repeat" related bigger improvements:
- New
modaledit.repeatLastChangecommand emulates Vim's dot.command quite faithfully. - The
repeatproperty used in context with commands taking arguments can now also contain a JS expression that returns a boolean value. In this case, the value is used as a condition that tells if the command should be repeated. The command is repeated as long as the expression returns a truthy value.
And some minor changes:
- New variable
__rkeysavailable for use in JS expressions. It contains the keys pressed to invoke a command in reverse order. This is handy if you need to access the last keys in the sequence. They are conveniently the first ones in__rkeys. - Removed unneeded images from the extension package. The package is now 3 MBs smaller.
Major release containing lot of new features and improvements.
It is possible now to import keybindings through the modaledit.importPresets
command. Vim presets are included in the extension
(#7). The presets can be
also defined as JavaScript (#9).
They are evaluated or "compiled" to JSON when import is run.
Search command has several new features:
-
There are four new parameters:
typeBeforeNextMatch,typeAfterNextMatch,typeBeforePreviousMatch, andtypeAfterPreviousMatch. These can be used to run key commands aftermodaledit.nextMatchandmodaledit.previousMathchcommands. The need for these parameters arose when implementing Vim'standfkey commands. These commands look for specified character and place the cursor either on it or before it. Without the new parameters, it would not be possible to emulate Vim's behavior usingmodaledit.search. This is because by default, it selects the search string and search always starts from the current cursor position. To make jumping to next and previous character possible, we need to adjust the cursor position before and after the commands. -
New parameter
wrapAroundcauses the search to jump the beginning/end of the file if it hits bottom/top. This closes issue #8 -
The implementation of
modaledit.searchandmodaledit.selectBetweencommands have been refactored. Adding the new parameters described above made it possible to simplify the implementation and remove hacky code. The changes should not break existing functionality but make these commands work more logically and consistently. For example, both of the commands now work properly when they are used to extend the existing selection.
You can now define a different cursor shape when selection is active in normal
mode using the selectCursorStyle. Also, you can
change the status bar text shown in each
mode. It is possible to include icons in the status bar, if you like. This
should be sufficient to close issue
#13
A secondary status bar was added to show the keys that have been pressed so far. It also shows help messages defined in bindings and warnings from the search command.
There is a new command modaledit.showBookmarks that shows all the defined
bookmarks. You can jump to any of them by selecting one in the list. Also,
the bookmark can now be any string instead of a number. This actually worked
previously, but now documentation about this is updated too.
New parameter select in the modaledit.goToBookmark command extends selection
till the bookmark instead of putting the cursor on it. This makes it possible to
use bookmarks as selection scoping mechanism à la Vim.
New variables __cmd and __rcmd can be used in JS expressions. They contain
the key sequence that was pressed as a string. They correspond to expressions:
__cmd = __keys.join('')
__rcmd = __rkeys.join('')In many cases, these variables allow you to write expressions that inspect the key sequence in a shorter form.
All the variants of __keys or __keySequence variables now contain the actual
key sequence that was used to invoke the command. Previously they contained the
sequence that the user pressed. Since you can also invoke key commands
programmatically using modaledit.typeNormalKeys, this made implementing
reusable commands more difficult. You could not rely on the key sequence to
correspond to the path to the keybinding you were defining. Now you can rely
that the __keys variable and its variants contain the path to the binding,
which should make sure that commands work correctly when invoked through
modaledit.typeNormalKeys.
-
Configuration section called
selectbindingscan be used to define key bindings that are in effect when selection is active. This allows you to define different key sequences for same leader keys in normal mode and selecion mode.For example in Vim, the
dkey is in normal mode the leader key for sequences such asdw(delete word) ordip(delete inside paragraph). In visual (selection) mode,ddeletes the selected text. Previously it was not possible to have such keymaps, but withselectbindingsyou can now define them. -
selectingflag is now refreshed when you switch between files. The select mode no longer "sticks" between tabs.
Two new commands (courtesy of David Little):
modaledit.enableSelectionturns selection mode on.modaledit.cancelMultipleSelectionscancels selection mode preserving multiple cursors.