Skip to content

Commit

Permalink
feat(filesystem): open in right below or left above split (#1294)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackmorse committed Jan 7, 2024
1 parent c5d2264 commit 2f2d088
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/neo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ S = open_split: Same as open, but opens in a new horizontal split.

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

open_rightbelow_vs: Same as open_vsplit, but opens in a right window
of the vertical split.

open_leftabove_vs: Same as open_vsplit, but opens in a left window
of the vertical split.

t = open_tabnew: Same as open, but opens in a new tab.

open_drop: Same as open, but opens with the |:drop| command.
Expand Down
2 changes: 2 additions & 0 deletions lua/neo-tree/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ local config = {
["S"] = "open_split",
-- ["S"] = "split_with_window_picker",
["s"] = "open_vsplit",
-- ["sr"] = "open_rightbelow_vs",
-- ["sl"] = "open_leftabove_vs",
-- ["s"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
-- ["<cr>"] = "open_drop",
Expand Down
16 changes: 16 additions & 0 deletions lua/neo-tree/sources/common/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,22 @@ M.open_vsplit = function(state, toggle_directory)
open_with_cmd(state, "vsplit", toggle_directory)
end

---Open file or directory in a right below vertical split of the closest window
---@param state table The state of the source
---@param toggle_directory function The function to call to toggle a directory
---open/closed
M.open_rightbelow_vs = function(state, toggle_directory)
open_with_cmd(state, "rightbelow vs", toggle_directory)
end

---Open file or directory in a left above vertical split of the closest window
---@param state table The state of the source
---@param toggle_directory function The function to call to toggle a directory
---open/closed
M.open_leftabove_vs = function(state, toggle_directory)
open_with_cmd(state, "leftabove vs", toggle_directory)
end

---Open file or directory in a new tab
---@param state table The state of the source
---@param toggle_directory function The function to call to toggle a directory
Expand Down
6 changes: 6 additions & 0 deletions lua/neo-tree/sources/filesystem/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ end
M.open_split = function(state)
cc.open_split(state, utils.wrap(fs.toggle_directory, state))
end
M.open_rightbelow_vs = function(state)
cc.open_rightbelow_vs(state, utils.wrap(fs.toggle_directory, state))
end
M.open_leftabove_vs = function(state)
cc.open_leftabove_vs(state, utils.wrap(fs.toggle_directory, state))
end
M.open_vsplit = function(state)
cc.open_vsplit(state, utils.wrap(fs.toggle_directory, state))
end
Expand Down

0 comments on commit 2f2d088

Please sign in to comment.