Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andvarfolomeev/obsidian

:book: Base Obsidian functionality in your Neovim
https://github.com/andvarfolomeev/obsidian

neovim neovim-plugin note-taking obsidian simple

Last synced: 18 days ago
JSON representation

:book: Base Obsidian functionality in your Neovim

Awesome Lists containing this project

README

        

# Obsidian for Neovim (WIP)

I often use Obsidian to take daily notes and maintain my knowledge base.
This plugin allows you to use the basic functionality to work with Obsidian vaults.

For full experience needs [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) plugin, [nvim-cmp](https://github.com/hrsh7th/nvim-cmp) plugin. And it also needs CLI tools like [ripgrep](https://github.com/BurntSushi/ripgrep), [fd](https://github.com/sharkdp/fd) and [sd](https://github.com/chmln/sd).

See more details in [Features](#features) and [help file](doc/obsidian.txt).

## Features

- [x] Opening vault
- [x] Creating new notes
- [x] Creating/Opening daily notes
- [x] Selecting and inserting templates to buffer with support placeholders like: `{{title}}`, `{{date}}`, `{time}}`
- [x] Searching notes with Telescope integration
- [x] Searching backlinks of the current note
- [x] Going to file via wiki link
- [x] Renaming current note with updating wiki links
- [x] Autocomplete of wiki links with cmp integration
- [x] Multi vault

## Configuration example with lazy.nvim

You do not need to decorate functions in keys if you have only one vault in opts.vaults.

```lua
{
'ada0l/obsidian',
lazy = 'VeryLazy',
keys = {
{ 'ov', 'lua require("obsidian").vault_prompt()', desc = 'Vault prompt' },
{ 'oc', 'lua require("obsidian").cd_vault()', desc = 'Cd vault' },
{ 'on', 'lua require("obsidian").new_note_prompt()', desc = 'New note' },
{ 'ot', 'lua require("obsidian").open_today()', desc = 'Open today' },
{ 'oT', 'lua require("obsidian").open_today_prompt()', desc = 'Open today (shift)' },
{ 'oi', 'lua require("obsidian").template_picker()', desc = 'Template picker' },
{ 'of', 'lua require("obsidian").note_picker()', desc = 'Note picker' },
{ 'ob', 'lua require("obsidian").backlinks_picker()', desc = 'Backlinks picker' },
{ 'or', 'lua require("obsidian").rename_prompt()', desc = 'Rename prompt' },
{
'gf',
function()
if require('obsidian').found_wikilink_under_cursor() ~= nil then
return 'lua require("obsidian").go_to()'
else
return 'gf'
end
end,
noremap = false,
expr = true,
},
},
---@type ObsidianOptions
opts = {
extra_fd_opts = '--exclude assets --exclude journals --exclude _debug_remotely_save',
vaults = {
{
dir = '~/Knowledge/',
daily = {
dir = 'journals',
format = '%Y-%m-%d',
},
note = {
dir = '.',
transformator = function(filename)
if filename ~= nil and filename ~= '' then
return filename
end
return string.format('%d', os.time())
end,
},
templates = {
dir = 'templates',
date = '%Y-%d-%m',
time = '%Y-%d-%m',
},
},
},
},
}
```

### Cmp integration

```lua
{
'hrsh7th/nvim-cmp',
dependencies = {
'ada0l/obsidian',
},
---@param opts cmp.ConfigSchema
opts = function(_, opts)
local cmp = require('cmp')
local obsidian = require('obsidian')
cmp.register_source('obsidian', obsidian.get_cmp_source().new())
table.insert(opts.sources, { name = 'obsidian' })
end,
},
```

## Similar plugins

- [epwalsh/obsidian.nvim](https://github.com/epwalsh/obsidian.nvim)