Enabling Vim Keybindings

As of Inkdrop v3.11.0, you can configure vim keybindings by installing vim plugin which provides following features:

Enabling Vim Keybindings

As of Inkdrop v3.11.0, you can configure vim keybindings by installing vim plugin which provides following features:

  • All common motions and operators, including text objects
  • Operator motion orthogonality
  • Visual mode — characterwise, linewise, blockwise
  • Incremental highlighted search (/, ?, #, *, g#, g*)
  • Search/replace with confirm (:substitute, :%s)
  • Search history
  • Sort (:sort)
  • Marks (,)
  • :global
  • Cross-buffer yank/paste

Installation

To install vim plugin, please use ipm command which is a CLI tool to manage plugins. You can learn more about it here.

Just run below command from the terminal:

> ipm install vim

After successfully installed it, please reload the app from Menu → Developer → Reload to activate the plugin.

Key customizations

Inkdrop provides very flexible keymap system so you can customize keymaps as you like. The default vim keymaps are defined here which are almost same as vim’s basic keymaps. You can check current keybinding settings from preferences:

Keybinding Settings

If you would like to check current keymap settings for vim mode, please type “vim-mode” to the text box labeled with search keybindings and it will filter others from the list. You can override these keymaps by editing your keymap.cson file. For example, it will map b to an operation moving to previous word and ctrl-a to selecting all:'.CodeMirror.vim-mode:not(.insert-mode):not(.key-buffering) textarea':
 'b': 'vim-mode:move-to-previous-word'
 'ctrl-a': 'editor:select-all'

Note that the CSS selector indicates that keymaps will be bound for non-insert mode in this case. By specifying correct CSS selectors, you can set keymaps for specific mode:

  • Not insert mode: .CodeMirror.vim-mode:not(.insert-mode):not(.key-buffering) textarea
  • Normal mode: .CodeMirror.vim-mode.normal-mode:not(.key-buffering) textarea
  • Insert mode: .CodeMirror.vim-mode.insert-mode textarea
  • Replace mode: .CodeMirror.vim-mode.replace-mode textarea
  • Visual mode: .CodeMirror.vim-mode.visual-mode:not(.key-buffering) textarea

Ex Commands

There are some Ex commands available for controlling Inkdrop itself.

:w, :write

Saves current note immediately to the disk.

:next, :n

Opens next note on the note list.

:prev

Opens previous note on the note list.

:preview, :p

Toggles HMTL preview.

:side-by-side, :side

Toggles side-by-side mode.

Get involved

vim plugin is open-sourced so you can hack it as you like. Let’s get involved!