Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

vim · Vim (Vi IMproved) text editor users list

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

Advanced
Messages Help
Messages 38576 - 38605 of 137808   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#38576 From: Eric Winger <ewinger@...>
Date: Wed Apr 2, 2003 5:09 pm
Subject: positioning in a vim file from another window
ewinger@...
Send Email Send Email
 
My coworker & I are debating whether vim can do this emacs thing. He thinks
vim can, I'm not convinced.

In general, does vim have the capability to reposition another buffer and move
to that position in the other buffer? (Or is window the correct term)

Here's two examples from emacs I'm thinking of:
* I can open a buffer list in emacs navigate to a line in the buffer list,
press Enter or o and the alternate buffer will open and put me in that
buffer.

* I can do a 'grep' or Mx list-matching-lines and get a nice little buffer of
all matching lines in the current buffer. From which I can press Enter and be
taken to that line in the other buffer.

Thanks,

eric

#38577 From: Pavel Tavoda <Pavel.Tavoda@...>
Date: Wed Apr 2, 2003 5:44 pm
Subject: Re: positioning in a vim file from another window
Pavel.Tavoda@...
Send Email Send Email
 
Generally I don't know, however for grep like positioning
and error positioning here is some support;
:help grep
:help quickfix
:help colder

Pavel

Eric Winger wrote:

>My coworker & I are debating whether vim can do this emacs thing. He thinks
>vim can, I'm not convinced.
>
>In general, does vim have the capability to reposition another buffer and move
>to that position in the other buffer? (Or is window the correct term)
>
>Here's two examples from emacs I'm thinking of:
>* I can open a buffer list in emacs navigate to a line in the buffer list,
>press Enter or o and the alternate buffer will open and put me in that
>buffer.
>
>* I can do a 'grep' or Mx list-matching-lines and get a nice little buffer of
>all matching lines in the current buffer. From which I can press Enter and be
>taken to that line in the other buffer.
>
>Thanks,
>
>eric
>
>

#38578 From: Dan Sharp <dwsharp@...>
Date: Wed Apr 2, 2003 5:43 pm
Subject: Re: positioning in a vim file from another window
dwsharp@...
Send Email Send Email
 
Eric Winger wrote:
> My coworker & I are debating whether vim can do this emacs thing. He thinks
> vim can, I'm not convinced.
>
> In general, does vim have the capability to reposition another buffer and move
> to that position in the other buffer? (Or is window the correct term)

Yes, it can.  The immediate example is quickfix mode, where the quickfix
windows contains compiler output, and clicking / hitting enter on one of
the lines will jump you to the corresponding file and line (and column,
if that much info is available).

See :he quickfix

> Here's two examples from emacs I'm thinking of:
> * I can open a buffer list in emacs navigate to a line in the buffer list,
> press Enter or o and the alternate buffer will open and put me in that
> buffer.

Look on www.vim.org for scripts like BufExplorer.

> * I can do a 'grep' or Mx list-matching-lines and get a nice little buffer of
> all matching lines in the current buffer. From which I can press Enter and be
> taken to that line in the other buffer.

The :grep command does just that.  Run :grep <pattern> to find the
matching lines.  The command :cwindow will open the quickfix window to
show the list of matches, and clicking / hitting enter on a line will
open the matching file in a new window and jump you to the matching line.

See :he :grep

Dan Sharp

#38579 From: Valery Kondakoff <strauss@...>
Date: Wed Apr 2, 2003 5:10 pm
Subject: 'autoindent', 'paste' and pasting indented text in Insert mode?
strauss@...
Send Email Send Email
 
Hello, Lukas!

Wednesday, April 2, 2003, you wrote to me:

>> When pasting some indented text in Insert mode it is pasted with weird
>> additional indentation.
>>
LR> :help 'pastetoggle'

Thank you. After reading 'paste' description, I was thinking, that it
is not necessary to set 'paste' or 'pastetoggle', when using GUI...

Here are the lines in question (from VIM help):

-----
Setting this option is useful when using Vim in a terminal, where Vim
cannot distinguish between typed text and pasted text.  In the GUI,
Vim knows about pasting and will mostly do the right thing without 'paste'
being set.
-----

Am I wrong? Do I still need to set 'paste/pastetoggle' even in GUI?

Thank you once again.

--
Best regards,
  Valery Kondakoff
  http://www.nbk.orc.ru (Ne Bey Kopytom)
  http://www.nbk.orc.ru/mtb (MTB riding in Moscow)

PGP key: mailto:pgp-public-keys@...?subject=GET%20strauss@...

np: Pussyfoot - Sea Breeze #C - Chari Chari (Fish Smell Like Cat) [stopped]

#38580 From: "Yiu Wing" <yiuwing.yip@...>
Date: Wed Apr 2, 2003 6:59 pm
Subject: Bug? Insert mode mapping with <silent>.
yiuwing.yip@...
Send Email Send Email
 
Hello All,

According to the doc for "map-<silent>", if a mapping is defined with the
<silent> option, it won't be echoed on the command line.  This works as
expected for normal mode mappings, but it doesn't work for insert mode
mappings.

The following mapping demonstrates this behaviour,

inoremap <silent> a a<ESc>:call tempname()<cr>a

If you type the letter 'a' repeatedly after remapping it, and with the
showmode option on, you can see the mode message "--insert--" flickers
sporadically.

Does <silent> not apply to insert map, or it is a bug?

Regards,

Yiu Wing

#38581 From: Eric Winger <ewinger@...>
Date: Wed Apr 2, 2003 7:00 pm
Subject: Re: positioning in a vim file from another window
ewinger@...
Send Email Send Email
 
Excellent! The grep thing works neatly.

Now can one do the equivalent of opening a directory in emacs and allow quick
selections in the quickfix window?

I tried loading up the minibuffer. But it doesn't seem to work. I tried
putting the .vim in my vim61/ftplugins directory. It didn't open
automagically. I then tried :source mini... but that didn't seem to open
anything either.

But I'm not sure that this will do what I was talking about. Where, in effect,
I can dump the output from a ls to the quickfix window and then scroll & open
new buffers from that.

Any ideas?

thx

eric


On Wednesday 02 April 2003 09:43 am, Dan Sharp wrote:
> Eric Winger wrote:
> > My coworker & I are debating whether vim can do this emacs thing. He
> > thinks vim can, I'm not convinced.
> >
> > In general, does vim have the capability to reposition another buffer and
> > move to that position in the other buffer? (Or is window the correct
> > term)
>
> Yes, it can.  The immediate example is quickfix mode, where the quickfix
> windows contains compiler output, and clicking / hitting enter on one of
> the lines will jump you to the corresponding file and line (and column,
> if that much info is available).
>
> See :he quickfix
>
> > Here's two examples from emacs I'm thinking of:
> > * I can open a buffer list in emacs navigate to a line in the buffer
> > list, press Enter or o and the alternate buffer will open and put me in
> > that buffer.
>
> Look on www.vim.org for scripts like BufExplorer.

>
> > * I can do a 'grep' or Mx list-matching-lines and get a nice little
> > buffer of all matching lines in the current buffer. From which I can
> > press Enter and be taken to that line in the other buffer.
>
> The :grep command does just that.  Run :grep <pattern> to find the
> matching lines.  The command :cwindow will open the quickfix window to
> show the list of matches, and clicking / hitting enter on a line will
> open the matching file in a new window and jump you to the matching line.
>
> See :he :grep
>
> Dan Sharp

#38582 From: Martin Norbäck <d95mback@...>
Date: Wed Apr 2, 2003 7:44 pm
Subject: Re: automatically comment/uncomment line and region
d95mback@...
Send Email Send Email
 
ons 2003-04-02 klockan 18.52 skrev Piet Delport:
> noremap <silent> ,c :<C-B>sil
<C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>
> noremap <silent> ,u :<C-B>sil
<C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>

Weee, severe magic. Thanks. Now I will never be able to
understand^Wchange this mapping again :)

Regards,

	 Martin

--
Martin Norbäck <d95mback@...>

#38583 From: Alan Schmitt <alan.schmitt@...>
Date: Wed Apr 2, 2003 9:19 pm
Subject: launching a remote vim without any file
alan.schmitt@...
Send Email Send Email
 
Hello,

I've just read :h client-server, and I cannot find the answer to the
following question. How can I launch gvim the following way:
- if it is the first one, then it is created
- if a gvim already exists, then reuse it.

I tried using the --servername option, but it seems it requires a
--remote-something. However I do not want to open any file or anything,
so what --remote should I use ?

(what I'm really looking for is something of the form:
alias g='gvim --servername MY_GVIM --remote???'
that I can use either by doing
g
and getting a gvim, or
g foo.txt
and editing foo.txt in the existing gvim)

Thanks,

Alan Schmitt

--
The hacker: someone who figured things out and made something cool happen.

#38584 From: Bram Moolenaar <Bram@...>
Date: Wed Apr 2, 2003 9:34 pm
Subject: Re: visual 2html.vim
Bram@...
Send Email Send Email
 
Joachim Hofmann wrote:

> is it possible to pass only visually selected lines to 2html.vim?

Good question.  No, it currently isn't possible.  You can cut out the
lines you want to convert, but that might very well change the syntax
highlighting.

Since 2html.vim is a script, it doesn't take a line range argument.  It
would need to be wrapped in a user command to do this.  The user command
could check for a range, set a couple of variables and 2html.vim would
do only the specified lines when these variables are set.

It's not too difficult, since 2html.vim has uses "s:lnum" to go over the
lines.  Perhaps someone with a bit of Vim scriptology can make this.

--
Q: How does a UNIX Guru do Sex ?
A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep

  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///

#38585 From: Bram Moolenaar <Bram@...>
Date: Wed Apr 2, 2003 9:34 pm
Subject: Re: Inadequate functionality for sign related commands
Bram@...
Send Email Send Email
 
Hari Krishna Dara wrote:

> While using signs for my breakpts.vim script that I recently posted
> (which can be used to set breakpoints in vim functions), I have observed
> lack of functions/commands for doing certain things:

The sign funcionality has been designed to be used by a program or
script.  It's not something you type manually.

>     - There are no functions to check if a sign is set. I had to search
>       the output of "sign place" for the current line with the sign name
>       for this. This is how I did it, if anyone is interested:

You are supposed to keep a list of the placed signs yourself.  This
should not be too difficult, using a buffer-local variable.

>     - There are no commands to clear all the signs in a buffer/file or
>       defined with a particular type. "sing unplace *" removes all signs
>       and it doesn't take a buffer=<nr> option. I will have to get the
>       output of "sign place" and unplace them individually, by searching
>       for the appropriate signs, which is a pain.

If you remember which signs have been placed, you know how to remove
them.  This does require using a loop, but that should not be too
difficult.

>     - In general I was puzzled by the fact that only the sign place
>       command accepts name where as others don't. Is this a design flaw?

The sign placement isn't simple, that is true.  It was designed to be
used by Sun Workshop and Netbeans.  It's a little bit of puzzling, but I
haven't found something useful that is not possible.

--
GUARD #1:  What, ridden on a horse?
ARTHUR:    Yes!
GUARD #1:  You're using coconuts!
ARTHUR:    What?
GUARD #1:  You've got two empty halves of coconut and you're bangin' 'em
            together.
                                   The Quest for the Holy Grail (Monty Python)

  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///

#38586 From: Dan Sharp <dwsharp@...>
Date: Wed Apr 2, 2003 9:58 pm
Subject: Re: positioning in a vim file from another window
dwsharp@...
Send Email Send Email
 
Eric Winger wrote:
> Excellent! The grep thing works neatly.
>
> Now can one do the equivalent of opening a directory in emacs and allow quick
> selections in the quickfix window?

It doesn't use the quickfix window, but just doing
:e .
or
:Explore
will bring up the file explorer.  Look at
:he file-explorer
for help on using it, including keeping it open while opening files into
new windows.

> I tried loading up the minibuffer. But it doesn't seem to work. I tried
> putting the .vim in my vim61/ftplugins directory. It didn't open
> automagically. I then tried :source mini... but that didn't seem to open
> anything either.
>
> But I'm not sure that this will do what I was talking about. Where, in effect,
> I can dump the output from a ls to the quickfix window and then scroll & open
> new buffers from that.
>
> Any ideas?

It looks like you got minibufexplorer, but you want just plain
BufExplorer by Jeff Lanzarotta (or Hari Krishna Dara's SelectBuf
script).  They open a buffer with a list of the currently available
buffers, and clicking on an item in the list will jump you to that buffer.

In fact, to see them all working together, you may want to look at the
WinManager plugin.  It sets up an IDE-like environment with the file
explorer and buffer explorer always open on the left side.  See the
screenshot at
http://robotics.eecs.berkeley.edu/~srinath/vim/snapshot2.JPG for an example.

Dan Sharp

#38587 From: "Antoine J. Mechelynck" <antoine.mechelynck@...>
Date: Wed Apr 2, 2003 10:16 pm
Subject: Re: Bug? Insert mode mapping with <silent>.
antoine.mechelynck@...
Send Email Send Email
 
Yiu Wing <yiuwing.yip@...> wrote:
> Hello All,
>
> According to the doc for "map-<silent>", if a mapping is defined with
> the <silent> option, it won't be echoed on the command line.  This
> works as expected for normal mode mappings, but it doesn't work for
> insert mode mappings.
>
> The following mapping demonstrates this behaviour,
>
> inoremap <silent> a a<ESc>:call tempname()<cr>a
>
> If you type the letter 'a' repeatedly after remapping it, and with the
> showmode option on, you can see the mode message "--insert--" flickers
> sporadically.
>
> Does <silent> not apply to insert map, or it is a bug?
>
> Regards,
>
> Yiu Wing

I don't have much authority on this subject, but since I don't see another
answer down the line, I venture one.

IMHO, if you see "-- INSERT --" flickering but no trace of ":call
tempname()" being shown, then it's neither a bug nor <silent> not applying
to Insert mode, it's just normal behaviour. How do I mean? Well, <silent>
suppresses the map itself being echoed, but the mapping still "does its
stuff". In this case, part of that "stuff" consists of leaving insertmode
temporarily to call the "tempname()" function. Whenever the mapping goes
from Insert mode to Normal mode, "-- INSERT --" disappears. Whenever it goes
back to Insert mode through the normal-mode "a" (append) command at the end,
"-- INSERT --" reappears. I wouldn't call that a bug. But then, other people
might be more enlightened than me on this subject.

I think that, in order to avoid "-- INSERT --" flickering you could replace
the mapping by

             :inoremap    a    a<C-O>:call tempname()<CR>

(see :help i_CTRL-O). But then it might (or might not, I haven't tested it)
be temporarily replaced by "-- (insert) --" during execution of the mapping.

Regards,
Tony.

#38588 From: "John Kilbourne (s)" <jkilbou@...>
Date: Wed Apr 2, 2003 10:48 pm
Subject: makprg question
jkilbou@...
Send Email Send Email
 
I am working with a vim tutorial I found, learning makeprg.

With a little c source file I tried
:set makeprg=gcc \printf.c

and then
:make

I got
:!gcc\printf.c  > C:\TEMP\VIe1B2.tmp
[No write since last change]
shell returned 1

:make error

From the shell I type
make -v

and learn I have make version 3.77, etc.

John

#38589 From: Hari Krishna Dara <hari_vim@...>
Date: Thu Apr 3, 2003 1:59 am
Subject: executing registers using :@ command
hari_vim@...
Send Email Send Email
 
I have couple of questions/comments about executing registers using :@
command.

- According to the doc the :@* is supposed to work, but for me it
   doesn't always work. It looks like the :@ register keeps a copy of
   this register somewhere so it doesn't detect the change done
   externally (I am using version 6.1.422 on w2k). Here is how to reproduce it:

     - Open two vim windows.
     - On first vim, enter the following command:

	 :let @*='echo "hi"'

     - On second vim, try:

	 :@*
	 hi

     - Go back to the first vim, enter the following command:

	 :let @*='echo "hello"'

     - On second vim, try:

	 :@*
	 hi

   As you can see, you still get the old result. If you access the *
   register by some other means, such as ^R* and try @* again, it seems
   to work.

- The doc doesn't say you can't have line-continuation characters in the
   commands that you are executing through :@ command, and in fact vim
   didn't even give errors when recompiling such a function, but when I
   call the function, I get E15: Invalid expression errors. Ability to
   recompile a function using :@ command is very very useful, as you can
   *patch* a running instance of vim incrementally as you fix bugs in
   scripts, avoiding the restart (restart is not always simple).

Thank you,
Hari

#38590 From: Benji Fisher <benji@...>
Date: Thu Apr 3, 2003 2:45 am
Subject: Re: inverse search under windows(once again)
benji@...
Send Email Send Email
 
Baris Erbas wrote:
>
>  Dear Benji,
>  I have copied a tip of yours from vim's site. I have been
>  trying to use inverse search and have written about this a
>  couple of times but couldnt solve my problem.
>  I have gvim6.1 installed on my work machine using Win XP. I
>  want to use gvim to edit latex files and be able to use
>  inverse search via YAP! I installed also the latex-suite
>  plugin which seems to work fine. I start gvim with as gvim
>  --servername GVIM and in YAP's inverse search command line I put
>  C:\Program Files\vim\vim61\gvim.exe --remote +%l %f
>
>  When I double click on a line under YAP I goto the already
>  opened gvim but it tries to open the directory names where my
>  file resides. I am attaching a picture where you can see my
>  buffers menu after I tried inverse search. CAn you possibly
>  tell me what the problem maybe?

       What happens if you try the command

  > C:\Program Files\vim\vim61\gvim.exe --remote +1353 c:\path\to\foo.tex

from a shell?

					 --Benji Fisher

#38591 From: Walter Briscoe <wbriscoe@...>
Date: Thu Apr 3, 2003 8:13 am
Subject: Re: Vim 6.1.405 archives available
wbriscoe@...
Send Email Send Email
 
In message <200304020918.h329I5S00803@...> of Wed, 2 Apr 2003
11:18:05 in , Bram Moolenaar <Bram@...> writes
>
>Walter Briscoe wrote:
>
>> In message <200303312028.h2VKSdg11083@...> of Mon, 31 Mar 2003
>> 22:28:39 in , Bram Moolenaar <Bram@...> writes
>> >
>> >For those who are using the huge pile of patches, there are now archives
>> >available that include all the patches up to and including 6.1.405:
>>
>> That is REALLY good. I intend to download those files at the weekend.
>> Would it be possible to publish the scripts used to generate those
>> archives - so one could take snapshots in a similar way to Bram. I could
>> re-invent the wheel but am not inclined to do so. :-)
>
>The Makefile at the toplevel of the sources generates these archives.
>Check the comments to find out what extra requirements there are.
>
Thanks for that. I found it impossible to make that portable to W2K
cmd.exe and DJG make. The \ / issue is easily (but clutteringly)
resolved with a SEP macro and subshells replaced by scripts. The
stumbling block is that with lines like
         tar c $(RT_ALL) $(RT_ALL_BIN) $(RT_UNIX) $(RT_UNIX_DOS_BIN) | cdx
dist$(SEP)$(VIMRTDIR)
replacing
         tar cf - \
                 $(RT_ALL) \
                 $(RT_ALL_BIN) \
                 $(RT_UNIX) \
                 $(RT_UNIX_DOS_BIN) \
                 | (cd dist/$(VIMRTDIR); tar xf -)

the tar command is longer than the make is ready to handle.
(I found that "f -" was not portable.)

I am walking away from this at the moment; my sub-consciousness will
probably continue to work on it. I may try with bash as the shell.

I shall report anything I find in vim-dev rather than vim. I apologise
to my readers who find none of this relevant.
--
Walter Briscoe

#38592 From: Nagyon Álmos <b17@...>
Date: Thu Apr 3, 2003 8:44 am
Subject: displaying end of line symbol
b17@...
Send Email Send Email
 
Hello Vim-Experts,

I usually edit files with long lines and vim works
perfectly (with :set nowrap :set linebreak :set showbreak=> ),
but I'd like it  the another way, that is,
display where the end of line symbols are ( CR, CR-LF or LF
depending on the value of ff ).
And possibly with the pilcrow symbol
(postscript sign name, 00B6, or, if you speak Tex, \P ).

As I dont know which keywords to search in the faq, doc, maillists,
I'm left to ask you.
(So I apologize if it has been asked, or it is trivial.)
So how can I achieve this?

Thanks for any help,
Á.

#38593 From: Bram Moolenaar <Bram@...>
Date: Thu Apr 3, 2003 9:19 am
Subject: Re: Vim 6.1.405 archives available
Bram@...
Send Email Send Email
 
Walter Briscoe wrote:

> >The Makefile at the toplevel of the sources generates these archives.
> >Check the comments to find out what extra requirements there are.
> >
> Thanks for that. I found it impossible to make that portable to W2K
> cmd.exe and DJG make. The \ / issue is easily (but clutteringly)
> resolved with a SEP macro and subshells replaced by scripts. The
> stumbling block is that with lines like
>         tar c $(RT_ALL) $(RT_ALL_BIN) $(RT_UNIX) $(RT_UNIX_DOS_BIN) | cdx
dist$(SEP)$(VIMRTDIR)
> replacing
>         tar cf - \
>                 $(RT_ALL) \
>                 $(RT_ALL_BIN) \
>                 $(RT_UNIX) \
>                 $(RT_UNIX_DOS_BIN) \
>                 | (cd dist/$(VIMRTDIR); tar xf -)
>
> the tar command is longer than the make is ready to handle.
> (I found that "f -" was not portable.)

Yes, this only works on Unix.  Just install some kind of Unix on a free
partition.  Or run knoppix directly from CD.  That's easier than trying
to make this Makefile portable!

I'll make an A-A-P recipe for this some day, that will work whereever
Python is available.

--
MORTICIAN:    What?
CUSTOMER:     Nothing -- here's your nine pence.
DEAD PERSON:  I'm not dead!
MORTICIAN:    Here -- he says he's not dead!
CUSTOMER:     Yes, he is.
DEAD PERSON:  I'm not!
                                   The Quest for the Holy Grail (Monty Python)

  /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///

#38594 From: Michael Naumann <michael@...>
Date: Thu Apr 3, 2003 9:30 am
Subject: Re: displaying end of line symbol
michael@...
Send Email Send Email
 
On Thursday 03 April 2003 10:44, Nagyon Álmos wrote:
>   Hello Vim-Experts,
>
> I usually edit files with long lines and vim works
> perfectly (with :set nowrap :set linebreak :set showbreak=> ),
> but I'd like it  the another way, that is,
> display where the end of line symbols are ( CR, CR-LF or LF
> depending on the value of ff ).
> And possibly with the pilcrow symbol
> (postscript sign name, 00B6, or, if you speak Tex, \P ).
>
> As I dont know which keywords to search in the faq, doc, maillists,
> I'm left to ask you.

:he digraphs
:he lcs

> (So I apologize if it has been asked, or it is trivial.)

No, this is not trivial at all

> So how can I achieve this?

:set lcs=eol:<C-V>xb6
:set list

>
> Thanks for any help,
> Á.

you're welcome, Michael

#38595 From: paulo.saldanha@...
Date: Thu Apr 3, 2003 10:57 am
Subject: Help on regexp
paulo.saldanha@...
Send Email Send Email
 
In normal mode there's this move I can do to process everything till the 3
occurrence of, say, the character "H" : it's 3fH .

Now I want to do the same in a regular expression. Is there a simple way to
do it? I mean, I've been able to do it, but always in a way I feel too
messy.

Any ideas?

Paulo

#38596 From: Jürgen Krämer <jkraemer@...>
Date: Thu Apr 3, 2003 11:32 am
Subject: Re: Help on regexp
jkraemer@...
Send Email Send Email
 
Hi,

paulo.saldanha@... wrote:
> In normal mode there's this move I can do to process everything till the 3
> occurrence of, say, the character "H" : it's 3fH .
>
> Now I want to do the same in a regular expression. Is there a simple way to
> do it? I mean, I've been able to do it, but always in a way I feel too
> messy.

\%(.\{-\}i\)\{3\}

the first part "\%(.\{-\}H\)" matches anything until the next "H", the
second part "\{3\}" repeats this three times. The "\%(...\)" construct
is used so that the matched string is not counted as a sub-expression.

Regards,
Jürgen

--
Jürgen Krämer                                   Softwareentwicklung
Habel GmbH                                      mailto:jkraemer@...
Hinteres Öschle 2                               Tel: (0 74 61) 93 53 15
78604 Rietheim-Weilheim                         Fax: (0 74 61) 93 53 99

#38597 From: paulo.saldanha@...
Date: Thu Apr 3, 2003 1:41 pm
Subject: Re: Help on regexp
paulo.saldanha@...
Send Email Send Email
 
Thanks, Jürgen, no doubt your solution is better than mine's!

But, see, when you compare the regexp to the move in normal mode, it's 17
against 3 keystrokes! (OK, your expression could be shortened to 14
strokes).

Wouldn't it be nice if I could specify an atom in a regexp by means of a
move in the normal mode way?

Is there a way for doing this?






                       Jürgen Krämer
                       <jkraemer@...        Para:     vim mailing list
<vim@...>
                       e>                       cc:
                                                cco:
                       03/04/03 08:32           Assunto:  Re: Help on regexp







Hi,

paulo.saldanha@... wrote:
> In normal mode there's this move I can do to process everything till the
3
> occurrence of, say, the character "H" : it's 3fH .
>
> Now I want to do the same in a regular expression. Is there a simple way
to
> do it? I mean, I've been able to do it, but always in a way I feel too
> messy.

\%(.\{-\}i\)\{3\}

the first part "\%(.\{-\}H\)" matches anything until the next "H", the
second part "\{3\}" repeats this three times. The "\%(...\)" construct
is used so that the matched string is not counted as a sub-expression.

Regards,
Jürgen

--
Jürgen Krämer                                   Softwareentwicklung
Habel GmbH                                      mailto:jkraemer@...
Hinteres Öschle 2                               Tel: (0 74 61) 93 53 15
78604 Rietheim-Weilheim                         Fax: (0 74 61) 93 53 99

#38598 From: Pavel Tavoda <Pavel.Tavoda@...>
Date: Thu Apr 3, 2003 2:30 pm
Subject: Re: Help on regexp
Pavel.Tavoda@...
Send Email Send Email
 
For this things I'm using macro 'q'. For example:
--------------------------------
qq - Star recording to register q
/something<CR> - find something
0 - goto first column
c3fHnewtext<ESC> - change text to 3rd H to 'newtext'
q - end of macro
@q - repeate commands once more
1000@q - 1000 times or till error (e.g. end of file)
--------------------------------

OR

:g/Hello/normal 0c3fHsometext

Find 'Hello' and execute commands behind 'normal' as normal commands

Hope this help

Pavel

paulo.saldanha@... wrote:

>In normal mode there's this move I can do to process everything till the 3
>occurrence of, say, the character "H" : it's 3fH .
>
>Now I want to do the same in a regular expression. Is there a simple way to
>do it? I mean, I've been able to do it, but always in a way I feel too
>messy.
>
>Any ideas?
>
>Paulo
>
>
>

#38599 From: Johan Svedberg <winkle@...>
Date: Thu Apr 3, 2003 2:40 pm
Subject: Re: automatically comment/uncomment line and region
winkle@...
Send Email Send Email
 
* Apr 02 16:37 Martin Norbäck <d95mback@...>:

[...]

> au FileType vim     let b:comment_leader = '\" '

Shouldn't it be:

     au FileType vim     let b:comment_leader = '\" '

Escape:ing doesn't seem necessary?

[...]

--
Johan Svedberg, winkle@..., http://www.acc.umu.se/~winkle

#38600 From: "Charles E. Campbell" <cec@...>
Date: Thu Apr 3, 2003 4:10 pm
Subject: Re: reading remote files
cec@...
Send Email Send Email
 
On Mon, Mar 31, 2003 at 10:01:16AM -0500, Neil Watson wrote:
> I'm learning how to access remote files in vim (linux).
> I think I have to do this but, I've not been sucessful:
>
> Load net transfer vim plugin
> :runtime /usr/local/share/vim61/plugin/netrw.vim

You shouldn't need to use runtime at all, because netrw should be
automatically loaded.  Even if you did, the command above would not
work, because it tries prepending the given path with each directory
mentioned on the comma-separated runtimepath list, so you'd be getting
(failed) attempts to read from

/usr/local/share/vim/vimfiles/usr/local/share/vim61/plugin/netrw.vim

Also, runtime appears to fail without complaint, so you may not be
aware of its failure to do anything when you issued the command you gave
above.

> Read in file via scp
> :r scp://hostname/path/to/file
>
> I have ssh working between the to computers.  What have I missed?

Do you have

     set nocp
     if version >= 600
       filetype plugin indent on
     endif

in your <.vimrc>?

Even though your runtime... command undoubtedly failed, normally vim
would have picked up the the netrw plugin from the standard
distribution if filetype plugin was on.

By the way, the latest <netrw.vim> (v28) is available for download&test
from

     http://www.erols.com/astronaut/vim/index.html#vimlinks_scripts
     as "Network Oriented Reading and Writing"

Regards,
Chip Campbell

--
         Charles E Campbell, Jr, PhD            _   __   __
         Goddard Space Flight Center           / /_/\_\_/ /
         cec@...      /_/  \/_//_/
   PGP public key: http://www.erols.com/astronaut/pgp.html

#38601 From: Piet Delport <pjd@...>
Date: Thu Apr 3, 2003 4:37 pm
Subject: Re: 'autoindent', 'paste' and pasting indented text in Insert mode?
pjd@...
Send Email Send Email
 
On Wed, 02 Apr 2003 at 21:10:55 +0400, Valery Kondakoff wrote:
>
[...]
>
> After reading 'paste' description, I was thinking, that it
> is not necessary to set 'paste' or 'pastetoggle', when using GUI...
>
> Here are the lines in question (from VIM help):
>
> -----
> Setting this option is useful when using Vim in a terminal, where Vim
> cannot distinguish between typed text and pasted text.  In the GUI,
> Vim knows about pasting and will mostly do the right thing without 'paste'
> being set.
> -----
>
> Am I wrong? Do I still need to set 'paste/pastetoggle' even in GUI?

No, you shouldn't need to.  How exactly are you doing your pasting?

--
Piet Delport
Today's subliminal thought is:

#38602 From: Piet Delport <pjd@...>
Date: Thu Apr 3, 2003 4:40 pm
Subject: Re: Bug? Insert mode mapping with <silent>.
pjd@...
Send Email Send Email
 
On Thu, 03 Apr 2003 at 00:16:29 +0200, Antoine J. Mechelynck wrote:
> Yiu Wing <yiuwing.yip@...> wrote:
>>
>> According to the doc for "map-<silent>", if a mapping is defined with
>> the <silent> option, it won't be echoed on the command line.  This
>> works as expected for normal mode mappings, but it doesn't work for
>> insert mode mappings.
>>
>> The following mapping demonstrates this behaviour,
>>
>> inoremap <silent> a a<ESc>:call tempname()<cr>a
>>
>> If you type the letter 'a' repeatedly after remapping it, and with the
>> showmode option on, you can see the mode message "--insert--" flickers
>> sporadically.
>>
>> Does <silent> not apply to insert map, or it is a bug?
>
> I don't have much authority on this subject, but since I don't see another
> answer down the line, I venture one.
>
> IMHO, if you see "-- INSERT --" flickering but no trace of ":call
> tempname()" being shown, then it's neither a bug nor <silent> not applying
> to Insert mode, it's just normal behaviour. How do I mean? Well, <silent>
> suppresses the map itself being echoed, but the mapping still "does its
> stuff". In this case, part of that "stuff" consists of leaving insertmode
> temporarily to call the "tempname()" function. Whenever the mapping goes
> from Insert mode to Normal mode, "-- INSERT --" disappears. Whenever it goes
> back to Insert mode through the normal-mode "a" (append) command at the end,
> "-- INSERT --" reappears. I wouldn't call that a bug. But then, other people
> might be more enlightened than me on this subject.
>
> I think that, in order to avoid "-- INSERT --" flickering you could replace
> the mapping by
>
>             :inoremap    a    a<C-O>:call tempname()<CR>
>
> (see :help i_CTRL-O). But then it might (or might not, I haven't tested it)
> be temporarily replaced by "-- (insert) --" during execution of the mapping.

You might also want to look at the 'lazyredraw' option.

--
Piet Delport
Today's subliminal thought is:

#38603 From: MUlrich@...
Date: Thu Apr 3, 2003 4:47 pm
Subject: errorformat for aCC: HP ANSI C++ B3910B A.03.13
MUlrich@...
Send Email Send Email
 
Hi,

is there anybody who uses aCC as a compiler and has written a compiler
plugin for Vim quickfix?
(aCC is the compiler for HP-UX, in my case hpux 10.20 and hp-ux 11.x)

If not, I will have to figure out the errorformat myself, altough the :he
says its easy, I find it confising so far...



Mit freundlichen Grüssen / Best Regards

Matthias Ulrich
UG Product Development

BCT Technology AG
Im Lossenfeld 9
D-77731 Willstätt, Germany

+49 (0) 7852 996 248 phone
+49 (0) 7852 996 100 fax
mailto:mulrich@...

http://www.bct-technology.com
http://www.bct-portal.com

BCT - Differenzierung durch Standards
BCT - Differentiation Through Standards

#38604 From: Piet Delport <pjd@...>
Date: Thu Apr 3, 2003 4:54 pm
Subject: Re: displaying end of line symbol
pjd@...
Send Email Send Email
 
On Thu, 03 Apr 2003 at 11:30:14 +0200, Michael Naumann wrote:
> On Thursday 03 April 2003 10:44, Nagyon Álmos wrote:
>>
[...]
>>
>> And possibly with the pilcrow symbol
>> (postscript sign name, 00B6, or, if you speak Tex, \P ).
>>
[...]
>>
>> So how can I achieve this?
>
> :set lcs=eol:<C-V>xb6
                ^^^^^^^^
Instead of this, you can also use the PI digraph[1].  Along with being
more memorable, it'll work regardless of whether the current encoding
actually maps 0xB6 to "¶".


[1] by typing <C-K>PI

--
Piet Delport
Today's subliminal thought is:

#38605 From: "Yiu Wing" <yiuwing.yip@...>
Date: Thu Apr 3, 2003 5:40 pm
Subject: Re: Bug? Insert mode mapping with <silent>.
yiuwing.yip@...
Send Email Send Email
 
> Yiu Wing <yiuwing.yip@...> wrote:
> > Hello All,
> >
> > According to the doc for "map-<silent>", if a mapping is defined with
> > the <silent> option, it won't be echoed on the command line.  This
> > works as expected for normal mode mappings, but it doesn't work for
> > insert mode mappings.
> >
> > The following mapping demonstrates this behaviour,
> >
> > inoremap <silent> a a<ESc>:call tempname()<cr>a
> >
> > If you type the letter 'a' repeatedly after remapping it, and with the
> > showmode option on, you can see the mode message "--insert--" flickers
> > sporadically.
> >
> > Does <silent> not apply to insert map, or it is a bug?
> >
> > Regards,
> >
> > Yiu Wing
>
> I don't have much authority on this subject, but since I don't see another
> answer down the line, I venture one.

Your reply is appreciated!

> IMHO, if you see "-- INSERT --" flickering but no trace of ":call
> tempname()" being shown, then it's neither a bug nor <silent> not applying
> to Insert mode, it's just normal behaviour. How do I mean? Well, <silent>
> suppresses the map itself being echoed, but the mapping still "does its
> stuff". In this case, part of that "stuff" consists of leaving insertmode
> temporarily to call the "tempname()" function. Whenever the mapping goes

I thought suppressing the echo line is partly what <silent> is for.  If you
use the examples that come with the doc, which also have something to do on
the command line and they don't mess up the mode line or status line for
that matter, but those mappings are for normal mode.

> from Insert mode to Normal mode, "-- INSERT --" disappears. Whenever it
goes
> back to Insert mode through the normal-mode "a" (append) command at the
end,
> "-- INSERT --" reappears. I wouldn't call that a bug. But then, other
people
> might be more enlightened than me on this subject.
>
> I think that, in order to avoid "-- INSERT --" flickering you could
replace
> the mapping by
>
>             :inoremap    a    a<C-O>:call tempname()<CR>
>
> (see :help i_CTRL-O). But then it might (or might not, I haven't tested
it)
> be temporarily replaced by "-- (insert) --" during execution of the
mapping.

Unfortunately, I just tried the above suggestion, the flickers are still
there if you press the key repeatedly.

Thanks for your reply, again.

Yiu Wing

> Regards,
> Tony.
>
>

Messages 38576 - 38605 of 137808   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help