A plugin for neovim to view github trending repos. BTW, written by Rust and Lua language.
neovim >= 0.5
- Rust.(cargo inclusive)
Example using lazy.nvim
:
return {
{
"herschel-ma/ghtrending_nvim",
dependencies = { "MunifTanjim/nui.nvim" },
-- windows && nu
build = "cargo build --release"
config = function()
require("ghtrending").setup({
-- set your config here
})
end,
},
}
Default Configuration:
local M = {
chinese = true, -- default true, if false, show English
popup = {
border = {
style = "single", -- popup border style
},
win_options = {
winblend = 25,
winhighlight = "Normal:NormalFloat,FloatBorder:LineNr",
scrolloff = 3,
wrap = true,
},
},
layout = {
relative = "editor",
position = "50%",
size = {
width = "80%",
height = "50%",
},
},
left_popup_size = "30%",
right_popup_size = "70%",
}
-- require("ghtrending").setup(M) -- set config
refer to nui.nvim/lua/nui/popup for more detail. refer to nui.nvim/lua/nui/layout for more detail.
A command :GhtrendingRepo
present to popup a window to display github trending repos.
A command :GhtrendingOpenRepo
present to open the repository under current cursor with your default web browser.
A command :GhtrendingDev
present to popup a window to display github trending developers.
A command :GhtrendingOpenDev
present to open the most popular repository of the developer under current cursor with your default web browser.
Left pane:
popups.left_popup:map("n", "q", function()
layout:unmount()
end, { silent = true })
popups.left_popup:map("n", "<esc>", function()
layout:unmount()
end, { silent = true })
popups.left_popup:map("n", "L", function()
vim.api.nvim_set_current_win(popups.right_popup.winid)
end, { silent = true })
Right pane:
popups.right_popup:map("n", "H", function()
vim.api.nvim_set_current_win(popups.left_popup.winid)
end, { silent = true })