Vim Tips Wiki
Register
Advertisement
Tip 1332 Printable Monobook Previous Next

created 2006 · complexity basic · version 6.0


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[1];
  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();

Comments[]

Advertisement