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

Change keybindings #116

Closed
hadronized opened this issue Nov 5, 2019 · 3 comments
Closed

Change keybindings #116

hadronized opened this issue Nov 5, 2019 · 3 comments

Comments

@hadronized
Copy link

Just a small question: how can I change keybindings? I would like to remap things but I cannot find how. Thanks.

@liuchengxu
Copy link
Owner

liuchengxu commented Nov 5, 2019

For vim, it's impossible for now, I have not came up with a good solution. If you want to hack it, see :h popup_filter and

" noautocmd is neccessary in that too many plugins use redir, otherwise we'll
" see E930: Cannot use :redir inside execute().
let s:move_manager["\<C-J>"] = { winid -> win_execute(winid, 'noautocmd call clap#handler#navigate_result("down")') }
let s:move_manager["\<Down>"] = s:move_manager["\<C-J>"]
let s:move_manager["\<C-K>"] = { winid -> win_execute(winid, 'noautocmd call clap#handler#navigate_result("up")') }
let s:move_manager["\<Up>"] = s:move_manager["\<C-K>"]
let s:move_manager["\<Tab>"] = { winid -> win_execute(winid, 'noautocmd call clap#handler#select_toggle()') }
let s:move_manager["\<CR>"] = { _winid -> clap#handler#sink() }
let s:move_manager["\<Esc>"] = { _winid -> clap#handler#exit() }
let s:move_manager["\<C-A>"] = s:move_manager.ctrl_a
let s:move_manager["\<Home>"] = s:move_manager.ctrl_a
let s:move_manager["\<C-B>"] = s:move_manager.ctrl_b
let s:move_manager["\<Left>"] = s:move_manager.ctrl_b
let s:move_manager["\<C-F>"] = s:move_manager.ctrl_f
let s:move_manager["\<Right>"] = s:move_manager.ctrl_f
let s:move_manager["\<C-E>"] = s:move_manager.ctrl_e
let s:move_manager["\<End>"] = s:move_manager.ctrl_e
let s:move_manager["\<BS>"] = s:move_manager.bs
let s:move_manager["\<C-H>"] = s:move_manager.bs
let s:move_manager["\<C-D>"] = s:move_manager.ctrl_d
let s:move_manager["\<C-G>"] = s:move_manager["\<Esc>"]
.

For neovim, take a look at https://github.com/liuchengxu/vim-clap/blob/master/ftplugin/clap_input.vim .

" For example, use <C-n>/<C-p> instead of <C-j>/<C-k>.
autocmd FileType clap_input inoremap <silent> <buffer> <C-n> <C-R>=clap#handler#navigate_result('down')<CR>
autocmd FileType clap_input inoremap <silent> <buffer> <C-p> <C-R>=clap#handler#navigate_result('up')<CR>

Also see the related discussion at #104.

@hadronized
Copy link
Author

Aoutch.

@github-actions
Copy link

github-actions bot commented Jan 5, 2020

Stale issue message

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

2 participants