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

Pressing <Esc> should not move the cursor if we're already in Normal mode #92

Open
fghimis opened this issue May 31, 2021 · 7 comments
Open

Comments

@fghimis
Copy link

fghimis commented May 31, 2021

I am trying to reuse the normal keybindings for switching channels.

Normally, when pressing Ctrl+n I will advance one channel and Ctrl+p will go back.
Currently, this works only one I'm in Insert mode. When I switch to Normal mode it stops working.

I have tried the following nmaps:

  • :nmap <C-n> /buffer +1<CR>
  • :nmap <C-N> /buffer +1<CR>
  • :nmap ^N /buffer +1<CR>
  • :nmap C-N /buffer +1<CR>

And none worked.
I'm using the latest script on https://weechat.org/scripts/source/vimode.py.html/ : Version: 0.8.1

More info (I don't know if it helps):

  • on pressing :nmap after setting the keybindings, I would not get the expected <C-n>, but only n or N or ^N.
  • also ^F and ^B don't seem to work with default settings, but ^U and ^D work fine
@GermainZ
Copy link
Owner

Please try the script from this repo, that should work.
(The versions are a bit messed up, 0.8/0.8.1 from the weechat repo are actually 0.7 in this repo).

I will submit a PR to update the weechat script when I have some time :)

@fghimis
Copy link
Author

fghimis commented May 31, 2021

Thanks, it works now as intended!

@fghimis fghimis closed this as completed May 31, 2021
@fghimis
Copy link
Author

fghimis commented May 31, 2021

Another question, not to open another issue, but when I'm in normal mode and I press <Esc> I would get back 1 character (like backspace). Can that be fixed?

@GermainZ
Copy link
Owner

That's intended behavior (similar to vim). You can edit the source code if you don't like it, though. Specifically, you can comment out/remove this line.

@fghimis
Copy link
Author

fghimis commented May 31, 2021

No, I mean when I'm in Insert mode and i press Esc it's normal to go back 1 character.
But I am in Normal mode, and I press Esc again, and I go back 1 character (similar to pressing h in Normal mode).
Shouldn't it do nothing (already being in Normal mode)?

@GermainZ
Copy link
Owner

Oh yeah, I'll reopen the issue and rename it so I don't forget about it. Thanks!

@GermainZ GermainZ reopened this May 31, 2021
@GermainZ GermainZ changed the title Binding <C-n> and <C-p> to switch buffers not working in normal mode Pressing <Esc> should not move the cursor if we're already in Normal mode May 31, 2021
@fghimis
Copy link
Author

fghimis commented May 31, 2021

Oh and something else (it may be related to mode switching): Pressing <Esc> to cancel Ex mode will erase current line. Steps to reproduce:

  1. Enter insert mode, write: "some text here"
  2. Press Esc (enter normal mode)
  3. Press : (enter ex mode)
  4. Change your mind and press Esc to go back in normal mode
  5. "some text here" is gone, only : remains

On further checking, the text is there if I press undo (u) and then redo (C-R).

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

No branches or pull requests

2 participants