- Neovim 0.9+
- Telescope.nvim
- [OPTIONAL] Which-key.nvim
- krafna CLI tool installed (with
PEREC_DIRenv set leading to your vault directory)
If you are using render-markdown.nvim, it does not conflict with rendering krafna queries. (but it does make the headers have the same color as every other table it renders)
- Find files within Perec vault
- Execute krafna queries (read more about queries at krafna)
- You can query FRONTMATTER data (
FROM FRONTMATTER_DATA('<PEREC_DIR>')) - You can query LINKS (
FROM MD_LINKS('<PEREC_DIR>')) - You can query TASKS (
FROM MD_TASKS('<PEREC_DIR>'))
- You can query FRONTMATTER data (
- There is a live render of queryies withinr Markdown files if in
krafnacode block.- If cells are "too wide" they will be folded to the next line. Default is 80 characters, but can be changed in options. (
defaults: { max_width = 80 }) - If result of a query is a table with 2 columns from which first one is "checked", it will render todo list with checkboxes instead of the table. (Folding is still applied)
- If cells are "too wide" they will be folded to the next line. Default is 80 characters, but can be changed in options. (
- If FROM is not specified, default is
FROM FORNTMATTER_DATA('<PEREC_DIR>'). - There is templating engine for new files.
- When creating a new file, you can specify <file_name>:<template_name> and new file will be created with template within
PEREC_DIR/templates/<template_name>.mdfile. - You can specify variables with
{{ var_name }}- There are default variables available:
{{ today }}: Current date in formatYYYY-MM-DD{{ now }}: Current time in formatYYYY-MM-DD HH:MM- You can have nested variables and this are default available:
{{ file.name }}: Name of the file being created{{ file.path }}: Path of the file being created
- There are default variables available:
- You can execute lua code with
{% lua code %}
- When creating a new file, you can specify <file_name>:<template_name> and new file will be created with template within
- There is a
:PerecTodaycommand that will create a new file with today's date in the formatYYYY-MM-DD.mdand open it in a new buffer with template fromPEREC_DIR/templates/daily.md.
Note
You have to call require('perec').setup() for plugin to be set up.
{
'7sedam7/perec.nvim',
dependencies = {
'nvim-telescope/telescope.nvim', -- if Telescope is loaded otherwise, remove from here for faster startup.
'folke/which-key.nvim' -- optional
},
init = function()
require("perec").setup()
end,
}use {
'7sedam7/perec.nvim',
requires = {
'nvim-telescope/telescope.nvim',
'folke/which-key.nvim' -- optional
}
}call plug#begin()
Plug '7sedam7/perec.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'folke/which-key.nvim' -- optional
call plug#end()No setup required. The plugin will automatically configure itself.
-- Minimal setup
require('perec').setup()-- Optional: Override default keymaps
require('perec').setup({
cwd = $env.PEREC_DIR,
defaults = {
max_width = 80,
alternate_highlighter = "KrafnaTableRowEven",
},
keys = {
group = {
key = "<leader>p",
desc = "Perec functions",
},
keymaps = {
{
mode = "n",
key = "<leader>fx",
action = require('perec').find_files,
desc = "your desc"
}
}
}
})<leader>pf: [find_files] Find files within Perec vault<leader>pg: [grep_files] Grep files within Perec vault<leader>pp: [find_queries] Find krafna queries within Perec vault<leader>pq: [query_files] Query files within Perec vault (opens query within cursor if there is one)<leader>pa: [create_file] Create a new buffer within Perec vault (you can specify template, described above)<leader>pd: [render_quick_access] Renders quick access letters over the rows of the rendered table. Pressing them will open a file associated with that row in a new buffer.- Customize by passing custom keymaps in
.setup()
There is a live preview of the query as extmap bellow the query, that get's updated on save and buffer open/enter/...
(not in priority order, more stuff that benefits this in krafna repo roadmap)
- Add templating support
- Add one search instead of find files/grep files/etc
- Extract picker logic so it can be used by snacks and mini
- Setup working with encrypted files
- render-markdown.nvim for table and todo formatting inspiration
- CodeRabbit for code reviews
- Various AI tools for help with answering questions faster then me searching on Google/StackOverflow

