We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free. Anti-spam check. Do not fill this in!==Simple filter example== Following is a Python program to sort the words on each line of standard input (each line is separately sorted). <pre> # File sortwords.py from sys import stdin for line in stdin: print ' '.join(sorted(line.split())) </pre> A file you are editing in Vim may include the following text: <pre> this is a line with some words words on each line will be sorted fried banana and cream </pre> Use this procedure to filter the text: *Press <code>V</code> on the first line, then <code>jj</code> to select three lines. *Type <code>!python sortwords.py</code> and press Enter. The lines are replaced with the result from running the program: <pre> a is line some this with words be each line on sorted will words and banana cream fried </pre> Summary: Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA Cancel Editing help (opens in new window) Retrieved from "https://vim.fandom.com/wiki/Use_filter_commands_to_process_text"