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; [
|
||||
(nerdfonts.override { fonts = [ "Meslo" ]; })
|
||||
android-tools
|
||||
awscli2
|
||||
bashInteractive
|
||||
gitAndTools.gh
|
||||
google-cloud-sdk
|
||||
htop
|
||||
imagemagick
|
||||
k9s
|
||||
kubectl
|
||||
mosh
|
||||
neofetch
|
||||
@ -43,8 +41,19 @@ in
|
||||
kitty
|
||||
] ++ optionals isLinux [ ];
|
||||
|
||||
# GitHub CLI
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
};
|
||||
};
|
||||
|
||||
# Misc Programs
|
||||
programs.awscli.enable = true;
|
||||
programs.htop.enable = true;
|
||||
programs.jq.enable = true;
|
||||
programs.k9s.enable = true;
|
||||
programs.pandoc.enable = true;
|
||||
|
||||
# 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({
|
||||
options = {
|
||||
theme = "gruvbox_dark"
|
||||
-- theme = "nord"
|
||||
-- theme = "OceanicNext",
|
||||
}
|
||||
},
|
||||
sections = {lualine_c = {{pr_status}}}
|
||||
})
|
||||
|
@ -1,5 +1,14 @@
|
||||
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
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = {buffer = 0}
|
||||
|
Loading…
Reference in New Issue
Block a user