Skip to content

Commit e9f3266

Browse files
authored
refactor!: remove close_floats_on_esc_key opt, replace with cancel mapping (#1052)
1 parent 6c470c3 commit e9f3266

File tree

5 files changed

+6
-11
lines changed

5 files changed

+6
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ use {
204204
},
205205
["<2-LeftMouse>"] = "open",
206206
["<cr>"] = "open",
207-
["<esc>"] = "revert_preview",
207+
["<esc>"] = "cancel", -- close preview or floating neo-tree window
208208
["P"] = { "toggle_preview", config = { use_float = true } },
209209
["l"] = "focus_preview",
210210
["S"] = "open_split",

lua/neo-tree/defaults.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ local config = {
1515
-- popup_border_style is for input and confirmation dialogs.
1616
-- Configurtaion of floating window is done in the individual source sections.
1717
-- "NC" is a special style that works well with NormalNC set
18-
close_floats_on_escape_key = true,
1918
default_source = "filesystem",
2019
enable_diagnostics = true,
2120
enable_git_status = true,
@@ -338,7 +337,7 @@ local config = {
338337
},
339338
["<2-LeftMouse>"] = "open",
340339
["<cr>"] = "open",
341-
["<esc>"] = "revert_preview",
340+
["<esc>"] = "cancel", -- close preview or floating neo-tree window
342341
["P"] = { "toggle_preview", config = { use_float = true } },
343342
["l"] = "focus_preview",
344343
["S"] = "open_split",

lua/neo-tree/setup/deprecations.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ M.migrate = function(config)
103103
moved_inside("filesystem.follow_current_file", "enabled")
104104
moved_inside("buffers.follow_current_file", "enabled")
105105

106+
-- v3.x
107+
removed("close_floats_on_escape_key")
108+
106109
return migrations
107110
end
108111

lua/neo-tree/ui/popups.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
local vim = vim
2-
local Input = require("nui.input")
32
local NuiText = require("nui.text")
43
local NuiPopup = require("nui.popup")
54
local highlights = require("neo-tree.ui.highlights")
@@ -8,7 +7,7 @@ local log = require("neo-tree.log")
87
local M = {}
98

109
M.popup_options = function(title, min_width, override_options)
11-
local min_width = min_width or 30
10+
min_width = min_width or 30
1211
local width = string.len(title) + 2
1312

1413
local nt = require("neo-tree")

lua/neo-tree/ui/renderer.lua

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -873,12 +873,6 @@ local function create_floating_window(state, win_options, bufname)
873873
win.original_options = state.window
874874
table.insert(floating_windows, win)
875875

876-
if require("neo-tree").config.close_floats_on_escape_key then
877-
win:map("n", "<esc>", function(_)
878-
win:unmount()
879-
end, { noremap = true })
880-
end
881-
882876
win:on({ "BufHidden" }, function()
883877
vim.schedule(function()
884878
win:unmount()

0 commit comments

Comments
 (0)