use starship

This commit is contained in:
foosinn 2020-06-13 23:19:34 +02:00
parent 7711e69e5c
commit d5165d670e
2 changed files with 20 additions and 12 deletions

7
dotfiles/starship.toml Normal file
View file

@ -0,0 +1,7 @@
add_newline = false
[username]
show_always = true
[hostname]
ssh_only = false

View file

@ -1,9 +1,8 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
let
unstable = import <nixos-unstable> {};
in {
environment.systemPackages = with pkgs; [
bash
bat
@ -15,13 +14,23 @@
jq
ripgrep
z-lua
unstable.starship
(import ../packages/neovim.nix)
];
environment = {
etc = {
"starship.toml".source = ../dotfiles/starship.toml;
};
};
programs.bash = {
promptInit = ''
. <(starship init bash)
'';
interactiveShellInit = ''
export EDITOR=nvim
export STARSHIP_CONFIG=/etc/starship.toml
if [ -z "$SSH_AUTH_SOCK" ]; then
eval $(ssh-agent)
@ -43,14 +52,6 @@
fi
}
git_branch(){
branch=$(git branch 2> /dev/null) || exit 0
branch=$(sed -n '/^*/ s/* \(.*\)/\1/p' <<< $branch)
status=$(git status 2> /dev/null \
| grep -q "nothing to commit, working tree clean" || e cho -n '*')
echo "$branch$status "
}
. "$(fzf-share)/key-bindings.bash"
. "$(fzf-share)/completion.bash"
. <(z --init bash)