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