Skip to content

Instantly share code, notes, and snippets.

@RakshithNM
Last active January 5, 2022 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RakshithNM/b9c9bbc7845421668c897db692a69747 to your computer and use it in GitHub Desktop.
Save RakshithNM/b9c9bbc7845421668c897db692a69747 to your computer and use it in GitHub Desktop.
how to paste code from vim to online pastebin ix.io
  1. Create a folder called ~scripts in your home directory.

  2. In the directory create a file called ix.

  3. Add the following script to the file

#!/bin/bash

if [ -n "$1" ]; then
  curl "ix.io/$1" 2>/dev/null
  exit 0
fi

curl -F 'f:1=<-' ix.io 2>/dev/null
  1. Then run chmod +x ix.

  2. Add export PATH=$PATH:~/scripts to your ~/.bashrc or ~/.zshrc.

  3. Run source ~/.bashrc or source ~/.zshrc.

  4. Test that the ix command works by running echo "abc" | ix, it should return a ix.io url.

  5. Open up vim and position on top of the paragraph that you want paste online press !} to select the code to ix'ed.

  6. Type ix in the bottom where it looks like :.,.+4!, this should return the ix.io url of the form http://ix.io/abcd.

  7. Share the url with others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment