-
-
Notifications
You must be signed in to change notification settings - Fork 626
feat: add option to hide root dir path #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like your PR breaks indentations quite a lot, it will not pass linting. I'm going to merge the setup refactoring, you should then rebase because options like this should not be global anymore :) But it's indeed a wanted change, i believe users have asked for this some time ago.
Really nice feature! Looking forward to it. |
* chore: refacto setup part 1 refacto setup for code entrypoint following options switched boolean values as options to the setup function: - `nvim_tree_disable_netrw` -> `disable_netrw` - `nvim_tree_hijack_netrw` -> `hijack_netrw` - `nvim_tree_auto_open` -> `open_on_setup` - `nvim_tree_auto_close` -> `auto_close` - `nvim_tree_tab_open` -> `tab_open` - `nvim-tree-update-cwd` -> `update_cwd` - `nvim_tree_hijack_cursor` -> `hijack_cursor` - `nvim_tree_system_open_command` -> `system_open.cmd` - `nvim_tree_system_open_command_args` -> `system_open.args` - `nvim_tree_follow` -> `update_focused_file.enable` - `nvim_tree_follow_update_path` -> `update_focused_file.update_cwd` Also added new option `update_focused_file.ignore_list` which will ignore filepath or filetypes that matches one entry of the list when updating the path if update_cwd is true. * add deprecation warning * update readme * schedule on enter to avoid running before vim first buffer has loaded * update docs * correct typo * rename tab open -> open on tab
…on a closed folder while creating files (nvim-tree#628)
the new setup refactoring might have some issues when users require the tree before setting up global options, which might result in a startup check not detecting those out of date options.
- put renderer into its own folder, extract the padding logic to make it reloadable. Will allow small refactorings of the rendering logic to make it easier to extend. - get the icon state before each renderer reload
…into kyazdani42-master
Hi @kyazdani42 I had some time today to work on this pull request. I was unsure how to pass the Sorry to cause some problems with the indentations and linting, i just started learning lua a few weeks ago and i dont really know how to setup those things to work correctly. Anyway hope this is mergable and you all have a good day, Cheers ✌, Jim |
@jim-fx looks like there are still formatting issues. I could take this PR and format it properly because it looks ok otherwise, what do you think ? |
For learning purposes, I tried to fix the warnings from luacheck myself. Other than that you can do anything you want before you merge the pr. |
please rebase again :) |
@kyazdani42 just did :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please rebase
the PR and not merge the master in it ? You'd have had less issues.
If you don't know much about rebasing, i'd suggest this small exercise
@@ -78,6 +78,7 @@ function. | |||
open_on_tab = false, | |||
hijack_cursor = false, | |||
update_cwd = false, | |||
hide_root_folder = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indenting :)
@@ -200,7 +201,10 @@ Here is a list of the options available in the setup call: | |||
type: `boolean` | |||
default: false | |||
|
|||
*nvim-tree.view* | |||
- |hide_root_folder|: hide the path of the current working directory on top of the tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
badly resolved, add a *nvim-tree.hide_root_folder*
above your option declaration and do not remove the *nvim-tree.view*
before the view declaration :)
@@ -161,8 +161,15 @@ function M.on_keypress(mode) | |||
return keypress_funcs[mode](node) | |||
end | |||
|
|||
local hide_root_folder = view.View.hide_root_folder | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too many empty lines here, one suffice :)
if node.name == ".." then | ||
return lib.change_dir("..") | ||
if hide_root_folder then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing or node.name ~= '..'
@@ -408,7 +415,8 @@ local DEFAULT_OPTS = { | |||
hijack_cursor = false, | |||
update_cwd = false, | |||
lsp_diagnostics = false, | |||
update_focused_file = { | |||
hide_root_folder = false, | |||
update_focused_file = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
badly aligned :)
@@ -205,7 +212,8 @@ end | |||
|
|||
function M.set_index_and_redraw(fname) | |||
local i | |||
if M.Tree.cwd == '/' then | |||
local hide_root_folder = view.View.hide_root_folder | |||
if M.Tree.cwd == '/' and hide_root_folder then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this an and
and not an or
?
@@ -9,6 +9,7 @@ end | |||
M.View = { | |||
bufnr = nil, | |||
tabpages = {}, | |||
hide_root_folder = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing space.
@@ -107,7 +108,7 @@ end | |||
local DEFAULT_CONFIG = { | |||
width = 30, | |||
side = 'left', | |||
auto_resize = false, | |||
auto_resize = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unwanted change
@@ -141,7 +142,7 @@ function M.setup(opts) | |||
local options = vim.tbl_deep_extend('force', DEFAULT_CONFIG, opts) | |||
M.View.side = options.side | |||
M.View.width = options.width | |||
M.View.auto_resize = opts.auto_resize | |||
M.View.auto_resize = opts.auto_resize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bis
Hey, not to rush you, but it seems there's no more activity on this - if you wish, I can attempt to help merge this? This is a nice feature that I'd love to have in nvim-tree. Sorry if this sounds rude. |
code has changed much, you could reimplement this if the author does not give any news |
Hi, dont worry did not sound rude at all. I am currently very busy with university, so i will not have a lot of time the next few weeks. I think i sort of underestimated how much effort this takes with my lua skills. If you would like to implement it yourself, please go ahead. Otherwise i will probably try again in a few weeks, Cheers 👋 |
not only lua skills but codebase is hard to read imo, it started off as a learning project for lua, now i'm rewriting the whole thing bit by bit 😄 |
I have finished the functionality and added some "documentation" in - though I am rather unsure of how good it is - I depend on you to review and say your preference, since I am quite new to writing documentation with Vim syntax. The repo is https://github.com/MonAaraj/nvim-tree.lua - I believe I need to create a new pull request for this? I'm not quite sure, if I need to do so, please tell me here. |
make a new PR it'll be easier :) |
Duplicated to #728 |
Hi @kyazdani42 ,
This pull request adds a configuration option:
let g:nvim_tree_hide_root_folder
, which when enabled hides the path of the root folder on top of the tree like so:The intention is to allow for a more minimalistic ui, and for me personally tmux already shows the current directory so this information is sort of redundant.
Thanks for the aaaawsome plugin and cheers,
Jim