Fandom

Vim Tips Wiki

Using remote editing with knetattach

Redirected from VimTip1332

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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();

CommentsEdit

Also on Fandom

Random Wiki