glebglazov81 downloadsEdit codeblocks of Markdown documents with external editors to get autocompletion, indentation, LSP capabilities of your favourite editor (Neovim, VSCode, etc).
From time to time I need to add a snippet of the code to the document I'm working on. For simple one-liners Obsidian out-of-the box expedience is feasible. For multi-line scripts though I prefer having autocompletion engine, auto-indent, LSP capabilities. All of that I have in my editor of choice - Neovim. So idea I came up with was to send snippet from the codeblock to Neovim and on exit synchronise it back to Obsidian. That is exactly what Claude Code have implemented for me while I was having my morning coffee.
main.js, manifest.json, styles.css)external-codeblock-editor in your vault's .obsidian/plugins/ directory.obsidian/plugins/ directorynpm install to install dependenciesnpm run build to compile the pluginGo to Settings → External Codeblock Editor to configure your terminal command.
The terminal command should be provided as a JSON array. For example:
Alacritty + Neovim:
["/opt/homebrew/bin/alacritty", "-e", "zsh", "-c", "nvim"]
Ghostty + Nano:
["/Applications/Ghostty.app/Contents/MacOS/ghostty", "-e", "zsh", "-c", "nano"]
iTerm2 + Neovim:
["/Applications/iTerm.app/Contents/MacOS/iTerm2", "-e", "nvim"]
Terminal + Vim:
["/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal", "-e", "vim"]
VS Code (direct, no terminal):
["code", "--wait"]
Sublime Text (direct, no terminal):
["subl", "--wait"]
The plugin automatically detects file extensions for:
JavaScript, TypeScript, Python, Java, C/C++, Rust, Go, HTML, CSS, SCSS, JSON, YAML, XML, SQL, Bash, Shell, PHP, Ruby, Swift, Kotlin, Scala, Clojure, Haskell, Lua, Perl, R, MATLAB, Vue, Svelte, JSX, TSX, Markdown, and more.
npm run dev - Start development mode with file watchingnpm run build - Build for productionnpm run version - Bump version and update manifestsmain.ts - Main plugin codemanifest.json - Plugin manifestesbuild.config.mjs - Build configurationpath_to_vault=<path-to-your-vault>
npm run build && mkdir -p "$path_to_vault/.obsidian/plugins/neovim-codeblocks-editor" && cp main.js styles.css manifest.json "$path_to_vault/.obsidian/plugins/neovim-codeblocks-editor"
MIT License - see LICENSE file for details.
Issues and pull requests welcome! This is a simple plugin that could benefit from community improvements.