File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,11 @@ function M._wipe_rogue_buffer()
112
112
end
113
113
end
114
114
115
+ local function warn_wrong_mapping ()
116
+ local warn_str = " Wrong configuration for keymaps, refer to the new documentation. Keymaps setup aborted"
117
+ require ' nvim-tree.utils' .echo_warning (warn_str )
118
+ end
119
+
115
120
-- set user options and create tree buffer (should never be wiped)
116
121
function M .setup ()
117
122
M .View .side = vim .g .nvim_tree_side or M .View .side
@@ -137,14 +142,20 @@ function M.setup()
137
142
if vim .g .nvim_tree_disable_default_keybindings == 1 then
138
143
M .View .bindings = user_mappings
139
144
else
140
- M .View .bindings = vim .fn .extend (M .View .bindings , user_mappings )
145
+ ok , result = pcall (vim .fn .extend , M .View .bindings , user_mappings )
146
+ if not ok then
147
+ -- TODO: remove this in a few weeks
148
+ warn_wrong_mapping ()
149
+ return
150
+ else
151
+ M .View .bindings = result
152
+ end
141
153
end
142
154
143
155
for _ , b in pairs (M .View .bindings ) do
144
156
-- TODO: remove this in a few weeks
145
157
if type (b ) == " string" then
146
- local warn_str = " Wrong configuration for keymaps, refer to the new documentation. User keymaps setup aborted"
147
- require ' nvim-tree.utils' .echo_warning (warn_str )
158
+ warn_wrong_mapping ()
148
159
break
149
160
end
150
161
if type (b .key ) == " table" then
You can’t perform that action at this time.
0 commit comments