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: Support for Mode-Specific Keymaps in Oil Buffer #187

Closed
1 task done
mroavi opened this issue Sep 26, 2023 · 1 comment
Closed
1 task done

feature request: Support for Mode-Specific Keymaps in Oil Buffer #187

mroavi opened this issue Sep 26, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@mroavi
Copy link

mroavi commented Sep 26, 2023

Did you check existing requests?

  • I have searched the existing issues

Describe the feature

I would like the ability to specify the mode for a keymap in the Oil buffer. For example, I want to map the action.close function to the <Esc> key, but I only want this mapping to be active when in Normal mode. This means that if there is a visual selection active, pressing <Esc> should not close the Oil buffer. Instead, it should exit Visual mode and return to Normal mode, keeping the Oil buffer open.

I couldn't find information in the current documentation on how to accomplish mode-specific keymapping in the Oil buffer. If this is already possible, please do let me know.

@mroavi mroavi added the enhancement New feature or request label Sep 26, 2023
@mroavi mroavi changed the title Feature request: Support for Mode-Specific Keymaps in Oil Buffer feature request: Support for Mode-Specific Keymaps in Oil Buffer Sep 26, 2023
@stevearc
Copy link
Owner

I've added the ability to specify a mode. In your case, this is what you will want:

require("oil").setup({
  keymaps = {
    ["<Esc>"] = { callback = "actions.close", mode = "n" },
  },
})

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

2 participants