自带可以实现自增功能,按照 register number 给出的几个按键就可以用在录宏操作中,大致是录宏前C-u 2016 C-x r n r设置初值,然后录宏时先C-u 1 C-x r + r 设置增量为1,后C-x r i r插入寄存器r的值。楼上已经给出了好几种优雅的方式,而宏操作按键复杂不得已才会用下。
⋊> seq -f 'wow, %g is a new year!' 2015 2020 # 正序
wow, 2015 is a new year!
wow, 2016 is a new year!
wow, 2017 is a new year!
wow, 2018 is a new year!
wow, 2019 is a new year!
wow, 2020 is a new year!
⋊> seq -f 'wow, %g is a new year!' 2020 2015 # 倒序
wow, 2020 is a new year!
wow, 2019 is a new year!
wow, 2018 is a new year!
wow, 2017 is a new year!
wow, 2016 is a new year!
wow, 2015 is a new year!
~ $ for i in {2015..2020}; do echo "wow, $i is a new year\!"; done
wow, 2015 is a new year!
wow, 2016 is a new year!
wow, 2017 is a new year!
wow, 2018 is a new year!
wow, 2019 is a new year!
wow, 2020 is a new year!
~ $ for i in {2020..2015}; do echo "wow, $i is a new year\!"; done
wow, 2020 is a new year!
wow, 2019 is a new year!
wow, 2018 is a new year!
wow, 2017 is a new year!
wow, 2016 is a new year!
wow, 2015 is a new year!