diff --git a/tasks/apt.yaml b/tasks/apt.yaml index d1791d3..2905e59 100644 --- a/tasks/apt.yaml +++ b/tasks/apt.yaml @@ -4,4 +4,4 @@ apt: pkg: - socat - + - fish diff --git a/tasks/fish.yaml b/tasks/fish.yaml new file mode 100644 index 0000000..fb0076c --- /dev/null +++ b/tasks/fish.yaml @@ -0,0 +1,15 @@ +--- + +- name: fish config directory + file: + path: ~/.config/fish + state: directory + +- name: fish config files + template: + src: fish/{{ item }}.fish.j2 + dest: ~/.config/fish/{{ item }}.fish + with_items: + - fish_title + - fish_prompt + - fish_greeting diff --git a/templates/fish/fish_greeting.fish.j2 b/templates/fish/fish_greeting.fish.j2 new file mode 100644 index 0000000..488f4d6 --- /dev/null +++ b/templates/fish/fish_greeting.fish.j2 @@ -0,0 +1,2 @@ +# disable greeting +set fish_greeting diff --git a/templates/fish/fish_prompt.fish.j2 b/templates/fish/fish_prompt.fish.j2 new file mode 100644 index 0000000..d3942d8 --- /dev/null +++ b/templates/fish/fish_prompt.fish.j2 @@ -0,0 +1,21 @@ +# target format: user@host:~$ +function fish_prompt --description 'prompt' + set -l color_cwd + set -l suffix + switch $USER + case root toor + if set -q fish_color_cwd_root + set color_cwd $fish_color_cwd_root + else + set color_cwd $fish_color_cwd + end + set suffix '#' + case '*' + set color_cwd $fish_color_cwd + set suffix '>' + end + + set -g fish_prompt_pwd_dir_length 0 + + echo -n -s "$USER" @ "$__fish_prompt_hostname" : (set_color $color_cwd) (prompt_pwd) (set_color normal) " $suffix " +end diff --git a/templates/fish/fish_title.fish.j2 b/templates/fish/fish_title.fish.j2 new file mode 100644 index 0000000..d105475 --- /dev/null +++ b/templates/fish/fish_title.fish.j2 @@ -0,0 +1,11 @@ +function fish_title + set -l suffix + switch $USER + case root toor + set suffix '#' + case '*' + set suffix '>' + end + + echo -n -s "(prompt_pwd) " $suffix $_" +end