html tool

2019年5月22日星期三

vimgolf mark for 14


http://www.vimgolf.com/challenges/56fb2e75ccffcc0009026473?submissions_page=3

ps:

  • qq 9@q first know;
  • wr<ESC> 9@. 这个用法太惊人了,insert word 在普通模式
  • V"=[] p, and  [-----1,2,]  Amazing

#1 Urtica dioica / @udioica - Score: 14 - 03/31/16 @ 01:43
5gJV"=[<C-R><C-A>]<CR>pZZ

@jdupont655: @chunleng: <C-R><C-A> is one of several ways to automatically insert some text on the command line, when this text is already under the cursor in the buffer. Depending on type of text, you can hit different mappings: <C-R><C-W> for a word, <C-R><C-A> for a WORD, <C-R><C-F> for a filepath, <C-R><C-P> for an expanded filepath. Here, when you hit <C-R><C-A>, your cursor is on one of the digits, so the WORD under the cursor is ------...2,...,29,. Besides, the number of minus signs in front of the number 2 is even (24; 1 at the end of the first line, then 23 on the second one). So, ----...2 evaluates to the positive number 2. Finally, you replace the line by putting the evaluation of an expression given through the expression register ("={expr}p). Here, the expression is a list ([2, ..., 29]), and when you ask to put a list, Vim puts each of its item on a separate line. 

没有评论:

发表评论