Obsidian.nvim
Obsidian ๐ค Neovim
Install / Use
/learn @epwalsh/Obsidian.nvimREADME
A Neovim plugin for writing and navigating Obsidian vaults, written in Lua.
Built for people who love the concept of Obsidian -- a simple, markdown-based notes app -- but love Neovim too much to stand typing characters into anything else.
If you're new to Obsidian I highly recommend watching this excellent YouTube video for a great overview.
Keep in mind this plugin is not meant to replace Obsidian, but to complement it. The Obsidian app is very powerful in its own way; it comes with a mobile app and has a lot of functionality that's not feasible to implement in Neovim, such as the graph explorer view. That said, this plugin stands on its own as well. You don't necessarily need to use it alongside the Obsidian app.
Table of contents
- ๐ Features
- โ๏ธ Setup
- โ Contributing
Features
โถ๏ธ Completion: Ultra-fast, asynchronous autocompletion for note references and tags via nvim-cmp (triggered by typing [[ for wiki links, [ for markdown links, or # for tags), powered by ripgrep.
๐ Navigation: Navigate throughout your vault by typing gf on any link to another note.
๐ท Images: Paste images into notes.
๐ Syntax: Additional markdown syntax highlighting, concealing, and extmarks for references, tags, and check-boxes.
Commands
-
:ObsidianOpen [QUERY]to open a note in the Obsidian app. This command has one optional argument: a query used to resolve the note to open by ID, path, or alias. If not given, the note corresponding to the current buffer is opened. -
:ObsidianNew [TITLE]to create a new note. This command has one optional argument: the title of the new note. -
:ObsidianQuickSwitchto quickly switch to (or open) another note in your vault, searching by its name using ripgrep with your preferred picker (see plugin dependencies below). -
:ObsidianFollowLink [vsplit|hsplit]to follow a note reference under the cursor, optionally opening it in a vertical or horizontal split. -
:ObsidianBacklinksfor getting a picker list of references to the current buffer. -
:ObsidianTags [TAG ...]for getting a picker list of all occurrences of the given tags. -
:ObsidianToday [OFFSET]to open/create a new daily note. This command also takes an optional offset in days, e.g. use:ObsidianToday -1to go to yesterday's note. Unlike:ObsidianYesterdayand:ObsidianTomorrowthis command does not differentiate between weekdays and weekends. -
:ObsidianYesterdayto open/create the daily note for the previous working day. -
:ObsidianTomorrowto open/create the daily note for the next working day. -
:ObsidianDailies [OFFSET ...]to open a picker list of daily notes. For example,:ObsidianDailies -2 1to list daily notes from 2 days ago until tomorrow. -
:ObsidianTemplate [NAME]to insert a template from the templates folder, selecting from a list using your preferred picker. See "using templates" for more information. -
:ObsidianSearch [QUERY]to search for (or create) notes in your vault usingripgrepwith your preferred picker. -
:ObsidianLink [QUERY]to link an inline visual selection of text to a note. This command has one optional argument: a query that will be used to resolve the note by ID, path, or alias. If not given, the selected text will be used as the query. -
:ObsidianLinkNew [TITLE]to create a new note and link it to an inline visual selection of text. This command has one optional argument: the title of the new note. If not given, the selected text will be used as the title. -
:ObsidianLinksto collect all links within the current buffer into a picker window. -
:ObsidianExtractNote [TITLE]to extract the visually selected text into a new note and link to it. -
:ObsidianWorkspace [NAME]to switch to another workspace. -
:ObsidianPasteImg [IMGNAME]to paste an image from the clipboard into the note at the cursor position by saving it to the vault and adding a markdown image link. You can configure the default folder to save images to with theattachments.img_folderoption. -
:ObsidianRename [NEWNAME] [--dry-run]to rename the note of the current buffer or reference under the cursor, updating all backlinks across the vault. Since this command is still relatively new and could potentially write a lot of changes to your vault, I highly recommend committing the current state of your vault (if you're using version control) before running it, or doing a dry-run first by appending "--dry-run" to the command, e.g.:ObsidianRename new-id --dry-run. -
:ObsidianToggleCheckboxto cycle through checkbox options. -
:ObsidianNewFromTemplate [TITLE]to create a new note from a template in the templates folder. Selecting from a list using your preferred picker. This command has one optional argument: the title of the new note. -
:ObsidianTOCto load the table of contents of the current note into a picker list.
Demo
Setup
System requirements
- NeoVim >= 0.8.0 (this plugin uses
vim.fswhich was only added in 0.8). - If you want completion and search features (recommended) you'll need ripgrep to be installed and on your
$PATH. See ripgrep#installation for install options.
Specific operating systems also require additional dependencies in order to use all of obsidian.nvim's functionality:
- Windows WSL users need
wsl-openfor the:ObsidianOpencommand. - MacOS users need
pngpaste(brew install pngpaste) for the:ObsidianPasteImgcommand. - Linux users need xclip (X11) or wl-clipboard (Wayland) for the
:ObsidianPasteImgcommand.
Search functionality (e.g. via the :ObsidianSearch and :ObsidianQuickSwitch commands) also requires a picker such telescope.nvim (see plugin dependencies below).
Install and configure
To configure obsidian.nvim you just need to call require("obsidian").setup({ ... }) with the desired options.
Here are some examples using different plugin managers. The full set of plugin dependencies and configuration options are listed below.
โ ๏ธ WARNING: if you install from the latest release (recommended for stability) instead of
main, be aware that the README onmainmay reference features that haven't been released yet. For that reason I recommend viewing the README on the tag for the latest release instead ofmain.
Using lazy.nvim
return {
"epwalsh/obsidian.nvim",
version = "*", -- recommended, use latest release instead of latest commit
lazy = true,
ft = "markdown",
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
-- event = {
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
-- -- E.g. "BufReadPre " .. vim.fn.expan
