ardagnir / athame

Full vim for your shell (bash, zsh, gdb, python, etc)
GNU General Public License v3.0
1.63k stars 34 forks source link

Readline keys in normal mode #71

Closed yaohappiness closed 5 years ago

yaohappiness commented 5 years ago

Is thare any way for keys such as Ctrl-L, Ctrl-D in normal mode to be passed on to readline? It can be used in insert mode, of course, I've tried nnoremap <C-l> iclear<CR> and nnoremap <C-l> i<C-l><CR>,but not working.

ardagnir commented 5 years ago

This should probably be configurable, but right now it’s hardcoded. You can change this in athame_util.h:906 by swapping “iR” with “iRn” or whatever vim modes you want athame to check for readline keys. Not 100% sure how well tab completion will work in normal mode.

yaohappiness commented 5 years ago

It does work by replacing “iR” with “iRn” but got a little buggy. After passing keys to readline, vim will automatically enter insert mode. ( "Start each line in insert mode" in ~/.athamerc has been removed so it should start in normal mode.) "Tab" will cause the character under the cursor to be duplicated:

Snipaste_2019-05-12_13-38-13
ardagnir commented 5 years ago

The switch to insert mode is because athame_util.h:532 is passing in 0 for preserve_mode when it should be passing in 1. This might be an easy fix or changing it to a 1 might break something else (Probably the later, but I don’t have my laptop with me)

I think the weird tab behavior you’re seeing is “correct” from readline’s point of view. It’s not duplicating the e, the cursor is just before the e. Zsh will probably not have this problem because it tab completes at end of word instead of the cursor position.

yaohappiness commented 5 years ago

The problem seems to be solved by passing in 1. I haven't seen any unusual so far.

yaohappiness commented 5 years ago

Thanks for your reply.