Skip to content

Commit 18c7a31

Browse files
authored
chore: remove legacy view.mappings.list (#2371)
1 parent ace6422 commit 18c7a31

File tree

9 files changed

+1
-586
lines changed

9 files changed

+1
-586
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ Take a look at the [wiki](https://github.com/nvim-tree/nvim-tree.lua/wiki) for S
2626

2727
Community support: [matrix](https://matrix.to/#/#nvim-tree:matrix.org)
2828

29-
## New Mapping Method 2023-02-27
30-
31-
[:help nvim-tree.view.mappings](doc/nvim-tree-lua.txt) have been deprecated in favour of [:help nvim-tree.on_attach](doc/nvim-tree-lua.txt). Please visit [Migrating To on_attach](https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach) to transition.
32-
3329
## Requirements
3430

3531
[neovim >=0.8.0](https://github.com/neovim/neovim/wiki/Installing-Neovim)

doc/nvim-tree-lua.txt

Lines changed: 0 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ CONTENTS *nvim-tree*
2121
5.9 API Commands |nvim-tree-api.commands|
2222
6. Mappings |nvim-tree-mappings|
2323
6.1 Default Mappings |nvim-tree-mappings-default|
24-
6.2 Legacy Mappings |nvim-tree-mappings-legacy|
2524
7. Highlight Groups |nvim-tree-highlight|
2625
8. Events |nvim-tree-events|
2726
9. Bookmarks |nvim-tree-bookmarks|
@@ -285,14 +284,6 @@ Show the mappings: `g?`
285284

286285
Calls: `api.tree.collapse_all(true)`
287286

288-
*:NvimTreeGenerateOnAttach*
289-
290-
Creates and opens a new file `nvim-tree-on-attach.lua` in |stdpath| `"cache"`,
291-
usually `$XDG_CACHE_HOME/nvim`. Contains |nvim-tree.on_attach| function based
292-
on your |nvim-tree.view.mappings|, |nvim-tree.remove_keymaps| as well as the
293-
defaults.
294-
See https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach
295-
296287
==============================================================================
297288
4. SETUP *nvim-tree-setup*
298289

@@ -324,7 +315,6 @@ applying configuration.
324315
reload_on_bufenter = false,
325316
respect_buf_cwd = false,
326317
on_attach = "default",
327-
remove_keymaps = false,
328318
select_prompts = false,
329319
view = {
330320
centralize_selection = false,
@@ -337,12 +327,6 @@ applying configuration.
337327
number = false,
338328
relativenumber = false,
339329
signcolumn = "yes",
340-
mappings = {
341-
custom_only = false,
342-
list = {
343-
-- user mappings go here
344-
},
345-
},
346330
float = {
347331
enable = false,
348332
quit_on_focus_loss = true,
@@ -816,15 +800,6 @@ specific mappings. See |nvim-tree-mappings|.
816800
When on_attach is not a function, |nvim-tree-mappings-default| will be called.
817801
Type: `function(bufnr) | string`, Default: `"default"`
818802

819-
*nvim-tree.remove_keymaps*
820-
Deprecated: please see |nvim-tree-mappings-legacy|
821-
This can be used to remove the default mappings in the tree.
822-
- Remove specific keys by passing a `string` table of keys
823-
eg. {"<C-o>", "<CR>", "o", "<Tab>"}
824-
- Remove all default mappings by passing `true`
825-
- Ignore by passing `false`
826-
Type: `bool` or `{string}`, Default: `false`
827-
828803
*nvim-tree.select_prompts*
829804
Use |vim.ui.select| style prompts. Necessary when using a UI prompt decorator
830805
such as dressing.nvim or telescope-ui-select.nvim
@@ -894,20 +869,6 @@ Window / buffer setup.
894869
Show diagnostic sign column. Value can be `"yes"`, `"auto"`, `"no"`.
895870
Type: `string`, Default: `"yes"`
896871

897-
*nvim-tree.view.mappings*
898-
Deprecated: please see |nvim-tree-mappings-legacy|
899-
900-
*nvim-tree.view.mappings.custom_only*
901-
Will use only the provided user mappings and not the default otherwise,
902-
extends the default mappings with the provided user mappings.
903-
Overrides |nvim-tree.remove_keymaps|
904-
Type: `boolean`, Default: `false`
905-
906-
*nvim-tree.view.mappings.list*
907-
A list of keymaps that will extend or override the default keymaps.
908-
Type: `table`
909-
Default: see |nvim-tree-mappings-legacy|
910-
911872
*nvim-tree.view.float*
912873
Configuration options for floating window
913874

@@ -1827,21 +1788,6 @@ config.mappings.default_on_attach({bufnr})
18271788
Parameters: ~
18281789
{bufnr} (number) nvim-tree buffer number passed to |nvim-tree.on_attach|
18291790

1830-
config.mappings.active() *nvim-tree-api.config.mappings.active()*
1831-
Deprecated: only functions when using legacy |nvim-tree.view.mappings|
1832-
Retrieve a clone of the currently active mappings: defaults + user.
1833-
Changing the active mappings will require a call to |nvim-tree-setup|
1834-
1835-
Return: ~
1836-
(table) as per |nvim-tree.view.mappings.list|
1837-
1838-
config.mappings.default() *nvim-tree-api.config.mappings.default()*
1839-
Deprecated: only functions when using legacy |nvim-tree.view.mappings|
1840-
Retrieve a clone of the default mappings.
1841-
1842-
Return: ~
1843-
(table) as per |nvim-tree.view.mappings.list|
1844-
18451791
*nvim-tree-api.config.mappings.get_keymap()*
18461792
config.mappings.get_keymap()
18471793
Retrieves all buffer local mappings for nvim-tree.
@@ -2019,57 +1965,6 @@ Alternatively, you may apply these default mappings from your |nvim-tree.on_atta
20191965
-- your removals and mappings go here
20201966
end
20211967
<
2022-
==============================================================================
2023-
6.2 LEGACY MAPPINGS *nvim-tree-mappings-legacy*
2024-
2025-
nvim-tree mappings were provided via the deprecated |nvim-tree.view.mappings|
2026-
and |nvim-tree.remove_keymaps|
2027-
2028-
These are ignored when |nvim-tree.on_attach| is present.
2029-
2030-
You are encouraged to migrate you existing legacy mappings to
2031-
|nvim-tree.on_attach| using |:NvimTreeGenerateOnAttach|
2032-
2033-
Please visit https://github.com/nvim-tree/nvim-tree.lua/wiki/Migrating-To-on_attach
2034-
2035-
`view.mappings.list` is a table of:
2036-
{key} (string|table of string) mandatory |{lhs}|.
2037-
2038-
{action} (string) mandatory name of the action.
2039-
`""` to remove an action with {key}. The case of {key} must
2040-
exactly match the action you are removing e.g. `'<Tab>'` to
2041-
remove the default preview action.
2042-
An arbitrary description when using `action_cb`.
2043-
2044-
{action_cb} (function) optional custom function that will be called.
2045-
Receives the node as a parameter.
2046-
Non-empty description for `action` is required.
2047-
2048-
{mode} (string) optional mode as per |nvim_set_keymap|.
2049-
Default `'n'`.
2050-
2051-
Examples:
2052-
>
2053-
local function print_node_path(node)
2054-
print(node.absolute_path)
2055-
end
2056-
2057-
----
2058-
2059-
view = {
2060-
mappings = {
2061-
list = {
2062-
-- remove a default mapping for cd
2063-
{ key = "<2-RightMouse>", action = "" },
2064-
2065-
-- add multiple normal mode mappings for edit
2066-
{ key = { "<CR>", "o" }, action = "edit", mode = "n" },
2067-
2068-
-- custom action
2069-
{ key = "p", action = "print_the_node_path", action_cb = print_node_path },
2070-
2071-
----
2072-
<
20731968
==============================================================================
20741969
7. HIGHLIGHT GROUPS *nvim-tree-highlight*
20751970

lua/nvim-tree.lua

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ local reloaders = require "nvim-tree.actions.reloaders.reloaders"
1212
local git = require "nvim-tree.git"
1313
local filters = require "nvim-tree.explorer.filters"
1414
local modified = require "nvim-tree.modified"
15-
local keymap_legacy = require "nvim-tree.keymap-legacy"
1615
local find_file = require "nvim-tree.actions.tree.find-file"
1716
local open = require "nvim-tree.actions.tree.open"
1817
local events = require "nvim-tree.events"
@@ -380,7 +379,6 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
380379
reload_on_bufenter = false,
381380
respect_buf_cwd = false,
382381
on_attach = "default",
383-
remove_keymaps = false,
384382
select_prompts = false,
385383
view = {
386384
centralize_selection = false,
@@ -393,12 +391,6 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
393391
number = false,
394392
relativenumber = false,
395393
signcolumn = "yes",
396-
mappings = {
397-
custom_only = false,
398-
list = {
399-
-- user mappings go here
400-
},
401-
},
402394
float = {
403395
enable = false,
404396
quit_on_focus_loss = true,
@@ -619,7 +611,6 @@ local FIELD_OVERRIDE_TYPECHECK = {
619611
width = { string = true, ["function"] = true, number = true, ["table"] = true },
620612
max = { string = true, ["function"] = true, number = true },
621613
min = { string = true, ["function"] = true, number = true },
622-
remove_keymaps = { boolean = true, table = true },
623614
on_attach = { ["function"] = true, string = true },
624615
sorter = { ["function"] = true, string = true },
625616
root_folder_label = { ["function"] = true, string = true, boolean = true },
@@ -721,8 +712,6 @@ function M.setup(conf)
721712
log.raw("config", "%s\n", vim.inspect(opts))
722713
end
723714

724-
keymap_legacy.generate_legacy_on_attach(opts)
725-
726715
require("nvim-tree.actions").setup(opts)
727716
require("nvim-tree.keymap").setup(opts)
728717
require("nvim-tree.colors").setup()

lua/nvim-tree/api.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,6 @@ Api.marks.navigate.select = wrap(require("nvim-tree.marks.navigation").select)
210210

211211
Api.config.mappings.default_on_attach = require("nvim-tree.keymap").default_on_attach
212212

213-
Api.config.mappings.active = wrap(function()
214-
notify.warn "api.config.mappings.active is deprecated in favor of config.mappings.get_keymap"
215-
return require("nvim-tree.keymap-legacy").active_mappings_clone()
216-
end)
217-
218-
Api.config.mappings.default = function()
219-
notify.warn "api.config.mappings.default is deprecated in favor of config.mappings.get_keymap_default"
220-
return require("nvim-tree.keymap-legacy").default_mappings_clone()
221-
end
222-
223213
Api.config.mappings.get_keymap = wrap(function()
224214
return require("nvim-tree.keymap").get_keymap()
225215
end)

lua/nvim-tree/commands.lua

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local keymap_legacy = require "nvim-tree.keymap-legacy"
21
local api = require "nvim-tree.api"
32
local view = require "nvim-tree.view"
43

@@ -121,15 +120,6 @@ local CMDS = {
121120
api.tree.collapse_all(true)
122121
end,
123122
},
124-
{
125-
name = "NvimTreeGenerateOnAttach",
126-
opts = {
127-
desc = "nvim-tree: generate on_attach function from deprecated view.mappings",
128-
},
129-
command = function()
130-
keymap_legacy.cmd_generate_on_attach()
131-
end,
132-
},
133123
}
134124

135125
function M.get()

lua/nvim-tree/config.lua

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)