Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ use {
["<cr>"] = "open",
["S"] = "open_split",
["s"] = "open_vsplit",
["t"] = "open_tabnew",
["C"] = "close_node",
["<bs>"] = "navigate_up",
["."] = "set_root",
Expand Down
6 changes: 4 additions & 2 deletions doc/neo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ Note: The "selected" item is the line the cursor is currently on.

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
s = open_vsplit: Same as open, but opens in a vertical split.

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

<bs> = navigate_up: Moves the root directory up one level.

Expand Down Expand Up @@ -743,7 +745,7 @@ Fired after a file (or folder) has been moved. The arg is a table containing
Fired just before a file is opened. The arg is a table containing the `state`
of the source being used, the `path` of the file to be opened, and `open_cmd`,
which is the open command that was requested. `open_cmd` will be either |edit|,
|split|, or |vsplit|. This function should return a table with a property called
|split|, |vsplit|, |tabnew|. This function should return a table with a property called
`handled` which is true if the file open operation was handled, or false if it
was not. If `{ handled = true }` is not returned, the file will be opened using
the built-in logic.
Expand Down
1 change: 1 addition & 0 deletions lua/neo-tree/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ local config = {
["<cr>"] = "open",
["S"] = "open_split",
["s"] = "open_vsplit",
["t"] = "open_tabnew",
["C"] = "close_node",
["z"] = "close_all_nodes",
["R"] = "refresh",
Expand Down
1 change: 1 addition & 0 deletions lua/neo-tree/sources/buffers/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ end
M.open = cc.open
M.open_split = cc.open_split
M.open_vsplit = cc.open_vsplit
M.open_tabnew = cc.open_tabnew

M.refresh = refresh

Expand Down
8 changes: 8 additions & 0 deletions lua/neo-tree/sources/common/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ M.open_vsplit = function(state, toggle_directory)
open_with_cmd(state, "vsplit", 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
---open/closed
M.open_tabnew = function (state, toggle_directory)
open_with_cmd(state, "tabnew", toggle_directory)
end

M.rename = function(state, callback)
local tree = state.tree
local node = tree:get_node()
Expand Down
3 changes: 3 additions & 0 deletions lua/neo-tree/sources/filesystem/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ end
M.open_vsplit = function(state)
cc.open_vsplit(state, utils.wrap(fs.toggle_directory, state))
end
M.open_tabnew = function (state)
cc.open_tabnew(state, utils.wrap(fs.toggle_directory, state))
end

M.refresh = refresh

Expand Down
1 change: 1 addition & 0 deletions lua/neo-tree/sources/git_status/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ end
M.open = cc.open
M.open_split = cc.open_split
M.open_vsplit = cc.open_vsplit
M.open_tabnew = cc.open_tabnew

M.refresh = refresh

Expand Down