Skip to content
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

feature request: slightly tighter navigation using dynamically managed <left> / h and <right> / l #463

Open
1 task done
kenbankspeng opened this issue Aug 14, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kenbankspeng
Copy link

kenbankspeng commented Aug 14, 2024

Did you check existing requests?

  • I have searched the existing issues

Describe the feature

Optionally, a yazi-like oil navigation method, that imho some would slightly prefer.

    - <left> / h and <right> / l operate as cursor_left and cursor_right if not is_oil_open
    - <left> / h and <right> / l operate as cursor_left and cursor_right if is_oil_open and in Insert mode
    -  if is_oil_open and normal mode then
           <left> / h operate as action.parent
           <right> / l operate as select if oil.get_cursor_entry().type == directory

The end result is a tighter key sequence navigating only with left and right until over the target file and pressing enter. Not required to (but still can) use minus key for parent. Not required to (but still can) use enter key to change directory.

Realized either by add a mux util into your api or maybe just in your recipe docs.

pseudocode:

function mux(normal_action, oil_action)
   if is_oil_open then oil_action()
   else normal_action()
   end
end

function maybe_right_maybe_cd()
   if is_oil_open and oil.get_cursor_entry().type == directory then
       action.select()  aka change directory
   else
       go_right()
end

function maybe_left_maybe_parent()
   if is_oil_open then 
       action.parent()
   else
      go_left()
   end
end

vim.keymap.set("n", "<left>", mux(go_left, actions.parent.callback), "parent")
vim.keymap.set("n", "<right>", mux(go_right, maybe_go_right_maybe_cd), "right")

Provide background

I implemented it for myself and liked it. Imho, a slightly tighter navigation in a direction vim users tend to like.

What is the significance of this feature?

nice to have

Additional details

No response

@kenbankspeng kenbankspeng added the enhancement New feature or request label Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant