big update

This commit is contained in:
Bruno Carlin 2017-04-14 18:38:15 +02:00
parent 7a45a85686
commit 346a209c13
9 changed files with 133 additions and 11 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
lfm/.config/lfm/lfm.history

View file

@ -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

View file

@ -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

View file

@ -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

Binary file not shown.

View file

@ -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:

1
mailcap/.mailcap Normal file
View file

@ -0,0 +1 @@
*/*; xdg-open "%s"

View file

@ -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 <f2> '<sync-mailbox><refresh><enter-command>source ~/.config/mutt/waarp<enter><change-folder>!<enter>'
macro index <f3> '<sync-mailbox><refresh><enter-command>source ~/.config/mutt/perso<enter><change-folder>!<enter>'
## 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 <Up> previous-line
bind pager <Down> 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 <F73> previous-entry
bind index <F72> next-entry

View file

@ -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