update home manager & add gh pr check lualine
This commit is contained in:
parent
1214454969
commit
42004fddfd
15
home.nix
15
home.nix
@ -27,12 +27,10 @@ in
|
|||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
(nerdfonts.override { fonts = [ "Meslo" ]; })
|
(nerdfonts.override { fonts = [ "Meslo" ]; })
|
||||||
android-tools
|
android-tools
|
||||||
awscli2
|
|
||||||
bashInteractive
|
bashInteractive
|
||||||
|
gitAndTools.gh
|
||||||
google-cloud-sdk
|
google-cloud-sdk
|
||||||
htop
|
|
||||||
imagemagick
|
imagemagick
|
||||||
k9s
|
|
||||||
kubectl
|
kubectl
|
||||||
mosh
|
mosh
|
||||||
neofetch
|
neofetch
|
||||||
@ -43,8 +41,19 @@ in
|
|||||||
kitty
|
kitty
|
||||||
] ++ optionals isLinux [ ];
|
] ++ optionals isLinux [ ];
|
||||||
|
|
||||||
|
# GitHub CLI
|
||||||
|
programs.gh = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
git_protocol = "ssh";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Misc Programs
|
# Misc Programs
|
||||||
|
programs.awscli.enable = true;
|
||||||
|
programs.htop.enable = true;
|
||||||
programs.jq.enable = true;
|
programs.jq.enable = true;
|
||||||
|
programs.k9s.enable = true;
|
||||||
programs.pandoc.enable = true;
|
programs.pandoc.enable = true;
|
||||||
|
|
||||||
# Enable Flakes & Commands
|
# Enable Flakes & Commands
|
||||||
|
@ -1,7 +1,49 @@
|
|||||||
|
-- Cached variable
|
||||||
|
local cached_pr_status = ""
|
||||||
|
|
||||||
|
-- Read process output
|
||||||
|
local function read_output(err, data)
|
||||||
|
if err then return end
|
||||||
|
if not data then return end
|
||||||
|
cached_pr_status = data
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Spawn process
|
||||||
|
local function execute_command()
|
||||||
|
local stdout = vim.loop.new_pipe(false)
|
||||||
|
|
||||||
|
local spawn_opts = {
|
||||||
|
detached = true,
|
||||||
|
stdio = {nil, stdout, nil},
|
||||||
|
args = {"-c", "gh pr checks | awk '{ print $2 }'"}
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.loop.spawn("bash", spawn_opts,
|
||||||
|
function() stdout:read_start(read_output) end)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Spawn & schedule process
|
||||||
|
execute_command()
|
||||||
|
vim.fn.timer_start(300000, execute_command)
|
||||||
|
|
||||||
|
-- Return status from cache
|
||||||
|
function pr_status()
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- PENDING COLOR - #d29922
|
||||||
|
-- PASS COLOR - #3fb950
|
||||||
|
-- FAIL COLOR - #f85149
|
||||||
|
return cached_pr_status:gsub("\n", ""):gsub("fail", " "):gsub("pass",
|
||||||
|
" ")
|
||||||
|
:gsub("pending", " "):sub(1, -2)
|
||||||
|
end
|
||||||
|
|
||||||
require('lualine').setup({
|
require('lualine').setup({
|
||||||
options = {
|
options = {
|
||||||
theme = "gruvbox_dark"
|
theme = "gruvbox_dark"
|
||||||
-- theme = "nord"
|
-- theme = "nord"
|
||||||
-- theme = "OceanicNext",
|
-- theme = "OceanicNext",
|
||||||
}
|
},
|
||||||
|
sections = {lualine_c = {{pr_status}}}
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
require("toggleterm").setup({open_mapping = [[<c-\>]]})
|
require("toggleterm").setup({open_mapping = [[<c-\>]]})
|
||||||
|
|
||||||
|
-- Get PR status on terminal load
|
||||||
|
-- require("toggleterm").setup({
|
||||||
|
-- open_mapping = [[<c-\>]],
|
||||||
|
-- on_create = function(term)
|
||||||
|
-- vim.cmd("startinsert")
|
||||||
|
-- term:send("gh pr checks")
|
||||||
|
-- end
|
||||||
|
-- })
|
||||||
|
|
||||||
-- Duplicate C-w & Esc Behavior
|
-- Duplicate C-w & Esc Behavior
|
||||||
function _G.set_terminal_keymaps()
|
function _G.set_terminal_keymaps()
|
||||||
local opts = {buffer = 0}
|
local opts = {buffer = 0}
|
||||||
|
Loading…
Reference in New Issue
Block a user