Skip to content

ragnarok22/whereami.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Whereami.nvim

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

Features

  • Country flag notification
  • City and IP information
  • ISP lookup
  • Works with nvim-notify

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

Install nvim-notify and set it as the default notifier:

vim.notify = require("notify")

Here is 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

Run :Whereami to display the country you are in.

You can also provide an 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 address where your request originated from.
  • :Whereami isp: Show your current internet service provider.

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
whereami.isp() -- show the ISP

-- 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" })
vim.keymap.set("n", "<leader>s", whereami.isp, { desc = "Show the ISP" })

Testing

The plugin uses plenary.nvim for its test suite. You can run the tests from the project root with:

nvim --headless -c "PlenaryBustedDirectory lua/tests {minimal_init = 'tests/minimal_init.lua'}" +qa

The command requires Neovim and plenary.nvim to be installed.

See SECURITY.md for details on our security policy.

License

GNU GPLv3

About

A simple plugin for neovim to get the current location

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages