kevinhwang91 / rnvimr

Make Ranger running in a floating window to communicate with Neovim via RPC
BSD 3-Clause "New" or "Revised" License
804 stars 17 forks source link

Have to press <C-v> twice #71

Closed rockyzhang24 closed 3 years ago

rockyzhang24 commented 3 years ago

Hi, I am using the default settings, i.e., <C-v> for vsplit. However, I have to press <C-v> twice consecutively to open a vsplit window. Pressing only once doesn't work, i.e., nothing happens.

I double-checked I don't have such a keymapping in ranger's rc.conf, and also no such mapping in my nvim settings.

BTW, both <C-x> and <C-t> work well.

Any ideas? Thank you very much.

kevinhwang91 commented 3 years ago

Yes, I can reproduce in macos. ranger uses curses, I guess it's caused by terminfo.

In the below snippet code, the first type of ctrl-v doesn't show the key.

import time
import curses

def main(stdscr):
    begin_x, begin_y = 0, 0
    width, height = 40, 20
    win = curses.newwin(height, width, begin_y, begin_x)
    win.scrollok(True)
    while True:
        k = win.getch()
        win.addstr(f'key {str(k)} typed.\n')
        win.refresh()
        time.sleep(0.1)

if __name__ == "__main__":
    print(curses.wrapper(main))

In short, it's macos's upstream bug.

You can remap the extra actions as a workaround, run :h rnvimr_action for detail.

I'm sorry that I couldn't solve this issue.

rockyzhang24 commented 3 years ago

Okay, I got it. Thanks. By the way, you can mention this issue for macOS users in the README, the "advanced configuration" section which has rnvimr_action example there.

kevinhwang91 commented 3 years ago

Sure, I will add it to README later.

sethidden commented 2 years ago

Can you check if typing in your terminal stty lnext undef then launching nvim and trying CTRL+V fixes it? If it fixes it, add the stty snippet to your ~/.bashrc or ~/.zshrc

Courtesy of https://github.com/jonas/tig/issues/314#issuecomment-57881920