A mix of 'wyattjsmith1/weather.nvim' and 'ellisonleao/weather.nvim'
A simple plugin to display weather in nvim.
lualine
integration
Weather report popup with nui.nvim
Packer:
use {
'lazymaniac/wttr.nvim',
requires = {
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
}
}
Lazy:
{
'lazymaniac/wttr.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
}
}
require'wttr'.setup {
-- your options
}
Default configuration:
opts = {
-- If not provided then location will be found by IP.
-- It can be other location point like:
-- ~Eiffel+Tower - Note: ~ and + sign instead of space
-- @github.com - Domain name
-- muc - Three letter airport code
--
-- Exmaple:
-- location = "~Eiffel+Tower"
location = "",
-- One of predefinied formats
-- 1 - Preview: ☀️ +6°C
-- 2 - Preview: ☀️ 🌡️+6°C 🌬️↓4km/h
-- 3 - Preview: Porto, Portugal: ☀️ +6°C
-- 4 - Preview: Porto, Portugal: ☀️ 🌡️+6°C 🌬️↓4km/h
format = 1
-- Custom format. If present then overwrites default format defined above
--
-- Source: wttr.in
-- To specify your own custom output format, use the special %-notation:
--
-- Possible options:
-- c Weather condition,
-- C Weather condition textual name,
-- x Weather condition, plain-text symbol,
-- h Humidity,
-- t Temperature (Actual),
-- f Temperature (Feels Like),
-- w Wind,
-- l Location,
-- m Moon phase 🌑🌒🌓🌔🌕🌖🌗🌘,
-- M Moon day,
-- p Precipitation (mm/3 hours),
-- P Pressure (hPa),
-- u UV index (1-12),
--
-- D Dawn*,
-- S Sunrise*,
-- z Zenith*,
-- s Sunset*,
-- d Dusk*,
-- T Current time*,
-- Z Local timezone.
--
-- (*times are shown in the local timezone)
custom_format = ""
}
{
'lazymaniac/wttr.nvim',
event = 'VeryLazy',
dependencies = {
'nvim-lua/plenary.nvim',
'MunifTanjim/nui.nvim',
},
opts = {
location = '',
format = 1,
custom_format = '%C+%cP:%p+T:%t+F:%f+%w+%m+%P+UV:%u+Hum:%h',
},
},
wttr.nvim
starts a scheduler with periodic calls to wttr.in
. Response is
extracted and saved in 'text' field. Use this fieled in lualine or other place
you want to display current weather.
Integration with lualine
wttr.nvim
can integrate easily with lualine
. To do so, you will need to use
'text' field in lualine:
require('lualine').setup {
sections = {
lualine_x = { "require'wttr'.text" }
}
}
Weather forecast with nui.nvim
Call get_forecast() function to display popup with weather report
Example:
:lua require'wttr'.get_forecast()
To close popup press q
or <esc>