-
-
Notifications
You must be signed in to change notification settings - Fork 855
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
feat: expand file browser functionality #1257
feat: expand file browser functionality #1257
Conversation
@Conni2461 what do you think about |
I dont know. I need to think about this but (for a change) i kinda wanna do fun telescope things this week, so i dont feel like even thinking about it. I am also not that interested about these fs operations anymore. So if you wanna finish this sooner rather than later, you are on your own :) Originally we planed a simple If you can wait, we can talk about this next week, because right now i dont know. |
Yeah, no worries -- more than earned :) thanks for the pointer. I'll try and think about something I'd happily get merged. |
c2a0044
to
e5f16cb
Compare
Ok, I think I found a satisfactory solution for the finders switch. I'm pretty happy with this now :) @tami5 may I please ask you to review / test drive this PR whenever you have too much time this week before Conni takes a look (he's understandably too busy with more important things :))? :) Ideally in conjunction with nvim-lua/plenary.nvim#241 I'll probably keep cleaning up the plenary PR a bit further as mentioned over there. |
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.
Great work @fdschmidt93, I was going to test more but my dinner is ready 😭
map("n", "g", actions.goto_prev_dir) | ||
map("i", "<C-f>", actions.toggle_browser) | ||
map("n", "<f>", actions.toggle_browser) | ||
map("i", "<C-w>", actions.goto_cwd) |
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.
<C-w>
is so commonly used for deleting previous word. same goes for <C-f>
which is char forward.
map("i", "<C-h>", actions.toggle_hidden) | ||
map("n", "<h>", actions.toggle_hidden) | ||
map("i", "<C-g>", actions.goto_prev_dir) | ||
map("n", "g", actions.goto_prev_dir) |
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.
this is a bit slow when the user has g.. mappings in normal mode, it would be cool if somehow <nowait>
is given (not sure that would fix it though)
map("i", "<C-h>", actions.toggle_hidden) | ||
map("n", "<h>", actions.toggle_hidden) | ||
map("i", "<C-g>", actions.goto_prev_dir) |
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.
<C-h>
make more sense then <C-g>
for goto_prev_dir, no?
Thanks already for the comments so far @tami5 :) I'll try to incorporate them some time tomorrow (evening, probably). How do you like the UX otherwise with toggling between the file and folders picker? Something like that for navigation was what I always am missing in nvim-tree or the like, so I've built it in :) Happy to get more ideas if you have some here. |
I don't use nvim-tree so I'm not sure. |
a3d5bd6
to
add7938
Compare
f55c9fe
to
a4d9a80
Compare
Update for anyone subscribed to the PR as file browser expansion seems to be a rather anticipated feature. As a beacon of hope nvim-lua/plenary.nvim#241 now only needs to undergo (most likely) Conni's review. Then I can clean up #1257 which should hopefully be more straightforward given that the branch is rather advanced. |
Great work @fdschmidt93! Also I've seen that mapping actions.move_file to fails. |
Ah, right now that's
Works fine for me on nvim master. Is there any sort of error log? Maybe plenary's scandir relies on some lua version your nvim is not linked against or something? Should be easily tested with local pscan = require "plenary.scandir"
print(vim.inspect(pscan.scan_dir(vim.loop.cwd(), {
hidden = true,
add_dirs = true,
depth = 1,
}))) Does this work for you and give you files / folders of nvim E: I've added |
aa910ee
to
111c883
Compare
It works now, thanks! :) Also, I think that previously, the mapping C-d was used to scroll down the preview window. You are overwriting it now. |
<C-m> sends the same key codes as <CR>, that's why it wasn't mapped by default.
For the time being the mappings are mostly for me to test the file browser. However, the file picker is going to be a very "active" picker and therefore I'd personally lean to have all these actions as defaults because I'd say that is what users want from the file browser (otherwise you can also use find files). In any case, you can always remap that mapping again. |
local tbl = { line } | ||
tbl.ordinal = Path:new(line):make_relative(opts.cwd) | ||
return setmetatable(tbl, mt) | ||
local fb_finder = function(opts) |
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.
There's an annoying issue I'll have to look into and is probably not so easily fixed.
- Multi select
- Search
- Find multi selection not highlighted again
This currently happens, because this PR creates new finders eagerly in _call
. This affects master
in a different form.
- Launch
file_browser
- Multi select
- Go to different folder
- Return & find multi selections gone
Ultimately, the multi selection is inadequately preserved since the entry is created anew from a new finder resulting in a new metatable for the entry, such that picker:is_multi_selected
doesn't result in true
for the same entry. I'll have to think about this some more to come up with an hopefully easy fix (maybe add selection as a table w/o metatable
, if easily possible?).
E: this of course also affects live grep
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.
Now the entries are cached by their absolute path to transparently remain multi selections across file and folder browsers.
4c03042
to
481d026
Compare
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.
I think there's an error on the lines 1176 and 1177:
Wouldn't it be something like this?
set_bkm(buf, "n", "<CR>", "<cmd>lua _G.__TelescopeBatchRename()<CR>", opts)
set_bkm(buf, "i", "<CR>", "<cmd>lua _G.__TelescopeBatchRename()<CR>", opts)
No, it should work all the same with or without |
I was refering also to the missing Otherwise from your last commit I'm getting this error: |
Ah sorry, too sleepy. Forget entirely what I said. I read something totally different from your comment than what you wrote. Of course you're right, must have gotten it wrong when I renamed it. e: function works again now. |
dc10e1a
to
027ae65
Compare
58f3517
to
1b83a17
Compare
skip-checks: true
Yeah I think it shouldnt be here. Always should have been an extension. This was my mistake. |
Closing the PR accordingly and will release a beta version over at the soon-to-be made public Once the extension is released, we'll probably do a |
The extension has now made been made accessible: https://github.com/nvim-telescope/telescope-file-browser.nvim Please consider it a beta for the time being and see the associated roadmap. |
Woohoo! Can’t wait to try this. Thanks for all the hard work 👍👍👍👍 |
Supersedes #613
Closes #584 #1337
Large share of the creds of course to @elianiva and everyone helping on the original PR
The
builtin.file_browser
now{file, folder}_browser
(wherefile_browser
shows the currently picked folder) which keep multi selections in sync via caching entries by absolute pathNote on usage:
<C-y>/y
orm
(moving only normal mode for now) in target directoryDemo: Moving around files across folders into another folder
fb.mp4