chnn / obsidian.nvim

Neovim plugin for Obsidian, written in Lua

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Obsidian.nvim

A Neovim plugin for Obsidian, written in Lua.

This is 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.

Features

  • ▶️ Autocompletion for note references via nvim-cmp (triggered by typing [[)
  • 🏃 Go to a note buffer with gf when cursor is on a reference
  • 💅 Additional markdown syntax highlighting and concealing for references

Commands

  • :ObsidianBacklinks for getting a location list of references to the current buffer
  • :ObsidianToday to create a new daily note
  • :ObsidianOpen to open a note in the Obsidian app (only works on MacOS for now)

Setup

Requirements

The plugin plenary.nvim is required, and if you want completion features (recommended) you'll also need ripgrep to be installed and on your $PATH. See ripgrep#installation for install options.

Install

Using vim-plug, for example:

Plug 'nvim-lua/plenary.nvim'  " required
Plug 'hrsh7th/nvim-cmp'       " optional, for completion
Plug 'godlygeek/tabular'      " optional, needed for 'preservim/vim-markdown'
Plug 'preservim/vim-markdown' " optional, recommended for syntax highlighting, folding, etc.
Plug 'epwalsh/obsidian.nvim'

To avoid unexpected breaking changes, you can also pin Obsidian.nvim to a specific release like this:

Plug 'epwalsh/obsidian.nvim', { 'tag': 'v1.*' }

Always check the CHANGELOG when upgrading.

Configuration

For a minimal configuration, just add:

require("obsidian").setup({
  dir = "~/my-vault",
  completion = {
    nvim_cmp = true, -- if using nvim-cmp, otherwise set to false
  }
})

❗ Note that you do not need to specify this plugin as an nvim-cmp "source". Obsidian.nvim will set itself up as a source automatically when you enter a markdown buffer within your vault directory.

require("cmp").setup({
  sources = {
    { name = "obsidian" }, -- WRONG! Don't put this here. Obsidian configures itself for nvim-cmp
  },
})

About

Neovim plugin for Obsidian, written in Lua

License:Apache License 2.0


Languages

Language:Lua 81.2%Language:Python 9.3%Language:Vim Script 7.1%Language:Shell 1.2%Language:Makefile 1.2%