Skip to content

kis9a/vimsidian

Repository files navigation

vimsidian

Vim plugin to help edit Obsidian notes in Vim. Links, backlink resolution and jumps, search and completion and highlighting. Even if you don't use Obsidian, you can use it to manage your notes locally.

This plugin was made for me, but I hope it will be useful for those who want to easily edit Obsidian notes with vim as I do. If you have trouble using it, please post an issues below. Contributions, edits and distribution are also welcome.


Motivation

In my earlier days, I used to divide notes in directories and manage note relationships by describing relative paths. However, I had trouble categorizing notes and spent a lot of time resolving note paths. I needed to achieve the following.

  • Hierarchical structure is not suitable for classification of detailed personal knowledge.
  • Create atomic notes and link notes to each other.
  • Eliminate stress by unifying editing tasks and management of editing plugins in Vim.
  • [[Link]] format to integrate into Obsidian.

For me, vimsidian is the plugin that solves these issues and complements my PKM (personal knowledge managment).

Features

  • Insert mode completion of note names.
  • Find and move the link under the cursor.
  • Go to link before or afater current cursor.
  • Create a note with the name of the link under the cursor.
  • Search for notes and lines matching keywords.
  • Display notes in the quickfix window containing the tag string under the cursor.
  • Highlighting broken links.
  • Fewer dependencies.

Extensions

Initialization

Requirements

Installation

Use your favorite plugin manager.

Plug 'kis9a/vimsidian'

Configuration

  1. make .obsidian file or directory in your obsidian vault directory.

If the current working directory contains a .obsidian file or directory, it will be recognized as an Obsidian vault.

  1. configure mappings

~/.vim/ftplugin/vimsidian.vim

if exists("b:loaded_vimsidian_ftplugin_mappings")
  finish
endif
let b:loaded_vimsidian_ftplugin_mappings = 1

nnoremap <silent> <buffer> <C-k> :VimsidianJump<CR>
nnoremap <silent> <buffer> <2-LeftMouse> :VimsidianJump<CR>
nnoremap <silent> <buffer> sk :VimsidianPrevLink<CR>
nnoremap <silent> <buffer> sj :VimsidianNextLink<CR>
nnoremap <silent> <buffer> sl :VimsidianFindLinks<CR>
nnoremap <silent> <buffer> sg :VimsidianFindBacklinks<CR>
nnoremap <silent> <buffer> st :VimsidianFindTags<CR>
nnoremap <silent> <buffer> sN :VimsidianSearchNotes<Space>
nnoremap <silent> <buffer> sL :VimsidianSearchLinks<Space>

autocmd WinEnter,BufEnter <buffer> silent! VimsidianMatchBrokenLinks
autocmd CursorMoved <buffer> silent! VimsidianMatchCursorLink
Use fzf to list note names

Open listings using fzf instead of quick fix window. See fzf installation at https://github.com/junegunn/fzf.vim#installation

# e.g
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'

if executable('fzf')
  let g:vimsidian_use_fzf = 1
endif

Help

See Vim doc - Syntax highlight, Variables and Commands help

:h vimsidian

Developments

If you contribute to this repository, please use the following tools for linting and testing

Linting

Use vim-parser, vim-vimlint

make init
make lint

When using vint

make vint-int
make lint-vint

Testing

Use vim-themis, CI .github/workflows/test.yml

make init
make test

LICENSE

WTFPL license - Do What The F*ck You Want To Public License

About

Vim plugin for PKM like obsidian.md

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •