Skip to content

Commit 2f2d088

Browse files
authoredJan 7, 2024
feat(filesystem): open in right below or left above split (#1294)
1 parent c5d2264 commit 2f2d088

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed
 

‎doc/neo-tree.txt

+6
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ S = open_split: Same as open, but opens in a new horizontal split.
232232

233233
s = open_vsplit: Same as open, but opens in a vertical split.
234234

235+
open_rightbelow_vs: Same as open_vsplit, but opens in a right window
236+
of the vertical split.
237+
238+
open_leftabove_vs: Same as open_vsplit, but opens in a left window
239+
of the vertical split.
240+
235241
t = open_tabnew: Same as open, but opens in a new tab.
236242

237243
open_drop: Same as open, but opens with the |:drop| command.

‎lua/neo-tree/defaults.lua

+2
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ local config = {
372372
["S"] = "open_split",
373373
-- ["S"] = "split_with_window_picker",
374374
["s"] = "open_vsplit",
375+
-- ["sr"] = "open_rightbelow_vs",
376+
-- ["sl"] = "open_leftabove_vs",
375377
-- ["s"] = "vsplit_with_window_picker",
376378
["t"] = "open_tabnew",
377379
-- ["<cr>"] = "open_drop",

‎lua/neo-tree/sources/common/commands.lua

+16
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,22 @@ M.open_vsplit = function(state, toggle_directory)
776776
open_with_cmd(state, "vsplit", toggle_directory)
777777
end
778778

779+
---Open file or directory in a right below vertical split of the closest window
780+
---@param state table The state of the source
781+
---@param toggle_directory function The function to call to toggle a directory
782+
---open/closed
783+
M.open_rightbelow_vs = function(state, toggle_directory)
784+
open_with_cmd(state, "rightbelow vs", toggle_directory)
785+
end
786+
787+
---Open file or directory in a left above vertical split of the closest window
788+
---@param state table The state of the source
789+
---@param toggle_directory function The function to call to toggle a directory
790+
---open/closed
791+
M.open_leftabove_vs = function(state, toggle_directory)
792+
open_with_cmd(state, "leftabove vs", toggle_directory)
793+
end
794+
779795
---Open file or directory in a new tab
780796
---@param state table The state of the source
781797
---@param toggle_directory function The function to call to toggle a directory

‎lua/neo-tree/sources/filesystem/commands.lua

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ end
186186
M.open_split = function(state)
187187
cc.open_split(state, utils.wrap(fs.toggle_directory, state))
188188
end
189+
M.open_rightbelow_vs = function(state)
190+
cc.open_rightbelow_vs(state, utils.wrap(fs.toggle_directory, state))
191+
end
192+
M.open_leftabove_vs = function(state)
193+
cc.open_leftabove_vs(state, utils.wrap(fs.toggle_directory, state))
194+
end
189195
M.open_vsplit = function(state)
190196
cc.open_vsplit(state, utils.wrap(fs.toggle_directory, state))
191197
end

0 commit comments

Comments
 (0)
Please sign in to comment.