Closed monkoose closed 4 years ago
I think it's a good idea for using gitignore
rather than adding an extra global variable in vimscript to hide matched files.
I found that I can use git check-ignore to check a directory or a file is in the ignored list in git or not. But I'm not sure that it works in flat
under Ranger, I will try it out.
In the end, I think this is a good feature for Ranger, If I have done, I will pr to Ranger master.
Not sure if i have understood you right, but maybe the thing you want to implement can be a performance problem, isn't it easier to find local .gitignore + global .gitignore combined, parse them and change each line of it (one ignore item per line as gitignore documentation specify it) to be acceptable for hidden_filter
ranger variable?
Not sure if i have understood you right, but maybe the thing you want to implement can be a performance problem
Use git check-ignore check a single file will cause a performance issue, but a directory will not. I have tested under chromium repo, it's a huge repo.
isn't it easier to find local .gitignore + global .gitignore combined, parse them and change each line of it
No, they use different rules and it's hard to be translated to each other. If using git check-ignore to check a total git project, it may crash in a huge repo.
git check-ignore cache each directory is the best solution I think.
flat
could work, but it causes a bad performance using git check-ignore
in a hung repo. Maybe I should disable this feature when users use flat
.
Btw, there are some bugs when enable both vcs
and flat
in Ranger.
As i said previously. Its easy to strip away unneeded characters from each line in .gitignore file, so hidden_filter
would accept it. Do you need some help?
Was lazy to create issue but hacks/calibrate_ueberzug()
translate image outside of terminal window for me so i disabled this lines for now.
start_x += win_info['col']
start_y += win_info['row']
So at least i can fully see images.
You can get list of ignored dirs and files for the project with git status --ignored
. So you don't even need to process .gitignore files.
As i said previously. Its easy to strip away unneeded characters from each line in .gitignore file, so
hidden_filter
would accept it. Do you need some help?Was lazy to create issue but
hacks/calibrate_ueberzug()
translate image outside of terminal window for me so i disabled this lines for now.start_x += win_info['col'] start_y += win_info['row']
So at least i can fully see images.
I guess this cause by your version of ueberzug, maybe checkhealth could complain something. If not, please open another issue.
You can get list of ignored dirs and files for the project with
git status --ignored
. So you don't even need to process .gitignore files.
No, .gitgnore is not only in the git root. Users can use ignore file by excludesfile.
Btw, git status --ignored
is slower than git check-ignore
.
rule of gitignore and regex is different.
No, they use different rules and it's hard to be translated to each other.
I guess this cause by your version of ueberzug, maybe checkhealth could complain something. If not, please open another issue.
Yes this solves it.
Btw, git status --ignored is slower than git check-ignore.
Are you sure about this? Because it doesn't need to traverse directory tree, and just prints out ignored dirs and files (that only outside of ignored dirs).
Btw, git status --ignored is slower than git check-ignore.
Are you sure about this? Because it doesn't need to traverse directory tree, and just prints out ignored dirs and files (that only outside of ignored dirs).
Yes, git check-ignore
is faster than git status --ignored
inside a single directory. But I have tested git check-ignore
just now, it made me mad by the terrible performance, because changing directory will trigger git check-ignore
. I will use git status --ignored
to test tomorrow.
You can try hide-git-file
branch and test. If no issue I will merge this feature into master.
example config:
Plug 'kevinhwang91/rnvimr', {'branch': 'hide-git-file', 'do': 'make sync'}
let g:rnvimr_hide_git = 1
Please give me some feedback.
I will give my feedback tomorrow.
For now i don't see any problems, but i didn't test it in some very big repo (and i'm not sure if i want to download and test this). If you tested it and there is no impact on performace in a big repo, i think it can be merged.
Maybe some big functions can be refactored like load_bit_by_bit
because it is really hard to understand what is going on, but it is only if you have time to spend on this for sure.
Thank you very much, it is good feature to have in a file manager.
I had fixed a bug about attaching the hidden file, please update the hide-git-file
branch.
Performance bottleneck depends on git status
. I will improve the documentation to let users know about that.
Although I can implement this feature through preprocessing and postprocessing tech to enhance load_bit_by_bit
which is very bloated and slow, I copied this function from ranger directly into the rnvimr library so that I can easily improve the performance of this part in the future.
Updated. All good.
hide-git-file
have merged into master
branch. The option g:rnvimr_hide_git
change to g:rnvimr_hide_gitignore
.
Using asynchronous callback function and cache ignored data to solve the performance issue. I think it's time to close this issue.
I have one more enhancement to propose.
In
rc.conf
there ishidden_filter
variable, can you add plugin variable to append it list to thishidden_filter
for ranger instance that opens with rnvimr? So some directories and files likenode_modules
etc could be hidden by default. I don't want some directories to be hidden in my shell ranger by default, but i don't want to see them when i working on my projects.For example
let g:rnvimr_some_variable = ['^node_modules$', '\.ext$', '^some_other_dir$']
Or maybe better approach would be to respect global and local .gitignore files? But the problem is that it uses different syntax than
hidden_filter
regex.