Tuesday, July 3, 2012

VIM - share current file in your LAN (for one person)

Inspired by César Bustíos Benites I've made nice VIM key map to share my current file using NetCat tool.

map <Leader>= :!cat % \| nc -l 5555 &<CR>:let @+='http://10.0.0.89:5555'<CR>

You can change port and IP address to your own. Now I'm pressing ,= followed by (my leader is ",") and Ctr-V (Shift-Ins) into my friend IM window :) (Of course everything in LAN)

What above nc command do?
Echoing file content and pipe it to nc which listen on given port and if connection from client begins netcat returns piped content to client, that's all.

No comments: