Skip to content

How does patching keybindings work? #1

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

Open
rieje opened this issue Jan 31, 2020 · 0 comments
Open

How does patching keybindings work? #1

rieje opened this issue Jan 31, 2020 · 0 comments

Comments

@rieje
Copy link

rieje commented Jan 31, 2020

I'm not really a programmer, so I'm hoping you can help me understand how the patch for adding C-v for pasting from primary selection works. By default, C-Y pastes from primary selection, as defined:

case XK_Y:
XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
           utf8, utf8, win, CurrentTime);
return;

So I simply assumed creating the same entry for XK_v would do it:

case XK_v:
XConvertSelection(dpy, (ev->state & ShiftMask) ? clip : XA_PRIMARY,
           utf8, utf8, win, CurrentTime);
return;

However, it seems to apply to C-V instead. Your patch works fine and the difference is at line 27 where you have the exclamation point at !(ev->state & ShiftMask). What's the context of that and why is it needed here but not for case XK_Y? I assume it's something to do with shift key being used for capital Y vs. not being used for lowercase v. Also, why is it necessary to create an empty case for `case XK_v?

Much appreciated.

P.S. I'm thinking of changing the binding of C-j and C-k for down/up for vim-like behavior and C-l for ~ C-; for Enter to stay on home row but am still deciding if it's worth it and if it's trivial to implement it.

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

1 participant