!JAfPjWAdLCtgeCAwnS:matrix.org

Neovim

7684 Members
neovim is a great text editor | https://neovim.io | https://github.com/sponsors/neovim | Bridged to #neovim at irc.libera.chat282 Servers

Load older messages


SenderMessageTime
26 Nov 2022
@ii14:matrix.orgii14output settings?18:49:31
@ii14:matrix.orgii14replace vim.ui.select if you want to change the ui18:50:09
@clason:matrix.orgclasonhttps://github.com/nvim-telescope/telescope-ui-select.nvim#telescope-setup-and-configuration18:52:44
@mehwork:libera.chatmehworkis there an easier way of getting init.vim picking up changes to a required file (namely plugins.lua) so :PackerSync can work without restarting nvim?19:31:09
@ii14:matrix.orgii14you can unreference the module and load it again19:36:06
@ii14:matrix.orgii14 package.loaded['plugins'] = nil 19:36:19
@ii14:matrix.orgii14but you shouldn't rely on that too much19:37:40
@mehwork:libera.chatmehwork ok, also any idea why i keep seeing a Q show up in irssi here? I imagine it's from people using matrix clients sending some special char 19:42:40
@mehwork:libera.chatmehworkfor example, what you typed appeared as Qpackage.loaded...19:42:53
@fundar:matrix.orgdundargocNo, we don't use irsssi19:43:45
@gpanders:matrix.orggpandersMaybe irssi doesn’t like the back tick character19:47:35
@gpanders:matrix.orggpanders`19:47:40
@ii14:matrix.orgii14it's markdown, inline code block19:48:06
@ii14:matrix.orgii14well not Q, but backticks19:48:27
@nexs:matrix.orgNEXhi, if we want execute some system-cmd in neovim, what function should we use?19:53:09
@vi-:libera.chatvi- joined the room.19:53:17
@fundar:matrix.orgdundargocLike, a shell command?19:53:27
@vi-:libera.chatvi- haven't updated nvim pkgs in a while. What broke in tree-sitter from a few months ago? 19:53:34
@nexs:matrix.orgNEX i've found vim.fn.system vim.loop.spawn os.execute, 19:53:49
@vi-:libera.chatvi- E5113: Error while calling lua chunk: /usr/share/nvim/runtime/plugin/nvim-treesitter.lua:37: must pass one of: 'command', 'callback' 19:53:50
@ii14:matrix.orgii14vim.fn.system (vim.fn.systemlist) is synchronous, vim.fn.jobstart and vim.loop.spawn is async19:54:19
@nexs:matrix.orgNEX but seems vim.fn.system will block, and os.execute and vim.loop.spawn wont 19:54:22
@ii14:matrix.orgii14os.execute should block too19:54:31
@nexs:matrix.orgNEXoh, got it! thanks :)19:54:56
@ii14:matrix.orgii14with os.execute you don't get the output iirc19:55:11
@ii14:matrix.orgii14just the exit code19:55:15
@chanced:matrix.orgChance
In reply to @chanced:matrix.org

I'm struggling to understand why this higher order function isn't working as I'd expect as a value to Packer's config. I have never touched lua before so it is likely my ignorance of the language:

local cfg = function(plugin_name) 
	return function() require("cfg." .. plugin_name) end
end	

return packer.startup(function(use)
	use { "folke/which-key.nvim", config = cfg("which-key") }
end

Simply invoking the closure works as I'd expect outside of the packer lifecycle:

cfg("some-file")()

the problem is is that plugin_name is nil once Packer calls the config function. It works fine if I pass it a regular function:

use { "folke/which-key.nvim", config = function() require("cfg.which-key") end } 
is there a way to terminate scope, causing the context to be lost in the closure?
19:56:20
@ii14:matrix.orgii14 Chance: packer does this thing that it serializes the config function into the bytecode that is then loaded from the compiled file. the references to the outside variables are lost 19:57:53
@chanced:matrix.orgChance *

I'm struggling to understand why this higher order function isn't working as I'd expect as a value to Packer's config. I have never touched lua before so it is likely my ignorance of the language:

local cfg = function(plugin_name) 
	return function() require("cfg." .. plugin_name) end
end	

return packer.startup(function(use)
	use { "folke/which-key.nvim", config = cfg("which-key") }
end

Simply invoking the closure works as I'd expect outside of the packer lifecycle:

cfg("some-file")()

the problem is is that plugin_name is nil once Packer calls the config function. It works fine if I pass it a function directly:

use { "folke/which-key.nvim", config = function() require("cfg.which-key") end } 
19:58:03
@chanced:matrix.orgChance ii14: ahhh, thank you. 19:58:29

There are no newer messages yet.


Back to Room List