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

Re: editing ChangeLogs with Vim?

Expand Messages
  • François Pinard
    [M.K.] ... Yes. ... I do not know how useful these might be, but here is what I use. It may give you ideas. Suggestions welcome! A few comments follow at
    Message 1 of 2 , Jul 31, 2005
      [M.K.]

      > Is there any special handling for editing ChangeLog files in Vim?

      Yes.

      > [...] can anyone who does use Vim to maintain ChangeLogs share any
      > effective tips & tricks they use?

      I do not know how useful these might be, but here is what I use. It may
      give you ideas. Suggestions welcome! A few comments follow at the end.

      File ~/.vim/plugin/changelog.vim:

      ---------------------------------------------------------------------->
      runtime! ftplugin/changelog.vim

      let g:changelog_username = 'François Pinard <pinard@...>'
      ----------------------------------------------------------------------<

      File ~/.vim/plugin/spell.vim:

      ---------------------------------------------------------------------->
      function Set_spell()
      if version >= 700
      let langue = input("Langue? [, en, fr] ", "")
      if langue == "f" || langue == "fr"
      setlocal spell spelllang=fr
      elseif langue == "e" || langue == "en"
      setlocal spell spelllang=en
      endif
      endif
      endfunction
      ----------------------------------------------------------------------<

      File ~/.vim/ftplugin/changelog.vim:

      ---------------------------------------------------------------------->
      if &filetype != 'changelog'
      finish
      endif

      call Set_spell()
      setlocal noexpandtab
      ----------------------------------------------------------------------<

      File ~/.vim/syntax/changelog.vim:

      ---------------------------------------------------------------------->
      highlight! link changelogTemps WarningMsg
      highlight! link changelogReported WarningMsg

      syntax match changelogTemps "([0-9][0-9]*h)"
      syntax match changelogTemps "([0-9][0-9]*\.[0-9]*h)"
      syntax match changelogReported "Reported by"
      ----------------------------------------------------------------------<

      The `runtime! ...' line is for activating the `\o' command globally.
      `\o' (that is, backslash followed by letter o) is the magic keybinding
      to start a new ChangeLog entry.

      `Set_spell' is meant to interactively decide which language (English or
      French, or none) should be used to spell files being edited. I call
      Set_spell() in many ftplugins. It could be removed of course.

      The `finish' is for preventing `Set_spell' from being called at the time `\o'
      is being activated globally, as above.

      For my free software projecs, "Reported by" strings also highlighted, as
      a way to underline contributors. For my other projects, strings like
      "(2.5h)" are especially highlighted, as I process all such ChangeLogs,
      once per month, for billing purposes. The highlight is a feedback
      telling me I entered these annotation in the proper format.

      --
      François Pinard http://pinard.progiciels-bpi.ca
    Your message has been successfully submitted and would be delivered to recipients shortly.