Using remote editing with knetattach
From Vim Tips Wiki
I was trying kde's knetattach yesterday. It doesn't seem to know about Vim's built-in remote editing commands. To get knetattach to play nicely with Vim, I wrote the following Python script and made it the default application for remote text files. The application command line reads "net_vim_open.py %u", where %u is translated to the remote fish url.
#!/usr/bin/python #net_vim_open.py import os, sys def open_gvim(): v = sys.argv; if v[0:4] != 'fish': error_file = open('.net_vim_errors','a'); print >> error_file, "Error starting gvim"; print >> error_file, sys.argv; error_file.close(); else: v = v.replace("fish:", "scp:", 1); v = v.replace(":22", "/", 1); cmd = ' '.join(['gvim',v]); os.system(cmd); return; open_gvim(); sys.exit();