Friday, January 28, 2011

Re: Typing numbers

On Fri, Jan 28, 2011 at 05:35:02PM EST, Tim Chase wrote:
>> I concur that prefixing Vim normal mode commands with a count, such as
>> '7dw' to delete the next seven words is ineffective.. Something like
>> 'dw....' where you delete the next word (dw) and repeat the last command
>> (.) a number of times is the way I normally do it because I don't have
>> to count the words before I even start deleting. While I hit the dot (.)
>> repeatedly, I can see what I'm deleting and I know when to stop.. And
>> I can always hit 'u' for undo to bring back the words I deleted one at
>> a time in the event I got carried away.
>
> This breaks when using t/T with ";" to repeat the motion as it just finds
> the same one you just found. I have to break down and count for those :)

Another reason why I don't use t/T (and don't care much for f/F either).

There's only so much can fit under my skull.. and I prefer to stick with
a limited subset of keyboard actions that may not be the quickest and
most efficient for all occasions.. but that I can use without hesitation
or incurring any overhead rememberiing. Namely that if the cursor is at
the beginning of the line above and I want to get to the '..ii..' typo
in 'rememberiing.', I find it considerably more effective when all is
told to just hit 'w' till I get to the beginning of the word
'rememberiing'.. and either hit llll.. or hit 'e' to get to the end of
the word and then 'hh' followed by 'x' to delete the last of the two
'i''s.. What would I really gain by counting 1, 2, 3.. it's the 3rd 'i'
I want to remove.. or wait a minute.. is it the second..? Huh..

Now I'm aware that I could also jump to the next sentence and work
backward.. and there are probably other ways to get to that extra 'i' in
fewer keystrokes than my clumsy approach, but all in all, I much prefer
sticking to wwww.. or eeee.. and occasionally bbb.. etc. because it
would take me longer to produce the 'find the third i' or 'jump to next
sentence' key sequence than typing three or four (five or six..) 'w''s
in succession.

And on a really bad day, after such a minor distraction.. I might even
need another little extra effort to remember why I moved the cursor
there in the first place.. Clever is not always better..

>> Come to think of it, the only pratical use I have for counts is when
>> I need something like a line of dashes:
>>
>> i -<Esc> x 80p
>>
>> IOW - i for insert mode, one dash,<Esc> back to normal mode, 'x' to
>> delete the dash and yank it to the unnamed register, and finally 80p to
>> create a line of eighty dashes..
>
> I just use
>
> 80I-<esc>
>
> to save the cut/yank :)

Thanks Tim, even better illustrates my point...

Incidentally, you have just put paid to maybe 2-3 years of frustration..
I vaguely remembered that there was a better way (probably saw it in vim
tips, or maybe s/o once mentioned it on this list) and never memorized
it properly.. Once in a while, I would try.. hm.. starts with typing 80-
in normal mode.. then what..?? and I was never able to bring it back.
I actually stopped trying because it so annoyed me. :-)

To make sure it'll stick *this* time, I'll practice it for the next few
days.. :-)

One nice touch about the above sequence and makes it really elegant is
the upper case 'I' because you can type it regardless of where the
cursor is located on the current line: after you hit <Esc>, the cursor
sits on the last of your inserted dashes, which means that you just need
to type 'a' to switch to insert mode with the cursor on the first
character following the last dash and 'Enter' to separate your line of
dashes and the previous contents of the line and move down any ensuing
text.

Thanks again for your comments.

cj


--
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

Re: Scrolling screen lines, I knew, it's impossible.

On 29/01/11 1:44 PM, Bram Moolenaar wrote:
> Ben Schmidt wrote:
>
>> On 27/01/11 3:38 AM, oCameLo wrote:
>>> There's so many questions and feature requests about use mouse to
>>> scroll screen lines, but until now, it's still impossible.
>>
>> Bram, you're not opposed to this kind of feature, are you? So if I did
>> some work on it, it could be included in Vim at some stage, right?
>
> This is a change that has a high probablity of introducing new bugs.

True, though if coded carefully, these bugs should only appear when the
feature is turned on.

> There are also a few questions about how to allow the user to access
> this, with an option setting or with different scroll commands?
> Probably a setting, so that it can work with scrollbars.

I think it would probably be best to do this in stages:

1. Add new commands to scroll one screen line at a time. Test it out,
including by mapping the scrollwheel to those new commands in the X
GUIs. This shouldn't be too hard, as Vim can already display lines
starting part way through; it just usually doesn't. The experience
wouldn't be very smooth yet either, but screen-line scrolling would at
least be possible, and it would pave the way for something better.

2. Add an option to make scrolling work with screen lines. The meaning
of this option would be to affect all scrolling. To start with, though,
just make it change the meaning of the scroll wheel in X GUIs (already
implemented), and where easy, the clicks of the scroll bar arrows. It
might not affect Windows yet; it depends how the scrolling works there,
and I haven't looked in any detail.

3. Make other parts of Vim, such as moving line-to-line, vertical jumps,
and scrolling for scrolloff honour the new option, too, choosing window
positions that begin with partial lines. This would make the editing
experience pretty smooth.

4. Update the code for scrollbars more thoroughly, so that dragging the
bar can work with screen lines, too. Windows should definitely benefit
by this stage and the feature would basically be finished.

5. Pick the nits of little bugs that we can't foresee.

What do you think? Would this be an OK way to proceed?

Ben.

--
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

Re: Scrolling screen lines, I knew, it's impossible.

Ben Schmidt wrote:

> On 27/01/11 3:38 AM, oCameLo wrote:
> > There's so many questions and feature requests about use mouse to
> > scroll screen lines, but until now, it's still impossible.
>
> Bram, you're not opposed to this kind of feature, are you? So if I did
> some work on it, it could be included in Vim at some stage, right?

This is a change that has a high probablity of introducing new bugs.

There are also a few questions about how to allow the user to access
this, with an option setting or with different scroll commands?
Probably a setting, so that it can work with scrollbars.

--
If you feel lonely, try schizophrenia.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
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

Re: Remapping CTRL-I to

On Fri, Jan 28, 2011 at 03:14:36PM EST, Tim Chase wrote:
> On 01/28/2011 12:14 PM, Chris Jones wrote:

>> In my environment, this causes the<Alt+I> combo to send<Esc> to
>> Vim.. and it looks like it might work with no side effects -- I first
>> checked in insert mode that<Alt+I> did not do anything that I could
>> see and I don't remember ever using it for anything else (?).
>
> The only catch is that (depending on your encoding and other stellar
> alignments) some alt+letter combinations produce various accented
> & ASCII characters >128.

Sounds promising.. Straight US-ASCII boy that I am.. this shouldn't be
a problem. Matter of fact, the first thing I do to an XTerm is make sure
the 8th bit is disabled, so I can use Alt+. in the shell to retrieve the
last word of the previous command.

As in:

| $ mkdir foofoofoobarbarbar
| $ cd Alt+. # gives me: cd foofoofoobarbarbar etc.

I use this all the time.

> If you type those characters intentionally (which it sounds like you
> don't), it may interfere. Otherwise, they should be safe to use (as
> mentioned in a sibling reply, they're case-sensitive).

I usually enter such characters either via the compose key, level three
mappings accessed by pressign the Winkeys, or occasionally Vim digraphs.

Thanks,

cj

--
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

Re: Starting out with VIM and C++

Thanks that helps out a lot.
--
View this message in context: http://vim.1045645.n5.nabble.com/Starting-out-with-VIM-and-C-tp3361804p3362244.html
Sent from the Vim - General mailing list archive at Nabble.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

Re: Typing numbers

> I concur that prefixing Vim normal mode commands with a count, such as
> '7dw' to delete the next seven words is ineffective.. Something like
> 'dw....' where you delete the next word (dw) and repeat the last command
> (.) a number of times is the way I normally do it because I don't have
> to count the words before I even start deleting. While I hit the dot (.)
> repeatedly, I can see what I'm deleting and I know when to stop.. And
> I can always hit 'u' for undo to bring back the words I deleted one at
> a time in the event I got carried away.

This breaks when using t/T with ";" to repeat the motion as it
just finds the same one you just found. I have to break down and
count for those :)

> Come to think of it, the only pratical use I have for counts is when
> I need something like a line of dashes:
>
> i -<Esc> x 80p
>
> IOW - i for insert mode, one dash,<Esc> back to normal mode, 'x' to
> delete the dash and yank it to the unnamed register, and finally 80p to
> create a line of eighty dashes..

I just use

80I-<esc>

to save the cut/yank :)

-tim


--
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

Re: Remapping CTRL-I to

On Fri, Jan 28, 2011 at 02:20:06PM EST, Ben Fritz wrote:
>
>
> On Jan 28, 12:14 pm, Chris Jones <cjns1...@gmail.com> wrote:
> >
> > Actually, while writing my reply, I tried a:
> >
> > | :inoremap <Esc>i <Esc>
> >
> > In my environment, this causes the <Alt+I> combo to send <Esc> to Vim..
> > and it looks like it might work with no side effects -- I first checked
> > in insert mode that <Alt+I> did not do anything that I could see and
> > I don't remember ever using it for anything else (?).
> >
>
> Alt keys do nothing special in Vim by default. If you're using GUI Vim
> you may need to read :help 'winaltkeys' but it sounds like you're
> sticking with the terminal.

Ah, yes.. that's probably what I had at the back of my mind re: using
the Alt modifier.

> You can probably map it directly:
>
> :inoremap <A-i> <Esc>
>
> or
>
> :inoremap <M-i> <Esc>

Well, you know what.. I've never been able to use the A- or M- syntax..
Tha's why I always specify <Esc> instead in my mappings. Time to revisit
this maybe..

> Note that Alt maps, unlike CTRL maps, are case-sensitive.

Interesting.. would mean that I can map Alt+<key> and Shift+Alt+<key> to
different things.. right?

Thanks,

cj

--
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