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
Cycle previewers with git commit and bcommit already using it #528
Conversation
I'm a bit confused, what do you mean by |
Like in which previewer i am currently in like in which of the 3 are currently displayed:
Like the name. I have no idea why i wrote context 🤣 |
ah, ok I see. I think "context" makes sense but calling it a "name" is easier for me to understand 😆 |
We could put it where we currently have |
08ebc07
to
3f37238
Compare
Half working version: https://gist.github.com/Conni2461/d02a0216e0436cd436ca5991e2c239bb :| Way to much duplication shouldn't happen in telescope and i don't know how to proceed because of the upcoming ui module. |
Okay i have the changing title. Here is a new video: https://streamable.com/n3b8aq It requires a new PR for plenary. I will update this post after i submitted that PR. Edit: requires nvim-lua/plenary.nvim#82 thats why tests are failing require('telescope').setup {
defaults = {
mappings = {
i = {
["<C-s>"] = actions.cycle_previewers_next,
["<C-a>"] = actions.cycle_previewers_prev,
},
},
}
} |
12440e9
to
9946e55
Compare
GJ, works like a charm! Is it possible to switch to a custom previewer instead of predefined one? e.g file previewer to media previewer from media_files extension |
Do you want it as second previewer so you can cycle or do you just want to replace the previewer? Because yes you should just be able to do that. Like with everything 😆 Something like this: local my_find_files = function(opts)
opts = opts or {} -- just in case you wanna do opts. Then you have to merge tables or so
require'telescope.builtin'.find_files {
-- function to new previewer. Just for example bat one
previewer = require'telescope.previewers'.cat.new(opts),
-- or if you want to cycle
alt_previewers = {
-- Array of functions
require'telescope.previewers'.cat.new(opts),
}
} I tested this. Its really weird to jump between buffer and term previewers. But i love how its possible 🤣 Also if a previewer has no specific window title it will just print "Preview". So this feature works with older versions (and term previewers haven't added titles for them) but pwntester or windwp can just add them later if they want |
Perfect, exactly what I wanted. Thank you! |
what about auto-deduction? for example images. So that file browser and others can switch to image preview |
Pretty sick. Great work! 👌 |
I know i kinda like it :D what about message at top of Edit: thanks again for suggestion :D |
I think it is quite useful. But if it could be independent of the diff itself would be great. But I assume this is waaaay to heavy. Edit: maybe make the commit message just another previewer that can be cycled. I guess a git commit message source would be nice in general. And if you have a a diff open and wonder about some information in the related commit message, you could cycle and read it. |
And while I'm already brainstorming and telling wishes: it would be great to have another action which will not checkout this commit, but put the file into a diff view. The scrollable preview is nice, but sumtimes you need a proper split diff view and also be able to pull old hunks into your buffer. |
Don't say more. You're wishes will be granted. Today or tomorrow dont know but this week 99%. Who need different PRs. 1000+ changes PR incoming. 😆
I like having so clear suggestions. |
Do we wanna highlight the message? I guess so we can highlight hash, author and date |
9946e55
to
f161aa6
Compare
🤗 Could we have proper buffer highlighting for the "as was " file and some diff highlights for the, well yeah, diff view? In your screenshot it looks so pale. Makes it kinda hard to "see" anything. But I like the header highlights. 🙃 |
That screenshot shows only git message in a new preview. I just picked one where i actually described the commit 🤣 I am close to vimdiff on split, vsplit and tabedit mappings. Enter will still be checkout. In my opinion. Also this will only be implemented for |
I think i could have made the clip better but i am too lazy to record again. How did you do that like 100 times @elianiva 😆 Here is showcase of all new features: https://streamable.com/5xu5r7 Commit follows in a sec |
3c86c4f
to
d21c5f1
Compare
00ea4c9
to
f247607
Compare
Okay i am like 95% done with this here, if anyone wanna try it. I still need to implement titles for old previewers and i am going to run this branch for 1,2 days after that i kinda wanna merge and move on 😆 |
03a4642
to
705940a
Compare
Everything in telescope land is done, but dynamic title breaks everything if And i wanted to move on 😭 |
Any news? I can not wait for that 😄 |
:) Something is missing in plenary to make it work. Otherwise its done here. Just a rebase. I will check in on the plenary work tomorrow maybe i can help out :) |
10c8171
to
535a4d1
Compare
@VVKot I rebased this pr, so you can technically use it. Only |
Thanks @Conni2461 , I can check this out! |
I'll try to finish + merge it this evening (mostly just docs missing). |
@Conni2461 sorry, I haven't circled back here - but I did check out your branch and this looks great! |
2b51d6c
to
dd5a4f2
Compare
- new git previewers - jump to line in bcommit previewer - vimdiff for bcommits - dynamic preview window titles - more previewers documentation Co-authored-by: Thore Strassburg <thore@weilbier.net>
8d101bc
to
2a0e7d0
Compare
skip-checks: true
Lets give this a try. Might not be perfect but its only implemented for commits and bcommits, so we can iterate on it in the next few weeks. Maybe more people can come up with really cool things when using the api in extensions. Its not mapped on default so you need to setup something like this: require('telescope').setup {
defaults = {
mappings = {
i = {
["<C-s>"] = actions.cycle_previewers_next,
["<C-a>"] = actions.cycle_previewers_prev,
},
},
}
} |
Closes #307
Closes #627
Look at it here: https://streamable.com/sxi8fz
Continuation of #314
Edit: would be cool if we could somehow show the context of the previewer. Idk how we would do this.