Guest User

Untitled

a guest
Jun 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. " Will write text including first match until before the second match:
  2. " :WriteMatchedText first second /path/to/file.ext
  3.  
  4. function! WriteMatchedText(first, second, file)
  5. exec "normal /".a:first."\<CR>"
  6. normal v
  7. exec "normal /".a:second."\<CR>h"
  8. normal y
  9. call writefile(split(@", "\n"), expand(a:file))
  10. endfunction
  11.  
  12. command! -bar -nargs=+ -complete=file WriteMatchedText call WriteMatchedText(<f-args>)
Add Comment
Please, Sign In to add comment