README file from
GithubVim Commands
Bring Vim-style command mappings to all of Obsidian:
- Map multi-key sequences, leaders, and modified keys to any Obsidian command.
- Use mappings across tabs, sidebars, and other app views, not only the editor.
- Keep mappings in a vault-local, vimrc-style config file.
Vim Commands works with core commands and commands added by community plugins (everything you can find in command palette).
It stays out of text fields and Vim insert mode.
This plugin extends Obsidian's built-in Vim mode; it does not replace it. Enable Obsidian's Vim key bindings to get standard Vim editing and use these command mappings inside the Markdown editor.
Usage
- Enable Settings → Editor → Vim key bindings.
- Install and enable Vim Commands.
- Create
.vimrcin the root of your vault. You can start from the LazyVim-inspired config. - Add mappings using this form (examples below):
nmap <keys> :obcommand <command-id><CR>
- Reload the plugin after editing the file.
Change the file path under Settings → Vim Commands → Config file path if you keep these mappings elsewhere. The path must be inside the vault.
Only nmap ... :obcommand ...<CR> and let mapleader = "..." are handled; unrelated vimrc lines are ignored. The default <Leader> key is <Space>.
If a key combination conflicts with an Obsidian hotkey, unassign that hotkey under Settings → Hotkeys first.
To inspect available command IDs, open the developer console (View → Toggle developer tools or Ctrl+Shift+I / Cmd+Option+I) and run:
Object.entries(app.commands.commands).map(([id, command]) => [id, command.name]);
Mini Vimrc
Mini Vimrc complements this plugin well: Mini Vimrc configures editor behavior such as inoremap jk <Esc> and motion remaps, while Vim Commands invokes Obsidian commands throughout the app.
Mapping examples
let mapleader = ","
" Open the command palette and search
nmap <Leader>: :obcommand command-palette:open<CR>
nmap <Leader>/ :obcommand global-search:open<CR>
" Open the quick switcher
nmap <Leader><Space> :obcommand switcher:open<CR>
" Move between tabs
nmap H :obcommand workspace:previous-tab<CR>
nmap L :obcommand workspace:next-tab<CR>
" Commands from community plugins work too
nmap <Leader>gg :obcommand obsidian-git:open-git-view<CR>
LazyVim-inspired config
The examples/lazy.vimrc file is a ready-to-adapt, LazyVim-inspired starter based on LazyVim key mappings. Copy it to <vault>/.vimrc, trim what you don't need, and reload the plugin. Obsidian-specific commands are grouped under <Leader>o*.