Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

Commit

Permalink
fix: get current buffer handle using lua api
Browse files Browse the repository at this point in the history
  • Loading branch information
pyrho committed Jan 18, 2022
1 parent 2d21665 commit eca77f5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lua/nerveux/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,16 @@ local function setup_autocmds()
-- string.format([[au BufEnter %s lua require'nerveux'.update_virtual_titles(vim.fn.expand("<abuf>"), true)]], pathpattern)
-- )
vim.cmd(string.format(
[[au BufRead %s lua require'nerveux'.update_virtual_titles(vim.fn.expand("<abuf>"), true)]],
[[au BufRead %s lua require'nerveux'.update_virtual_titles(true)]],
pathpattern))
vim.cmd(string.format(
[[au InsertLeave %s lua require'nerveux'.update_virtual_titles(vim.fn.expand("<abuf>"), true)]],
[[au InsertLeave %s lua require'nerveux'.update_virtual_titles(true)]],
pathpattern))
vim.cmd(string.format(
[[ au BufWrite %s lua require'nerveux'.update_virtual_titles(vim.fn.expand("<abuf>"),true) ]],
[[ au BufWrite %s lua require'nerveux'.update_virtual_titles(true) ]],
pathpattern))
vim.cmd(string.format(
[[ au InsertEnter %s lua require'nerveux'.update_virtual_titles(vim.fn.expand("<abuf>"),false) ]],
[[ au InsertEnter %s lua require'nerveux'.update_virtual_titles(false) ]],
pathpattern, ns))
end

Expand Down Expand Up @@ -248,7 +248,8 @@ function nerveux.open_zettel_under_cursor()
end)
end

function nerveux.update_virtual_titles(buf, is_overlay)
function nerveux.update_virtual_titles(is_overlay)
local buf = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_clear_namespace(buf, ns, 0, -1)
nerveux.add_all_virtual_titles(buf, is_overlay)
end
Expand Down

0 comments on commit eca77f5

Please sign in to comment.