Git Product home page Git Product logo

Comments (16)

liuchengxu avatar liuchengxu commented on May 31, 2024

vim-which-key takes mappings from :map, what do :map <leader>lb and other :map <leader>l say?

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

:map l output screenshot below
screenshot 2018-12-12 16 26 20

Hitting SPACE (my leader) invokes which-key, screenshot:
screenshot 2018-12-12 16 27 22

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

Looks like if more than one chars are in the leader mapping, only one of them shows up. Here's the full output of :map <leader>. Note how I have many <leader>h bindings, but only two show up.

screenshot 2018-12-12 16 30 38

from vim-which-key.

liuchengxu avatar liuchengxu commented on May 31, 2024

Have you updated vim-which-key to the latest version? If so, please provide a minimal vimrc to help reproduce. It works for me.

2018-12-12 8 51 21

2018-12-12 8 51 04

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

Updated to d326c18 on master, still have this issue. Do you have your minimal .vimrc to check against? Can you share?

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

Also, I don't fully understand +prefix usage. I have nmap <leader>l :set list!<CR>, and if I remove it from my .vimrc, I see l -> +prefix in which-key window, selecting it shows all leader bindings of l.

from vim-which-key.

liuchengxu avatar liuchengxu commented on May 31, 2024

Quick example:

set nocompatible

call plug#begin()
Plug 'liuchengxu/vim-which-key'
call plug#end()

let g:mapleader="\<Space>"

nnoremap <silent> <leader>      :<c-u>WhichKey '<Space>'<CR>
nnoremap <silent> <localleader> :<c-u>WhichKey  ','<CR>

nnoremap <Leader>1 :echom "THis is one"<cr>

let g:which_key_map = {}

let g:which_key_map.1 = ['echom "This is one"', "One"]

call which_key#register('<Space>', "g:which_key_map")

+prefix is the default group name, see https://github.com/liuchengxu/vim-which-key/blob/master/plugin/which_key.vim#L21, that means you have a number of mappings leading by <Leader>l*. However, if you have a mapping <Leader>l, then vim-which-key will display it rhs instead.

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

from vim-which-key.

liuchengxu avatar liuchengxu commented on May 31, 2024

rhs means right-hand-side, see :h rhs.

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

Thanks. Can you share the .vimrc section related to which-key, which produces the screenshot you sent earlier

from vim-which-key.

liuchengxu avatar liuchengxu commented on May 31, 2024

Here is my config https://github.com/liuchengxu/space-vim. I also change the highlight of WhichKeyDesc in the pict:

highlight WhichKeyDesc ctermfg=68 guifg=#5f87d7

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

However, if you have a mapping <Leader>l, then vim-which-key will display it rhs instead.

I have only this l key mapped in my .vimrc:

nmap <leader>l :set list!<CR>

lusty explorer provides these:

nmap <silent> <Leader>lf :LustyFilesystemExplorer<CR>
  nmap <silent> <Leader>lr :LustyFilesystemExplorerFromHere<CR>
  nmap <silent> <Leader>lb :LustyBufferExplorer<CR>
  nmap <silent> <Leader>lg :LustyBufferGrep<CR>

If I understand you, which-key would only show nmap <leader>l :set list!<CR> mapping.
But if you look this screenshot, one of the lusty's l mappings is also shown.

Your .vimrc suggest the use of dictionary for such cases, is it needed for such cases (single letter and same letter in multiple letter combinations, like l and lb)?

from vim-which-key.

liuchengxu avatar liuchengxu commented on May 31, 2024

By default it will show other <leader>l* instead of <leader>l only, see https://github.com/liuchengxu/vim-which-key/blob/master/plugin/which_key.vim#L13. You could try this if you don't want that:

let g:which_key_flatten = 0

If you have two mappings <Leader>l and <Leader>lb, when you press <Leader>l, I don't know whether you want to trigger <Leader>l or in the middle of <Leader>lb, see :h ttimeoutlen, so I suggest avoid such mappings. Don't map <Leader>l when you have <Leader>l* mappings.

Read https://github.com/liuchengxu/vim-which-key#configuration and the doc please.

from vim-which-key.

srustamo avatar srustamo commented on May 31, 2024

from vim-which-key.

liuchengxu avatar liuchengxu commented on May 31, 2024

Closing then. Feel free to reopen if you still have questions.

from vim-which-key.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.