I would like to write a python script that parses some vim data and returns a result. For example, we'll turn numbers, separated by lines, into a sorted list of unique numbers. If we had this as the input:
The python script would do:
#!/usr/bin/python import sys sys.stdout.write('\n'.join([str(i) for i in (sorted(set([int(k) for k in sys.argv[-1].split()])))]))
This would expect the text from vim to be passed as an arg, so perhaps something like:
:imap <c-t> <c-r>=system('x.py <text_from_vim>')<cr>
And now vim would look like:
How could this be done?