Save selected text (partial line) from Vim
问题 I try to save some selected text (part of a line) from Vim. Here is the line: THIS TEST STRING - SELECTED_TARGET_WORLD where the bold represents the select text. I do this: :'<,'> w! test/selected_text but in the file selected_text I find the string: THIS TEST STRING - SELECTED_TARGET_WORLD How do I make it save only the selected part of the line? 回答1: :[range]w filename only works with lines so… you have to put the selected text on its own line. An alternative using :help :redir : :'<,'>"ay