Closed TheCedarPrince closed 3 years ago
This is AMAZING! I think I will start using this tool in my daily workflow. Great work @ronisbr!
Thanks! I hope it will be useful :)
Just a suggestion, but would it be possible to add in vi-like keybinds for navigating? Alongside the arrow keys working, it would be great to have h, j, k, l support and things like Ctrl + d or Ctrl + u for chunked navigation. Is this a good idea or not so much? Happy to look into contributing on that aspect. Thanks!
Yes, we can do this! In fact, for those single keybindings you can do this right now (I am not sure if we should make this default or not, perhaps we can add a vim-mode
to change the default keybindings?)
julia> using TerminalPager
julia> TerminalPager.set_keybinding('h', :left)
julia> TerminalPager.set_keybinding('j', :down)
julia> TerminalPager.set_keybinding('k', :up)
julia> TerminalPager.set_keybinding('l', :right)
For CTRL+d
or CTRL+u
I can add new actions to scroll half the screen as in default vim behavior. However, I am using CTRD+D (end of transmission) to quit the pager, but I can be configurable.
Maybe having an option to turn vim-mode
is the best one. What do you think?
P.S.: command with more that one character, like gg
, will take a little more to implement.
Hey @ronisbr - I like the idea of making vim keybinds an optional mode such that you could have something in your startup.jl like ENV["PAGER_MODE"] = vi
or ENV["PAGER_MODE"] = default
. For me, I think it would be a bit of a pain to manually have to call those set_keybinding
commands from my startup.jl. What do you think?
Nice! This idea to add an environment variable is just amazing! I will do that :) Thanks for the suggestion!
Question: in vi mode, do we map arrow keys together with hjkl?
Yea! Let me know if you need any assistance. Happy to test. :)
I think mapping the arrow keys with hjkl is reasonable as that is also valid in vim.
Actually, only CTRL+D and CTRL+U needed the special treatment of PAGER_MODE=vi
:) I also did not implement multiple keystrokes commands (like gg
) since it will add some intricate logic. However, g
goes to the beginning, so gg
will go to the beginning twice :D
I implemented h j k l 0 $ CTRL+D CTRL+U
. Did I miss something?
@ronisbr - I think the only other thing I can think of is capital G which goes to the bottom of the pager. Otherwise, great work! Looking forward to trying this out!
Yes! I forgot to list G
but it should be working. Let me know please if you have problems.
For sure! Is it already released or is it coming out in the next version?
it is in main
. I will release as soon as I finish the initial documentation.
Ah shoot @ronisbr - I forgot that in some systems, things like Ctrl+D or Ctrl+U would cancel the current on-going command. For right now, Ctrl+D does not work on mac in the pager mode as it closes the pager view. :/
Hum, that's strange. I am using macOS (iTerm) and CTRL+D works perfectly. If I start Julia with PAGER_MODE=vi julia
and call the pager, CTRL+D and CTRL+U go down and up. If not, then CTRL+D exits the pager. Can you tell me more details about your setup?
This is AMAZING! I think I will start using this tool in my daily workflow. Great work @ronisbr!
Just a suggestion, but would it be possible to add in vi-like keybinds for navigating? Alongside the arrow keys working, it would be great to have h, j, k, l support and things like Ctrl + d or Ctrl + u for chunked navigation. Is this a good idea or not so much? Happy to look into contributing on that aspect. Thanks!