tl/dr

  • Install (Linux) dateutils package.
  • Vim/Neovim (example): :read ! dateseq 2018-12-04 2019-12-31

Since Dec 2015 I’ve been tracking an intermittent diet (fasting, zero calories, 2d/week – see my comments (vstuart) here).

Updated plot (date):

diet-Gnuplot-2018.12.01.png

[Image source. Click image to open in new window.]


which I quickly plot in a terminal with

alias gp='echo "    [gplot: Gnuplot of weight]" && gnuplot -p /mnt/Vancouver/Programming/scripts/gnuplot/plot.gp'

which executes

#!/bin/bash
# /mnt/Vancouver/Programming/scripts/gnuplot/plot.gp
# ...

that is found the executable file plot.gp, which you can execute in a terminal with

gnuplot -p plot.gp`

Today I reached the end of my datafile (weight.dat) file (which I edit in Neovim),

2018-11-20  184.8   fast
2018-11-21  180.8
2018-11-22  182.6   fast
2018-11-23  180.2
2018-11-24  183.4
2018-11-25  185.4
2018-11-26  185.4
2018-11-27  185.8   fast
2018-11-28  182.6
2018-11-29  182.6   fast
2018-11-30  181.0
# DEC
2018-12-01  183.4
2018-12-02  185.6

I needed to append a new sequence of dates to that file, which I accomplished in Neovim (Vim) as follows.

First, since I am in (Arch) Linux, I needed to install the dateutils package, which includes the dateseq utility [reference].

Then, in Neovim, use the :read command to append the output to your Vim buffer (i.e. open file).


dateseq.png

[Click image to open in new window.]



[Vim] Making a List of Numbers

:for i in range(1,10) | put ='192.168.0.'.i | endfor
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.4
192.168.0.5
192.168.0.6
192.168.0.7
192.168.0.8
192.168.0.9
192.168.0.10

[Vim] Insert Current Date or Time

:pu =strftime('%Y-%m-%d')
2018-12-02

Some strftime() Format String Examples

Format String              Example output
-------------              --------------
%c                         Thu 27 Sep 2007 07:37:42 AM EDT (depends on locale)
%a %d %b %Y                Thu 27 Sep 2007
%b %d, %Y                  Sep 27, 2007
%d/%m/%y %H:%M:%S          27/09/07 07:36:32
%H:%M:%S                   07:36:44
%T                         07:38:09
%m/%d/%y                   09/27/07
%y%m%d                     070927
%x %X (%Z)                 09/27/2007 08:00:59 AM (EDT)
%Y-%m-%d                   2016-11-23
%F                         2016-11-23 (works on some systems)

RFC822 format:
%a, %d %b %Y %H:%M:%S %z   Wed, 29 Aug 2007 02:37:15 -0400