Wikia

Vim Tips Wiki

Using remote editing with knetattach

Talk0
1,612pages on
this wiki
Revision as of 09:30, November 25, 2009 by 164.67.235.128 (Talk)

Tip 1332 Printable Monobook Previous Next

created September 19, 2006 · complexity basic · author Anon · 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

Around Wikia's network

Random Wiki