pi_spec.txt 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. *pi_spec.txt* Nvim
  2. by Gustavo Niemeyer ~
  3. This is a filetype plugin to work with rpm spec files.
  4. Currently, this Vim plugin allows you to easily update the %changelog
  5. section in RPM spec files. It will even create a section for you if it
  6. doesn't exist yet. If you've already inserted an entry today, it will
  7. give you the opportunity to just add a new item in today's entry. If you
  8. don't provide a format string (|spec_chglog_format|), it'll ask you an
  9. email address and build a format string by itself.
  10. 1. How to use it |spec-how-to-use-it|
  11. 2. Customizing |spec-customizing|
  12. ==============================================================================
  13. 1. How to use it *spec-how-to-use-it*
  14. The spec_chglog plugin provides a map like the following:
  15. :map <buffer> <LocalLeader>c <Plug>SpecChangelog
  16. It means that you may run the plugin inside a spec file by pressing
  17. your maplocalleader key (default is '\') plus 'c'. If you do not have
  18. |spec_chglog_format| set, the plugin will ask you for an email address
  19. to use in this edit session.
  20. Every time you run the plugin, it will check to see if the last entry in the
  21. changelog has been written today and by you. If the entry matches, it will
  22. just insert a new changelog item, otherwise it will create a new changelog
  23. entry. If you are running with |spec_chglog_release_info| enabled, it will
  24. also check if the name, version and release matches. The plugin is smart
  25. enough to ask you if it should update the package release, if you have not
  26. done so.
  27. Setting a map *spec-setting-a-map*
  28. -------------
  29. As you should know, you can easily set a map to access any Vim command (or
  30. anything, for that matter). If you don't like the default map of
  31. <LocalLeader>c, you may just set up your own key. The following line
  32. shows you how you could do this in your vimrc file, mapping the plugin to
  33. the <F5> key:
  34. au FileType spec map <buffer> <F5> <Plug>SpecChangelog
  35. Note: the plugin will respect your desire to change the default mapping
  36. and won't set it.
  37. This command will add a map only in the spec file buffers.
  38. ==============================================================================
  39. 2. Customizing *spec-customizing*
  40. The format string *spec_chglog_format*
  41. -----------------
  42. You can easily customize how your spec file entry will look like. To do
  43. this just set the variable "spec_chglog_format" in your vimrc file like
  44. this: >
  45. let spec_chglog_format = "%a %b %d %Y My Name <my@email.com>"
  46. Note that "%a %b %d %Y" is the most used time format. If you don't provide
  47. a format string, when you run the SpecChangelog command for the first
  48. time, it will ask you an email address and build the |spec_chglog_format|
  49. variable for you. This way, you will only need to provide your email
  50. address once.
  51. To discover which format options you can use, take a look at the strftime()
  52. function man page.
  53. Where to insert new items *spec_chglog_prepend*
  54. -------------------------
  55. The plugin will usually insert new %changelog entry items (note that it's
  56. not the entry itself) after the existing ones. If you set the
  57. spec_chglog_prepend variable >
  58. let spec_chglog_prepend = 1
  59. it will insert new items before the existing ones.
  60. Inserting release info *spec_chglog_release_info*
  61. ----------------------
  62. If you want, the plugin may automatically insert release information
  63. on each changelog entry. One advantage of turning this feature on is
  64. that it may control if the release has been updated after the last
  65. change in the package or not. If you have not updated the package
  66. version or release, it will ask you if it should update the package
  67. release for you. To turn this feature on, just insert the following
  68. code in your vimrc: >
  69. let spec_chglog_release_info = 1
  70. Then, the first item in your changelog entry will be something like: >
  71. + name-1.0-1cl
  72. If you don't like the release updating feature and don't want to answer
  73. "No" each time it detects an old release, you may disable it with >
  74. let spec_chglog_never_increase_release = 1
  75. Good luck!!
  76. vim:tw=78:ts=8:noet:ft=help:norl: