Packer.nvim: keys option doesn't work as expected

Created on 20 Jan 2021  路  9Comments  路  Source: wbthomason/packer.nvim

use {'unblevable/quick-scope',opt=true, keys='f'}

but it doesn't load at all the plugin

All 9 comments

Thanks for the report! Typically, this happens when you have another plugin, loaded later, which overrides the keymap you've set in your plugin config.

For example, in my setup, the spec use {'unblevable/quick-scope', keys='f'} does not work, because vim-sneak takes over f, but use {'unblevable/quick-scope', keys='x'} does work as expected (also note that I've removed the redundant manual use of the opt key).

Does loading on keys like this work with your setup with other plugin managers, e.g. vim-plug or dein.vim? If so, please post your plugin specification, and I'll have a look to see if I can improve my approach to keymap loading.

Thanks!

Thanks for the report! Typically, this happens when you have another plugin, loaded later, which overrides the keymap you've set in your plugin config.

For example, in my setup, the spec use {'unblevable/quick-scope', keys='f'} does not work, because vim-sneak takes over f, but use {'unblevable/quick-scope', keys='x'} does work as expected (also note that I've removed the redundant manual use of the opt key).

Does loading on keys like this work with your setup with other plugin managers, e.g. vim-plug or dein.vim? If so, please post your plugin specification, and I'll have a look to see if I can improve my approach to keymap loading.

Thanks!

thanks for response,
so setting keys option implicitly sets opt ??,

Yep! From the README:

-- The following keys all imply lazy-loading
  cmd = string or list,        -- Specifies commands which load this plugin.
  ft = string or list,         -- Specifies filetypes which load this plugin.
  keys = string or list,       -- Specifies maps which load this plugin. See "Keybindings".
  event = string or list,      -- Specifies autocommand events which load this plugin.
  fn = string or list          -- Specifies functions which load this plugin.
  cond = string, function, or list of strings/functions,   -- Specifies a conditional test to load this plugin
  setup = string or function,  -- Specifies code to run before this plugin is loaded.

All of the lazy-loading keys implicitly set opt for you, since lazy-loading is handled by making a plugin an opt plugin and invoking packadd at the appropriate time.

Thanks @wbthomason I'm closing the issue.
In future I might ask doubts on this, hope you help me

Yep, feel free to ask any other questions (or if you have an example showing that packer's keymap loading fails in a situation that dein or plug work, I'd be interested to know about it).

Yep, feel free to ask any other questions (or if you have an example showing that packer's keymap loading fails in a situation that dein or plug work, I'd be interested to know about it).

I just now migrated from plug to packer
and I never came across lazy loading features like in this plugin, here lazy loading is very customisable thanks for that bro

can we use vim commands in run option??

I wanted to something like this
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} in packer?

Yep, please see: https://github.com/wbthomason/packer.nvim/#updateinstall-hooks

again thanks @wbthomason bro

Was this page helpful?
0 / 5 - 0 ratings