A Neovim plugin for editing Logseq graphs.
It provides:
- Smart Indentation:
<Tab>and<S-Tab>move the entire bullet tree (parent + children). - Auto-bullet:
<CR>,o, andOautomatically continue the bullet list. - Strict Formatting: An
awk-based formatter (viaconform.nvim) that cleans upcollapsed::trueand enforces hierarchy/indentation levels compatible with Logseq. - Daily Note Access:
:LogseqDailyor Lua API. - Hoisting: Focus on the current block (
<leader>zl).
using lazy.nvim
{
"Conor-McLeod/logseq-mode.nvim",
dir = "/path/to/logseq-mode.nvim", -- If local
dependencies = {
"stevearc/conform.nvim", -- Optional, for formatting
"folke/snacks.nvim", -- Optional, for grep picker
},
opts = {
logseq_dir = "~/logseq-graph", -- Path to your graph
additional_dirs = { "~/main-vault" }, -- Optional, for unified search
},
config = function(_, opts)
require("logseq_mode").setup(opts)
end,
}To enable the fix-formatting on save, you need to configure conform.nvim to use the logseq_fixer.
{
"stevearc/conform.nvim",
opts = function(_, opts)
opts.formatters_by_ft = opts.formatters_by_ft or {}
-- Add logseq_fixer to markdown
-- It only runs if the file is inside the configured logseq_dir
if not opts.formatters_by_ft.markdown then
opts.formatters_by_ft.markdown = { "logseq_fixer" }
else
table.insert(opts.formatters_by_ft.markdown, "logseq_fixer")
end
end,
}The plugin automatically sets buffer-local keymaps for Markdown files inside your logseq_dir.
| Key | Description |
|---|---|
<Tab> |
Indent current tree (Smart Indent) |
<S-Tab> |
Unindent current tree |
<CR> (Insert) |
Continue list (auto-bullet) |
o / O |
New line with bullet |
<leader>zl |
Hoist block (Focus) |
local logseq = require("logseq_mode")
-- Open today's journal
logseq.daily_note()
-- Search across Logseq + other directories (requires snacks.nvim)
logseq.unified_search()