remove custom gx command in favor of netrw functionnalities and add documentation for netrw hijack
This commit is contained in:
parent
894acce5ef
commit
ce2420b9da
@ -130,7 +130,6 @@ highlight NvimTreeFolderIcon guibg=blue
|
||||
- `I` will toggle visibility of folders hidden via |g:nvim_tree_ignore|
|
||||
- `H` will toggle visibility of dotfiles (files/folders starting with a `.`)
|
||||
- `R` will refresh the tree
|
||||
- `gx` opens the file with the `open` command on MACOS and `xdg-open` in linux
|
||||
- Double left click acts like `<CR>`
|
||||
- Double right click acts like `<C-]>`
|
||||
|
||||
@ -138,8 +137,6 @@ highlight NvimTreeFolderIcon guibg=blue
|
||||
|
||||
This plugin is very fast because it uses the `libuv` `scandir` and `scandir_next` functions instead of spawning an `ls` process which can get slow on large files when combining with `stat` to get file informations.
|
||||
|
||||
The Netrw vim plugin is disabled, hence features like `gx` don't work across your windows/buffers. You could use a plugin like [this one](https://github.com/stsewd/gx-extended.vim) if you wish to use that feature.
|
||||
|
||||
## Features
|
||||
|
||||
- Open file in current buffer or in split with FzF like bindings (`<CR>`, `<C-v>`, `<C-x>`, `<C-t>`)
|
||||
|
||||
@ -180,12 +180,25 @@ Can be 0 or 1. When 1, will open the tree when entering a new tab if the
|
||||
tree was previously open.
|
||||
Default is 0
|
||||
|
||||
|g:nvim_tree_width_allow_resize| *g:nvim_tree_width_allow_resize*
|
||||
|g:nvim_tree_width_allow_resize| *g:nvim_tree_width_allow_resize*
|
||||
|
||||
Can be 0 or 1. When 1, it will not resize the tree to it's original width
|
||||
when opening a new file.
|
||||
Default is 0
|
||||
|
||||
|g:nvim_tree_hijack_netrw| *g:nvim_tree_hijack_netrw*
|
||||
|
||||
Can be 0 or 1. When 1, disable netrw buffers when nvim-tree start but keeps
|
||||
existing netrw functionnalities accross buffers (like `gx`).
|
||||
1 by default.
|
||||
|
||||
|g:nvim_tree_disable_netrw| *g:nvim_tree_disable_netrw*
|
||||
|
||||
Can be 0 or 1. When 1, completely disable netrw and all related
|
||||
functionnalities.
|
||||
1 by default.
|
||||
|
||||
|
||||
==============================================================================
|
||||
INFORMATIONS *nvim-tree-info*
|
||||
|
||||
@ -216,8 +229,6 @@ INFORMATIONS *nvim-tree-info*
|
||||
- '<Tab>' will open the file as a preview (keeps the cursor in the tree)
|
||||
- 'I' will toggle visibility of folders hidden via |g:nvim_tree_ignore|
|
||||
- 'R' will refresh the tree
|
||||
- 'gx' opens the file with the `open` command on macos and `xdg-open`
|
||||
on linux.
|
||||
|
||||
- Double left click acts like '<CR>'
|
||||
- Double right click acts like '<C-]>'
|
||||
|
||||
@ -280,7 +280,6 @@ local function set_mappings()
|
||||
[bindings.next_git_item] = 'on_keypress("next_git_item")';
|
||||
[bindings.dir_up] = 'on_keypress("dir_up")';
|
||||
[bindings.close] = 'on_keypress("close")';
|
||||
gx = "xdg_open()";
|
||||
}
|
||||
|
||||
for k,v in pairs(mappings) do
|
||||
|
||||
@ -196,25 +196,6 @@ function M.reset_highlight()
|
||||
renderer.render_hl(lib.Tree.bufnr)
|
||||
end
|
||||
|
||||
function M.xdg_open()
|
||||
local node = lib.get_node_at_cursor()
|
||||
-- TODO: this should open symlink targets
|
||||
if not node or node.entries or node.link_to then return end
|
||||
|
||||
local cmd
|
||||
if vim.fn.has('unix') == 1 then
|
||||
cmd = 'xdg-open'
|
||||
else
|
||||
cmd = 'open'
|
||||
end
|
||||
|
||||
vim.loop.spawn(cmd, {args={node.absolute_path}}, vim.schedule_wrap(function(code)
|
||||
if code ~= 0 then
|
||||
api.nvim_err_writeln("Could not open "..node.absolute_path)
|
||||
end
|
||||
end))
|
||||
end
|
||||
|
||||
colors.setup()
|
||||
vim.defer_fn(M.on_enter, 1)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user