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 recommendation:vim-leader-guide #34

Closed
tracyone opened this issue Jan 5, 2017 · 25 comments
Closed

Plugin recommendation:vim-leader-guide #34

tracyone opened this issue Jan 5, 2017 · 25 comments

Comments

@tracyone
Copy link
Contributor

tracyone commented Jan 5, 2017

vim-leader-guide

Spacemacs like function:displays the available key bindings automatically and dynamically.

No need any config.

#suppose  leader is space
nnoremap <silent> <leader> :<c-u>LeaderGuide '<Space>'<CR>
vnoremap <silent> <leader> :<c-u>LeaderGuideVisual '<Space>'<CR>
@liuchengxu
Copy link
Owner

liuchengxu commented Jan 5, 2017

Actually, I have tried this plugin before. However, I don't think it is good enough to play an important role in the daily use at present. It seemingly can't give a real-time prompt like which key and helm in spacemacs,which is very important. Furthermore, the help information of key bindings needs to be well organized so that we can get a good experience in using, which also needs some works to be done.

For now, I suggest putting it in private plugins. But we can keep this issue open, it may be good enough someday.

@zer4tul
Copy link
Collaborator

zer4tul commented Jan 5, 2017

i've made a preview branch, maybe you can have a try. https://github.com/zer4tul/space-vim/tree/heavy . for me, it's nearly give me the prompt what i need like which-key+helm, because i cannot remember every keybinding.
so what we need is a function or command like (global-set-key (kbd key) ',func) in core/core_funcs.el, to easily bind keys and give them a pretty description.

@liuchengxu
Copy link
Owner

@zer4tul Wow, it really looks pretty heavy! I'll give it a try.

@fno2010
Copy link
Contributor

fno2010 commented Jan 6, 2017

I also tried vim-leader-guide, and I think it should be useful. If you are used to using spacemacs with evil, which-key is very helpful. But the difference between vim and evil maybe the leader key timeout. Many vimers like to set leader timeout.

For example, in vim, I can bind <leader>b and <leader>bn to different functions. But in evil, if I bind <leader>bn, the <leader>b will be a group and I cannot bind <leader>b.

Any thoughts?

@liuchengxu
Copy link
Owner

liuchengxu commented Jan 6, 2017

It can't be denied that vim-leader-guide is useful. Firstly, I just haven't figured out a nice way to integrate it into space-vim smoothly. Meanwhile, I hope the user experience could be as good as which key in spacemacs,at least acceptable. If not, the current solution is to use SPC ? supported by fzf.vim to find some certain key. Not so smart, not so convenient, but still a workaround.

I am not sure if I was on a wrong direction to vim-leader-guide before. If someone could share a mature vim-leader-guide configuration, I'm utterly willing to take a chance.

@fno2010
Copy link
Contributor

fno2010 commented Jan 6, 2017

@zer4tul: just checked your heavy branch. It is really what I wanted when I started to try space-vim. But the same question as my above comment, is it possible to handle leader timeout very well?

@liuchengxu Have you tried @zer4tul 's branch? It should be more similar with spacemacs. If you are just looking for something like the which-key in spacemacs, I think it is not bad. You can see the screenshot:

2017-01-06-233238_1920x1080_scrot

But you can see that <leader>qm and <leader>qQ cannot be grouped, because <leader>q is also mapped.

@zer4tul
Copy link
Collaborator

zer4tul commented Jan 6, 2017

i've noticed that. seems there are two problems.

  1. timeoutlen. seems it does nothing to leader-guide. try:

set timeoutlen=1

  1. grouping ( or "prefix keys" in emacs). seems we have to do some hack to get the "prefix keys"-alike things to work.

@liuchengxu
Copy link
Owner

liuchengxu commented Jan 7, 2017

I have tried the heavy branch (Still, I think that the leader guide is good, but not enough. Even SPC q is not speedy like before).

Maybe we can make a new branch focusing on this? It's really a major revision and some problems indeed exist. I suggest integrating this into space-vim slowly. In order to bring in vim-leader-guide eventually, some good plans have to be made too.

With so much content added, I don't think space-vim is simple or elegant any more 😂 。

@liuchengxu
Copy link
Owner

@zer4tul I have just made a new branch named vim-leader-guide based on the most recent master branch. Could you merge the heavy branch (or the part you think is ready) into it? Then we can all have a look and do something together.

@zer4tul
Copy link
Collaborator

zer4tul commented Jan 7, 2017

Initial version done. i have sent the PR.

@liuchengxu
Copy link
Owner

liuchengxu commented Jan 7, 2017

Accepted.

By far, some problems are annoying.

  • SPC ? does not work.
  • SPC ;; does not work.
  • Without lightline enabled, an error raises in call lightline#update(), python-mode error.

For SPC q [qQs] in vim-leader-guide branch, I don't think it's necessary and it will result in a lag in exiting vim via SPC q, which is mapped in plugin vim-better-default. We must prevent this type of key bindings. This problem has been presented above. If we can't find a solution, then what we can do is to avoid it.

I want to invite you to be a collaborator of space-vim so that you can have the push access to the repo, are you interested? It's definitely a big change, which is far beyond what I designed in the very beginning. Now I am a little dazed frankly 🙉 . @tracyone @zer4tul @fno2010

@zer4tul
Copy link
Collaborator

zer4tul commented Jan 8, 2017

well, it's OK for me. i want to make a leader-guide layer, so those ones who don't need the prompt can easily disable it.

@liuchengxu
Copy link
Owner

@zer4tul Thanks, I have sent the invitation.

@liuchengxu
Copy link
Owner

liuchengxu commented Jan 8, 2017

I have pushed a commit to vim-leader-guide branch.

  • Since we intend to make leader-guide a layer, we could source core_keybindings.vim in the layer config. (EDIT: So stupid, I made a mistake here, please correct me.)
  • Disable SPC q [qQs] temporarily until find a solution.
  • Improve lightline/config.vim.

SPC ? and SPC ;; problem still exists.

@liuchengxu
Copy link
Owner

liuchengxu commented Jan 13, 2017

@zer4tul I have a problem:

2017-01-13 3 40 26

I simply configure vim-leader-guide in UserConfig() (not in vim-leader-guide branch) :

    let g:lmap =  {}

    let g:lmap['a'] = { 'name' : '+align' }
    let g:lmap['b'] = { 'name' : '+buffer' }
    ......

vim-leader-guide doesn't show me the name +align (actually the whole help information doesn't show up), but the key mappings under the catergory SPC a is seemingly normal.

2017-01-13 3 42 32

If we can add the brief description to the existing key mappings shown in vim-leader-guide, maybe a lot of works could be saved.

@zer4tul
Copy link
Collaborator

zer4tul commented Jan 13, 2017

这周跟下周都会比较忙,年底,你懂的。这个问题等我忙过这段时间看一下,有进展我会回复。

@liuchengxu
Copy link
Owner

了然了然,顺其自然,正事要紧

@ctjhoa
Copy link

ctjhoa commented Jan 14, 2017

Hi there,
I just find out about this repo, I've got my spacevim for quit a while now. I have vim-leader-guide support and I've already faced this issue.
It looks like a vim-leader-guide bug to me. Using this particular version fix the problem. Unfortunately I don't have time to dig deeper in this now.

@liuchengxu
Copy link
Owner

liuchengxu commented Jan 14, 2017

@ctjhoa Thanks! spacevim is also a good job!

It seems that to switch to the particular version could not solve the problem in my case, it raises some other errors:

Error detected while processing function leaderGuide#start_by_prefix:
line    6:
E121: Undefined variable: s:cached_dicts
E116: Invalid arguments for function has_key(s:cached_dicts, a:key) || g:leaderGuide_run_map_on_popup
E15: Invalid expression: !has_key(s:cached_dicts, a:key) || g:leaderGuide_run_map_on_popup
line   12:
E121: Undefined variable: s:desc_lookup
E116: Invalid arguments for function has_key(s:desc_lookup, a:key) || has_key(s:desc_lookup , 'top')
E15: Invalid expression: has_key(s:desc_lookup, a:key) || has_key(s:desc_lookup , 'top')
line   18:
E121: Undefined variable: rundict
E116: Invalid arguments for function <SNR>149_start_buffer
Press ENTER or type command to continue

I will dive into this when I have time。

BTW, since spacevim has supported vim-leader-guide, are you positive on helping space-vim make a leader-guide Layer if you have time? Maybe we have the same goals, which is to switch from spacemacs to vim painlessly. I'm also a spacemacs user and a vimmer.

@tracyone
Copy link
Contributor Author

I just made a ctrlp extension :ctrlp-leader-guide😄

@liuchengxu
Copy link
Owner

@tracyone Uh, it looks not bad, but maybe not the ultimate goal.

@tracyone
Copy link
Contributor Author

another similar plugin: sunaku/vim-shortcut

@liuchengxu
Copy link
Owner

It looks good. I'll give it a try.

@ctjhoa
Copy link

ctjhoa commented Mar 18, 2017

@liuchengxu I've done some progress on the vim-leader-guide issue (hecal3/vim-leader-guide#39). I'm not against merging efforts it's just that I'm really busy, I will try to take a look at your integration ASAP.

@liuchengxu
Copy link
Owner

liuchengxu commented Mar 19, 2017

@ctjhoa Great! Thanks a lot! I'm still working on this, although I'm also too busy(actually lazy) to delve into the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants