ragnarok22/whereami.nvim

github github
utility
stars 14
issues 0
subscribers 2
forks 1
CREATED

2023-07-01

UPDATED

5 months ago


Whereami.nvim

An easy way to test your VPN by getting your current location without leaving Neovim.

Installation

lazy:

{
    "ragnarok22/whereami.nvim",
    cmd = "Whereami"
}

pckr:

{
    'ragnarok22/whereami.nvim',
    -- Lazy loading on specific command
    cond = {
        cmd {'Whereami'}
    }
}

packer (deprecated):

use 'ragnarok22/whereami.nvim'

and then execute :PackerUpdate.

Usage with nvim-notify:

You only need to install nvim-notify and set the notify:

vim.notify = require("notify")

Here an example of installation using lazy:

{
  "ragnarok22/whereami.nvim",
  cmd = "Whereami",
  dependencies = {
    "rcarriga/nvim-notify",
    config = function()
      vim.notify = require("notify")
    end
  }
}

Usage

You can use the command or the API

Command

Just type the command :Whereami and you will see the country you are.

You can also provide and argument:

  • :Whereami country: Show the country location where you request was originated from.
  • :Whereami city: Show the city location where you request was originated from.
  • :Whereami ip: Show the ip location where you request was originated from.

API

You can also use the methods, for example for key bindings

local whereami = require("whereami")
whereami.country() -- show the country
whereami.city() -- show the city
whereami.ip() -- show the IP

-- set keymaps
vim.keymap.set("n", "<leader>l", whereami.country, { desc = "Show the country" })
vim.keymap.set("n", "<leader>e", whereami.city, { desc = "Show the city" })
vim.keymap.set("n", "<leader>i", whereami.ip, { desc = "Show the ip" })