git action for creating and checking out a new branch#755
git action for creating and checking out a new branch#755kkharji merged 3 commits intonvim-telescope:masterfrom
Conversation
…sic docstrings for git actions
|
Although c-a is beginning of the line for me, but I hardly see any need for it in git picker. LGTM cc @elianiva |
|
@tami5 Ooh yes good old readline bindings, I forgot about that. I think it would be good to use something else perhaps, that's something I know a lot of people have ingrained in their fingers! Let me think about an alternate binding and check back in later with some options. |
|
Alright I have two ideas for the mapping:
Either way, let me know what your thoughts are. I also added a confirmation prompt to make sure a user doesn't accidentally hit the mapping and create a branch by accident, similar to how the I think I will work on some general docs next for all the default mappings for the different builtin pickers, as afaik you really can't find out about those mappings unless you dig into the source code (unless I am mistaken and just have not seen where that is easily able to be found). |
I'm kinda leaning towards the second option as it is what telescope about "customizability" however a default as you stated might be a important. I agree customizability sucks and its kinda hard. With #582 I attempt to solve this issue, hopefully by the end of the week I'll start working on it.
Hmm since we're adding not deleting perhaps is a bit robust to confirm, no? adding != deleting. So perhaps it would be better without confirmation. I think you had it right from the first time.
|
Yeah, I think that's sensible. My thought process for adding a default was that since there is already a default for deleting a branch, it would seem a bit odd to me as a new Telescope user to not have a default mapping for adding a new branch. But I am perfectly happy with leaving the keymapping up to the user, I can easily add a custom function to my own config for it.
I can certainly revert it back to
Well I am still pretty new to Lua, and still kinda getting my bearings inside of the Telescope codebase, so this may be a perfect place for me to help! I consider myself to be a pretty good writer, and am probably still new enough to Telescope that I can explain some of those in decent enough detail that a newbie could understand what I write! I'll look into working on that over the coming days when I have the chance. I really was only able to make this PR by just refactoring the |
|
LGTM! We can probably merge after you add the docs for those actions that Tami mentioned, if you want. |
|
@elianiva @tami5 I just switched the default mapping back to Sidenote: if you see the asciicast video I responded to elianiva with on the review, do either of you have any idea how to fix the weird spacing that happens with the error messages I Edit: damn elianiva you're fast! beat me to my own response lol. Do you want me to add docs I mentioned in this PR or open a new one with that? Either is fine with me. It might take me a while to get through writing some of that up for all the builtins. |
It only happens when we print the message as soon as Telescope gets closed. Wrapping it with
I think opening a new one is better so we keep this PR small and we can merge it sooner. |
|
Yes I agree this PR should be merged for now and later on we can collaborate more on documening available action. Thanks @smithbm2316 tag me whenever you need help with something |
Gotcha. After looking at the help docs for both of those I can see why you'd feel those are a bit hacky. I think at least wrapping the case where we have a git error with one of those might be a decent idea because of how awful the formatting is, but it's your call if you want me to try that or not. The other cases the formatting is not so bad, just a bit weird. But a git error (see the asciinema vid) really gets formatted in a hard to read way imo.
I agree! Edit: and by the time I finished typing this out on my phone, it's merged of course 😂. Thanks both of you for the help. I'll ping you when I have at least a WIP PR ready to go for those docs we've talked about. |
Damn I just noticed it, not sure what's the issue. I think this action can later be improved to close the prompt after clicking |
I definitely like this idea. That implementation may be a bit over my head atm with my current Lua knowledge, but I'm sure with some more practice and tinkering I could make something like that happen. I'll keep that on my radar for a future improvement to this. |
|
uhhhhh @smithbm2316 is writing docs :) There is this: #587 also max result query issue still exist but vigoux was looking into that. Also why did docgen not run for you? Do you have gh actions disabled for that fork? |
I was wondering why this didn't work. I'll take a look into this later and see if I can figure out if it's an issue in my fork. |
* upstream/master: picker(live_grep): add option to grep only over open files (nvim-telescope#666) git(action): create and checkout branch (nvim-telescope#755) readme: fix broken links and spelling errors (nvim-telescope#753) added a new DynamicFinder (which can be used with rust_analyzer) (nvim-telescope#705) feat: add icons to git_status finder (nvim-telescope#401) fix: update to newer code (nvim-telescope#744) pickers(buffers): added only_cwd opt (nvim-telescope#739) feat: asyncify pickers - except for live_grep (nvim-telescope#709) fix: Use standardized names for current buffer fuzzy find (nvim-telescope#737) fix(git_branches): use the quoted fields instead of json-formatting and fix regressions with nvim-telescope#695 (nvim-telescope#704) feat: buf highlights for current buffer fuzzy find (nvim-telescope#732)
actions.git_create_branchthat will allow the user to create and checkout a new branch if it doesn't already existI set the default binding to
<C-a>to trigger this action when using thegit_branchespicker, but am happy to change that if people don't like it. The best mnemonic keymapping I could think of was<C-c>as in checkout or create, but that obviously will not work as a binding lol. I'm very much open to suggestion on the binding, my thought process was<C-a>could be thought of as add new branch, even if that doesn't really match the git command itself (since I usedgit checkout -b [new-branch]).