bairui

Untitled

Jun 10th, 2011
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.60 KB | None | 0 0
  1. " Goal: Create a line with: foobar1 foobar2 ... foobar19
  2. " Note: the_isz solves this example without Nexus, using the much simpler:
  3. "         join(map(range(1,19), '"foobar" . v:val'), " ")
  4.  
  5. " First approach is using normal mode commands and a substitute:
  6. call s1.reset()
  7. $
  8. normal 19ix
  9. s/x/\="foobar".s1.next()/g
  10. normal o
  11.  
  12. " Second approach uses vimscript:
  13. call s1.reset()
  14. call setline('$', join(map(range(1,19), "printf('foobar%d', s1.next())"), ' '))
  15. " alternatively, if you don't need printf power, use the simpler case below:
  16. call setline('$', join(map(range(1,19), '"foobar".s1.next()'), ' '))
Advertisement
Add Comment
Please, Sign In to add comment