fish
This commit is contained in:
parent
0b7da58795
commit
18caa32b2c
5 changed files with 162 additions and 84 deletions
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
host,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
|
|
@ -7,6 +6,7 @@
|
|||
./tmux.nix
|
||||
./git.nix
|
||||
./gpg.nix
|
||||
./fish.nix
|
||||
];
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
|
|
@ -18,60 +18,6 @@
|
|||
nvim-pkg
|
||||
];
|
||||
};
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
set fish_greeting # Disable greeting
|
||||
set show_startup_tips false
|
||||
set -U tide_right_prompt_items status\x1ecmd_duration\x1etime
|
||||
'';
|
||||
shellInit = "
|
||||
fish_add_path /usr/local/go/bin
|
||||
fish_add_path ~/go/bin
|
||||
fish_add_path ~/.local/bin
|
||||
set -gx MANPAGER 'nvim +Man!'
|
||||
set -gx EDITOR 'nvim'
|
||||
set -gx _JAVA_AWT_WM_NONREPARENTING 1
|
||||
set -gx NIX_FLAKE '/home/e/dev/nix'
|
||||
";
|
||||
plugins = [
|
||||
{
|
||||
name = "fzf";
|
||||
inherit (pkgs.fishPlugins.fzf-fish) src;
|
||||
}
|
||||
{
|
||||
name = "puffer";
|
||||
inherit (pkgs.fishPlugins.puffer) src;
|
||||
}
|
||||
];
|
||||
functions = {
|
||||
nix = {
|
||||
wraps = "nix";
|
||||
body = ''
|
||||
if status is-interactive
|
||||
and test (count $argv) = 1 -a "$argv[1]" = develop
|
||||
nix develop --command (status fish-path)
|
||||
else
|
||||
command nix $argv
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
shellAbbrs = {
|
||||
g = "git";
|
||||
k = "kubectl";
|
||||
};
|
||||
shellAliases = {
|
||||
":q" = "exit";
|
||||
hms = "home-manager switch --flake $NIX_FLAKE#${host.username}";
|
||||
rbs = "sudo nixos-rebuild switch --flake $NIX_FLAKE#${host.hostName}";
|
||||
mpv = "mpv --no-keepaspect-window";
|
||||
cat = "bat -pp";
|
||||
tcd = "cd $(mktemp -d)";
|
||||
docker = "nerdctl";
|
||||
vimdiff = "nvim -d";
|
||||
};
|
||||
};
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
|
|
|||
97
home-manager/shared/programs/shell/fish.nix
Normal file
97
home-manager/shared/programs/shell/fish.nix
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
{pkgs, host, ...}: {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
interactiveShellInit = ''
|
||||
set fish_greeting # Disable greeting
|
||||
set show_startup_tips false
|
||||
set -U tide_right_prompt_items status\x1ecmd_duration\x1etime
|
||||
'';
|
||||
shellInit = "
|
||||
fish_add_path /usr/local/go/bin
|
||||
fish_add_path ~/go/bin
|
||||
fish_add_path ~/.local/bin
|
||||
set -gx MANPAGER 'nvim +Man!'
|
||||
set -gx EDITOR 'nvim'
|
||||
set -gx _JAVA_AWT_WM_NONREPARENTING 1
|
||||
set -gx NIX_FLAKE '/home/e/dev/nix'
|
||||
";
|
||||
plugins = [
|
||||
{
|
||||
name = "fzf";
|
||||
inherit (pkgs.fishPlugins.fzf-fish) src;
|
||||
}
|
||||
{
|
||||
name = "puffer";
|
||||
inherit (pkgs.fishPlugins.puffer) src;
|
||||
}
|
||||
];
|
||||
functions = {
|
||||
nix = {
|
||||
wraps = "nix";
|
||||
body = ''
|
||||
if status is-interactive
|
||||
and test (count $argv) = 1 -a "$argv[1]" = develop
|
||||
nix develop --command (status fish-path)
|
||||
else
|
||||
command nix $argv
|
||||
end
|
||||
'';
|
||||
};
|
||||
fish_jj_prompt = {
|
||||
body = ''
|
||||
if not command -sq jj
|
||||
return 1
|
||||
end
|
||||
|
||||
if not jj root &>/dev/null
|
||||
return 1
|
||||
end
|
||||
|
||||
# Generate prompt
|
||||
set -l info "$(
|
||||
jj log --ignore-working-copy --no-graph --color=always --revisions=@ --template "
|
||||
separate(
|
||||
' ',
|
||||
self.change_id().shortest(),
|
||||
bookmarks.join(', '),
|
||||
if(conflict, label('conflict', '×')),
|
||||
if(empty, label('empty', '(empty)')),
|
||||
if(divergent, label('divergent', '(divergent)')),
|
||||
if(hidden, label('hidden', '(hidden)')),
|
||||
)
|
||||
"
|
||||
)"
|
||||
or return 1
|
||||
|
||||
if test -n $info
|
||||
printf ' (jj: %s)' $info
|
||||
else
|
||||
return 1
|
||||
end
|
||||
'';
|
||||
};
|
||||
fish_vcs_prompt = {
|
||||
body = ''
|
||||
fish_jj_prompt $argv
|
||||
or fish_git_prompt $argv
|
||||
or fish_hg_prompt $argv
|
||||
or fish_fossil_prompt $argv
|
||||
'';
|
||||
};
|
||||
};
|
||||
shellAbbrs = {
|
||||
g = "git";
|
||||
k = "kubectl";
|
||||
};
|
||||
shellAliases = {
|
||||
":q" = "exit";
|
||||
hms = "home-manager switch --flake $NIX_FLAKE#${host.username}";
|
||||
rbs = "sudo nixos-rebuild switch --flake $NIX_FLAKE#${host.hostName}";
|
||||
mpv = "mpv --no-keepaspect-window";
|
||||
cat = "bat -pp";
|
||||
tcd = "cd $(mktemp -d)";
|
||||
docker = "nerdctl";
|
||||
vimdiff = "nvim -d";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
git -C "$left" commit -q -m baseline --allow-empty
|
||||
mv "$left/.git" "$right"
|
||||
git -C "$right" add --intent-to-add -A
|
||||
(cd "$right"; nvim -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen)
|
||||
(cd "$right"; nvim -c "lua vim.g.snacks_indent=false" -c "lua require('lazy').load({plugins = {'diffview.nvim'}})" -c DiffviewOpen)
|
||||
git -C "$right" diff-index --quiet --cached HEAD && { echo "No changes done, aborting split."; exit 1; }
|
||||
git -C "$right" commit -q -m split
|
||||
git -C "$right" restore . # undo changes in modified files
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue