diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7dfe179 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lfm/.config/lfm/lfm.history diff --git a/fish/.config/fish/config.fish b/fish/.config/fish/config.fish index ae7ebde..0119305 100644 --- a/fish/.config/fish/config.fish +++ b/fish/.config/fish/config.fish @@ -1,7 +1,8 @@ ## PATH set -x PATH $PATH ~/.local/bin ~/.go/bin -set -x EDITOR nano +set -x EDITOR vim +set -x VIRTUAL_ENV_DISABLE_PROMPT true ## SSH init set -x SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket @@ -15,6 +16,8 @@ end ## Go utils set -x GOPATH ~/.go +## aliases +alias jsonpp "python -mjson.tool" function bind_bang switch (commandline -t)[-1] @@ -28,3 +31,25 @@ end function fish_user_key_bindings bind ! bind_bang end + +function __autovenv --on-variable PWD + set -l base $PWD + set -l has_venv false + + while test $base != '/' + if test -f $base/.venv/bin/activate.fish + set has_venv $base/.venv + break + end + set base (dirname $base) + end + + if test -n "$VIRTUAL_ENV" -a $has_venv = 'false' + deactivate + else if test $has_venv != 'false' + if test -z "$VIRTUAL_ENV" -o "$VIRTUAL_ENV" != "$has_env" + source "$has_venv/bin/activate.fish" + end + end +end + diff --git a/fish/.config/fish/functions/autovenv.fish b/fish/.config/fish/functions/autovenv.fish new file mode 100644 index 0000000..c86a108 --- /dev/null +++ b/fish/.config/fish/functions/autovenv.fish @@ -0,0 +1,7 @@ +function __autovenv --on-variable PWD + echo PWD has changed to $PWD + set -l base $PWD + if test -f $base/.venv/bin/activate.fish + source $base/.venv/bin/activate.fish + end +end diff --git a/fish/.config/fish/functions/fish_prompt.fish b/fish/.config/fish/functions/fish_prompt.fish index d45ff6b..242e58c 100644 --- a/fish/.config/fish/functions/fish_prompt.fish +++ b/fish/.config/fish/functions/fish_prompt.fish @@ -14,23 +14,83 @@ function __bcarlin_prompt_suffix set color_suffix $fish_color_cwd end - echo -n -s (set_color $color_suffix --bold) "$suffix" (set_color normal) + echo -n -s ' ' (set_color $color_suffix --bold) "$suffix" (set_color normal) ' ' end function __bcarlin_prompt_git - set -l git_branch (git rev-parse --abbrev-ref HEAD) + set -l git_infos (git status --porcelain --branch ^/dev/null ) if test $status -ne 0 echo -n -s '' return end - echo -n -s (set_color blue) ± (set_color normal) '(' + set -l git_branch (echo $git_infos | grep '##' | sed -e 's|## \([^\.]\+\).*|\1|') + set -l has_untracked false + set -l staged_count 0 + set -l changed_count 0 + set -l conflict_count 0 + set -l staged_count 0 + set -l behind (echo $git_infos | grep '##' | grep behind | sed -e 's|.*behind \([0-9]\+\).*|\1|') + set -l ahead (echo $git_infos | grep '##' | grep ahead | sed -e 's|.*ahead \([0-9]\+\).*|\1|') + + for line in $git_infos + set -l flags (echo $line | cut -c '-2') + set flag1 (string sub -l 1 $flags) + set flag2 (string sub -s 2 -l 1 $flags) + + if test $flags = '??' + set has_untracked true + continue + end + + if test $flag1 = 'U' -o $flag2 = 'U' + set conflict_count (math $conflict_count + 1) + continue + end + + if contains $flag1 'M' 'A' 'C' 'R' 'D' + set staged_count (math $staged_count + 1) + end + + if contains $flag2 'M' 'A' 'R' 'C' 'D' + set changed_count (math $changed_count + 1) + end + end + + + echo -n -s ' ' (set_color blue) ± (set_color normal) '(' echo -n -s (set_color red --bold) $git_branch (set_color normal) + + if test (math $staged_count + $conflict_count + $changed_count) -ne 0 -o $has_untracked = true + echo -n -s '|' + test -n "$behind"; and echo -s -n (set_color red) "↓$behind" (set_color normal) + test -n "$ahead"; and echo -s -n (set_color green) "↑$ahead" (set_color normal) + test $conflict_count -ne 0; and echo -s -n (set_color red) "✖$conflict_count" (set_color normal) + test $staged_count -ne 0; and echo -s -n (set_color red) "●$staged_count" (set_color normal) + test $changed_count -ne 0; and echo -s -n (set_color blue) "✚$changed_count" (set_color normal) + test $has_untracked = true; and echo -s -n '…' + else + echo -n -s (set_color green --bold) "✔" (set_color normal) + end + echo -n -s ')' end -function fish_prompt --description 'Write out the prompt' - set -l _pwd (set_color $fish_color_cwd) (prompt_pwd) - - echo -n -s "$USER" @ (prompt_hostname) ' ' $_pwd ' ' (__bcarlin_prompt_git) ' ' (__bcarlin_prompt_suffix) ' ' +function __bcarlin_prompt_venv + if test -n "$VIRTUAL_ENV" + set -l venv_name (basename $VIRTUAL_ENV) + if test $venv_name = '.venv' + set venv_name (basename (dirname $VIRTUAL_ENV)) + end + echo -n -s (set_color blue --bold) "(" $venv_name ") " (set_color normal) + end +end + +function fish_prompt --description 'Write out the prompt' + set -l _pwd (set_color $fish_color_cwd) (prompt_pwd) + + echo -n -s (__bcarlin_prompt_venv) + echo -n -s "$USER" @ (prompt_hostname) ' ' $_pwd + echo -n -s (__bcarlin_prompt_git) + echo -n -s (__bcarlin_prompt_suffix) end diff --git a/lfm/.config/lfm/lfm.history b/lfm/.config/lfm/lfm.history deleted file mode 100644 index fb0f105..0000000 Binary files a/lfm/.config/lfm/lfm.history and /dev/null differ diff --git a/lfm/.config/lfm/lfm.ini b/lfm/.config/lfm/lfm.ini index ba725fb..f6f5e40 100644 --- a/lfm/.config/lfm/lfm.ini +++ b/lfm/.config/lfm/lfm.ini @@ -98,7 +98,7 @@ z: / 2: find "$p" -name "*" -print0 | xargs --null -0 grep -EHcni "TODO|WARNING|FIXME|BUG" 3: find "$p" -name "*" -print0 | xargs --null -0 grep -EHcni "TODO|WARNING|FIXME|BUG" >output.txt & 4: cp $s "$o" -5: +5: xdg-open "$f" & 6: 7: 8: diff --git a/mailcap/.mailcap b/mailcap/.mailcap new file mode 100644 index 0000000..be5471e --- /dev/null +++ b/mailcap/.mailcap @@ -0,0 +1 @@ +*/*; xdg-open "%s" diff --git a/mutt/.config/mutt/muttrc b/mutt/.config/mutt/muttrc index 2831172..36ce190 100644 --- a/mutt/.config/mutt/muttrc +++ b/mutt/.config/mutt/muttrc @@ -1,7 +1,7 @@ -set editor=nano +set editor=vim set send_charset="utf-8" - +set index_format="%4C %Z %{%b %d} %-15.15L %y %s" set sort=threads set sort_aux=last-date-received @@ -11,6 +11,7 @@ source $EMAIL_ACCOUNT macro index 'source ~/.config/mutt/waarp!' macro index 'source ~/.config/mutt/perso!' + ## other source mutt-color-solarized.muttrc source muttrc.forgotten-attachment @@ -24,3 +25,21 @@ set sidebar_short_path set sidebar_delim_chars="/" set sidebar_folder_indent set sidebar_indent_string=" " + + +set alias_file=~/.config/mutt/muttrc.aliases +set sort_alias=alias +set reverse_alias=yes +source $alias_file + + +# Key bindings +bind pager previous-line +bind pager next-line +bind index,pager \CS sidebar-toggle-visible +#bind index,pager \CN sidebar-next-new +#bind index,pager \CP sidebar-prev-new +bind index,pager \CN sidebar-next +bind index,pager \CP sidebar-prev +bind index previous-entry +bind index next-entry diff --git a/systemd/.config/systemd/user/gnome-keyring-daemon.service b/systemd/.config/systemd/user/gnome-keyring-daemon.service new file mode 100644 index 0000000..1b312bb --- /dev/null +++ b/systemd/.config/systemd/user/gnome-keyring-daemon.service @@ -0,0 +1,9 @@ +[Unit] +Description=Gnome Keyring daemon + +[Service] +Type=forking +ExecStart=/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,gnupg + +[Install] +WantedBy=default.target