Update fish prompt + aerc theme

This commit is contained in:
Kujiu 2023-09-06 02:22:26 +02:00
parent fb7afd8a49
commit e838ab664b
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
11 changed files with 701 additions and 53 deletions

View file

@ -34,9 +34,11 @@ You need to install:
- neovim - neovim
- newsboat - newsboat
- offlineimap3 - offlineimap3
- pandoc - pandoc (>= v3.0)
- poezio - poezio
- pyinotify - pyinotify
- python3-pygments
- scdoc
- tmux - tmux
- toot - toot
- unoconv - unoconv

View file

@ -1,5 +1,11 @@
#!/usr/bin/env fish #!/usr/bin/env fish
# #
fundle plugin 'edc/bass'
fundle plugin 'jorgebucaran/nvm.fish'
fundle plugin 'rbenv/fish-rbenv'
fundle init
set -x COLORFGBG "default;default" set -x COLORFGBG "default;default"
set -x VISUAL "nvim" set -x VISUAL "nvim"
set -x EDITOR "lvim" set -x EDITOR "lvim"

View file

@ -2,7 +2,7 @@
# #
function cd function cd
builtin cd $argv source "$__fish_data_dir/functions/cd.fish" $argv
if test -f venv/bin/activate if test -f venv/bin/activate
source venv/bin/activate source venv/bin/activate
else if test -f bin/activate else if test -f bin/activate

View file

@ -19,18 +19,21 @@ function fish_prompt --description 'Write out the prompt'
set -f color_bg1 192330 set -f color_bg1 192330
set -f color_bg2 212e3f set -f color_bg2 212e3f
set -f color_bg3 29394f set -f color_bg3 29394f
set -f color_status $color_yellow set -f color_bg4 39506d
set -f color_sel0 2b3b51
set -f color_sel1 3c5372
set -f color_status $color_green
set -f color_bind $color_green set -f color_bind $color_green
set -f color_cwd $fish_color_cwd set -f color_cwd $fish_color_cwd
set -f color_vcs_text $color_yellow set -f color_vcs_text $color_yellow
set -f color_vcs_bg $color_bg3 set -f color_vcs_bg $color_bg2
set -f char_bind 'E' set -f char_bind 'E'
set -f char_user_cwd '%' set -f char_user_cwd '%'
set -f char_root_cwd '#' set -f char_root_cwd '#'
set -l last_status $status set -f last_status $status
set -l normal (set_color normal) set -f normal (set_color normal)
set -l prompt_status "" set -f prompt_status "✔"
set -g __fish_git_prompt_color $color_blue set -g __fish_git_prompt_color $color_blue
set -g __fish_git_prompt_showstashstate 1 set -g __fish_git_prompt_showstashstate 1
@ -82,34 +85,55 @@ function fish_prompt --description 'Write out the prompt'
set -g __fish_git_prompt_color_upstream_done $normal set -g __fish_git_prompt_color_upstream_done $normal
# We don't want the leading space. # We don't want the leading space.
set -l vcs (fish_vcs_prompt '%s' 2>/dev/null) set -f vcs (fish_vcs_prompt '%s' 2>/dev/null)
# Since we display the prompt on a new line allow the directory names to be longer. # Since we display the prompt on a new line allow the directory names to be longer.
set -q fish_prompt_pwd_dir_length set -q fish_prompt_pwd_dir_length
or set -lx fish_prompt_pwd_dir_length 0 or set -lx fish_prompt_pwd_dir_length 0
# Color the prompt differently when we're root # Color the prompt differently when we're root
set -l suffix $char_user_cwd set -f suffix $char_user_cwd
if functions -q fish_is_root_user; and fish_is_root_user if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root set -f color_cwd $fish_color_cwd_root
end end
set suffix $char_root_cwd set -f suffix $char_root_cwd
end end
# Color the prompt in red on error # Color the prompt in red on error
if test $last_status -ne 0 if test $last_status -ne 0
set color_status $color_red set -f color_status $color_red
set prompt_status "[" $last_status "]" set -f prompt_status "[" $last_status "]"
end end
echo -s (prompt_login) (set_color -b $color_cwd $color_text) (prompt_pwd) (set_color -b $color_vcs_bg $color_cwd) '' (set_color -b $color_vcs_bg $color_vcs_text) (fish_vcs_prompt) (set_color -b normal $color_vcs_bg) '' $normal set -f string_env ""
set -f string_venv ""
set -f string_rbenv ""
set -f string_nvm (nvm current)
if command -q rbenv
set -f string_rbenv (rbenv local)
if not test -n string_rbenv
set -f string_rbenv (rbenv global)
end
if test {"$string_rbenv"} = "system"
set -f string_rbenv ""
end
end
if test {"$string_nvm"} = "system"
set -f string_nvm ""
end
set -l venv ""
set -q VIRTUAL_ENV_DISABLE_PROMPT set -q VIRTUAL_ENV_DISABLE_PROMPT
or set -g VIRTUAL_ENV_DISABLE_PROMPT true or set -g VIRTUAL_ENV_DISABLE_PROMPT true
set -q VIRTUAL_ENV set -q VIRTUAL_ENV
and set -l venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV") and set -f string_venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV")
if test -n {"$string_rbenv"} || test -n {"$string_nvm"} || test -n {"$string_venv"}
set -f string_env "$string_nvm| $string_rbenv| $string_venv"
end
# Do nothing if not in vi mode # Do nothing if not in vi mode
if test "$fish_key_bindings" = fish_vi_key_bindings if test "$fish_key_bindings" = fish_vi_key_bindings
@ -119,13 +143,13 @@ function fish_prompt --description 'Write out the prompt'
set -f color_bind $color_red set -f color_bind $color_red
set -f char_bind 'N' set -f char_bind 'N'
case insert case insert
set -f color_bind $color_green set -f color_bind $color_yellow
set -f char_bind 'I' set -f char_bind 'I'
case replace_one case replace_one
set -f color_bind $color_blue set -f color_bind $color_cyan
set -f char_bind 'r' set -f char_bind 'r'
case replace case replace
set -f color_bind $color_cyan set -f color_bind $color_blue
set -f char_bind 'R' set -f char_bind 'R'
case visual case visual
set -f color_bind $color_magenta set -f color_bind $color_magenta
@ -133,10 +157,29 @@ function fish_prompt --description 'Write out the prompt'
end end
end end
echo -n -s $normal echo -n -s (prompt_login)
echo -n -s (set_color --bold -b $color_bind $color_text) $char_bind (set_color -b $color_venv $color_bind) ''
echo -n -s (set_color --bold -b $color_venv $color_text) $venv (set_color -b $color_status $color_venv) '' echo -n -s (set_color -b $color_venv $color_text) $string_env
echo -n -s (set_color -b $color_status $color_text) $prompt_status $suffix (set_color -b normal $color_status) ' ' $normal echo -n -s (set_color -b $color_status $color_venv) ''
echo -n -s (set_color -b $color_status $color_text) $prompt_status
echo -n -s (set_color -b normal $color_status) ''
echo $normal
echo -n -s (set_color -b $color_cwd $color_text) (prompt_pwd)
echo -n -s (set_color -b $color_vcs_bg $color_cwd) ''
echo -n -s (set_color -b $color_vcs_bg $color_vcs_text) (fish_vcs_prompt)
echo -n -s (set_color -b normal $color_vcs_bg) '' $normal
echo -s $normal
echo -n -s (set_color --bold -b $color_bind $color_text) $char_bind
echo -n -s (set_color -b $color_status $color_bind) ''
echo -n -s (set_color -b $color_cwd $color_text) $suffix
echo -n -s (set_color -b normal $color_cwd) ' ' $normal
end end
function fish_right_prompt -d "Right prompt" function fish_right_prompt -d "Right prompt"

View file

@ -0,0 +1,462 @@
set __fundle_current_version '0.7.1'
function __fundle_seq -a upto
seq 1 1 $upto 2>/dev/null
end
function __fundle_next_arg -a index
set -l args $argv[2..-1]
set -l arg_index (math $index + 1)
if test (count $args) -lt $arg_index
echo "missing argument for $args[$index]"
return 1
end
set -l arg $args[$arg_index]
switch $arg
case '--*'
echo "expected argument for $args[$index], got $arg"; and return 1
case '*'
echo $arg; and return 0
end
end
function __fundle_compare_versions -a version1 -a version2
for i in (__fundle_seq 4)
set -l v1 (echo $version1 | cut -d '.' -f $i | sed -Ee 's/[a-z]+//g')
set -l v2 (echo $version2 | cut -d '.' -f $i | sed -Ee 's/[a-z]+//g')
if test \( -n $v1 -a -z $v2 \) -o \( -n $v1 -a -n $v2 -a $v1 -lt $v2 \)
echo -n "lt"; and return 0
else if test \( -z $v1 -a -n $v2 \) -o \( -n $v1 -a -n $v2 -a $v1 -gt $v2 \)
echo -n "gt"; and return 0
end
end
echo -n "eq"; and return 0
end
function __fundle_date -d "returns a date"
set -l d (date +%s%N)
if echo $d | string match -rvq 'N'
echo $d
else
gdate +%s%N
end
return 0
end
function __fundle_self_update -d "updates fundle"
set -l fundle_repo_url "https://github.com/tuvistavie/fundle.git"
# This `sed` stays for now since doing it easily with `string` requires "--filter", which is only in 2.6.0
set -l latest (command git ls-remote --tags $fundle_repo_url | sed -n -e 's|.*refs/tags/v\(.*\)|\1|p' | tail -n 1)
if test (__fundle_compare_versions $latest (__fundle_version)) != "gt"
echo "fundle is already up to date"; and return 0
else
set -l file_url_template 'https://raw.githubusercontent.com/tuvistavie/fundle/VERSION/functions/fundle.fish'
set -l file_url (string replace 'VERSION' -- "v$latest" $file_url_template)
set -l tmp_file (mktemp /tmp/fundle.XXX)
set -l update_message "fundle has been updated to version $latest"
curl -Ls $file_url > $tmp_file; and mv $tmp_file (status -f); and echo $update_message; and return 0
end
end
function __fundle_url_rev -d "prints the revision from the url" -a git_url
set -l rev (echo $git_url | cut -d '#' -f 2 -s)
if test -n "$rev"
echo $rev
else
echo HEAD
end
end
function __fundle_remote_url -d "prints the remote url from the full git url" -a git_url
echo $git_url | cut -d '#' -f 1
end
function __fundle_rev_parse -d "prints the revision if any" -a dir -a commitish
set -l sha (command git --git-dir $dir rev-parse -q --verify $commitish 2>/dev/null)
if test $status -eq 0
echo -n $sha
return 0
end
return 1
end
function __fundle_commit_sha -d "returns sha of the commit-ish" -a dir -a commitish
if test -d "$dir/.git"
set dir "$dir/.git"
end
if __fundle_rev_parse $dir "origin/$commitish"
return 0
end
__fundle_rev_parse $dir $commitish
end
function __fundle_plugins_dir -d "returns fundle directory"
if test -z "$fundle_plugins_dir"
if test -n "$XDG_CONFIG_HOME"
echo $XDG_CONFIG_HOME/fish/fundle
else
echo $HOME/.config/fish/fundle
end
else
echo $fundle_plugins_dir
end
end
function __fundle_no_git -d "check if git is installed"
# `command -q` is >= 2.5.0
if not command -s git > /dev/null 2>&1
echo "git needs to be installed and in the path"
return 0
end
return 1
end
function __fundle_check_date -d "check date"
if date +%s%N | string match -rvq 'N'
return 0
end
if command -s gdate > /dev/null 2>&1
return 0
end
echo "You need to have a GNU date compliant date installed to use profiling. Use 'brew install coreutils' on OSX"
return 1
end
function __fundle_get_url -d "returns the url for the given plugin" -a repo
set split (string split @ $repo)
set repo $split[1]
set tag $split[2]
set url "https://github.com/$repo.git"
test ! -z "$tag"; and set url (string join "#tags/" "$url" "$tag")
echo "$url"
end
function __fundle_plugin_index -d "returns the index of the plugin" -a plugin
for i in (__fundle_seq (count $__fundle_plugin_names))
if test "$__fundle_plugin_names[$i]" = "$plugin"
return $i
end
end
# NOTE: should never reach this point
echo "could not find plugin: $plugin"
exit 1
end
function __fundle_checkout_revision -a plugin -a git_url
set -l plugin_dir (__fundle_plugins_dir)/$plugin
set -l git_dir $plugin_dir/.git
set -l sha (__fundle_commit_sha $git_dir (__fundle_url_rev $git_url))
if test $status -eq 0
command git --git-dir="$git_dir" --work-tree="$plugin_dir" checkout -q -f $sha
else
echo "Could not checkout $plugin revision $sha"
return 1
end
end
function __fundle_update_plugin -d "update the given plugin" -a plugin -a git_url
echo "Updating $plugin"
set -l remote_url (__fundle_remote_url $git_url)
set -l git_dir (__fundle_plugins_dir)/$plugin/.git
command git --git-dir=$git_dir remote set-url origin $remote_url 2>/dev/null
command git --git-dir=$git_dir fetch -q 2>/dev/null
__fundle_checkout_revision $plugin $git_url
end
function __fundle_install_plugin -d "install the given plugin" -a plugin -a git_url
if __fundle_no_git
return 1
end
set -l plugin_dir (__fundle_plugins_dir)/$plugin
set -l git_dir $plugin_dir/.git
set -l remote_url (__fundle_remote_url $git_url)
if test -d $plugin_dir
echo "$argv[1] installed in $plugin_dir"
return 0
else
echo "Installing $plugin"
command git clone -q $remote_url $plugin_dir
__fundle_checkout_revision $plugin $git_url
end
end
function __fundle_update -d "update the given plugin, or all if unspecified" -a plugin
if test -n "$plugin"; and test ! -d (__fundle_plugins_dir)/$plugin/.git
echo "$plugin not installed. You may need to run 'fundle install'"
return 1
end
if test -n "$plugin"
set -l index (__fundle_plugin_index $plugin)
__fundle_update_plugin "$plugin" $__fundle_plugin_urls[$index]
else
for i in (__fundle_seq (count $__fundle_plugin_names))
__fundle_update_plugin $__fundle_plugin_names[$i] $__fundle_plugin_urls[$i]
end
end
end
function __fundle_show_doc_msg -d "show a link to fundle docs"
if test (count $argv) -ge 1
echo $argv
end
echo "See the docs for more info. https://github.com/tuvistavie/fundle"
end
function __fundle_load_plugin -a plugin -a path -a fundle_dir -a profile -d "load a plugin"
if begin; set -q __fundle_loaded_plugins; and contains $plugin $__fundle_loaded_plugins; end
return 0
end
set -l plugin_dir (string replace -r '/.$' '' -- "$fundle_dir/$plugin/$path")
if not test -d $plugin_dir
__fundle_show_doc_msg "$plugin not installed. You may need to run 'fundle install'"
return 1
end
# Take everything but "plugin-" from the last path component
set -l plugin_name (string replace -r '.*/(plugin-)?(.*)$' '$2' -- $plugin)
set -l init_file "$plugin_dir/init.fish"
set -l conf_dir "$plugin_dir/conf.d"
set -l bindings_file "$plugin_dir/key_bindings.fish"
set -l functions_dir "$plugin_dir/functions"
set -l completions_dir "$plugin_dir/completions"
set -l plugin_paths $__fundle_plugin_name_paths
if begin; test -d $functions_dir; and not contains $functions_dir $fish_function_path; end
set fish_function_path $fish_function_path[1] $functions_dir $fish_function_path[2..-1]
end
if begin; test -d $completions_dir; and not contains $completions_dir $fish_complete_path; end
set fish_complete_path $fish_complete_path[1] $completions_dir $fish_complete_path[2..-1]
end
if test -f $init_file
source $init_file
else if test -d $conf_dir
# read all *.fish files in conf.d
for f in $conf_dir/*.fish
source $f
end
else
# For compatibility with oh-my-fish themes, if there is no `init.fish` file in the plugin,
# which is the case with themses, the root directory of the plugin is trerated as a functions
# folder, so we include it in the `fish_function_path` variable.
if not contains $plugin_dir $fish_function_path
set fish_function_path $fish_function_path[1] $plugin_dir $fish_function_path[2..-1]
end
end
if test -f $bindings_file
set -g __fundle_binding_paths $bindings_file $__fundle_binding_paths
end
set -g __fundle_loaded_plugins $plugin $__fundle_loaded_plugins
set -l dependencies (printf '%s\n' $plugin_paths $__fundle_plugin_name_paths | sort | uniq -u)
for dependency in $dependencies
set -l name_path (string split : -- $dependency)
if test "$profile" -eq 1
set -l start_time (__fundle_date +%s%N)
__fundle_load_plugin $name_path[1] $name_path[2] $fundle_dir $profile
set -l ellapsed_time (math \((__fundle_date +%s%N) - $start_time\) / 1000)
echo "$name_path[1]": {$ellapsed_time}us
else
__fundle_load_plugin $name_path[1] $name_path[2] $fundle_dir $profile
end
end
emit "init_$plugin_name" $plugin_dir
end
function __fundle_bind -d "set up bindings"
if functions -q fish_user_key_bindings; and not functions -q __fish_user_key_bindings
functions -c fish_user_key_bindings __fish_user_key_bindings
end
function fish_user_key_bindings
for bindings in $__fundle_binding_paths
source $bindings
end
if functions -q __fish_user_key_bindings
__fish_user_key_bindings
end
end
end
function __fundle_init -d "initialize fundle"
set -l fundle_dir (__fundle_plugins_dir)
if test (count $__fundle_plugin_names) -eq 0
__fundle_show_doc_msg "No plugin registered. You need to call 'fundle plugin NAME' before using 'fundle init'. \
Try reloading your shell if you just edited your configuration."
return 1
end
set -l profile 0
if begin; contains -- -p $argv; or contains -- --profile $argv; and __fundle_check_date; end
set profile 1
end
set -l has_uninstalled_plugins 0
for name_path in $__fundle_plugin_name_paths
set -l name_path (string split : -- $name_path)
if test "$profile" -eq 1
set -l start_time (__fundle_date +%s%N)
__fundle_load_plugin $name_path[1] $name_path[2] $fundle_dir $profile
set -l ellapsed_time (math \((__fundle_date +%s%N) - $start_time\) / 1000)
echo "$name_path[1]": {$ellapsed_time}us
else
__fundle_load_plugin $name_path[1] $name_path[2] $fundle_dir $profile || set has_uninstalled_plugins 1
end
end
__fundle_bind
return $has_uninstalled_plugins
end
function __fundle_install -d "install plugin"
if test (count $__fundle_plugin_names) -eq 0
__fundle_show_doc_msg "No plugin registered. You need to call 'fundle plugin NAME' before using 'fundle install'"
end
for i in (__fundle_seq (count $__fundle_plugin_names))
__fundle_install_plugin $__fundle_plugin_names[$i] $__fundle_plugin_urls[$i] $argv
end
set -l original_plugins_count (count (__fundle_list -s))
__fundle_init
# if plugins count increase after init, new plugins have dependencies
# install new plugins dependencies if any
if test (count (__fundle_list -s)) -gt $original_plugins_count
__fundle_install $argv
end
end
function __fundle_clean -d "cleans fundle directory"
set -l fundle_dir (__fundle_plugins_dir)
set -l used_plugins (__fundle_list -s)
set -l installed_plugins $fundle_dir/*/*/
for installed_plugin in $installed_plugins
set -l plugin (string trim --chars="/" \
(string replace -r -- "$fundle_dir" "" $installed_plugin))
if not contains $plugin $used_plugins
echo "Removing $plugin"
rm -rf $fundle_dir/$plugin
end
end
end
function __fundle_plugin -d "add plugin to fundle" -a name
set -l plugin_url ""
set -l plugin_path "."
set -l argv_count (count $argv)
set -l skip_next true
if test $argv_count -eq 0 -o -z "$argv"
echo "usage: fundle plugin NAME [[--url] URL] [--path PATH]"
return 1
else if test $argv_count -gt 1
for i in (__fundle_seq (count $argv))
test $skip_next = true; and set skip_next false; and continue
set -l arg $argv[$i]
switch $arg
case '--url'
set plugin_url (__fundle_next_arg $i $argv)
test $status -eq 1; and echo $plugin_url; and return 1
set skip_next true
case '--path'
set plugin_path (__fundle_next_arg $i $argv)
test $status -eq 1; and echo $plugin_path; and return 1
set skip_next true
case '--*'
echo "unknown flag $arg"; and return 1
case '*'
test $i -ne 2; and echo "invalid argument $arg"; and return 1
set plugin_url $arg
end
end
end
test -z "$plugin_url"; and set plugin_url (__fundle_get_url $name)
set name (string split @ $name)[1]
if not contains $name $__fundle_plugin_names
set -g __fundle_plugin_names $__fundle_plugin_names $name
set -g __fundle_plugin_urls $__fundle_plugin_urls $plugin_url
set -g __fundle_plugin_name_paths $__fundle_plugin_name_paths $name:$plugin_path
end
end
function __fundle_version -d "prints fundle version"
echo $__fundle_current_version
end
function __fundle_print_help -d "prints fundle help"
echo "usage: fundle (init | plugin | list | install | update | clean | self-update | version | help)"
end
function __fundle_list -d "list registered plugins"
if begin; contains -- -s $argv; or contains -- --short $argv; end
for name in $__fundle_plugin_names
echo $name
end
else
for i in (__fundle_seq (count $__fundle_plugin_names))
echo {$__fundle_plugin_names[$i]}\n\t{$__fundle_plugin_urls[$i]}
end
end
end
function fundle -d "run fundle"
if __fundle_no_git
return 1
end
set -l sub_args ""
switch (count $argv)
case 0
__fundle_print_help
return 1
case 1
case '*'
set sub_args $argv[2..-1]
end
switch $argv[1]
case "init"
__fundle_init $sub_args
case "plugin"
__fundle_plugin $sub_args
case "list"
__fundle_list $sub_args
case "plugins"
echo "'fundle plugins' has been replaced by 'fundle list'"
case "install"
__fundle_install $sub_args
case "update"
__fundle_update $sub_args
case "clean"
__fundle_clean
case "self-update"
__fundle_self_update
case "version" -v --version
__fundle_version
case "help" -h --help
__fundle_print_help
return 0
case "*"
__fundle_print_help
return 1
end
end

View file

@ -4,19 +4,22 @@
function prompt_login --description "display user name for the prompt" function prompt_login --description "display user name for the prompt"
set -f color_dark_text 131a24 set -f color_dark_text 131a24
set -f color_venv 71839b
set -f color_cwd $fish_color_cwd set -f color_cwd $fish_color_cwd
set -f color_user $fish_color_user
if functions -q fish_is_root_user; and fish_is_root_user if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root set -f color_cwd $fish_color_cwd_root
set -f color_user $fish_color_cwd_root
end end
end end
if not set -q __fish_machine if not set -q __fish_machine
set -g __fish_machine set -g __fish_machine
set -l debian_chroot $debian_chroot set -f debian_chroot $debian_chroot
if test -r /etc/debian_chroot if test -r /etc/debian_chroot
set debian_chroot (cat /etc/debian_chroot) set -f debian_chroot (cat /etc/debian_chroot)
end end
if set -q debian_chroot[1] if set -q debian_chroot[1]
@ -33,8 +36,11 @@ function prompt_login --description "display user name for the prompt"
# If we're running via SSH, change the host color. # If we're running via SSH, change the host color.
set -l color_host $fish_color_host set -l color_host $fish_color_host
if set -q SSH_TTY; and set -q fish_color_host_remote if set -q SSH_TTY; and set -q fish_color_host_remote
set color_host $fish_color_host_remote set -f color_host $fish_color_host_remote
end end
echo -n -s (set_color -b $fish_color_user $color_dark_text) "$USER" (set_color -b $color_host $fish_color_user)(set_color -b $color_host $color_dark_text) (prompt_hostname) (set_color -b $color_cwd $color_host)(set_color -b $color_cwd $color_dark_text) echo -n -s (set_color -b $color_user $color_dark_text) "$USER"
echo -n -s (set_color -b $color_host $fish_color_user)
echo -n -s (set_color -b $color_host $color_dark_text) (prompt_hostname)
echo -n -s (set_color -b $color_venv $color_host)
end end

View file

@ -35,11 +35,15 @@ function update-homes -d "Update homes configuration"
if not test -d $homes_private_path if not test -d $homes_private_path
echo (set_color f4a261)"*** WARNING ***"(set_color normal) echo (set_color f4a261)"*** WARNING ***"(set_color normal)
echo "*** $homes_private_path does not exist" echo "*** $homes_private_path does not exist"
echo
echo
end end
if not functions -q update-homes-secrets if not functions -q update-homes-secrets
echo (set_color f4a261)"*** WARNING ***"(set_color normal) echo (set_color f4a261)"*** WARNING ***"(set_color normal)
echo "*** update-homes-secrets is not defined" echo "*** update-homes-secrets is not defined"
echo
echo
end end
if set -q _flag_help if set -q _flag_help
@ -69,10 +73,13 @@ function update-homes -d "Update homes configuration"
end end
if set -q _flag_install if set -q _flag_install
echo
echo
echo (set_color 81b29a)"*** Install user softwares ***"(set_color normal)
echo
echo (set_color 719cd6)"*** Install nvimpager ***"(set_color normal)
echo
mkdir -p ~/.cache mkdir -p ~/.cache
go install github.com/jesseduffield/lazydocker@latest
go install github.com/jesseduffield/lazygit@latest
rm -rf ~/.cache/nvimpager-git rm -rf ~/.cache/nvimpager-git
git clone --depth 1 https://github.com/lucc/nvimpager ~/.cache/nvimpager-git git clone --depth 1 https://github.com/lucc/nvimpager ~/.cache/nvimpager-git
pushd ~/.cache/nvimpager-git pushd ~/.cache/nvimpager-git
@ -82,23 +89,45 @@ function update-homes -d "Update homes configuration"
end end
if set -q _flag_desktop && set -q _flag_install if set -q _flag_desktop && set -q _flag_install
echo
echo
echo (set_color 719cd6)"*** Install lazydocker ***"(set_color normal)
echo
go install github.com/jesseduffield/lazydocker@latest
echo
echo
echo (set_color 719cd6)"*** Install lazygit ***"(set_color normal)
echo
go install github.com/jesseduffield/lazygit@latest
echo
echo
echo (set_color 719cd6)"*** Install bluetuith ***"(set_color normal)
go install github.com/darkhz/bluetuith@latest
echo
echo
echo (set_color 719cd6)"*** Install poezio-omemo and epr ***"(set_color normal)
echo
pip install --user --break-system-packages -U poezio-omemo epr-reader pip install --user --break-system-packages -U poezio-omemo epr-reader
echo
echo
echo (set_color 719cd6)"*** Install poezio plugins ***"(set_color normal)
echo
rm -rf ~/.local/share/poezio/plugins rm -rf ~/.local/share/poezio/plugins
mkdir -p ~/.local/share/poezio mkdir -p ~/.local/share/poezio
set -l poezio_version $(poezio --version | cut -d " " -f 2) set -l poezio_version $(poezio --version | cut -d " " -f 2)
rm -rf ~/.cache/poezio-git rm -rf ~/.cache/poezio-git
git clone --depth 1 https://codeberg.org/poezio/poezio ~/.cache/poezio-git git clone --depth 1 -b $poezio_version https://codeberg.org/poezio/poezio ~/.cache/poezio-git
pushd ~/.cache/poezio-git pushd ~/.cache/poezio-git
git checkout $poezio_version
popd popd
cp -r ~/.cache/poezio-git/plugins ~/.local/share/poezio cp -r ~/.cache/poezio-git/plugins ~/.local/share/poezio
rm -rf ~/.cache/poezio-git rm -rf ~/.cache/poezio-git
end end
if set -q _flag_remove if set -q _flag_remove
echo "**** Remove old config" echo (set_color 81b29a)"**** Remove old config ***"(set_color normal)
# Remove zsh # Remove zsh
rm ~/.zcompdump rm ~/.zcompdump
@ -122,6 +151,10 @@ function update-homes -d "Update homes configuration"
end end
if set -q _flag_git if set -q _flag_git
echo
echo
echo (set_color 81b29a)"*** Update homes configuration directories ***"(set_color normal)
echo
pushd $homes_path pushd $homes_path
gitpr gitpr
popd popd
@ -133,7 +166,13 @@ function update-homes -d "Update homes configuration"
end end
end end
echo "**** Copying common part" echo
echo
echo (set_color 81b29a)"*** Synchronize files ***"(set_color normal)
echo
echo
echo (set_color 719cd6)"*** Copying common part ***"(set_color normal)
echo
if test -d $homes_path/common if test -d $homes_path/common
pushd $homes_path pushd $homes_path
rsync --exclude=".*.swp" -av ./common/ ~/ rsync --exclude=".*.swp" -av ./common/ ~/
@ -146,7 +185,10 @@ function update-homes -d "Update homes configuration"
end end
if set -q _flag_root if set -q _flag_root
echo "**** Copying root part" echo
echo
echo (set_color 719cd6)"*** Copying root part ***"(set_color normal)
echo
if test -d $homes_path/root if test -d $homes_path/root
pushd $homes_path pushd $homes_path
rsync --exclude=".*.swp" -av ./root/ ~/ rsync --exclude=".*.swp" -av ./root/ ~/
@ -160,7 +202,10 @@ function update-homes -d "Update homes configuration"
end end
if set -q _flag_desktop if set -q _flag_desktop
echo "**** Copying desktop part" echo
echo
echo (set_color 719cd6)"*** Copying desktop part ***"(set_color normal)
echo
if test -d $homes_path/desktop if test -d $homes_path/desktop
pushd $homes_path pushd $homes_path
rsync --exclude=".*.swp" -av ./desktop/ ~/ rsync --exclude=".*.swp" -av ./desktop/ ~/

View file

@ -14,7 +14,7 @@
# keyring already exists, in which case the latter will be used. # keyring already exists, in which case the latter will be used.
# #
# Default: auto # Default: auto
#pgp-provider=auto pgp-provider=gpg
# By default, the file permissions of accounts.conf must be restrictive and # By default, the file permissions of accounts.conf must be restrictive and
# only allow reading by the file owner (0600). Set this option to true to # only allow reading by the file owner (0600). Set this option to true to
@ -41,7 +41,7 @@
# Set the $TERM environment variable used for the embedded terminal. # Set the $TERM environment variable used for the embedded terminal.
# #
# Default: xterm-256color # Default: xterm-256color
#term=xterm-256color term=xterm-direct
# Display OSC8 strings in the embedded terminal # Display OSC8 strings in the embedded terminal
# #
@ -216,7 +216,7 @@ new-message-bell=false
# Sets the styleset to use for the aerc ui elements. # Sets the styleset to use for the aerc ui elements.
# #
# Default: default # Default: default
styleset-name=nord styleset-name=nightfox
# Activates fuzzy search in commands and their arguments: the typed string is # Activates fuzzy search in commands and their arguments: the typed string is
# searched in the command or option in any position, and need not be # searched in the command or option in any position, and need not be
@ -339,7 +339,7 @@ threading-enabled=true
# pager which supports ANSI codes. # pager which supports ANSI codes.
# #
# Default: less -R # Default: less -R
pager=nvimpager # pager=nvimpager
# #
# If an email offers several versions (multipart), you can configure which # If an email offers several versions (multipart), you can configure which
@ -380,14 +380,14 @@ pager=nvimpager
# Specifies the command to run the editor with. It will be shown in an embedded # Specifies the command to run the editor with. It will be shown in an embedded
# terminal, though it may also launch a graphical window if the environment # terminal, though it may also launch a graphical window if the environment
# supports it. Defaults to $EDITOR, or vi. # supports it. Defaults to $EDITOR, or vi.
#editor= editor=nvim
# #
# Default header fields to display when composing a message. To display # Default header fields to display when composing a message. To display
# multiple headers in the same row, separate them with a pipe, e.g. "To|From". # multiple headers in the same row, separate them with a pipe, e.g. "To|From".
# #
# Default: To|From,Subject # Default: To|From,Subject
#header-layout=To|From,Subject header-layout=To|From,Cc,Bcc,Subject
# #
# Specifies the command to be used to tab-complete email addresses. Any # Specifies the command to be used to tab-complete email addresses. Any
@ -445,9 +445,7 @@ address-book-cmd=khard email --parsable --remove-first-line %s
# accepted. The commands are invoked with sh -c and are expected to output # accepted. The commands are invoked with sh -c and are expected to output
# valid UTF-8 text. # valid UTF-8 text.
# #
# Example (obviously, this requires that you write your main text/plain body text/html=pandoc -f html -t rst --list-tables=true | pygmentize -l rst | colorize
# using the markdown syntax):
text/html=pandoc -f markdown -t html --standalone
[filters] [filters]
# #
@ -481,7 +479,7 @@ text/plain=colorize
text/calendar=calendar text/calendar=calendar
message/delivery-status=colorize message/delivery-status=colorize
message/rfc822=colorize message/rfc822=colorize
text/html=pandoc -f html -t rst | colorize text/html=pandoc -f html -t rst --list-tables=true | pygmentize -l rst | colorize
#text/html=html | colorize #text/html=html | colorize
#text/*=bat -fP --file-name="$AERC_FILENAME" #text/*=bat -fP --file-name="$AERC_FILENAME"
#application/x-sh=bat -fP -l sh #application/x-sh=bat -fP -l sh

View file

@ -0,0 +1,79 @@
#
# nightfox styleset
# Based on: https://github.com/EdenEast/nightfox.nvim/
#
*.normal=true
*.fg=#cdcecf
*.selected.bg=#3c5372
*.selected.italic=true
*error.bold=true
error.fg=#c94f6d
warning.fg=#f4a261
success.fg=#81b29a
statusline_default.bg=#131a24
statusline_default.fg=#aeafb0
statusline_error.fg=#c94f6d
statusline_warning.fg=#f4a261
statusline_success.fg=#81b29a
msglist_default.fg=#cdcecf
msglist_unread.bold=true
msglist_unread.fg=#719cd6
msglist_read.fg=#aeafb0
msglist_flagged.fg=#dbc074
msglist_flagged.bold=true
msglist_marked.fg=#63cdcf
msglist_marked.bold=true
msglist_answered.fg=#81b29a
msglist_answered.italic=true
msglist_deleted.bg=#738091
msglist_deleted.fg=#c94f6d
msglist_deleted.italic=true
msglist_result.fg=#9d79d6
dirlist_default.fg=#cdcecf
dirlist_unread.fg=#719cd6
dirlist_recent.fg=#63cdcf
completion*.selected.fg=#63cdcf
completion_default.bg=#212e3f
completion_gutter.bg=#39506d
completion_pill.bg=#192330
tab.bg=#131a24
tab.fg=#aeafb0
tab.selected.bg=#719cd6
tab.selected.fg=#131a24
stack.fg=#63cdcf
stack.bg=#192330
spinner.fg=#f4a261
border.bg=#39506d
selector_*.bg=#212e3f
selector_default.fg=#cdcecf
selector_focused.bg=#81b29a
selector_focused.fg=#131a24
selector_chooser.fg=#cdcecf
title.bg=#212e3f
title.fg=#f4a261
header.bg=#212e3f
header.fg=#f4a261
[viewer]
url.underline=true
url.fg=#719cd6
header.fg=#dbc074
signature.fg=#9d79d6
diff_meta.fg=#63cdcf
diff_chunk.fg=#719cd6
diff_add.fg=#81b29a
diff_del.fg=#c94f6d
quote_*.italic=true
quote_1.fg=#81b29a
quote_2.fg=#738091
quote_3.fg=#aeafb0
quote_4.fg=#71839b
quote_x.fg=#71839b

View file

@ -7,3 +7,5 @@ copy-to = Sent
source-cred-cmd = keyring get "mail:template@example.com" "template@example.com" source-cred-cmd = keyring get "mail:template@example.com" "template@example.com"
outgoing-cred-cmd = keyring get "mail:template@example.com" "template@example.com" outgoing-cred-cmd = keyring get "mail:template@example.com" "template@example.com"
signature-file = "~/.config/aerc/accounts/template@example.com/signature.txt" signature-file = "~/.config/aerc/accounts/template@example.com/signature.txt"
pgp-auto-sign = true
pgp-opportunistic-encrypt = true

View file

@ -32,20 +32,25 @@ function update-homes-secrets -d "Update secrets for configuration of homes"
end end
if set --query _flag_desktop if set --query _flag_desktop
echo "*** Set secrets" echo
echo
echo (set_color 81b29a)"*** Set secrets ***"(set_color normal)
echo
echo
echo (set_color 719cd6)"*** Set poezio ***"(set_color normal)
echo
sed -i "s/REPLACE_DEVICE_HOSTNAME/`hostname`/g" ~/.config/poezio/poezio.cfg sed -i "s/REPLACE_DEVICE_HOSTNAME/`hostname`/g" ~/.config/poezio/poezio.cfg
sed -i "s/REPLACE_FINGERPRINT/cert_fingerprint/g" ~/.config/poezio/poezio.cfg sed -i "s/REPLACE_FINGERPRINT/cert_fingerprint/g" ~/.config/poezio/poezio.cfg
sed -i "s/REPLACE_JID/template@example.com/g" ~/.config/poezio/poezio.cfg sed -i "s/REPLACE_JID/template@example.com/g" ~/.config/poezio/poezio.cfg
sed -i "s/KEYRING_ID/xmpp:template@example.com/g" ~/.config/poezio/poezio.cfg sed -i "s/KEYRING_ID/xmpp:template@example.com/g" ~/.config/poezio/poezio.cfg
sed -i "s/KEYRING_USER/template@example.com/g" ~/.config/poezio/poezio.cfg sed -i "s/KEYRING_USER/template@example.com/g" ~/.config/poezio/poezio.cfg
echo
echo
echo (set_color 719cd6)"*** Set newsboat ***"(set_color normal)
echo
sed -i "s/FRESHRSSLOGIN/example_user/g" ~/.config/newsboat/config sed -i "s/FRESHRSSLOGIN/example_user/g" ~/.config/newsboat/config
sed -i "s/FRESHRSSKEEPASSXC/rss:freshrss.example.com/g" ~/.config/newsboat/config sed -i "s/FRESHRSSKEEPASSXC/rss:freshrss.example.com/g" ~/.config/newsboat/config
sed -i "s/FRESHRSSURL/https:\/\/freshrss.example.com\/api\/greader.php/g" ~/.config/newsboat/config sed -i "s/FRESHRSSURL/https:\/\/freshrss.example.com\/api\/greader.php/g" ~/.config/newsboat/config
end end
end end
if set --query _flag_root
rsync --exclude=".*.swp" -av ./root/ ~/
end