A Vim plugin for working with Logseq-style markdown files.
- Syntax Highlighting for TODO/DOING/DONE keywords and tags
- Tag Search (
:Ltag) with editable results that propagate changes back to source files - Jump to Today's Journal (
:Ltoday) - opensjournals/YYYY_MM_DD.md - Wiki Links - navigate with
gfon[[page]]links - Tag Navigation - use
gfon#tagto search for all occurrences - Full Directory Search (
:Lsearch) across all Logseq markdown files - Task Status Cycling - cycle through task states: (no task) → TODO → DOING → DONE → (no task)
- Block Movement - move lines or selections up/down like in Logseq Desktop
- Wiki Link Creation - wrap selected text with
[[]]brackets in visual mode
Plug 'spacebarlabs/vim-logseq'After adding to your init.vim or .vimrc:
- Restart Vim/Neovim or run
:source $MYVIMRC - Run
:PlugInstall - Restart Vim/Neovim again
Plugin 'spacebarlabs/vim-logseq'After adding, run :PluginInstall and restart Vim/Neovim.
git clone https://github.com/spacebarlabs/vim-logseq.git ~/.vim/pack/plugins/start/vim-logseqFor Neovim:
git clone https://github.com/spacebarlabs/vim-logseq.git ~/.local/share/nvim/site/pack/plugins/start/vim-logseq- Open any markdown file in your Logseq directory
- Try
:Ltodayto open today's journal - Use
:Ltag <tagname>to search for tags - Press
gfon tags or wiki links to navigate
The following keybindings are available in Logseq files (automatically enabled for files in journals/ or pages/ directories):
<Leader>t- Cycle task status on current line (plain → TODO → DOING → DONE → plain)<Alt-k>- Move current line or visual selection up<Alt-j>- Move current line or visual selection downgf- Follow link or tag under cursor
Note: The wiki link creation feature has no default keybinding to avoid conflicts with standard Vim behavior. You can map it yourself (see Customization section below).
You can customize keybindings using the provided <Plug> mappings. Add to your .vimrc or init.vim:
" Custom keybindings for Logseq features
nmap <Leader>c <Plug>(logseq-cycle-task)
nmap <C-Up> <Plug>(logseq-move-up)
vmap <C-Up> <Plug>(logseq-move-up)
nmap <C-Down> <Plug>(logseq-move-down)
vmap <C-Down> <Plug>(logseq-move-down)
vmap <Leader>l <Plug>(logseq-make-link)Available <Plug> mappings:
<Plug>(logseq-cycle-task)- Cycle task status<Plug>(logseq-move-up)- Move block up<Plug>(logseq-move-down)- Move block down<Plug>(logseq-make-link)- Create wiki link (visual mode only)
- Check if plugin is installed: Run
:LogseqDebugto see plugin status - Verify filetype plugin is enabled: Add to your config:
filetype plugin indent on syntax on
- Check installation path: Run
:set runtimepath?and verify vim-logseq is listed - Restart Vim/Neovim: After installing or modifying config, restart completely
- Run the test script: From the plugin directory, run
./test-install.sh
- Check filetype is set correctly: Open a Logseq file and run
:set filetype?- Should show
logseqfor files injournals/orpages/directories - If it shows
markdown, manually set::set filetype=logseq
- Should show
- Ensure syntax is enabled:
:syntax on - For files outside journals/pages, manually set filetype:
:set filetype=logseq
- Ensure you're in a Logseq directory structure (with
journals/orpages/subdirectories) - Set the Logseq root:
let g:logseq_root = '/path/to/your/logseq' - Run
:LogseqDebugto check configuration
Make sure your init.vim or .vimrc has this structure:
call plug#begin()
Plug 'spacebarlabs/vim-logseq'
call plug#end()
" These must come AFTER plug#end()
filetype plugin indent on
syntax onSee :help vim-logseq for full documentation.
" Set your Logseq root directory (optional)
let g:logseq_root = '~/Documents/Logseq'
" Customize keybindings (optional)
" Example: Use different keys for task cycling
autocmd FileType logseq nmap <buffer> <C-t> <Plug>(logseq-cycle-task)
" Example: Use Ctrl+Up/Down instead of Alt+j/k for block movement
autocmd FileType logseq nmap <buffer> <C-Up> <Plug>(logseq-move-up)
autocmd FileType logseq nmap <buffer> <C-Down> <Plug>(logseq-move-down)
autocmd FileType logseq vmap <buffer> <C-Up> <Plug>(logseq-move-up)
autocmd FileType logseq vmap <buffer> <C-Down> <Plug>(logseq-move-down)