Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

0 votes

How to run a callback when an nvim plugin is loaded. Can I tie this back to running a callback when a plugin is required/imported?

I'm starting to set up my environment now and 10 months after your question I'm having the same problem. The packadd documentation says that the directory should follow the structure pack/*/opt/{name}/...
J.Adler's user avatar
  • 101
0 votes
Accepted

Check if there are non-empty or named buffers open

I ended up using this: local function no_buffers_worth_saving() for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do if vim.api.nvim_buf_get_option(bufnr, 'buflisted') and not vim.api....
ElRudi's user avatar
  • 113
0 votes

Check if there are non-empty or named buffers open

I would us the filetype and the readonly option to determine if the buffer is relevant: function are_all_buffers_unnamed_and_empty() for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do local ...
Vivian De Smedt's user avatar
1 vote
Accepted

Convert vimwiki_diary_months to lua

I would do: dict = { ['1'] = 'Enero', ['2'] = 'Febrero', ['3'] = 'Marzo', ['4'] = 'Abril', ['5'] = 'Mayo', ['6'] = 'Junio', ['7'] = 'Julio', ['8'] = 'Agosto', ['9'] = 'Septiembre', ...
Vivian De Smedt's user avatar
0 votes

How can I use vim.api from an external Lua script?

At least with Vim, I'd expect this communication to be done either using --remote-expr to communicate to a Vim server or via :help channel to communicate between Vim and a running process. I think ...
D. Ben Knoble's user avatar
  • 26.4k
1 vote
Accepted

How to lua-ify a parameterized vimscript function call?

My understanding is that vim.cmd.xxx is somehow equivalent the vim.cmd('xxx'). There are no specific specific support for vim.cmd.call. What you try to achieve is probably best done using (vim.fn): ...
Vivian De Smedt's user avatar

Top 50 recent answers are included