mirror of
https://github.com/elkowar/dots-of-war.git
synced 2024-11-06 03:12:24 +00:00
add fish to nix
This commit is contained in:
parent
b3eaf2bb34
commit
4893da9523
4 changed files with 172 additions and 2 deletions
|
@ -1 +1 @@
|
|||
/nix/store/v0n44jjhbc1jh715dysni16gyskaf3g4-home-manager-files/.config/htop/htoprc
|
||||
/nix/store/mq1kmcv74gnyvvjsp5djgsd5p8hqsqx1-home-manager-files/.config/htop/htoprc
|
58
files/nix-stuff/nixpkgs/config/fish-prompt.fish
Normal file
58
files/nix-stuff/nixpkgs/config/fish-prompt.fish
Normal file
|
@ -0,0 +1,58 @@
|
|||
function __fish_vi_mode_prompt_real
|
||||
set -l turquoise (set_color 5fdfff)
|
||||
set -l orange (set_color df5f00)
|
||||
switch $fish_bind_mode
|
||||
case insert
|
||||
echo -n "─"
|
||||
case default
|
||||
echo -n $turquoise'N'
|
||||
case visual
|
||||
echo -n $orange'V'
|
||||
case replace_one
|
||||
echo -n $turquoise'R'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Cache exit status
|
||||
set -l last_status $status
|
||||
|
||||
# Gruvboxy
|
||||
set -l normal ( set_color normal)
|
||||
set -l white ( set_color ebdbb2)
|
||||
set -l turquoise ( set_color 83a598)
|
||||
set -l orange ( set_color fe8019)
|
||||
set -l aqua ( set_color 8ec07c)
|
||||
set -l blue ( set_color 83a598)
|
||||
set -l limegreen ( set_color b8bb26)
|
||||
set -l purple ( set_color d3869b)
|
||||
|
||||
|
||||
# Configure __fish_git_prompt
|
||||
set -g __fish_git_prompt_char_stateseparator ' '
|
||||
set -g __fish_git_prompt_color 5fdfff
|
||||
set -g __fish_git_prompt_color_flags df5f00
|
||||
set -g __fish_git_prompt_color_prefix white
|
||||
set -g __fish_git_prompt_color_suffix white
|
||||
set -g __fish_git_prompt_showdirtystate true
|
||||
set -g __fish_git_prompt_showuntrackedfiles true
|
||||
set -g __fish_git_prompt_showstashstate true
|
||||
set -g __fish_git_prompt_show_informative_status true
|
||||
|
||||
set -l current_user (whoami)
|
||||
set -l vi_mode (__fish_vi_mode_prompt_real)
|
||||
set -l git_prompt (__fish_git_prompt " (%s)")
|
||||
#(pwd|sed "s=$HOME=~=")
|
||||
|
||||
set -g fish_prompt_pwd_dir_length 1
|
||||
|
||||
echo -n $white'╭─'$vi_mode
|
||||
echo -n $white'─'$aqua$current_user$white' in '$limegreen(prompt_pwd)
|
||||
echo -n $turquoise$git_prompt
|
||||
if test $last_status -gt 0
|
||||
echo -n ' '$orange$last_status
|
||||
end
|
||||
echo
|
||||
|
||||
echo -n $white'╰─λ '
|
||||
echo -n $normal
|
111
files/nix-stuff/nixpkgs/config/fish.nix
Normal file
111
files/nix-stuff/nixpkgs/config/fish.nix
Normal file
|
@ -0,0 +1,111 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.elkowar.programs.fish;
|
||||
myConf = import ../myConfig.nix;
|
||||
in
|
||||
{
|
||||
options.elkowar.programs.fish = {
|
||||
enable = lib.mkEnableOption "Fish configuration";
|
||||
};
|
||||
config = {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
functions = {
|
||||
fish_prompt = builtins.readFile ./fish-prompt.fish;
|
||||
fish_greeting = "";
|
||||
fish_mode_prompt = "";
|
||||
};
|
||||
|
||||
shellAliases = {
|
||||
ls = "exa --icons";
|
||||
};
|
||||
|
||||
shellAbbrs = {
|
||||
vim = "nvim";
|
||||
tsh = "trash";
|
||||
cxmonad = "nvim /home/leon/.xmonad/lib/Config.hs";
|
||||
cnix = "cd ~/nixpkgs/ && nvim home.nix && cd -";
|
||||
|
||||
gaa = "git add --all";
|
||||
gc = "git commit -m ";
|
||||
gp = "git push";
|
||||
gs = "git status";
|
||||
};
|
||||
|
||||
plugins =
|
||||
[
|
||||
{
|
||||
name = "foreign-env";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "oh-my-fish";
|
||||
repo = "plugin-foreign-env";
|
||||
rev = "dddd9213272a0ab848d474d0cbde12ad034e65bc";
|
||||
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
shellInit = ''
|
||||
fish_vi_key_bindings
|
||||
|
||||
#set -U FZF_TMUX 1
|
||||
set -U FZF_DEFAULT_COMMANDS "--filepath-word --cycle"
|
||||
set -U FZF_PREVIEW_FILE_CMD "head -n 10 | bat --color=always --decorations=never"
|
||||
set -U fish_greeting
|
||||
|
||||
|
||||
#if status is-interactive
|
||||
#and not set -q TMUX
|
||||
#exec tmux
|
||||
#end
|
||||
|
||||
|
||||
[ (hostname) = "garnix" ] && alias rm='echo "rm is disabled. Please use trash instead."; false'
|
||||
|
||||
function run_pipr
|
||||
set -l commandline (commandline -b)
|
||||
pipr --out-file /tmp/pipr_out --default "$commandline"
|
||||
set -l result (cat /tmp/pipr_out)
|
||||
commandline -r $result
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
bind \ca run_pipr
|
||||
|
||||
function c
|
||||
set -l result (/home/leon/scripts/conf)
|
||||
commandline -r "$result"
|
||||
commandline -f execute
|
||||
end
|
||||
|
||||
|
||||
function replace_with_yay
|
||||
set -l cmd (commandline -b)
|
||||
switch $cmd
|
||||
case "*pacman*"
|
||||
set edited (echo $cmd | sed 's/sudo //g' | sed 's/pacman/yay/g')
|
||||
case "yay*"
|
||||
set edited (echo $cmd | sed 's/yay/sudo pacman/g')
|
||||
end
|
||||
commandline -r "$edited"
|
||||
commandline -f repaint
|
||||
end
|
||||
|
||||
bind \cy replace_with_yay
|
||||
|
||||
# fff file manager cd on exit
|
||||
function f
|
||||
fff $argv
|
||||
set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME $HOME/.cache
|
||||
cd (cat $XDG_CACHE_HOME/fff/.fff_d)
|
||||
end
|
||||
set -x EDITOR "nvim"
|
||||
set -x FFF_TRASH_CMD "trash" # make fff's trash function use trash-cli
|
||||
|
||||
fenv source '$HOME/.nix-profile/etc/profile.d/nix.sh'
|
||||
set -g NIX_PATH "$HOME/.nix-defexpr/channels:$NIX_PATH"
|
||||
fenv source "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -10,11 +10,12 @@ in
|
|||
#useZsh = lib.mkEnableOption
|
||||
};
|
||||
|
||||
imports = [ ../config/tmux.nix ../config/generalConfig.nix ../config/zsh.nix ];
|
||||
imports = [ ../config/tmux.nix ../config/generalConfig.nix ../config/zsh.nix ../config/fish.nix ];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
elkowar.programs.tmux.enable = true;
|
||||
elkowar.programs.zsh.enable = true;
|
||||
elkowar.programs.fish.enable = true;
|
||||
elkowar.generalConfig.shellAliases = {
|
||||
gc = "git commit";
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue