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

Plugin overwrites keymaps of restricted_keys #33

Closed
Mithrandir2k18 opened this issue Aug 21, 2023 · 10 comments
Closed

Plugin overwrites keymaps of restricted_keys #33

Mithrandir2k18 opened this issue Aug 21, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@Mithrandir2k18
Copy link

Describe the bug
installing the plugin disables shortcuts for e.g. CTRL+P which opens builtin.git_files in telescope or - is
is a bind for oil.nvim. This is how I mainly navigate between files. Hardtime also doesn't give me an error message
telling me that that's suboptimal, so I think it may be a bug.

Config options
Nothing, I really just added hardtime to lazy as per the readme.

Expected behavior
hardtime gives me a hard time but still lets me navigate between files.

Additional context
See my dotfiles repo for my neovim config.

@m4xshen
Copy link
Owner

m4xshen commented Aug 21, 2023

You can add "oil" and "TelescopePrompt" to disabled_filetypes to disable hardtime.nvim when using these plugins.

@Mithrandir2k18
Copy link
Author

Tried that, the problem is enabling hardtime seems to unbind/rebind some of my binds, like <C-P> for searching the repo or - for oil. Even after disabling it the binds still don't work. It doesn't hurt anything if I set enabled=false in the opts but as soon as I enable it, I need to disable it and restart nvim to reload the binds it overrides.

@m4xshen
Copy link
Owner

m4xshen commented Aug 26, 2023

Could you provide your keymap setting of <C-P> and -?

@AW3i
Copy link

AW3i commented Aug 28, 2023

I have the same issue with the keybindings in oil. This is how I have the keybinding defined in my config
vim.keymap.set("n", "-", require("oil").open, { desc = "Open parent directory" })

@m4xshen m4xshen changed the title Installing hardtime disables a lot of my config Plugin overwrites keymaps of restricted_keys Aug 28, 2023
@m4xshen m4xshen reopened this Aug 28, 2023
@m4xshen m4xshen added the bug Something isn't working label Aug 28, 2023
@m4xshen
Copy link
Owner

m4xshen commented Aug 30, 2023

Please try out the latest version of hardtime.nvim. It should work fine now.

@AW3i
Copy link

AW3i commented Aug 30, 2023

I pulled the latest version and I'm getting the following error now

E5108: Error executing lua: .../aw3i/.local/share/nvim/lazy/oil.nvim/lua/oil/init.lua:379: Vim:E565: Not allowed to change text or change window                                                              
stack traceback:                                                                                                                                                                                                
        [C]: in function 'edit'                                                                                                                                                                                 
        .../aw3i/.local/share/nvim/lazy/oil.nvim/lua/oil/init.lua:379: in function 'callback'                                                                                                                 
        ...ocal/share/nvim/lazy/hardtime.nvim/lua/hardtime/init.lua:15: in function <...ocal/share/nvim/lazy/hardtime.nvim/lua/hardtime/init.lua:11>  

@m4xshen
Copy link
Owner

m4xshen commented Aug 31, 2023

@AW3i are you using lazy.nvim to install plugins? If yes, please set the keymap in the keys section when installing oil.nvim:

{
      "stevearc/oil.nvim",
      dependencies = { "nvim-tree/nvim-web-devicons" },
      opts = {},
      keys = {
         { "-", ":lua require('oil').open()<CR>" },
      },
}

@AW3i
Copy link

AW3i commented Aug 31, 2023

Using the keys section makes it work, thanks!

@m4xshen m4xshen closed this as completed Aug 31, 2023
@m4xshen m4xshen pinned this issue Aug 31, 2023
@Mithrandir2k18
Copy link
Author

@AW3i are you using lazy.nvim to install plugins? If yes, please set the keymap in the keys section when installing oil.nvim:

{
      "stevearc/oil.nvim",
      dependencies = { "nvim-tree/nvim-web-devicons" },
      opts = {},
      keys = {
         { "-", ":lua require('oil').open()<CR>" },
      },
}

What's the difference between setting it in the plugins map vs. setting the keymap separately?

@m4xshen
Copy link
Owner

m4xshen commented Sep 7, 2023

Putting it inside keys makes sure that the keymap is set after the plugin is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants