feat: git-worktree; fix: htran should work, kpxc sadge

telescope-reuse-window
htran 2023-09-30 21:03:22 -07:00
parent bcc7f68c1e
commit 75ba98e276
5 changed files with 128 additions and 66 deletions

View File

@ -499,12 +499,21 @@ require('telescope').setup {
-- Telescope key remap stuffs -- Telescope key remap stuffs
pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'file_browser') pcall(require('telescope').load_extension, 'file_browser')
pcall(require('telescope').load_extension, 'git_worktree')
remap('n', '<C-p>', '<cmd>Telescope<cr>', { desc = 'Open Telescope general search' }) remap('n', '<C-p>', '<cmd>Telescope<cr>', { desc = 'Open Telescope general search' })
remap('n', '<leader>fm', function() remap('n', '<leader>fm', function()
require("telescope").extensions.file_browser.file_browser({}) require("telescope").extensions.file_browser.file_browser({})
end, { desc = '[F]ile [M]utation' }) end, { desc = '[F]ile [M]utation' })
remap('n', '<leader>ft', function()
require("telescope").extensions.git_worktree.git_worktrees()
end, { desc = '[F]ind [T]ree' })
remap('n', '<leader>tm', function()
require("telescope").extensions.git_worktree.create_git_worktree()
end, { desc = '[T]ree [M]utate' })
remap('n', '<leader>ff', function() remap('n', '<leader>ff', function()
require('telescope.builtin').find_files({ require('telescope.builtin').find_files({
hidden = false, hidden = false,

View File

@ -20,13 +20,15 @@
}; };
base-modules = [ base-modules = [
home-profiles.alacritty # home-profiles.alacritty
home-modules.alacritty
home-profiles.kitty home-profiles.kitty
home-profiles.git home-profiles.git
home-profiles.ssh home-profiles.ssh
home-profiles.shells home-profiles.shells
{config.programs.home-manager.enable = true;} {config.programs.home-manager.enable = true;}
home-profiles.nix-index # home-profiles.nix-index
home-profiles.neovim home-profiles.neovim
]; ];
in { in {
@ -42,15 +44,14 @@ in {
home-profiles.nerd_font_module home-profiles.nerd_font_module
home-profiles.git-htran home-profiles.git-htran
home-profiles.dev-packages home-profiles.dev-packages
home-profiles.zk # home-profiles.zk
home-modules.darwin-spotlight home-modules.darwin-spotlight
{ {
home.username = "htran"; home.username = "htran";
home.homeDirectory = "/Users/htran"; home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11"; home.stateVersion = "23.11";
} }
home-profiles.passman # home-profiles.passman
]; ];
}; };
}; };
@ -67,47 +68,13 @@ in {
home-profiles.nerd_font_module home-profiles.nerd_font_module
home-profiles.git-pegasust home-profiles.git-pegasust
home-profiles.dev-packages home-profiles.dev-packages
home-profiles.zk # home-profiles.zk
home-modules.darwin-spotlight home-modules.darwin-spotlight
{ {
home.username = "hungtran"; home.username = "hungtran";
home.homeDirectory = "/Users/hungtran"; home.homeDirectory = "/Users/hungtran";
home.stateVersion = "23.11"; home.stateVersion = "23.11";
repo.shells.shellAliases = {
git-lol = ''
git log --graph --decorate --color=always --abbrev-commit \
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'';
git-lola = ''
git log --graph --decorate --color=always --abbrev-commit --all\
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'';
};
} }
]; ];
}; };

View File

@ -210,10 +210,12 @@ in {
]; ];
}; };
passman = { passman = {pkgs}: {
# Bruh, keepassxc on Darwin doesn't contain cli # Bruh, keepassxc on Darwin doesn't contain cli
# On Linux, however, it correctly gives `keepassxc-cli` # On Linux, however, it correctly gives `keepassxc-cli`
home.packages = [cell.packages.kpxc]; home.packages = assert !pkgs.stdenv.isDarwin || throw "kpxc known to have caused sandbox-exec problem"; [
cell.packages.kpxc
];
}; };
darwin-patches = { darwin-patches = {
@ -221,4 +223,17 @@ in {
# a community-driven project. Things fail to build all the time. # a community-driven project. Things fail to build all the time.
manual.manpages.enable = false; manual.manpages.enable = false;
}; };
# inspo: https://github.com/NixOS/nixpkgs/blob/0396d3b0fb7f62ddc79a506ad3e6124f01d2ed0a/nixos/modules/rename.nix
rename = {
config,
options,
pkgs,
}: {
imports = let
inherit (pkgs.lib) mkRemovedOptionModule;
in [
(mkRemovedOptionModule ["programs" "nix-index" "enable"] "nix-index seems to not really benefit us")
];
};
} }

View File

@ -88,6 +88,42 @@ in {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
initExtra = cfg.shellInitExtra or ""; initExtra = cfg.shellInitExtra or "";
shellAliases =
{
git-lol = ''
git log --graph --decorate --color=always --abbrev-commit \
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'';
git-lola = ''
git log --graph --decorate --color=always --abbrev-commit --all\
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'';
}
// (cfg.shellAliases or {});
}; };
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -97,6 +133,38 @@ in {
{ {
nix-rebuild = "sudo nixos-rebuild switch"; nix-rebuild = "sudo nixos-rebuild switch";
hm-switch = "home-manager switch --flake"; hm-switch = "home-manager switch --flake";
git-lol = ''
git log --graph --decorate --color=always --abbrev-commit \
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'';
git-lola = ''
git log --graph --decorate --color=always --abbrev-commit --all\
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'';
} }
// (cfg.shellAliases or {}); // (cfg.shellAliases or {});
history = { history = {

View File

@ -8,6 +8,8 @@ in {
kpxc = let kpxc = let
inherit (pkgs) keepassxc; inherit (pkgs) keepassxc;
in in
if pkgs.stdenv.isDarwin
then
pkgs.stdenv.mkDerivation { pkgs.stdenv.mkDerivation {
pname = "keepassxc-darwin"; pname = "keepassxc-darwin";
version = keepassxc.version; version = keepassxc.version;
@ -33,7 +35,8 @@ in {
// { // {
description = "Wrapper for keepassxc and keepassxc-cli with additional Darwin-specific fixes"; description = "Wrapper for keepassxc and keepassxc-cli with additional Darwin-specific fixes";
}; };
}; }
else keepassxc;
pixi-edit = inputs.cells.dev.packages.pixi-edit; pixi-edit = inputs.cells.dev.packages.pixi-edit;