-
Hi, I use LazyVim for about two weeks now and mostly use default so far (they seem great so far!). Checkhealth tells me:
I only want to expand on the defaults and only overwrite what I want to change. My ~/.config/nvim/lua/plugins/neo-tree.luareturn {
"nvim-neo-tree/neo-tree.nvim",
-- opts = function(_, opts)
-- ???
-- end
config = {
window = {
mappings = {
["l"] = "open",
["h"] = "close_node",
},
},
},
} My ~/.config/nvim/lua/plugins/telescope.luareturn {
"nvim-telescope/telescope.nvim",
dependencies = {
{
"nvim-telescope/telescope-fzf-native.nvim",
build = "make",
config = function()
require("telescope").load_extension("fzf")
end,
},
},
config = {
defaults = {
mappings = {
i = {
["<C-k>"] = require("telescope.actions").move_selection_previous,
["<C-j>"] = require("telescope.actions").move_selection_next,
["<C-q>"] = require("telescope.actions").send_selected_to_qflist + require("telescope.actions").open_qflist,
},
},
},
},
-- -- does not work
-- opts = function(_, opts)
-- local telescope = require("telescope")
-- opts.defaults.mappings.i = telescope.config.mappings.i(vim.tbl_extend(opts.defaults.mappings.i, {
-- ["<C-k>"] = require("telescope.actions").move_selection_previous,
-- ["<C-j>"] = require("telescope.actions").move_selection_next,
-- ["<C-q>"] = require("telescope.actions").send_selected_to_qflist + require("telescope.actions").open_qflist,
-- }))
-- end,
-- -- does not work
-- mappings = {
-- i = {
-- ["<C-k>"] = require("telescope.actions").move_selection_previous,
-- ["<C-j>"] = require("telescope.actions").move_selection_next,
-- ["<C-q>"] = require("telescope.actions").send_selected_to_qflist + require("telescope.actions").open_qflist,
-- },
-- },
-- -- does not work
-- config = function(_, config)
-- local actions = require("telescope.actions")
-- config.defaults.mappings.i = vim.tbl_extend("force", config.defaults.mappings.i, {
-- ["<C-k>"] = actions.move_selection_previous,
-- ["<C-j>"] = actions.move_selection_next,
-- ["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
-- })
-- end,
} I tried a few things for telescope and played around with Any advice how it is done properly? I think I am still lacking some understanding how lua works. PS: What is the difference between |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
As the message says, return {
"nvim-neo-tree/neo-tree.nvim",
opts = {
window = {
mappings = {
["l"] = "open",
["h"] = "close_node",
},
},
},
} The same for telescope. However, you also need to make sure to use proper closures, otherwise you're loading telescope in the spec itself. Which is not somhing you want. ["<C-k>"] = function(...)
return require("telescope.actions").move_selection_previous(...)
end
|
Beta Was this translation helpful? Give feedback.
-
this changes looks to be very good defaults? or there is another way to achieve this without moving the hand from middle row |
Beta Was this translation helpful? Give feedback.
As the message says,
config
as a table is deprecated. Useopts
instead for this:The same for telescope.
However, you also need to make sure to use proper closures, otherwise you're loading telescope in the spec itself. Which is not somhing you want.
keys
is something that lazy supports.mappings
is a telescope option, unrelated to lazy