Comments (7)
你配错了。
仔细读 README, g:which_key_map
是一个 Dict, 针对里面的每个 key, 对应的 value 是一个 List 或者 String。如果是 String, 必须已经通过 map 的方式定义了该快捷键。
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'liuchengxu/vim-which-key'
call plug#end()
let g:mapleader = "\<Space>"
let g:maplocaleader = ','
nnoremap <leader>w :update<CR>
let g:which_key_map = {
\ 'name' : '+Leader',
\ 'w' : '保存文件',
\ }
call which_key#register('<leader>', "g:which_key_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<leader>'<CR>
from vim-which-key.
@liuchengxu 感谢您的指点,按照您所说,value值必须是string,所以我把之前配置不合法的部分删除了
let g:which_key_map = {
\ 'name' : '+Leader',
\ 'w' : '保存文件',
\ 'x' : '保存并退出文件',
\ 'q' : '退出文件',
\ 'a' : '退出所有文件',
\ 's' : '全文范围内替换光标处的单词',
\ }
call which_key#register('<leader>', "g:which_key_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<leader>'<CR>
现在我的配置是这样的,可还是不行啊
from vim-which-key.
value值必须是string
我没这么说过。
g:which_key_map 是一个 Dict, 针对里面的每个 key, 对应的 value 是一个 List 或者 String
这才是我说的。
你再看一遍 README,麻烦读完。
from vim-which-key.
String:
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'liuchengxu/vim-which-key'
call plug#end()
let g:mapleader = "\<Space>"
let g:maplocaleader = ','
" 如果已经自定义了快捷键,那么 value 可以用 String。
nnoremap <leader>w :update<CR>
let g:which_key_map = {
\ 'name' : '+Leader',
\ 'w' : '保存文件',
\ }
call which_key#register('<leader>', "g:which_key_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<leader>'<CR>
List:
set nocompatible
call plug#begin('~/.vim/plugged')
Plug 'liuchengxu/vim-which-key'
call plug#end()
let g:mapleader = "\<Space>"
let g:maplocaleader = ','
" 如果不存在对应的自定义快捷键,使用 List,第一个元素是要执行的命令,第二个元素为描述信息。
let g:which_key_map = {
\ 'name' : '+Leader',
\ 'w' : ['update', '保存文件'],
\ }
call which_key#register('<leader>', "g:which_key_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<leader>'<CR>
from vim-which-key.
@liuchengxu 谢谢您的耐心提示。
我才get到您之前说我的点,您之前的意思是我用的配置写的是string形式,但是没有定义快捷键操作,所以没有显示中文信息。但是那些操作我都是已经定义过得,只不过没有贴出来而已。
nnoremap <leader>w :w<CR>
let g:which_key_map = {
\ 'name' : '+Leader',
\ 'w' : '保存文件',
\ }
call which_key#register('<leader>', "g:which_key_map")
nnoremap <silent> <leader> :<c-u>WhichKey '<leader>'<CR>
现在我的配置基本都是把您贴出来的代码copy了一下,但还是不能显示中文,只能显示具体映射成了哪个键。
from vim-which-key.
那你提供一个最小 vimrc 吧,去掉其他配置信息,只保留 vim-which-key 配置,参考 https://github.com/liuchengxu/vim-which-key/wiki/mimimal-vimrc 。vim -u minimal.vimrc
以 minimal.vimrc 启动。
from vim-which-key.
那你提供一个最小 vimrc 吧,去掉其他配置信息,只保留 vim-which-key 配置,参考 https://github.com/liuchengxu/vim-which-key/wiki/mimimal-vimrc 。
vim -u minimal.vimrc
以 minimal.vimrc 启动。
真是不好意思,为了一个弱智的问题麻烦了您这么久。
我把leader键映射成了逗号。
call which_key#register('<leader>', "g:which_key_map")
应该写成
call which_key#register(',', "g:which_key_map")
再次感谢您的耐心回复!
from vim-which-key.
Related Issues (20)
- How `which_key_use_floating_win' works? HOT 1
- Sort which-key entries by description instead of actual keys HOT 2
- Allow calling lua functions directly? HOT 1
- 突然无法使用 HOT 3
- Using map <nowait>
- How to make the background transparent? HOT 1
- Using lua doesn't seem to work HOT 3
- Name <Tab> prefix HOT 2
- Show only the mappings provided by dictionary HOT 7
- Hide all mappings that do not have a description. HOT 1
- Add documentation on how to map lua functions
- Recent commit to improve keycode merging broke which-key for me HOT 9
- Domain name has been sold? HOT 3
- Mason Registry Error HOT 2
- In visual mode, which key seems to make cursor jump before command actually executed HOT 4
- Buffer local mappings are cached even with g:which_key_run_map_on_popup set to 1 HOT 1
- Exit key setting to a list of keys doesn't work HOT 2
- Is there a way to set a padding for the floating popup window ?
- vim7.4 error
- Getting weird error when launching Fern HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-which-key.