Factor out fish module
This commit is contained in:
parent
8dd5a33171
commit
345d9257c5
|
@ -67,92 +67,6 @@ with lib; {
|
|||
tmate
|
||||
];
|
||||
})
|
||||
(mkIf config.nathan.programs.util.fish {
|
||||
#########################
|
||||
## Fish Configuration
|
||||
#########################
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
# Setup our aliases
|
||||
shellAliases = {
|
||||
ls = "exa --icons";
|
||||
la = "exa --icons -a";
|
||||
lg = "exa --icons --git";
|
||||
cat = "bat";
|
||||
dig = "dog";
|
||||
df = "duf";
|
||||
idris2 = "rlwrap -s 1000 idris2 --no-banner";
|
||||
};
|
||||
# Custom configuration
|
||||
interactiveShellInit = ''
|
||||
# Setup any-nix-shell
|
||||
any-nix-shell fish --info-right | source
|
||||
# Load logger function
|
||||
source ~/.config/fish/functions/cmdlogger.fish
|
||||
# Load up vi keybindings
|
||||
fish_vi_key_bindings
|
||||
'';
|
||||
functions = {
|
||||
# Setup command logging to ~/.logs
|
||||
cmdlogger = {
|
||||
onEvent = "fish_preexec";
|
||||
body = ''
|
||||
mkdir -p ~/.logs
|
||||
echo (date -u +"%Y-%m-%dT%H:%M:%SZ")" "(echo %self)" "(pwd)": "$argv >> ~/.logs/(hostname)-(date "+%Y-%m-%d").log
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
directory = {
|
||||
truncation_length = 3;
|
||||
fish_style_pwd_dir_length = 1;
|
||||
};
|
||||
git_commit = {
|
||||
commit_hash_length = 6;
|
||||
only_detached = false;
|
||||
};
|
||||
package = { symbol = ""; };
|
||||
time = {
|
||||
disabled = false;
|
||||
format = "[$time]($style)";
|
||||
time_format = "%I:%M %p";
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "zenburn";
|
||||
style = "header,rule,snip,changes";
|
||||
};
|
||||
};
|
||||
#########################
|
||||
## Readline + fzf and other quality of life stuff
|
||||
#########################
|
||||
programs.readline = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
set editing-mode vi
|
||||
set show-all-if-ambiguous on
|
||||
set editing-mode vi
|
||||
|
||||
set keymap vi-command
|
||||
# these are for vi-command mode
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
j: history-search-forward
|
||||
k: history-search-backward
|
||||
set keymap vi-insert
|
||||
# these are for vi-insert mode
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
'';
|
||||
};
|
||||
programs.fzf = { enable = true; };
|
||||
})
|
||||
(mkIf config.nathan.programs.util.json {
|
||||
#########################
|
||||
## JSON Utilities
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
{ config, lib, pkgs, inputs, ... }:
|
||||
with lib; {
|
||||
config = mkMerge [
|
||||
(mkIf config.nathan.programs.util.fish {
|
||||
#########################
|
||||
## Fish Configuration
|
||||
#########################
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
# Setup our aliases
|
||||
shellAliases = {
|
||||
ls = "exa --icons";
|
||||
la = "exa --icons -a";
|
||||
lg = "exa --icons --git";
|
||||
cat = "bat";
|
||||
dig = "dog";
|
||||
df = "duf";
|
||||
idris2 = "rlwrap -s 1000 idris2 --no-banner";
|
||||
};
|
||||
# Custom configuration
|
||||
interactiveShellInit = ''
|
||||
# Setup any-nix-shell
|
||||
any-nix-shell fish --info-right | source
|
||||
# Load logger function
|
||||
source ~/.config/fish/functions/cmdlogger.fish
|
||||
# Load up vi keybindings
|
||||
fish_vi_key_bindings
|
||||
'';
|
||||
functions = {
|
||||
# Setup command logging to ~/.logs
|
||||
cmdlogger = {
|
||||
onEvent = "fish_preexec";
|
||||
body = ''
|
||||
mkdir -p ~/.logs
|
||||
echo (date -u +"%Y-%m-%dT%H:%M:%SZ")" "(echo %self)" "(pwd)": "$argv >> ~/.logs/(hostname)-(date "+%Y-%m-%d").log
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
directory = {
|
||||
truncation_length = 3;
|
||||
fish_style_pwd_dir_length = 1;
|
||||
};
|
||||
git_commit = {
|
||||
commit_hash_length = 6;
|
||||
only_detached = false;
|
||||
};
|
||||
package = { symbol = ""; };
|
||||
time = {
|
||||
disabled = false;
|
||||
format = "[$time]($style)";
|
||||
time_format = "%I:%M %p";
|
||||
};
|
||||
};
|
||||
};
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
theme = "zenburn";
|
||||
style = "header,rule,snip,changes";
|
||||
};
|
||||
};
|
||||
#########################
|
||||
## Readline + fzf and other quality of life stuff
|
||||
#########################
|
||||
programs.readline = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
set editing-mode vi
|
||||
set show-all-if-ambiguous on
|
||||
set editing-mode vi
|
||||
|
||||
set keymap vi-command
|
||||
# these are for vi-command mode
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
j: history-search-forward
|
||||
k: history-search-backward
|
||||
set keymap vi-insert
|
||||
# these are for vi-insert mode
|
||||
"\e[A": history-search-backward
|
||||
"\e[B": history-search-forward
|
||||
'';
|
||||
};
|
||||
programs.fzf = { enable = true; };
|
||||
})
|
||||
];
|
||||
}
|
|
@ -14,6 +14,7 @@ with nLib; {
|
|||
../common/programs/terminal.nix
|
||||
../common/programs/git.nix
|
||||
../common/programs/ssh.nix
|
||||
../common/programs/fish.nix
|
||||
./programs/core.nix
|
||||
./programs/emacs.nix
|
||||
./programs/devel.nix
|
||||
|
|
|
@ -14,6 +14,7 @@ with nLib; {
|
|||
../common/programs/terminal.nix
|
||||
../common/programs/git.nix
|
||||
../common/programs/ssh.nix
|
||||
../common/programs/fish.nix
|
||||
./programs/sway.nix
|
||||
./programs/communications.nix
|
||||
./programs/devel.nix
|
||||
|
|
Loading…
Reference in New Issue