cvs co me on vim.cvs.sf.net!

vimscript

vimscript means that I can use the same code on my backend and in my editor A Thought Leader

FEATURED


Look, a funny penguin.

ProTip from the ninja trenches: Unlike node, or python3, or perl6, vim is probably already installed on your server - no need for DevOps!

AN EXAMPLE: A WEBSERVER

This simple web server written in vimscript responds with "hello, world" for every request.
!while [ $? -eq 0 ];
\ do
\   nc -vlp 8080
\      -c "printf 'HTTP/1.0 200 MORNING\r\n\r\nhello, world\n'";
\ done

To run the server, run vim, type i, type the code in, type :w foo to save it, followed by :source % to run it.

See - you didn't even have to leave the editor!

Here is an example of a simple TCP server which listens on port 1337 and echoes whatever you send it:

!while [ $? -eq 0 ]; do nc -vlp 1337 -c cat; done

At this point it should be clear how to scale that up to a proper web service - just install a bunch of stuff and use it! Easy!

buildpassing betterthanemacs
^C ^C quit exit stop help ^[[B^[[A^[[C^[[A^[[D^[[B ^[[B^[[A ^[[3~^[[3~^[[3~ ? ^D ^D ^C goddammit ZZ Z Z Z Z :quit quit q :q :wq