Discussion:
[PATCH] vi-copy: select line with V
Juho Pohjala
2014-06-21 11:46:41 UTC
Permalink
Hi

My first commit would be a simple addition to vi-copy mode. Allow
selecting the whole line with 'V'. This is how Vim selects the current
line, and currently in tmux there's no default mapping for this option
at all. Also this select-line option is kind of 'hidden', since it's
not documented in man page and not mapped in 'list-keys -t vi-copy'.
This commit makes the option more visible.

In addition, I would also like to make the following changes:
'v' begins selection mode instead of 'space' (identical to Vim)
'C-v' toggles rectangular selection instead of 'v' (C-v starts block
selection in Vim)
'y' copies the selection instead of Enter (identical to Vim)
What would you think about such changes that alter the 'legacy' behaviour?

Best Regards,
Juho Pohjala
Juho Pohjala
2014-06-20 23:02:13 UTC
Permalink
Line selection works now similarly as in Vim.
---
mode-key.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mode-key.c b/mode-key.c
index 8bb83cb..0857c29 100644
--- a/mode-key.c
+++ b/mode-key.c
@@ -288,6 +288,7 @@ const struct mode_key_entry mode_key_vi_copy[] = {
{ 'M', 0, MODEKEYCOPY_MIDDLELINE },
{ 'N', 0, MODEKEYCOPY_SEARCHREVERSE },
{ 'T', 0, MODEKEYCOPY_JUMPTOBACK },
+ { 'V', 0, MODEKEYCOPY_SELECTLINE },
{ 'W', 0, MODEKEYCOPY_NEXTSPACE },
{ '\002' /* C-b */, 0, MODEKEYCOPY_PREVIOUSPAGE },
{ '\003' /* C-c */, 0, MODEKEYCOPY_CANCEL },
--
1.7.10.4
Balazs Kezes
2014-06-21 15:46:44 UTC
Permalink
Allow selecting the whole line with 'V'.
I like the idea but your patch only selects the current line. In vim
when you press V you enter line selection mode -- pressing j/k will
still keep full lines selected whereas your patch will continue
selecting single characters. Can you adjust your patch to make it more
vim like?
--
Balazs
Juho Pohjala
2014-06-22 10:28:44 UTC
Permalink
Hi Balazs,

Thanks for your comments.

I agree with you and will implement what you suggested.

--
Juho
Post by Balazs Kezes
Allow selecting the whole line with 'V'.
I like the idea but your patch only selects the current line. In vim
when you press V you enter line selection mode -- pressing j/k will
still keep full lines selected whereas your patch will continue
selecting single characters. Can you adjust your patch to make it more
vim like?
--
Balazs
Juho Pohjala
2014-07-12 21:59:05 UTC
Permalink
Hi

Please have a look at the updated patch.

--
Juho
Post by Juho Pohjala
Hi Balazs,
Thanks for your comments.
I agree with you and will implement what you suggested.
--
Juho
Post by Balazs Kezes
Allow selecting the whole line with 'V'.
I like the idea but your patch only selects the current line. In vim
when you press V you enter line selection mode -- pressing j/k will
still keep full lines selected whereas your patch will continue
selecting single characters. Can you adjust your patch to make it more
vim like?
--
Balazs
Balazs Kezes
2014-07-23 20:49:13 UTC
Permalink
Post by Juho Pohjala
Please have a look at the updated patch.
Thanks, this works surprisingly well! Some nits: in mode-keys.c you
should also update the mode_key_cmdstr_copy array. Also, it would be
nice if you could leave the line mode via v (normal mode) or ^v (block
mode), or reenter the line mode from those when V is pressed. Vim also
works that way.

Nicholas: After this is thoroughly tested, is this something you'd
consider for the mainline? It only affects the vi mode.

Thanks!
--
Balazs
Nicholas Marriott
2014-08-07 20:06:32 UTC
Permalink
Yes I will look at this after OpenBSD tree unlocks.
Post by Balazs Kezes
Post by Juho Pohjala
Please have a look at the updated patch.
Thanks, this works surprisingly well! Some nits: in mode-keys.c you
should also update the mode_key_cmdstr_copy array. Also, it would be
nice if you could leave the line mode via v (normal mode) or ^v (block
mode), or reenter the line mode from those when V is pressed. Vim also
works that way.
Nicholas: After this is thoroughly tested, is this something you'd
consider for the mainline? It only affects the vi mode.
Thanks!
--
Balazs
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Juho Pohjala
2014-08-07 22:34:52 UTC
Permalink
Hi

Thanks for the comments! Please check the updated patch.
in mode-keys.c you should also update the mode_key_cmdstr_copy array
Yes, new line was already included in the previous patch.


BR,
Juho


On Thu, Aug 7, 2014 at 11:06 PM, Nicholas Marriott
Yes I will look at this after OpenBSD tree unlocks.
Post by Balazs Kezes
Post by Juho Pohjala
Please have a look at the updated patch.
Thanks, this works surprisingly well! Some nits: in mode-keys.c you
should also update the mode_key_cmdstr_copy array. Also, it would be
nice if you could leave the line mode via v (normal mode) or ^v (block
mode), or reenter the line mode from those when V is pressed. Vim also
works that way.
Nicholas: After this is thoroughly tested, is this something you'd
consider for the mainline? It only affects the vi mode.
Thanks!
--
Balazs
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Nicholas Marriott
2014-11-06 09:18:06 UTC
Permalink
Applied to OpenBSD now (sorry for the delay). Thanks!
Post by Juho Pohjala
Hi
Thanks for the comments! Please check the updated patch.
in mode-keys.c you should also update the mode_key_cmdstr_copy array
Yes, new line was already included in the previous patch.
BR,
Juho
On Thu, Aug 7, 2014 at 11:06 PM, Nicholas Marriott
Yes I will look at this after OpenBSD tree unlocks.
Post by Balazs Kezes
Post by Juho Pohjala
Please have a look at the updated patch.
Thanks, this works surprisingly well! Some nits: in mode-keys.c you
should also update the mode_key_cmdstr_copy array. Also, it would be
nice if you could leave the line mode via v (normal mode) or ^v (block
mode), or reenter the line mode from those when V is pressed. Vim also
works that way.
Nicholas: After this is thoroughly tested, is this something you'd
consider for the mainline? It only affects the vi mode.
Thanks!
--
Balazs
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
------------------------------------------------------------------------------
Loading...