Re: get better copy backwards

2023-03-07 Thread Enan Ajmain
On Tue, 7 Mar 2023 09:40:39 +0100
Christian Brabandt  wrote:
> Try using yvb which should force the motion to be inclusive, e.g.
> include the right-most character. See :h o_v

Nice!  Thanks for this.  Didn't know.

> > It's not gonna be changed upstream, but I bet patching your own
> > copy of vim won't be too hard.  If I were using 'yb' as often as
> > you seem to be, I would've tried patching it.
>
> That makes it even more confusing, if you'll have to use a
> non-patched Vim.

True.

--
Enan

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20230307162748.75e3c833%40cirdan.


Re: get better copy backwards

2023-03-07 Thread Christian Brabandt


On Di, 07 Mär 2023, Enan Ajmain wrote:

> To answer your question, vim motions are of two types:
>   - ':h inclusive'
>   - ':h exclusive'
> 
> I don't understand that helpdoc well, but I understand that this is the
> reason 'yb' excludes the character the cursor was on.  For fun, try
> 'yge', which is an inclusive motion.  It's not a substitute of 'yb'
> (you'll see why when you try).  It's just to demonstrate the reason why
> 'yb' behaves unintuitively.

Try using yvb which should force the motion to be inclusive, e.g. 
include the right-most character. See :h o_v

> It's not gonna be changed upstream, but I bet patching your own copy of
> vim won't be too hard.  If I were using 'yb' as often as you seem to be,
> I would've tried patching it.

That makes it even more confusing, if you'll have to use a non-patched 
Vim.

Best,
Christian
-- 
Alles ist schon einmal gesagt worden, aber da niemand zuhört, muß man
es immer von neuem sagen.
-- André Gide

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/ZAb4hzSNAXgEpIuD%40256bit.org.


Re: get better copy backwards

2023-03-07 Thread M
вт, 7 мар. 2023 г., 10:21 Enan Ajmain <3nan.ajm...@gmail.com>:

> This behavior annoys me as well.  Fortunately I don't need to yank
> backward too often.
>
> To answer your question, vim motions are of two types:
>   - ':h inclusive'
>   - ':h exclusive'
>
> I don't understand that helpdoc well, but I understand that this is the
> reason 'yb' excludes the character the cursor was on.  For fun, try
> 'yge', which is an inclusive motion.  It's not a substitute of 'yb'
> (you'll see why when you try).  It's just to demonstrate the reason why
> 'yb' behaves unintuitively.
>
> It's not gonna be changed upstream, but I bet patching your own copy of
> vim won't be too hard.  If I were using 'yb' as often as you seem to be,
> I would've tried patching it.
>
> --
> Enan
> 3nan.ajm...@gmail.com
> https://www.github.com/3N4N
>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/20230307132118.6b628228%40cirdan
> .
>

Getting exclusive-inclusive difference is easier than it looks at first:
exclusive motions always exclude the rightmost character. This is both
weird and normal at the same time, as driving a car: turning wheel to the
right always turns car to the right, no matter if it goes forward or
backward.

Kind regards,
Matvey

>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAFsTB%2B%2BFx1hMQkDk3djewezaNr_M2vdj3NCw6ManPKF-GJm0Yw%40mail.gmail.com.


Re: get better copy backwards

2023-03-06 Thread Enan Ajmain
This behavior annoys me as well.  Fortunately I don't need to yank
backward too often.

To answer your question, vim motions are of two types:
  - ':h inclusive'
  - ':h exclusive'

I don't understand that helpdoc well, but I understand that this is the
reason 'yb' excludes the character the cursor was on.  For fun, try
'yge', which is an inclusive motion.  It's not a substitute of 'yb'
(you'll see why when you try).  It's just to demonstrate the reason why
'yb' behaves unintuitively.

It's not gonna be changed upstream, but I bet patching your own copy of
vim won't be too hard.  If I were using 'yb' as often as you seem to be,
I would've tried patching it.

--
Enan
3nan.ajm...@gmail.com
https://www.github.com/3N4N

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20230307132118.6b628228%40cirdan.


Re: get better copy backwards

2023-03-06 Thread Igor Lerinc
visual select makes even less sense.
better to just use emacs then.

pon, 6. mar 2023. 21:28 Owajigbanam Ogbuluijah  је
написао/ла:

> I often consider the cursor as the left edge of the block. This way,
> yanking backwards makes sense. Ensure the left edge of your cursor is
> outside (i.e. "right-bounding") the text you want to yank. Then the
> solution in Salman Halim's answer makes sense.
>
> This works for all cases except when you are at EOL. For the EOL case,
> there's a config which allows the cursor to go beyond EOL — can't remember
> it off the top of my head now, but it's there. Once you have that setup,
> the solution in my first paragraph should work.
>
> If both of these don't *feel right* to you, you could always visually
> select with your motions, then yank.
>
>
> Best,
> Igbanam
>
> On Mon, Mar 6, 2023 at 6:23 PM Igor Lerinc  wrote:
>
>> i'm saying that: backward yank doesn't include the ] where your cursor
>> currently is
>>
>> so i always lose that one last character.
>> i already have easymotion plugin, and that's why i just use 'f', even
>> tought i'm familiar with F for backwards, but just want to do less
>> keystrokes, that's whole point right?
>>
>> i understand, that pointer needs to be in that position, in order to be
>> able to insert before and after cursor , with *i* and *a* .
>> but why can't it copy that one front char in front of it if it's last
>> char in a word?
>>
>> what happens when i try to copy is i lose that last char from word.
>> and that alone, is making Vim useless for speedy work (tought, i wouldn't
>> complain about other features, just that, this slows me down very much)
>>
>> On Monday, March 6, 2023 at 5:51:09 PM UTC+1 Salman Halim wrote:
>>
>>> On Mon, Mar 6, 2023 at 11:17 AM Igor Lerinc  wrote:
>>>
 imagine i have line of text:
 echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
 "";

 my cursor is *█*

 echo *█*"Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
 "";

 and then, i move cursor to ] with *f*
 it will go before last character in word

 echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"*█*] . "." .
 "";

 and if i want to yank it backwards to $
 i need to move my cursor to left and only then yank it backwards

 i really hate that 'feature', why cursor can't just sit and go to the
 last character in word?

>>>
>>> Igor,
>>>
>>> It's possible I didn't fully understand the problem you're facing. Are
>>> you saying that you aren't sure about how to yank backwards or are you
>>> saying that the backward yank doesn't include the ] where your cursor
>>> currently is?
>>>
>>> If the first, then just as 'f' and 't' move forward to a given
>>> character, 'F' and 'T' move backward. In your case, you could just do
>>> 'y2F$' (all without the quotes, of course).
>>>
>>> Additionally, you could use the EasyMotion plugin (
>>> https://www.vim.org/scripts/script.php?script_id=3526) if you have a
>>> lot of $ signs and don't want to try to count them before issuing the
>>> command.
>>>
>>> If the second, then, yes, you have first move over a single character
>>> before doing the yank. Perhaps you could create a mapping that moves you
>>> over and does the yank?
>>>
>>> Hope this helps,
>>>
>>> Salman
>>>
>> --
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to vim_use+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/vim_use/159bea31-2683-4b6e-8890-46b38efef34cn%40googlegroups.com
>> 
>> .
>>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "vim_use" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/vim_use/fRPh8t33Kg8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/CAOmRJrdrz3%3DOMQBs0Md4HhAw8qZPzkY33%3DZOPn9rfWdpp4DsQQ%40mail.gmail.com
> 
> .
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below 

Re: get better copy backwards

2023-03-06 Thread Salman Halim
Set 'vritualedit' to onemore:

:set virtualedit=onemore

That will let it go just beyond the end of the line, but no further. Might
do exactly what Igabanam is suggesting. That combined with something like:

:nnoremap Y ly

Solves it for me, though you have to not be using Y (I use 'yy', so it's
free for me).

Salman

On Mon, Mar 6, 2023 at 3:28 PM Owajigbanam Ogbuluijah 
wrote:

> I often consider the cursor as the left edge of the block. This way,
> yanking backwards makes sense. Ensure the left edge of your cursor is
> outside (i.e. "right-bounding") the text you want to yank. Then the
> solution in Salman Halim's answer makes sense.
>
> This works for all cases except when you are at EOL. For the EOL case,
> there's a config which allows the cursor to go beyond EOL — can't remember
> it off the top of my head now, but it's there. Once you have that setup,
> the solution in my first paragraph should work.
>
> If both of these don't *feel right* to you, you could always visually
> select with your motions, then yank.
>
>
> Best,
> Igbanam
>
> On Mon, Mar 6, 2023 at 6:23 PM Igor Lerinc  wrote:
>
>> i'm saying that: backward yank doesn't include the ] where your cursor
>> currently is
>>
>> so i always lose that one last character.
>> i already have easymotion plugin, and that's why i just use 'f', even
>> tought i'm familiar with F for backwards, but just want to do less
>> keystrokes, that's whole point right?
>>
>> i understand, that pointer needs to be in that position, in order to be
>> able to insert before and after cursor , with *i* and *a* .
>> but why can't it copy that one front char in front of it if it's last
>> char in a word?
>>
>> what happens when i try to copy is i lose that last char from word.
>> and that alone, is making Vim useless for speedy work (tought, i wouldn't
>> complain about other features, just that, this slows me down very much)
>>
>> On Monday, March 6, 2023 at 5:51:09 PM UTC+1 Salman Halim wrote:
>>
>>> On Mon, Mar 6, 2023 at 11:17 AM Igor Lerinc  wrote:
>>>
 imagine i have line of text:
 echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
 "";

 my cursor is *█*

 echo *█*"Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
 "";

 and then, i move cursor to ] with *f*
 it will go before last character in word

 echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"*█*] . "." .
 "";

 and if i want to yank it backwards to $
 i need to move my cursor to left and only then yank it backwards

 i really hate that 'feature', why cursor can't just sit and go to the
 last character in word?

>>>
>>> Igor,
>>>
>>> It's possible I didn't fully understand the problem you're facing. Are
>>> you saying that you aren't sure about how to yank backwards or are you
>>> saying that the backward yank doesn't include the ] where your cursor
>>> currently is?
>>>
>>> If the first, then just as 'f' and 't' move forward to a given
>>> character, 'F' and 'T' move backward. In your case, you could just do
>>> 'y2F$' (all without the quotes, of course).
>>>
>>> Additionally, you could use the EasyMotion plugin (
>>> https://www.vim.org/scripts/script.php?script_id=3526) if you have a
>>> lot of $ signs and don't want to try to count them before issuing the
>>> command.
>>>
>>> If the second, then, yes, you have first move over a single character
>>> before doing the yank. Perhaps you could create a mapping that moves you
>>> over and does the yank?
>>>
>>> Hope this helps,
>>>
>>> Salman
>>>
>> --
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "vim_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to vim_use+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/vim_use/159bea31-2683-4b6e-8890-46b38efef34cn%40googlegroups.com
>> 
>> .
>>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/CAOmRJrdrz3%3DOMQBs0Md4HhAw8qZPzkY33%3DZOPn9rfWdpp4DsQQ%40mail.gmail.com
> 

Re: get better copy backwards

2023-03-06 Thread Owajigbanam Ogbuluijah
I often consider the cursor as the left edge of the block. This way,
yanking backwards makes sense. Ensure the left edge of your cursor is
outside (i.e. "right-bounding") the text you want to yank. Then the
solution in Salman Halim's answer makes sense.

This works for all cases except when you are at EOL. For the EOL case,
there's a config which allows the cursor to go beyond EOL — can't remember
it off the top of my head now, but it's there. Once you have that setup,
the solution in my first paragraph should work.

If both of these don't *feel right* to you, you could always visually
select with your motions, then yank.


Best,
Igbanam

On Mon, Mar 6, 2023 at 6:23 PM Igor Lerinc  wrote:

> i'm saying that: backward yank doesn't include the ] where your cursor
> currently is
>
> so i always lose that one last character.
> i already have easymotion plugin, and that's why i just use 'f', even
> tought i'm familiar with F for backwards, but just want to do less
> keystrokes, that's whole point right?
>
> i understand, that pointer needs to be in that position, in order to be
> able to insert before and after cursor , with *i* and *a* .
> but why can't it copy that one front char in front of it if it's last char
> in a word?
>
> what happens when i try to copy is i lose that last char from word.
> and that alone, is making Vim useless for speedy work (tought, i wouldn't
> complain about other features, just that, this slows me down very much)
>
> On Monday, March 6, 2023 at 5:51:09 PM UTC+1 Salman Halim wrote:
>
>> On Mon, Mar 6, 2023 at 11:17 AM Igor Lerinc  wrote:
>>
>>> imagine i have line of text:
>>> echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
>>> "";
>>>
>>> my cursor is *█*
>>>
>>> echo *█*"Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
>>> "";
>>>
>>> and then, i move cursor to ] with *f*
>>> it will go before last character in word
>>>
>>> echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"*█*] . "." .
>>> "";
>>>
>>> and if i want to yank it backwards to $
>>> i need to move my cursor to left and only then yank it backwards
>>>
>>> i really hate that 'feature', why cursor can't just sit and go to the
>>> last character in word?
>>>
>>
>> Igor,
>>
>> It's possible I didn't fully understand the problem you're facing. Are
>> you saying that you aren't sure about how to yank backwards or are you
>> saying that the backward yank doesn't include the ] where your cursor
>> currently is?
>>
>> If the first, then just as 'f' and 't' move forward to a given character,
>> 'F' and 'T' move backward. In your case, you could just do 'y2F$' (all
>> without the quotes, of course).
>>
>> Additionally, you could use the EasyMotion plugin (
>> https://www.vim.org/scripts/script.php?script_id=3526) if you have a lot
>> of $ signs and don't want to try to count them before issuing the command.
>>
>> If the second, then, yes, you have first move over a single character
>> before doing the yank. Perhaps you could create a mapping that moves you
>> over and does the yank?
>>
>> Hope this helps,
>>
>> Salman
>>
> --
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_use" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vim_use+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vim_use/159bea31-2683-4b6e-8890-46b38efef34cn%40googlegroups.com
> 
> .
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CAOmRJrdrz3%3DOMQBs0Md4HhAw8qZPzkY33%3DZOPn9rfWdpp4DsQQ%40mail.gmail.com.


Re: get better copy backwards

2023-03-06 Thread Igor Lerinc
i'm saying that: backward yank doesn't include the ] where your cursor 
currently is

so i always lose that one last character. 
i already have easymotion plugin, and that's why i just use 'f', even 
tought i'm familiar with F for backwards, but just want to do less 
keystrokes, that's whole point right?

i understand, that pointer needs to be in that position, in order to be 
able to insert before and after cursor , with *i* and *a* . 
but why can't it copy that one front char in front of it if it's last char 
in a word? 

what happens when i try to copy is i lose that last char from word. 
and that alone, is making Vim useless for speedy work (tought, i wouldn't 
complain about other features, just that, this slows me down very much)

On Monday, March 6, 2023 at 5:51:09 PM UTC+1 Salman Halim wrote:

> On Mon, Mar 6, 2023 at 11:17 AM Igor Lerinc  wrote:
>
>> imagine i have line of text:
>> echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." . 
>> "";
>>
>> my cursor is *█*
>>
>> echo *█*"Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." . 
>> "";
>>
>> and then, i move cursor to ] with *f*
>> it will go before last character in word
>>
>> echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"*█*] . "." . 
>> "";
>>
>> and if i want to yank it backwards to $
>> i need to move my cursor to left and only then yank it backwards
>>
>> i really hate that 'feature', why cursor can't just sit and go to the 
>> last character in word?
>>
>
> Igor,
>
> It's possible I didn't fully understand the problem you're facing. Are you 
> saying that you aren't sure about how to yank backwards or are you saying 
> that the backward yank doesn't include the ] where your cursor currently is?
>
> If the first, then just as 'f' and 't' move forward to a given character, 
> 'F' and 'T' move backward. In your case, you could just do 'y2F$' (all 
> without the quotes, of course).
>
> Additionally, you could use the EasyMotion plugin (
> https://www.vim.org/scripts/script.php?script_id=3526) if you have a lot 
> of $ signs and don't want to try to count them before issuing the command.
>
> If the second, then, yes, you have first move over a single character 
> before doing the yank. Perhaps you could create a mapping that moves you 
> over and does the yank?
>
> Hope this helps,
>
> Salman
>

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/159bea31-2683-4b6e-8890-46b38efef34cn%40googlegroups.com.


Re: get better copy backwards

2023-03-06 Thread Salman Halim
On Mon, Mar 6, 2023 at 11:17 AM Igor Lerinc  wrote:

> imagine i have line of text:
> echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
> "";
>
> my cursor is *█*
>
> echo *█*"Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"] . "." .
> "";
>
> and then, i move cursor to ] with *f*
> it will go before last character in word
>
> echo "Zdravo, " . $_GET["ime"] . " " . $_GET["prezime"*█*] . "." .
> "";
>
> and if i want to yank it backwards to $
> i need to move my cursor to left and only then yank it backwards
>
> i really hate that 'feature', why cursor can't just sit and go to the last
> character in word?
>

Igor,

It's possible I didn't fully understand the problem you're facing. Are you
saying that you aren't sure about how to yank backwards or are you saying
that the backward yank doesn't include the ] where your cursor currently is?

If the first, then just as 'f' and 't' move forward to a given character,
'F' and 'T' move backward. In your case, you could just do 'y2F$' (all
without the quotes, of course).

Additionally, you could use the EasyMotion plugin (
https://www.vim.org/scripts/script.php?script_id=3526) if you have a lot of
$ signs and don't want to try to count them before issuing the command.

If the second, then, yes, you have first move over a single character
before doing the yank. Perhaps you could create a mapping that moves you
over and does the yank?

Hope this helps,

Salman

-- 
-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_use+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/CANuxnEd42%2BBhqUKCfNNj4MjRGE6Z3WdvJdDcEKD8-N%3D0sYZzRw%40mail.gmail.com.