Loading ...
Sorry, an error occurred while loading the content.

Vim7: Listing the script where a map was defined

Expand Messages
  • Yegappan Lakshmanan
    Hi all, Check out the latest Vim 7 enhancement to display the script ... This command is similar to the :verbose set and the :verbose highlight
    Message 1 of 23 , Aug 15, 2005
    • 0 Attachment
      Hi all,

      Check out the latest Vim 7 enhancement to display the script
      where a key map was defined:

      :verbose map
      :verbose map <key>

      This command is similar to the ":verbose set <option>" and the
      ":verbose highlight <group>" commands. For more information,
      read the following topics:

      :help :map-verbose
      :help :highlight-verbose
      :help :set-verbose

      - Yegappan
    • Mikolaj Machowski
      ... Yesss! Thanks Bram :) Also thanks to Yegappan for notification. m.
      Message 2 of 23 , Aug 16, 2005
      • 0 Attachment
        Dnia wtorek 16 sierpień 2005 04:19, Yegappan Lakshmanan napisał:
        > Hi all,
        >
        > Check out the latest Vim 7 enhancement to display the script
        >
        > where a key map was defined:
        > :verbose map
        > :verbose map <key>

        Yesss! Thanks Bram :)

        Also thanks to Yegappan for notification.

        m.
      • Bram Moolenaar
        ... Actually, it s Yegappan who made this patch. I merely included it. -- hundred-and-one symptoms of being an internet addict: 58. You turn on your computer
        Message 3 of 23 , Aug 16, 2005
        • 0 Attachment
          Mikolaj Machowski wrote:

          > Dnia wtorek 16 sierpieñ 2005 04:19, Yegappan Lakshmanan napisa³:
          > > Hi all,
          > >
          > > Check out the latest Vim 7 enhancement to display the script
          > >
          > > where a key map was defined:
          > > :verbose map
          > > :verbose map <key>
          >
          > Yesss! Thanks Bram :)
          >
          > Also thanks to Yegappan for notification.

          Actually, it's Yegappan who made this patch. I merely included it.

          --
          hundred-and-one symptoms of being an internet addict:
          58. You turn on your computer and turn off your wife.

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
          \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
        • Keith W. Roberts
          ... Thank you, thank you, THANK YOU!! I ve wanted this for ages! -Keith
          Message 4 of 23 , Aug 16, 2005
          • 0 Attachment
            > -----Original Message-----
            > From: Yegappan Lakshmanan [mailto:yegappanl@...]
            > Sent: Monday, August 15, 2005 7:19 PM
            > To: Vim Developers
            > Subject: Vim7: Listing the script where a map was defined
            >
            > Hi all,
            >
            > Check out the latest Vim 7 enhancement to display the script
            > where a key map was defined:
            >
            > :verbose map
            > :verbose map <key>
            >
            > This command is similar to the ":verbose set <option>" and the
            > ":verbose highlight <group>" commands. For more information,
            > read the following topics:
            >
            > :help :map-verbose
            > :help :highlight-verbose
            > :help :set-verbose
            >
            > - Yegappan
            >

            Thank you, thank you, THANK YOU!! I've wanted this for ages!

            -Keith
          • drchip@campbellfamily.biz
            ... Boy, my scripts have been eating dust recently. This one applies to WhereFrom.vim and engspchk has been hit by internal spellchecking. Will Align get
            Message 5 of 23 , Aug 16, 2005
            • 0 Attachment
              Quoting "Keith W. Roberts" <keithr@...>:

              > > -----Original Message-----
              > > From: Yegappan Lakshmanan [mailto:yegappanl@...]
              > > Subject: Vim7: Listing the script where a map was defined
              > > Check out the latest Vim 7 enhancement to display the script
              > > where a key map was defined:
              > >
              > > :verbose map
              > > :verbose map <key>
              > >
              > > This command is similar to the ":verbose set <option>" and the
              > > ":verbose highlight <group>" commands. For more information,
              > > read the following topics:
              > >
              > > :help :map-verbose
              > > :help :highlight-verbose
              > > :help :set-verbose

              >
              > Thank you, thank you, THANK YOU!! I've wanted this for ages!

              Boy, my scripts have been eating dust recently. This one applies to
              WhereFrom.vim and engspchk has been hit by internal spellchecking.
              Will Align get built-in, too? Maybe we can pick on winmanager or something...
              :)

              Just wondering!
              Chip Campbell
            • Bram Moolenaar
              ... The intention is to make all Vim scripts obsolete. Especially yours! Just kidding, of course. It just happens that you have written very useful scripts
              Message 6 of 23 , Aug 16, 2005
              • 0 Attachment
                Charles Campbell wrote:

                > Boy, my scripts have been eating dust recently. This one applies to
                > WhereFrom.vim and engspchk has been hit by internal spellchecking.
                > Will Align get built-in, too? Maybe we can pick on winmanager or
                > something... :)

                The intention is to make all Vim scripts obsolete. Especially yours!



                Just kidding, of course. It just happens that you have written very
                useful scripts for functionality that works better when it's a part of
                base Vim. In the case of WhereFrom Vim can tell exactly where something
                was defined, without searching scripts.

                I notice that WhereFrom.vim also mentions the script for ":function" and
                ":command". It's very simple to do that with ":verbose" too, since the
                script ID is already remembered. Yegappan, are you listening?

                --
                hundred-and-one symptoms of being an internet addict:
                64. The remote to the T.V. is missing...and you don't even care.

                /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
                /// Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
                \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
                \\\ Buy LOTR 3 and help AIDS victims -- http://ICCF.nl/lotr.html ///
              • Mikolaj Machowski
                ... Oops :( Sorry Yegappan. Of course BIG THANKS :) m.
                Message 7 of 23 , Aug 16, 2005
                • 0 Attachment
                  Dnia wtorek 16 sierpień 2005 13:25, Bram Moolenaar napisał:
                  >
                  > Actually, it's Yegappan who made this patch. I merely included it.

                  Oops :( Sorry Yegappan.

                  Of course BIG THANKS :)

                  m.
                • Yegappan Lakshmanan
                  Hi Bram, ... One more patch coming up. :-)) - Yegappan
                  Message 8 of 23 , Aug 16, 2005
                  • 0 Attachment
                    Hi Bram,

                    On 8/16/05, Bram Moolenaar <Bram@...> wrote:
                    >
                    > Charles Campbell wrote:
                    >
                    > > Boy, my scripts have been eating dust recently. This one applies to
                    > > WhereFrom.vim and engspchk has been hit by internal spellchecking.
                    > > Will Align get built-in, too? Maybe we can pick on winmanager or
                    > > something... :)
                    >
                    > The intention is to make all Vim scripts obsolete. Especially yours!
                    >
                    > Just kidding, of course. It just happens that you have written very
                    > useful scripts for functionality that works better when it's a part of
                    > base Vim. In the case of WhereFrom Vim can tell exactly where something
                    > was defined, without searching scripts.
                    >
                    > I notice that WhereFrom.vim also mentions the script for ":function" and
                    > ":command". It's very simple to do that with ":verbose" too, since the
                    > script ID is already remembered. Yegappan, are you listening?
                    >

                    One more patch coming up. :-))

                    - Yegappan
                  • Yegappan Lakshmanan
                    Hi all, ... With the latest Vim7 snapshot, you can now use the :verbose command to list the location where a map or a function or a user-defined command or
                    Message 9 of 23 , Aug 30, 2005
                    • 0 Attachment
                      Hi all,

                      On 8/16/05, Bram Moolenaar <Bram@...> wrote:
                      >
                      > I notice that WhereFrom.vim also mentions the script for ":function" and
                      > ":command". It's very simple to do that with ":verbose" too, since the
                      > script ID is already remembered.
                      >

                      With the latest Vim7 snapshot, you can now use the ":verbose" command
                      to list the location where a map or a function or a user-defined command
                      or an autocommand or a Vim option or a highlight group was last defined.

                      The syntax is:

                      :verbose map <key>
                      :verbose function <name>
                      :verbose command <name>
                      :verbose autocmd <event>
                      :verbose set <option>?
                      :verbose highlight <name>

                      - Yegappan
                    • Zdenek Sekera
                      What is the latest ? I installed the release yesterday (Aug/29) but both :verbose map ... and map ... behave like map ... .
                      Message 10 of 23 , Aug 30, 2005
                      • 0 Attachment
                        What is "the latest" ?
                        I installed the release yesterday (Aug/29)
                        but both ":verbose map ..." and "map ..."
                        behave like "map ...".

                        ---Zdenek


                        > -----Original Message-----
                        > From: Yegappan Lakshmanan [mailto:yegappanl@...]
                        > Sent: 30 August 2005 15:09
                        > To: Vim Developers
                        > Subject: Re: Vim7: Listing the script where a map was defined
                        >
                        > Hi all,
                        >
                        > On 8/16/05, Bram Moolenaar <Bram@...> wrote:
                        > >
                        > > I notice that WhereFrom.vim also mentions the script for
                        > ":function" and
                        > > ":command". It's very simple to do that with ":verbose"
                        > too, since the
                        > > script ID is already remembered.
                        > >
                        >
                        > With the latest Vim7 snapshot, you can now use the ":verbose" command
                        > to list the location where a map or a function or a
                        > user-defined command
                        > or an autocommand or a Vim option or a highlight group was
                        > last defined.
                        >
                        > The syntax is:
                        >
                        > :verbose map <key>
                        > :verbose function <name>
                        > :verbose command <name>
                        > :verbose autocmd <event>
                        > :verbose set <option>?
                        > :verbose highlight <name>
                        >
                        > - Yegappan
                        >
                      • Yegappan Lakshmanan
                        Hi, ... You can use the Vim7 snapshot 138. Only the support for displaying the autocommand is new in the latest snapshot. The support for map, function and
                        Message 11 of 23 , Aug 30, 2005
                        • 0 Attachment
                          Hi,

                          On 8/30/05, Zdenek Sekera <Zdenek.Sekera@...> wrote:
                          > >
                          > > With the latest Vim7 snapshot, you can now use the ":verbose" command
                          > > to list the location where a map or a function or a
                          > > user-defined command
                          > > or an autocommand or a Vim option or a highlight group was
                          > > last defined.
                          > >
                          > > The syntax is:
                          > >
                          > > :verbose map <key>
                          > > :verbose function <name>
                          > > :verbose command <name>
                          > > :verbose autocmd <event>
                          > > :verbose set <option>?
                          > > :verbose highlight <name>
                          > >
                          >
                          > What is "the latest" ?
                          > I installed the release yesterday (Aug/29)
                          >

                          You can use the Vim7 snapshot 138. Only the support for displaying
                          the autocommand is new in the latest snapshot. The support for
                          map, function and command was available in the last several
                          snapshots. The support for the highlight group was available for the
                          past several months.

                          >
                          > but both ":verbose map ..." and "map ..."
                          > behave like "map ...".
                          >

                          The script name will be displayed only if Vim is compiled with "+eval".

                          Can you try the following commands (without any additional arguments) and
                          see whether the script names are displayed?

                          :verbose map
                          :verbose function
                          :verbose command
                          :verbose autocmd

                          - Yegappan
                        • Tony Mechelynck
                          ... From: Zdenek Sekera To: Yegappan Lakshmanan ; Vim Developers Sent: Tuesday, August 30,
                          Message 12 of 23 , Aug 30, 2005
                          • 0 Attachment
                            ----- Original Message -----
                            From: "Zdenek Sekera" <Zdenek.Sekera@...>
                            To: "Yegappan Lakshmanan" <yegappanl@...>; "Vim Developers"
                            <vim-dev@...>
                            Sent: Tuesday, August 30, 2005 4:04 PM
                            Subject: RE: Vim7: Listing the script where a map was defined


                            > What is "the latest" ?
                            > I installed the release yesterday (Aug/29)
                            > but both ":verbose map ..." and "map ..."
                            > behave like "map ...".
                            >
                            > ---Zdenek

                            Are you sure? (Try ":version") It works only in version 7 (not 6.3) and
                            there is no v7 "release", only "source snapshots" which someone must then
                            compile (I do it for Windows; for other systems you're on your own). Also,
                            it only says anything when *displaying* highlights, maps, options, etc., not
                            when *setting* or *clearing* them.

                            I tried it the day Bram (not Yegappan) mentioned it and again a few minutes
                            ago. Result: WORKSFORME.


                            Best regards,
                            Tony.
                          • Yegappan Lakshmanan
                            ... This will also work for abbreviations. So you can use the following command ... - Yegappan
                            Message 13 of 23 , Aug 30, 2005
                            • 0 Attachment
                              On 8/30/05, Yegappan Lakshmanan <yegappanl@...> wrote:
                              > Hi all,
                              >
                              > With the latest Vim7 snapshot, you can now use the ":verbose" command
                              > to list the location where a map or a function or a user-defined command
                              > or an autocommand or a Vim option or a highlight group was last defined.
                              >
                              > The syntax is:
                              >
                              > :verbose map <key>
                              > :verbose function <name>
                              > :verbose command <name>
                              > :verbose autocmd <event>
                              > :verbose set <option>?
                              > :verbose highlight <name>
                              >

                              This will also work for abbreviations. So you can use the following command
                              to display the location where an abbreviation was defined:

                              :verbose abbreviate

                              - Yegappan
                            • Zdenek SEKERA
                              Hi, ... I don t know how to find out what snapshot (not release, sorry, Tony!) I have, I downloaded whatever CVS gave me two days ago (from today) and
                              Message 14 of 23 , Aug 31, 2005
                              • 0 Attachment
                                Hi,

                                >
                                > You can use the Vim7 snapshot 138. Only the support for displaying
                                > the autocommand is new in the latest snapshot. The support for
                                > map, function and command was available in the last several
                                > snapshots. The support for the highlight group was available for the
                                > past several months.
                                >

                                I don't know how to find out what snapshot (not release, sorry, Tony!)
                                I have, I downloaded whatever CVS gave me two days ago (from today)
                                and completely recompiled it (yes, vim7, Tony, of course).

                                Anyway, I downloaded all again, and now it works. Have no idea
                                what was the problem yesterday.

                                >
                                >>but both ":verbose map ..." and "map ..."
                                >>behave like "map ...".
                                >>
                                >
                                >
                                > The script name will be displayed only if Vim is compiled with "+eval".
                                >
                                > Can you try the following commands (without any additional arguments) and
                                > see whether the script names are displayed?
                                >
                                > :verbose map
                                > :verbose function
                                > :verbose command
                                > :verbose autocmd

                                Yes, I am now getting that but have a few comments:

                                1. when I do e.g. ':verbose function', I get a very long listing of
                                quite long lines that wrap around. e.g.: (just a short example):

                                ...
                                function Uname()
                                Last set from /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                ...

                                There are also *much* longer lines.
                                Would it be a bad idea to replace the $HOME part of the path by
                                the customary '~', that would considerably shorten the output.

                                2. I see a difference:
                                :verbose function Uname
                                ----
                                function Uname()name
                                Last set from /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                1 return substitute(system("uname"), " *\n", "", "")
                                endfunction
                                ----

                                Notice different indenting (cosmetics) but more importantly the
                                the funny '...()name' part and the contents of the function itself.
                                Clearly, it outputs the function itself as well. Maybe that's
                                what's wanted but I don't like it. Firstly, I can get that output
                                via ':function Uname' which seems more appropriate to me (and
                                it will not have the 'Last set...' line interspersed inside the
                                function code, and, more importantly, when I do ':verbose function
                                Uname' I suppose I know I want to get that 'Last set ...' info only,
                                not the list of the function itself.

                                Do you think it would be appropriate to make the necessary
                                modifications?

                                For completeness, the whole function is:

                                ----
                                function! Uname()
                                return substitute(system("uname"), " *\n", "", "")
                                endfunction
                                ----

                                By the way: why am I not getting the '!' listed as well from
                                neither ':function Uname' nor ':verbose function Uname' ??

                                Cheers,

                                ---Zdenek
                              • Tony Mechelynck
                                ... From: Zdenek SEKERA To: Yegappan Lakshmanan Cc: Vim Developers Sent: Wednesday,
                                Message 15 of 23 , Aug 31, 2005
                                • 0 Attachment
                                  ----- Original Message -----
                                  From: "Zdenek SEKERA" <Zdenek.Sekera@...>
                                  To: "Yegappan Lakshmanan" <yegappanl@...>
                                  Cc: "Vim Developers" <vim-dev@...>
                                  Sent: Wednesday, August 31, 2005 10:22 AM
                                  Subject: Re: Vim7: Listing the script where a map was defined


                                  > Hi,
                                  >
                                  >>
                                  >> You can use the Vim7 snapshot 138. Only the support for displaying
                                  >> the autocommand is new in the latest snapshot. The support for
                                  >> map, function and command was available in the last several
                                  >> snapshots. The support for the highlight group was available for the
                                  >> past several months.
                                  >>
                                  >
                                  > I don't know how to find out what snapshot (not release, sorry, Tony!)
                                  > I have, I downloaded whatever CVS gave me two days ago (from today)
                                  > and completely recompiled it (yes, vim7, Tony, of course).
                                  >
                                  > Anyway, I downloaded all again, and now it works. Have no idea
                                  > what was the problem yesterday.

                                  If you downloaded the source from
                                  http://ftp.vim.org/pub/vim/unstable/snapshot/ (it works also with
                                  s/^http/ftp/) or the W32 executable distribution from my site
                                  http://users.skynet.be/antoine.mechelynck/vim/#vim7 then the snapshot number
                                  is part of the zip filename.

                                  Otherwise, there is no easy way to determine the snapshot number but there
                                  is a "version date" immediately before the "compile date" near the top of
                                  the ":version" listing. For example, my latest gvim 7 (which is snapshot
                                  139) has a ":version" listing starting with

                                  VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 30, compiled Aug 31 2005 01:06:49)
                                  MS-Windows 32 bit GUI version with OLE support
                                  Compiled by antoine.mechelynck@...
                                  Big version with GUI. Features included (+) or not (-):

                                  "2005 Aug 30" is the "version date" (the date the sources were finalized for
                                  this particular snapshot), "Aug 31 2005 01:06:49" is the "compile date",
                                  using the time zone of the compiling machine (mine currently uses UTC + 2
                                  hours, European summer time). -- The fact that the dates are shown using
                                  different formats is probably due to the fact that Bram's computer and mine
                                  use different values of $LC_TIME

                                  [...]
                                  > By the way: why am I not getting the '!' listed as well from
                                  > neither ':function Uname' nor ':verbose function Uname' ??
                                  >
                                  > Cheers,
                                  >
                                  > ---Zdenek

                                  The ! in "function! Uname()" isn't stored, it just avoids an error if you
                                  "redefine" an existing function (without ! it's an error, with ! you replace
                                  it by a new definition).


                                  Best regards,
                                  Tony.
                                • Zdenek SEKERA
                                  Tony Mechelynck wrote: ... I am getting vim7 sources as follows: cvs -z3 -d:pserver:anonymous@cvs.sf.net:/cvsroot/vim checkout vim which probably means that
                                  Message 16 of 23 , Aug 31, 2005
                                  • 0 Attachment
                                    Tony Mechelynck wrote:
                                    ...
                                    >> I don't know how to find out what snapshot (not release, sorry, Tony!)
                                    >> I have, I downloaded whatever CVS gave me two days ago (from today)
                                    >> and completely recompiled it (yes, vim7, Tony, of course).
                                    >>
                                    >> Anyway, I downloaded all again, and now it works. Have no idea
                                    >> what was the problem yesterday.
                                    >
                                    >
                                    > If you downloaded the source from
                                    > http://ftp.vim.org/pub/vim/unstable/snapshot/ (it works also with
                                    > s/^http/ftp/)

                                    I am getting vim7 sources as follows:

                                    cvs -z3 -d:pserver:anonymous@...:/cvsroot/vim checkout vim

                                    which probably means that cvs is not neccessarily synchronized
                                    with 'snapshot'. No big deal, I will change my habits and go for
                                    your suggestion. But that *may* explain my original problem.


                                    > or the W32 executable distribution from my site
                                    > http://users.skynet.be/antoine.mechelynck/vim/#vim7 then the snapshot
                                    > number is part of the zip filename.

                                    I'm on Linux but I know your distribution.

                                    >
                                    > Otherwise, there is no easy way to determine the snapshot number

                                    Too bad but good to know.

                                    > but
                                    > there is a "version date" immediately before the "compile date" near the
                                    > top of the ":version" listing. For example, my latest gvim 7 (which is
                                    > snapshot 139) has a ":version" listing starting with
                                    >
                                    > VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 30, compiled Aug 31 2005 01:06:49)
                                    > MS-Windows 32 bit GUI version with OLE support

                                    ...
                                    So to see what I got using your recepy I went back to my previous
                                    distribution (where ':verbose map' didn't work) and it says

                                    VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 26, compiled Aug 29 2005 13:25:03)
                                    Compiled by Zdenek.Sekera@..._for_Linux3.0.5

                                    Hmmm, but there is no snapshot of '2005 Aug 26' in the snapshot
                                    directory as far as I can see, but it's close :-).

                                    Anyway, no big deal, but for sure it would be nice to have a snapshot
                                    number in the :version, it would simplify communication.

                                    >
                                    > [...]
                                    >
                                    >> By the way: why am I not getting the '!' listed as well from
                                    >> neither ':function Uname' nor ':verbose function Uname' ??
                                    >>
                                    >> Cheers,
                                    >>
                                    >> ---Zdenek
                                    >
                                    >
                                    > The ! in "function! Uname()" isn't stored, it just avoids an error if
                                    > you "redefine" an existing function (without ! it's an error, with ! you
                                    > replace it by a new definition).

                                    Yes, I know it's meaning, that's why I'm using it.
                                    I'm just thinking that perhaps ':function ...' should
                                    display the complete function definition, the '!' is surely
                                    an important element. But it could also be considered a cosmetics
                                    in the display, because it's sufficient to try just once to re-source it
                                    and an error if any will tell you.

                                    Cheers,

                                    ---Zdenek
                                  • Yegappan Lakshmanan
                                    Hi, ... Yes. It is possible to replace the home directory of a user in the script path name with ~. But on operating systems like MS-Windows, the HOME
                                    Message 17 of 23 , Aug 31, 2005
                                    • 0 Attachment
                                      Hi,

                                      On 8/31/05, Zdenek SEKERA <Zdenek.Sekera@...> wrote:
                                      >
                                      > 1. when I do e.g. ':verbose function', I get a very long listing of
                                      > quite long lines that wrap around. e.g.: (just a short example):
                                      >
                                      > ...
                                      > function Uname()
                                      > Last set from /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                      > ...
                                      >
                                      > There are also *much* longer lines.
                                      > Would it be a bad idea to replace the $HOME part of the path by
                                      > the customary '~', that would considerably shorten the output.
                                      >

                                      Yes. It is possible to replace the home directory of a user in the script
                                      path name with ~. But on operating systems like MS-Windows, the HOME
                                      environment variable may not be always set or a MS-Windows user may not
                                      understand the meaning of ~.

                                      >
                                      > 2. I see a difference:
                                      > :verbose function Uname
                                      > ----
                                      > function Uname()name
                                      > Last set from /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                      > 1 return substitute(system("uname"), " *\n", "", "")
                                      > endfunction
                                      > ----
                                      >
                                      > Notice different indenting (cosmetics) but more importantly the
                                      > the funny '...()name' part and the contents of the function itself.
                                      >

                                      This looks like an existing bug. This is seen even in Vim 6.3.
                                      When executing ":verbose function <function_name>", additional
                                      characters are appended to the function heading.

                                      >
                                      > Clearly, it outputs the function itself as well. Maybe that's
                                      > what's wanted but I don't like it. Firstly, I can get that output
                                      > via ':function Uname' which seems more appropriate to me (and
                                      > it will not have the 'Last set...' line interspersed inside the
                                      > function code, and, more importantly, when I do ':verbose function
                                      > Uname' I suppose I know I want to get that 'Last set ...' info only,
                                      > not the list of the function itself.
                                      >

                                      This is an existing behavior (in Vim 6.3 also). My patch didn't change
                                      this. When using ":verbose function <name>", the body of the function
                                      is also listed. The only change in Vim 7.0 is to display the script
                                      where the function was defined. Currently this line is added after the
                                      function heading and before the body of the function.

                                      If this line is displayed at the end of the function, then you may have to
                                      scroll several screens (for large functions) to get to this information.

                                      - Yegappan
                                    • Charles E. Campbell, Jr.
                                      ... Well, the behavior for function certainly is verbose . I d ve preferred a wherefrom command instead of the verbose overloading, myself. The meaning
                                      Message 18 of 23 , Sep 1, 2005
                                      • 0 Attachment
                                        On 8/31/05, Zdenek SEKERA <Zdenek.Sekera@...> wrote:
                                        >1. when I do e.g. ':verbose function', I get a very long listing of
                                        > quite long lines that wrap around. e.g.: (just a short example):
                                        > Clearly, it outputs the function itself as well. Maybe that's
                                        > what's wanted but I don't like it...
                                        >

                                        Yegappan Lakshmanan wrote:
                                        >This is an existing behavior (in Vim 6.3 also). My patch didn't change
                                        >this. When using ":verbose function <name>", the body of the function
                                        >is also listed. The only change in Vim 7.0 is to display the script
                                        >where the function was defined...
                                        >
                                        >If this line is displayed at the end of the function, then you may have to
                                        >scroll several screens (for large functions) to get to this information.

                                        Well, the behavior for function certainly is "verbose". I'd've
                                        preferred a "wherefrom"
                                        command instead of the "verbose" overloading, myself. The meaning of
                                        the word
                                        "verbose" doesn't exactly seem to resemble the behavior we're getting.

                                        Regards,
                                        Chip Campbell
                                      • Zdenek Sekera
                                        ... That s certainly my feeling as well.
                                        Message 19 of 23 , Sep 1, 2005
                                        • 0 Attachment
                                          > -----Original Message-----
                                          > From: Charles E. Campbell, Jr. [mailto:drchip@...]
                                          > Sent: 01 September 2005 16:39
                                          > To: Vim Developers; bram@...
                                          > Subject: Re: Vim7: Listing the script where a map was defined
                                          >
                                          > On 8/31/05, Zdenek SEKERA <Zdenek.Sekera@...> wrote:
                                          > >1. when I do e.g. ':verbose function', I get a very long listing of
                                          > > quite long lines that wrap around. e.g.: (just a short example):
                                          > > Clearly, it outputs the function itself as well. Maybe that's
                                          > > what's wanted but I don't like it...
                                          > >
                                          >
                                          > Yegappan Lakshmanan wrote:
                                          > >This is an existing behavior (in Vim 6.3 also). My patch
                                          > didn't change
                                          > >this. When using ":verbose function <name>", the body of
                                          > the function
                                          > >is also listed. The only change in Vim 7.0 is to display the script
                                          > >where the function was defined...
                                          > >
                                          > >If this line is displayed at the end of the function, then
                                          > you may have to
                                          > >scroll several screens (for large functions) to get to this
                                          > information.
                                          >
                                          > Well, the behavior for function certainly is "verbose". I'd've
                                          > preferred a "wherefrom"
                                          > command instead of the "verbose" overloading, myself. The meaning of
                                          > the word
                                          > "verbose" doesn't exactly seem to resemble the behavior we're getting.

                                          That's certainly my feeling as well.

                                          ---Zdenek
                                        • Keith W. Roberts
                                          ... Perhaps a tweak to the behavior of :function is in order. :map xx lists all maps starting with xx, and likewise for all the others. But :fun can comprise
                                          Message 20 of 23 , Sep 2, 2005
                                          • 0 Attachment
                                            > -----Original Message-----
                                            > From: Yegappan Lakshmanan [mailto:yegappanl@...]
                                            > Sent: Wednesday, August 31, 2005 3:41 PM
                                            > To: Zdenek.Sekera@...
                                            > Cc: Vim Developers
                                            > Subject: Re: Vim7: Listing the script where a map was defined
                                            >
                                            > Hi,
                                            >
                                            > On 8/31/05, Zdenek SEKERA <Zdenek.Sekera@...> wrote:
                                            > >
                                            > > 1. when I do e.g. ':verbose function', I get a very long listing of
                                            > > quite long lines that wrap around. e.g.: (just a short example):
                                            > >
                                            > > ...
                                            > > function Uname()
                                            > > Last set from
                                            > /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                            > > ...
                                            >
                                            > This is an existing behavior (in Vim 6.3 also). My patch didn't change
                                            > this. When using ":verbose function <name>", the body of the function
                                            > is also listed. The only change in Vim 7.0 is to display the script
                                            > where the function was defined. Currently this line is added after the
                                            > function heading and before the body of the function.
                                            >
                                            > If this line is displayed at the end of the function, then
                                            > you may have to
                                            > scroll several screens (for large functions) to get to this
                                            > information.
                                            >
                                            > - Yegappan

                                            Perhaps a tweak to the behavior of :function is in order. :map xx lists all
                                            maps starting with xx, and likewise for all the others. But :fun can
                                            comprise many, MANY lines, so how about adding an illegal function name
                                            character to indicate "just show me the function definition line, not the
                                            whole function".

                                            Something like
                                            :fun *Save
                                            to list just the definition lines of all functions starting with "Save".

                                            Hmmm... even better ... why not make it a pattern instead, as
                                            :fun /^Save.*

                                            Then
                                            :fun /.*text.*
                                            would list all functions [definition line(s) only] with names containing
                                            "text".

                                            Consequently, :verbose fun /^Uname$ would list only the initial line of
                                            function Uname() in all the places it was previously defined.

                                            Or, I suppose you could make it act like :tag {ident}
                                            :h tag-regexp

                                            -Keith
                                          • Yegappan Lakshmanan
                                            Hi, ... Bram has implemented the above in the latest Vim7 snapshot. Now you can use the following command to list all the functions ... If you prefix this
                                            Message 21 of 23 , Sep 5, 2005
                                            • 0 Attachment
                                              Hi,

                                              On 9/2/05, Keith W. Roberts <keithr@...> wrote:
                                              >
                                              > Perhaps a tweak to the behavior of :function is in order. :map xx lists all
                                              > maps starting with xx, and likewise for all the others. But :fun can
                                              > comprise many, MANY lines, so how about adding an illegal function name
                                              > character to indicate "just show me the function definition line, not the
                                              > whole function".
                                              >
                                              > Something like
                                              > :fun *Save
                                              > to list just the definition lines of all functions starting with "Save".
                                              >
                                              > Hmmm... even better ... why not make it a pattern instead, as
                                              > :fun /^Save.*
                                              >
                                              > Then
                                              > :fun /.*text.*
                                              > would list all functions [definition line(s) only] with names containing
                                              > "text".
                                              >
                                              > Consequently, :verbose fun /^Uname$ would list only the initial line of
                                              > function Uname() in all the places it was previously defined.
                                              >

                                              Bram has implemented the above in the latest Vim7 snapshot.
                                              Now you can use the following command to list all the functions
                                              matching a pattern:

                                              :function /<pattern>

                                              If you prefix this command with 'verbose', then you will get the
                                              name of the script where a function is defined.

                                              - Yegappan
                                            • Yegappan Lakshmanan
                                              Hi Zdenek, ... In the latest Vim7 snapshot (142), the home directory path in the script path is replaced with ~. ... The display of extra characters after the
                                              Message 22 of 23 , Sep 6, 2005
                                              • 0 Attachment
                                                Hi Zdenek,

                                                On 8/31/05, Zdenek SEKERA <Zdenek.Sekera@...> wrote:
                                                >
                                                > > Can you try the following commands (without any additional arguments) and
                                                > > see whether the script names are displayed?
                                                > >
                                                > > :verbose map
                                                > > :verbose function
                                                > > :verbose command
                                                > > :verbose autocmd
                                                >
                                                > Yes, I am now getting that but have a few comments:
                                                >
                                                > 1. when I do e.g. ':verbose function', I get a very long listing of
                                                > quite long lines that wrap around. e.g.: (just a short example):
                                                >
                                                > ...
                                                > function Uname()
                                                > Last set from /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                                > ...
                                                >
                                                > There are also *much* longer lines.
                                                > Would it be a bad idea to replace the $HOME part of the path by
                                                > the customary '~', that would considerably shorten the output.
                                                >

                                                In the latest Vim7 snapshot (142), the home directory path in
                                                the script path is replaced with ~.

                                                >
                                                > 2. I see a difference:
                                                > :verbose function Uname
                                                > ----
                                                > function Uname()name
                                                > Last set from /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                                > 1 return substitute(system("uname"), " *\n", "", "")
                                                > endfunction
                                                > ----
                                                >
                                                > Notice different indenting (cosmetics) but more importantly the
                                                > the funny '...()name' part and the contents of the function itself.
                                                >

                                                The display of extra characters after the function name is fixed in the
                                                latest Vim7 snapshot.

                                                - Yegappan
                                              • Zdenek Sekera
                                                ... I tried it, works well, I think this is a very useful modification of the output. Thanks! ... Indeed, thanks again. I still don t like the interspersing
                                                Message 23 of 23 , Sep 7, 2005
                                                • 0 Attachment
                                                  > -----Original Message-----
                                                  > From: Yegappan Lakshmanan [mailto:yegappanl@...]
                                                  > Sent: 07 September 2005 03:57
                                                  > To: Zdenek Sekera
                                                  > Cc: Vim Developers
                                                  > Subject: Re: Vim7: Listing the script where a map was defined
                                                  >
                                                  > Hi Zdenek,
                                                  >
                                                  > On 8/31/05, Zdenek SEKERA <Zdenek.Sekera@...> wrote:
                                                  > >
                                                  > > > Can you try the following commands (without any
                                                  > additional arguments) and
                                                  > > > see whether the script names are displayed?
                                                  > > >
                                                  > > > :verbose map
                                                  > > > :verbose function
                                                  > > > :verbose command
                                                  > > > :verbose autocmd
                                                  > >
                                                  > > Yes, I am now getting that but have a few comments:
                                                  > >
                                                  > > 1. when I do e.g. ':verbose function', I get a very long listing of
                                                  > > quite long lines that wrap around. e.g.: (just a short example):
                                                  > >
                                                  > > ...
                                                  > > function Uname()
                                                  > > Last set from
                                                  > /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                                  > > ...
                                                  > >
                                                  > > There are also *much* longer lines.
                                                  > > Would it be a bad idea to replace the $HOME part of the path by
                                                  > > the customary '~', that would considerably shorten the output.
                                                  > >
                                                  >
                                                  > In the latest Vim7 snapshot (142), the home directory path in
                                                  > the script path is replaced with ~.
                                                  >

                                                  I tried it, works well, I think this is a very useful
                                                  modification of the output. Thanks!

                                                  > >
                                                  > > 2. I see a difference:
                                                  > > :verbose function Uname
                                                  > > ----
                                                  > > function Uname()name
                                                  > > Last set from
                                                  > /afs/cern.ch/user/s/sekera/.vim/AsNeeded/Uname.vim
                                                  > > 1 return substitute(system("uname"), " *\n", "", "")
                                                  > > endfunction
                                                  > > ----
                                                  > >
                                                  > > Notice different indenting (cosmetics) but more importantly the
                                                  > > the funny '...()name' part and the contents of the
                                                  > function itself.
                                                  > >
                                                  >
                                                  > The display of extra characters after the function name is
                                                  > fixed in the
                                                  > latest Vim7 snapshot.

                                                  Indeed, thanks again.

                                                  I still don't like the interspersing the "Last set...."
                                                  line inside the function code for 'verbose function Uname'.
                                                  Why not to just display the "Last set..." rather then the
                                                  whole function code with it, when the code can be had with
                                                  much more logical ':function Uname' ?? (I know you said
                                                  that's how it was before and you didn't change it so it
                                                  may need Bram's word on it).

                                                  This brings me back to the previous suggestion of Dr.Chip
                                                  to use simply a different command (I think he suggested
                                                  'wherefrom') to get the "last set..." line. I liked (and
                                                  said do) this suggestion very much. The command name really
                                                  says what it is doing. Using the 'verbose...' is much more
                                                  obscure, no doubt.

                                                  So we would have:
                                                  wherefrom function -> equiv to todays 'verbose function'
                                                  wherefrom Uname -> would give just the "last set ..."
                                                  line for the function Uname

                                                  ...and same for commands, maps, ...etc.

                                                  Cheers and thanks again! Very useful addition.

                                                  ---Zdenek
                                                Your message has been successfully submitted and would be delivered to recipients shortly.