mirror of
https://github.com/jbowdre/dotfiles.git
synced 2024-11-22 01:12:19 +00:00
modularize fish
This commit is contained in:
parent
124ca467d1
commit
f989b1d8ca
3 changed files with 75 additions and 9 deletions
|
@ -2,6 +2,7 @@
|
|||
# Common CLI apps
|
||||
|
||||
imports = [
|
||||
./fish.nix
|
||||
./tmux.nix
|
||||
./vim.nix
|
||||
];
|
||||
|
|
74
nix/home/features/cli/fish.nix
Normal file
74
nix/home/features/cli/fish.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
hasPackage = pname: lib.any (p: p ? pname && p.name == pname) config.home.packages;
|
||||
hasExa = hasPackage "exa";
|
||||
in
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
shellAbbrs = rec {
|
||||
jqless = "jq -C | less -r";
|
||||
ls = mkIf hasExa "exa";
|
||||
vi = "vim";
|
||||
v = "vim";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
|
||||
};
|
||||
|
||||
functions = {
|
||||
# Disable greeting
|
||||
fish_greeting = "";
|
||||
# Rebuild home-manager
|
||||
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
|
||||
};
|
||||
|
||||
shellInit = "source ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish";
|
||||
|
||||
interactiveShellInit =
|
||||
# Open command buffer in vim when alt+e is pressed
|
||||
''
|
||||
bind \ee edit_command_buffer
|
||||
'' +
|
||||
# Use vim bindings and cursors
|
||||
''
|
||||
fish_vi_key_bindings
|
||||
set fish_cursor_default block blink
|
||||
set fish_cursor_insert line blink
|
||||
set fish_cursor_replace_one underscore blink
|
||||
set fish_cursor_visual block
|
||||
'' +
|
||||
# Use terminal colors
|
||||
''
|
||||
set -U fish_color_autosuggestion brblack
|
||||
set -U fish_color_cancel -r
|
||||
set -U fish_color_command brgreen
|
||||
set -U fish_color_comment brmagenta
|
||||
set -U fish_color_cwd green
|
||||
set -U fish_color_cwd_root red
|
||||
set -U fish_color_end brmagenta
|
||||
set -U fish_color_error brred
|
||||
set -U fish_color_escape brcyan
|
||||
set -U fish_color_history_current --bold
|
||||
set -U fish_color_host normal
|
||||
set -U fish_color_match --background=brblue
|
||||
set -U fish_color_normal normal
|
||||
set -U fish_color_operator cyan
|
||||
set -U fish_color_param brblue
|
||||
set -U fish_color_quote yellow
|
||||
set -U fish_color_redirection bryellow
|
||||
set -U fish_color_search_match 'bryellow' '--background=brblack'
|
||||
set -U fish_color_selection 'white' '--bold' '--background=brblack'
|
||||
set -U fish_color_status red
|
||||
set -U fish_color_user brgreen
|
||||
set -U fish_color_valid_path --underline
|
||||
set -U fish_pager_color_completion normal
|
||||
set -U fish_pager_color_description yellow
|
||||
set -U fish_pager_color_prefix 'white' '--bold' '--underline'
|
||||
set -U fish_pager_color_progress 'brwhite' '--background=cyan'
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -37,14 +37,6 @@
|
|||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
fish = {
|
||||
enable = true;
|
||||
shellInit = "source ${config.home.homeDirectory}/.nix-profile/etc/profile.d/nix.fish";
|
||||
functions = {
|
||||
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
|
||||
};
|
||||
};
|
||||
|
||||
git = {
|
||||
enable = lib.mkDefault true;
|
||||
delta.enable = true;
|
||||
|
@ -56,7 +48,6 @@
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
targets.genericLinux.enable = true;
|
||||
|
|
Loading…
Reference in a new issue