Sunday, August 30, 2009

Re: Retaining cursor position and getting back the # character's normal use

Seeing that this email has slept for 10 days on the list with no answer,
I guess it's my turn.

On 20/08/09 11:52, Bernard El-Hagin wrote:
>
>
>
> Hi,
>
>
> I have two questions:
>
>
>
> 1) Let's say I have the following code:
>
>
>
> if ( whatever1 ) {
>
> # do stuff 1;
> }
>
>
> if ( whatever2 ) {
>
> # do stuff 2;
> }
>
>
> And let's say I'm in normal mode and have my cursor on the first "e"
> of "whatever1". When I now use j to move a couple of lines down, I
> would like the cursor to also be at the first "e" of "whatever2", but
> what it does is jump to the beginning of the line between the two
> ifs and never returns. I have set "sol" to true and I don't know
> what other setting can help here (except for virtualedit, which I don't
> want).

Works for me, with gvim 7.2.245 (Huge) with GTK2-GNOME GUI. Here too,
'sol' is on, and 'virtualedit' is set to the empty string. You could try

vim -N -u NONE

(with vim and -u in lowercase and the rest in uppercase), or

vim -N -u NORC

or, on Unix

vim -u /usr/local/share/vim/vim72/vimrc_example.vim

or, on Windows

vim -u C:\PROGRA~1\vim\vim72\vimrc_example.vim

(or the same with gvim instead of vim if you prefer) to see which ones
of them work and which ones don't. If they all work, and your usual Vim
doesn't, then the culprit is probably your vimrc. If, in addition,

vim --noplugin

doesn't work, then the culprit is almost certainly your vimrc.

You might also try

:verbose map j

to see if you haven't got a mapping telling Vim to do something else
when you hit j. If you do, the above, will also tell you where it was
set. (I have no such mapping defined.)


>
>
>
> 2) I write a lot in Perl, in which the default behaviour of the # key
> is special. I don't *want* it to be special. All I want, is to get the
> "#" character when I type the "#" character. That is all. How can I achieve
> this?

I don't know Perl, but try

:verbose map! #

while editing a Perl file. (The exclamation mark is important.) Or if
you would describe that "special behaviour" in more detail, it might be
easier for me to guess what happens.

>
>
>
> Thanks,
> Bernard


Next time, one question per post, please.


Best regards,
Tony.
--
Tonight's the night: Sleep in a eucalyptus tree.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

No comments:

Post a Comment