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

Re: Vim7: Listing the script where a map was defined

Expand Messages
  • 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 1 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 2 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 3 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 4 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 5 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 6 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.