nvim-0x0 ā€“ Upload files, yanks, and selections to 0x0.st

Cover Image for nvim-0x0 ā€“ Upload files, yanks, and selections to 0x0.st
Rahul M. Juliato
Rahul M. Juliato
#neovim#plugin# productivity# 0x0

One thing I really missed from Emacs was how easy it was to upload files and text snippets to 0x0.st.

For those unfamiliar, 0x0.st is a simple, no-fuss file and text-sharing service where you can upload texts and images and get a shareable link instantly (you can also host your own instance of it).

So, I decided to bring that experience to Neovim with nvim-0x0, my first ever Neovim plugin! šŸŽ‰

Obligatory Demos

  • Uploading the current opened file:
    icomplete

  • Uploading a visual selection:
    icomplete

  • Uploading the last yanked/deleted text:
    icomplete

  • Uploading a file selected in oil.nvim:
    icomplete

  • Uploading an image selected in oil.nvim:
    icomplete

Installation

Using lazy.nvim

Add the following to your lazy.nvim configuration:

require('lazy').setup({
  {
    "LionyxML/nvim-0x0",
    opts = {
      -- base_url = "https://<your-0x0-instance>/",  -- only needed if you host your own 0x0 instance
      use_default_keymaps = true,                    -- Set to false if you want to define your own keymaps
    }
  }
})

Usage

By default, the following keymaps are available:

  • <leader>0f - Upload the current file
  • <leader>0s - Upload the current visual selection
  • <leader>0y - Upload the last yank or delete content
  • <leader>0o - Upload a file selected in oil.nvim

If use_default_keymaps = false, you can define your own mappings, like:

vim.keymap.set('n', '<leader>uf', require("nvim-0x0").upload_current_file, { desc = "Upload current file" })
vim.keymap.set('v', '<leader>us', require("nvim-0x0").upload_selection, { desc = "Upload selection" })
vim.keymap.set('n', '<leader>uy', require("nvim-0x0").upload_yank, { desc = "Upload yank" })
vim.keymap.set('n', '<leader>uo', require("nvim-0x0").upload_oil_file, { desc = "Upload oil.nvim file" })

If you would like to host your own instance of 0x0, set base_url = "https://0x0.st/".

Conclusion

I made nvim-0x0 to bring a simple and fast 0x0.st experience to Neovim, and I hope it makes your workflow smoother. If you try it out, let me know what you think!

Check out the plugin on GitHub:
āž” nvim-0x0 Repository

Feel free to open issues, share feedback, or contribute. šŸš€