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

Re: ftplugin/changelog.vim

Expand Messages
  • Bram Moolenaar
    ... Thanks for making this. A few comments: - The current changelog plugin sets textwidth to 78. That s not much, but you might want to include it. - Using
    Message 1 of 13 , Aug 5, 2002
    • 0 Attachment
      Nikolai Weibull wrote:

      > Here's a Filetype-plugin for Changelog files. It adds the command
      > NewChangelogEntry (in search of a better name!) and the mapping
      > <Leader>o. Both start a new entry in the Changelog, preferably under the
      > same date and username in use at the moment. It has a couple of
      > variables to alter the look of it. Documentation is included.

      Thanks for making this. A few comments:

      - The current changelog plugin sets 'textwidth' to 78. That's not much,
      but you might want to include it.

      - Using "cat /etc/passwd" looks very strange. Isn't there a "proper"
      way to get the real name of the user? (I don't mean sending yourself
      an e-mail and looking at the "From:" field! :-).

      --
      Corduroy pillows: They're making headlines!

      /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
      /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\
      \\\ Project leader for A-A-P -- http://www.a-a-p.org ///
      \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
    • Nikolai 'pcp' Weibull
      ... added... ... yeah...it s quite ugly...should be portable though...i don t know if there s a prettier way (could use AWK instead of sed...)...or Vim could
      Message 2 of 13 , Aug 6, 2002
      • 0 Attachment
        On Mon, 05 Aug 2002 21:09:39 +0000, Bram Moolenaar wrote:
        >
        > Nikolai Weibull wrote:
        >
        > > Here's a Filetype-plugin for Changelog files. It adds the command
        > > NewChangelogEntry (in search of a better name!) and the mapping
        > > <Leader>o. Both start a new entry in the Changelog, preferably under the
        > > same date and username in use at the moment. It has a couple of
        > > variables to alter the look of it. Documentation is included.
        >
        > Thanks for making this. A few comments:
        >
        > - The current changelog plugin sets 'textwidth' to 78. That's not much,
        > but you might want to include it.

        added...

        >
        > - Using "cat /etc/passwd" looks very strange. Isn't there a "proper"
        > way to get the real name of the user? (I don't mean sending yourself
        > an e-mail and looking at the "From:" field! :-).
        >
        yeah...it's quite ugly...should be portable though...i don't know if
        there's a prettier way (could use AWK instead of sed...)...or Vim could
        provide functions such as a getpwnam() function. That would solve the
        problem =). suggestions?

        --
        /* Name: Nikolai 'pcp' Weibull -- Age: 22 -- Born in: Chicago, IL USA *
        * Where @: Gothenburg, Sweden -- Homepage: http://www.pcppopper.org/ *
        * Email: da.box@..., pcp@... -- System: GeForce2 MX 32 *
        * Celeron 667at950, Fujitsu 20.49gb UDMA-66, ASUS CUV4X, 256mb PC133 *
        * main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} */
      • Preben 'Peppe' Guldberg
        ... I m not sure how portable it is. If your system uses some other authentication method, /etc/passwd is a shot in the dark. Anyway, as for suggestions, I d
        Message 3 of 13 , Aug 6, 2002
        • 0 Attachment
          Thus wrote Nikolai 'pcp' Weibull (da.box@...) on [020806]:
          > On Mon, 05 Aug 2002 21:09:39 +0000, Bram Moolenaar wrote:

          > > - Using "cat /etc/passwd" looks very strange. Isn't there a "proper"
          > > way to get the real name of the user? (I don't mean sending yourself
          > > an e-mail and looking at the "From:" field! :-).

          > yeah...it's quite ugly...should be portable though...i don't know if
          > there's a prettier way (could use AWK instead of sed...)

          I'm not sure how portable it is. If your system uses some other
          authentication method, /etc/passwd is a shot in the dark.

          Anyway, as for suggestions, I'd use something like

          " Note the colon
          let gecos = system('grep "^`whoami`:" /etc/passwd')
          let gecos = substitute(gecos, '^\%([^:]*:\)\{4}\([^:]*\):.*', '\1', '')

          This assumes that you do not want to just :edit /etc/passwd.

          Peppe
          --
          Preben 'Peppe' Guldberg __/-\__ "Before you criticize someone, walk
          peppe@... (o o) a mile in his shoes. That way, if
          -----------------------oOOo (_) oOOo-- he gets angry, he'll be a mile away
          http://www.xs4all.nl/~peppe/ - and barefoot." --Sarah Jackson
        • Glenn Maynard
          ... I think this needs a realname Vim variable, defaulting to a system- specific call for this. This is definitely nonportable in Unix (think NIS), and it
          Message 4 of 13 , Aug 6, 2002
          • 0 Attachment
            On Wed, Aug 07, 2002 at 12:11:05AM +0200, Preben 'Peppe' Guldberg wrote:
            > > yeah...it's quite ugly...should be portable though...i don't know if
            > > there's a prettier way (could use AWK instead of sed...)
            >
            > I'm not sure how portable it is. If your system uses some other
            > authentication method, /etc/passwd is a shot in the dark.

            I think this needs a 'realname' Vim variable, defaulting to a system-
            specific call for this. This is definitely nonportable in Unix (think
            NIS), and it won't work at all in other systems. Never touch /etc/passwd
            directly; that's what getpwuid() is for.

            --
            Glenn Maynard
          • Nikolai 'pcp' Weibull
            ... ok...i can implement a getpwnam function, but that would really benefit from array support, i.e. returning the information as an array...adding a lot of
            Message 5 of 13 , Aug 6, 2002
            • 0 Attachment
              On Tue, 06 Aug 2002 19:22:11 +0000, Glenn Maynard wrote:
              > On Wed, Aug 07, 2002 at 12:11:05AM +0200, Preben 'Peppe' Guldberg wrote:
              > > > yeah...it's quite ugly...should be portable though...i don't know if
              > > > there's a prettier way (could use AWK instead of sed...)
              > >
              > > I'm not sure how portable it is. If your system uses some other
              > > authentication method, /etc/passwd is a shot in the dark.
              >
              > I think this needs a 'realname' Vim variable, defaulting to a system-
              > specific call for this. This is definitely nonportable in Unix (think
              > NIS), and it won't work at all in other systems. Never touch /etc/passwd
              > directly; that's what getpwuid() is for.
              >
              ok...i can implement a getpwnam function, but that would really benefit
              from array support, i.e. returning the information as an array...adding
              a lot of specific functions would work too, but be more ugly in the long
              run or? is my consern for an overcluttered namespace uncalled for?

              --
              /* Name: Nikolai 'pcp' Weibull -- Age: 22 -- Born in: Chicago, IL USA *
              * Where @: Gothenburg, Sweden -- Homepage: http://www.pcppopper.org/ *
              * Email: da.box@..., pcp@... -- System: GeForce2 MX 32 *
              * Celeron 667at950, Fujitsu 20.49gb UDMA-66, ASUS CUV4X, 256mb PC133 *
              * main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} */
            • Glenn Maynard
              ... I wouldn t implement getpwnam. That s Unix-specific. I m suggesting simply realname , which does whatever the OS needs to get the real name, since real
              Message 6 of 13 , Aug 7, 2002
              • 0 Attachment
                On Wed, Aug 07, 2002 at 08:29:59AM +0200, Nikolai 'pcp' Weibull wrote:
                > ok...i can implement a getpwnam function, but that would really benefit
                > from array support, i.e. returning the information as an array...adding
                > a lot of specific functions would work too, but be more ugly in the long
                > run or? is my consern for an overcluttered namespace uncalled for?

                I wouldn't implement getpwnam. That's Unix-specific. I'm suggesting
                simply "realname", which does whatever the OS needs to get the real
                name, since "real name" is fairly generic. (If a script needs any
                other information from getpwnam or getpwuid, it's probably Unix-
                specific anyway, and can use Unix-specific shell calls.)

                I don't know how to actually do this in other systems, though.

                --
                Glenn Maynard
              • Nikolai 'pcp' Weibull
                ... Emacs-Lisp implements a multitude of user related functions. We could go for that approach. no need for associative arrays then =). emacs has
                Message 7 of 13 , Aug 7, 2002
                • 0 Attachment
                  On Wed, 07 Aug 2002 17:38:42 +0000, Glenn Maynard wrote:
                  >
                  > I wouldn't implement getpwnam. That's Unix-specific. I'm suggesting
                  > simply "realname", which does whatever the OS needs to get the real
                  > name, since "real name" is fairly generic. (If a script needs any
                  > other information from getpwnam or getpwuid, it's probably Unix-
                  > specific anyway, and can use Unix-specific shell calls.)
                  >
                  > I don't know how to actually do this in other systems, though.
                  >
                  Emacs-Lisp implements a multitude of user related functions. We could go
                  for that approach. no need for associative arrays then =). emacs has
                  user-full-name user-real-name user-* blah...but from glancing at the
                  source it uses getpwnam for retrieval. What other OS's do we need to
                  consider? i guess Windows would have something similar. i mean you can
                  type in the real name for users in Windows so...i have no idea about Mac
                  OS (but it's Unix based now right?)...suggestions on other Os:es? This
                  function is rather pleasant to have am i right?

                  --
                  /* Name: Nikolai 'pcp' Weibull -- Age: 22 -- Born in: Chicago, IL USA *
                  * Where @: Gothenburg, Sweden -- Homepage: http://www.pcppopper.org/ *
                  * Email: da.box@..., pcp@... -- System: GeForce2 MX 32 *
                  * Celeron 667at950, Fujitsu 20.49gb UDMA-66, ASUS CUV4X, 256mb PC133 *
                  * main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} */
                • Glenn Maynard
                  ... Emacs has a lot of junk. Vim isn t Emacs. :) Implement the things that are needed and are useful. (What the heck is the difference between a full name
                  Message 8 of 13 , Aug 7, 2002
                  • 0 Attachment
                    On Thu, Aug 08, 2002 at 01:03:59AM +0200, Nikolai 'pcp' Weibull wrote:
                    > Emacs-Lisp implements a multitude of user related functions. We could go
                    > for that approach. no need for associative arrays then =). emacs has
                    > user-full-name user-real-name user-* blah...but from glancing at the

                    Emacs has a lot of junk. Vim isn't Emacs. :) Implement the things
                    that are needed and are useful. (What the heck is the difference
                    between a full name and a real name? My full name is "Glenn Fredrick
                    John Maynard Jr.", but my computer doesn't know that and doesn't need
                    to. :)

                    > source it uses getpwnam for retrieval. What other OS's do we need to
                    > consider? i guess Windows would have something similar. i mean you can
                    > type in the real name for users in Windows so...i have no idea about Mac
                    > OS (but it's Unix based now right?)...suggestions on other Os:es? This
                    > function is rather pleasant to have am i right?

                    Just implement it in Unix for now (making sure you block it in #defines
                    correctly); people who need this in other OS's can implement it later.

                    Then, in your script, do something like (pseudocode; my Vim script is
                    bad):

                    if $user_realname exists
                    $used_realname = $user_realname
                    else if realname() exists
                    $used_realname = realname()
                    else
                    $used_realname = "realname"
                    fi

                    In other words, let the user define an overriding name at runtime; if that's
                    not there and realname() is implemented, use that; otherwise use some
                    fallback.

                    (Of course, I have no idea if Bram would want a patch that adds this
                    function or that this is how he'd want it done; I'm just saying how
                    I'd do it. :)

                    --
                    Glenn Maynard
                  • Nikolai 'pcp' Weibull
                    ... apparently Emacs function checks for some environment variables as well...guess we could do the same...($NAME). -- /* Name: Nikolai pcp Weibull -- Age:
                    Message 9 of 13 , Aug 8, 2002
                    • 0 Attachment
                      On Wed, 07 Aug 2002 19:18:45 +0000, Glenn Maynard wrote:
                      > Just implement it in Unix for now (making sure you block it in #defines
                      > correctly); people who need this in other OS's can implement it later.
                      >
                      > Then, in your script, do something like (pseudocode; my Vim script is
                      > bad):
                      >
                      > if $user_realname exists
                      > $used_realname = $user_realname
                      > else if realname() exists
                      > $used_realname = realname()
                      > else
                      > $used_realname = "realname"
                      > fi
                      >
                      > In other words, let the user define an overriding name at runtime; if that's
                      > not there and realname() is implemented, use that; otherwise use some
                      > fallback.
                      >
                      > (Of course, I have no idea if Bram would want a patch that adds this
                      > function or that this is how he'd want it done; I'm just saying how
                      > I'd do it. :)
                      >
                      apparently Emacs function checks for some environment variables as
                      well...guess we could do the same...($NAME).

                      --
                      /* Name: Nikolai 'pcp' Weibull -- Age: 22 -- Born in: Chicago, IL USA *
                      * Where @: Gothenburg, Sweden -- Homepage: http://www.pcppopper.org/ *
                      * Email: da.box@..., pcp@... -- System: GeForce2 MX 32 *
                      * Celeron 667at950, Fujitsu 20.49gb UDMA-66, ASUS CUV4X, 256mb PC133 *
                      * main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);} */
                    • Nikolai :: lone-star :: Weibull
                      Someone had some code to make username lookups on win32 systems for the above file. if someone knows what i m talking about please resend me the additions to
                      Message 10 of 13 , Oct 24, 2002
                      • 0 Attachment
                        Someone had some code to make username lookups on win32 systems for the
                        above file. if someone knows what i'm talking about please resend me the
                        additions to the file above and i'll try to include it in the updated
                        version (that i'm writing at the moment). thanks!

                        --
                        ::: name: Nikolai Weibull :: aliases: pcp / lone-star :::
                        ::: born: Chicago, IL USA :: loc now: Gothenburg, Sweden :::
                        ::: page: http://pcppopper.org/ :: top ref: google "pcp rocks" :::
                        main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
                      • Sylvain Chouleur
                        Hi, there is a little syntax error in changelog ftplugin: in the s:passwd_field function, field argument is not correctly used. Here is a patch. Regards,
                        Message 11 of 13 , Aug 10, 2012
                        • 0 Attachment
                          Hi,

                          there is a little syntax error in changelog ftplugin:
                          in the s:passwd_field function, field argument is not correctly used.

                          Here is a patch.

                          Regards,
                          Sylvain

                          --
                          You received this message from the "vim_dev" maillist.
                          Do not top-post! Type your reply below the text you are replying to.
                          For more information, visit http://www.vim.org/maillist.php
                        • Bram Moolenaar
                          ... Nikolai maintains that file. ... -- hundred-and-one symptoms of being an internet addict: 232. You start conversations with, Have you gotten an ISDN
                          Message 12 of 13 , Aug 11, 2012
                          • 0 Attachment
                            Sylvain Chouleur wrote:

                            > there is a little syntax error in changelog ftplugin:
                            > in the s:passwd_field function, field argument is not correctly used.
                            >
                            > Here is a patch.

                            Nikolai maintains that file.

                            > diff -r 9266cfe865c3 runtime/ftplugin/changelog.vim
                            > --- a/runtime/ftplugin/changelog.vim Wed Aug 08 18:01:05 2012 +0200
                            > +++ b/runtime/ftplugin/changelog.vim Fri Aug 10 11:55:11 2012 +0200
                            > @@ -106,10 +106,10 @@
                            >
                            > function! s:passwd_field(line, field)
                            > let fields = split(a:line, ':', 1)
                            > - if len(fields) < field
                            > + if len(fields) < a:field
                            > return ""
                            > endif
                            > - return fields[field - 1]
                            > + return fields[a:field - 1]
                            > endfunction
                            >
                            > function! s:capitalize(word)
                            >

                            --
                            hundred-and-one symptoms of being an internet addict:
                            232. You start conversations with, "Have you gotten an ISDN line?"

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

                            --
                            You received this message from the "vim_dev" maillist.
                            Do not top-post! Type your reply below the text you are replying to.
                            For more information, visit http://www.vim.org/maillist.php
                          Your message has been successfully submitted and would be delivered to recipients shortly.