-
-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat branch complete on attach #1579
Conversation
@alex-courtis sorry i haven't been much here lately, i've been kind of tired to do anything related to IT to be honest. |
@kyazdani42 Glad to hear you are well, burn out is a real thing, take your time! Perhaps this is a good time to review merger with neo-tree - why duplicate work when resulting products are very similar? Thanks for all your hard work! |
:) a mixed-up feeling of burn-out and technology critique. Nevermind ^^ |
Glad to hear you are back and not intending to stress yourself.
Another maintainer would be great. There is a regular workload of bugs and PRs. I am able to dedicate time now, but that may change. Perhaps we look at some PRs and see if anyone stands out that we could approach. @gegoune : your ideas and different approaches to functionality have been most insightful. Perhaps you could be a maintainer, with a mandate of product management over development. |
I would be very happy to help to full extend of my abilities. Thank you for kind words @alex-courtis! ❤️ |
Testing 4ec73bb
local function print_node_path(node)
print(node.absolute_path)
end
require("nvim-tree").setup({
-- remove_keymaps = true,
-- remove_keymaps = {
-- -- inexistent
-- "X",
-- -- exists
-- "Y",
-- },
view = {
mappings = {
-- custom_only = true,
-- list = {
-- -- new
-- { key = "A", action = "cd" },
-- { key = "?", action = "toggle_help" },
-- -- override
-- { key = "B", action = "cd" },
-- -- remove existing
-- { key = { "<2-RightMouse>" }, action = "" },
-- { key = "C", action = "" },
-- { key = { "D", "E" }, action = "" },
-- -- remove inexistent
-- { key = "G", action = "" },
-- { key = { "L", "M" }, action = "" },
-- -- custom overwrite
-- { key = "F", action = "print_the_node_path", action_cb = print_node_path },
-- -- custom new
-- { key = { "N", "Q" }, action = "print_the_node_path", action_cb = print_node_path },
-- },
},
},
log = {
enable = true,
truncate = true,
types = {
dev = true,
},
},
})
local api = require("nvim-tree.api")
local log = require("nvim-tree.log")
local default = api.config.mappings.default()
for _, a in ipairs(default) do
log.raw("dev", "D %s %s\n", vim.inspect(a.key), a.action)
end
local active = api.config.mappings.active()
for _, a in ipairs(active) do
log.raw("dev", "A %s %s\n", vim.inspect(a.key), a.action)
end |
Add |
I think we are finally ready to release this:
@gegoune I would be most grateful if you could review the docs, help, wiki etc and sanity test the migration wiki steps with your configuration. |
|
||
Single right / middle mouse mappings will requre changes to |mousemodel| or |mouse|. | ||
|
||
DEFAULT MAPPINGS *nvim-tree-default-mappings* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these as they are problematic to generate; DEFAULT_ON_ATTACH is quite readable.
Of course. Cases on all PR's branch:
We could turn last argument ( local opts = function(desc)
return { desc = 'nvim-tree: ' .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end this will also add nice prefix automatically. Users can change it easily, but will avoid a lot of repeatition. Also, mappings with Will make couple edits to wiki page in a bit, will also look through docs and make individual comments if I find anything. Exceptional work on that PR Alex, well done! |
Noticed that vim.keymap.set('n', 'D', '', { buffer = bufnr })
vim.keymap.del('n', 'D', { buffer = bufnr }) Is it easy enough to detect and remove that pair altogether? If not mentioning it on wiki might be enough. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent!
That one is annoying. I failed at reliably detecting existing mappings so just gave up and mapped/unmapped. I'll add a comment in the generated file. |
Heh... I have a helper like that in my config. Yes. That will make the default and generated much easier to read. |
Yeah... we tried a few tricks but gave up... even getting the function name reliably is an issue. |
Thank you so much for reviewing... this one is horrible. I'll try and get the updates in tomorrow. |
There could be a comment on top of generated function saying something along those lines: "Attention: body of this function was automatically generated. Although care was taken to ensure (?)its correctness and completeness(/?) user's review is required. Please check for following issues in auto generated content: ". I have been using that branch entire week. It just works. |
This is great news. I was tempted to try and revert some legacy bits to current, now that you've made on_attach much simpler, however working code should be used. Finishing last little tasks and releasing... |
Feature branch containing all functionality to migrate from mappings to on_attach keymaps.
Resolves #1475
New
chore/action_cb_help_poc
help displays vim mappings with their descriptionmigration notification (yes, some users will get upset)no need at this timeon_attach
Legacy
chore/migrate-legacy-mappings
legacy migration of mappings to an on_attach functionchore/migrate-legacy-mappings-via-keymap
remove mappings and dispatcherchore/migrate-legacy-mappings-tool
:NvimTreeGenerateOnAttachaction = ""
translated toremove_keymaps
warn whensilently handle removal of inexistent mappingsremove_keymap
oraction = ""
key not found as this has been consistently problematic RE case etc.