Created
September 29, 2010 08:59
-
-
Save Raimondi/602477 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Will write text including first match until before the second match: | |
" :WriteMatchedText first second /path/to/file.ext | |
function! WriteMatchedText(first, second, file) | |
exec "normal /".a:first."\<CR>" | |
normal v | |
exec "normal /".a:second."\<CR>h" | |
normal y | |
call writefile(split(@", "\n"), expand(a:file)) | |
endfunction | |
command! -bar -nargs=+ -complete=file WriteMatchedText call WriteMatchedText(<f-args>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment