Thursday, June 11, 2015

Re: g:timestamp_rep syntax

Dear Christian,

On 2015-06-11 Thu 15:03, Christian Brabandt wrote:
> Hi Jacob!
>
> On Do, 11 Jun 2015, Jacob Wegelin wrote:
>
>> The timestamp.vim plugin works beautifully. It automatically updates a line in the file that I edit, giving the second when I last re-saved the file.
>>
>> But how does one change the format of the timestamp?
>>
>> .vim/doc/timestamp.txt
>>
>> says, about the format:
>>
>> Default: '%a %d %b %Y %I:%M:%S %p %Z'
>>
>> <snip>
>>
>> To change this value, either set g:timestamp_rep in your {.vimrc} or set b:timestamp_rep for the buffer in question.
>>
>> Can anyone provide an example of the syntax whereby one explicitly sets g:timestamp_rep in the .vimrc?
>>
>> For instance, I tried inserting the following line into my .vimrc
>>
>> set g:'%a'
>>
>> and this threw an error when I opened a new file in vim.
>>
>> Thanks for any insight
>
> You need to set a variable. This is done using the :let command, so you
> have to use in your .vimrc:
>
> :let g:timestampe_rep='%a %b'

I placed the following into my .vimrc:

:let g:timestamp_rep='%Y-%m-%d %a %H:%M:%S'

Then I opened a file which was initially

Created: TIMESTAMP
Modified: TIMESTAMP

and when I saved it, it became

Created: 2015-06-11 Thu 15:47:21
Modified: 2015-06-11 Thu 15:47:21

But when I resaved it, and later re-opened it and resaved, the timestamps
were not updated.

It appears that the plugin recognizes TIMESTAMP and changes it, but it
does not recognize the date in that format to re-change it.

How could I fix this?

Thanks

Jacob Wegelin

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: