Some fish shell changes

This commit is contained in:
Natsu Kagami 2023-07-09 17:31:59 +02:00
parent a6aeb27729
commit c4e4292e12
Signed by: nki
GPG key ID: 55A032EB38B49ADB

View file

@ -1,11 +1,18 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
with lib;
{ {
imports = [ imports = [
./tide/nix-shell.nix ./tide/nix-shell.nix
]; ];
home.packages = with pkgs; [ options.programs.fish.everywhereAbbrs = mkOption {
type = types.attrsOf types.str;
description = "Abbreviations that expands everywhere";
default = { };
};
config.home.packages = with pkgs; [
timg timg
# For fzf.fish # For fzf.fish
fzf fzf
@ -13,7 +20,7 @@
bat bat
]; ];
programs.fish = { config.programs.fish = {
enable = true; enable = true;
functions = { functions = {
# Simplify nix usage! # Simplify nix usage!
@ -73,6 +80,7 @@
wraps = "rg"; wraps = "rg";
description = "Search with ripgrep and put results into the editor"; description = "Search with ripgrep and put results into the editor";
}; };
echo-today = "date +%F";
}; };
tide = { tide = {
@ -83,10 +91,13 @@
cat = "bat --theme=GitHub "; cat = "bat --theme=GitHub ";
catp = "bat --theme=GitHub -p "; catp = "bat --theme=GitHub -p ";
l = "exa -l --color=always "; l = "exa -l --color=always ";
};
# My own commands for easy access everywhereAbbrs = {
thisterm = "cd ~/Projects/uw/$CURRENT_TERM"; lsports =
today = "date +%F"; if pkgs.stdenv.isDarwin
then "lsof -i -P | grep LISTEN"
else "ss -tulp";
}; };
shellInit = '' shellInit = ''
@ -136,6 +147,16 @@
bind -M default gi beginning-of-line bind -M default gi beginning-of-line
bind -M default gl end-of-line bind -M default gl end-of-line
# Everywhere abbrs
${
concatStringsSep "\n"
(mapAttrsToList (k: v: "abbr --add --position anywhere -- ${k} ${escapeShellArg v}")
config.programs.fish.everywhereAbbrs)
}
# Replace today with actual today
abbr --add --position anywhere today -f echo-today
# Set up direnv # Set up direnv
# ${pkgs.direnv}/bin/direnv hook fish | source # ${pkgs.direnv}/bin/direnv hook fish | source
@ -192,7 +213,7 @@
}; };
# Source files # Source files
home.file = { config.home.file = {
"fish/change_cmd.fish" = { "fish/change_cmd.fish" = {
source = ./. + "/change_cmd.fish"; source = ./. + "/change_cmd.fish";
target = ".config/fish/conf.d/change_cmd.fish"; target = ".config/fish/conf.d/change_cmd.fish";