nvim-config

Log | Files | Refs | Submodules | README

commit 505616d1b39db3d296e51705f9a2dade484061ea
parent a6379bef2c3fee5410820549dff21a800a88e94e
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date:   Wed,  7 Sep 2022 11:27:08 +0200

feat: enhance zest plugin

Diffstat:
Mplugin/zest.lua | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/plugin/zest.lua b/plugin/zest.lua @@ -77,12 +77,12 @@ local subcommands = { search = function(count, ...) search(mk_query(count > 0, ...)) end, - goto = function(count, ...) + ["goto"] = function(count, ...) local res = zest('search', '-f', mk_query(false, ...)) local file = res[count] or res[1] if not file then return end - vim.cmd(string.format("edit %s", file)) + vim.cmd.edit(file) end, refs = function() if buf_is_zest() then @@ -91,7 +91,7 @@ local subcommands = { end, create = function() local fname = (zest 'create')[1] - vim.cmd(string.format("edit %s", fname)) + vim.cmd.edit(fname) end } @@ -125,4 +125,18 @@ end vim.api.nvim_command[[command! -complete=customlist,v:lua.Zest_complete -count=0 -nargs=+ Zest lua Zest(<count>, <f-args>)]] +vim.api.nvim_create_autocmd("Filetype", { + pattern = "markdown", + callback = function(args) + if buf_is_zest(args.buf) then + vim.api.nvim_create_autocmd("BufUnload", { + buffer = args.buf, + callback = function() + zest "reindex" + end + }) + end + end +}) + return M