From b9ea238dd7e8a56b1d171cdc76e405bb2a8584dd Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Wed, 21 Feb 2018 12:18:32 +0000 Subject: Improve i3 status --- bin/bin/keyboard | 6 +++ bin/bin/tmux_attach | 5 ++- git/.gitconfig | 2 +- i3/.config/i3/config | 2 +- i3/.config/i3blocks/bin/battery | 51 +++++++++++++++++++++++ i3/.config/i3blocks/bin/email | 5 +-- i3/.config/i3blocks/bin/repos | 28 +++++++++++++ i3/.config/i3blocks/bin/updates | 13 ++++++ i3/.config/i3blocks/bin/wifi | 10 ++++- i3/.config/i3blocks/config | 67 ++++++++++++++++++------------- i3/.config/i3status/config | 58 --------------------------- mutt/.mutt/colors.muttrc | 25 ------------ mutt/.mutt/colors/base.muttrc | 29 ++++++++++++++ mutt/.mutt/colors/nord.muttrc | 6 +++ mutt/.mutt/colors/solarized.light.muttrc | 5 +++ mutt/.mutt/muttrc | 8 +--- pkgs/base-packages/PKGBUILD | 23 ++++++----- tmux/.tmux.conf | 3 ++ vim/.vimrc | 69 ++++++++++++++++++++------------ xdg-open/.config/mimeapps.list | 1 + xinit/.xinitrc | 8 +--- zsh/.zsh/.zshrc | 19 +++++++-- 22 files changed, 271 insertions(+), 172 deletions(-) create mode 100755 i3/.config/i3blocks/bin/battery create mode 100755 i3/.config/i3blocks/bin/repos create mode 100755 i3/.config/i3blocks/bin/updates delete mode 100644 i3/.config/i3status/config delete mode 100644 mutt/.mutt/colors.muttrc create mode 100644 mutt/.mutt/colors/base.muttrc create mode 100644 mutt/.mutt/colors/nord.muttrc create mode 100644 mutt/.mutt/colors/solarized.light.muttrc diff --git a/bin/bin/keyboard b/bin/bin/keyboard index ed46c16..e0cf952 100755 --- a/bin/bin/keyboard +++ b/bin/bin/keyboard @@ -37,6 +37,12 @@ xmodmap -e "add mod4 = Super_L" xmodmap -e "keycode any = space" xcape -e 'Super_L=space' +# Make return (Control_R, Return) +xmodmap -e "keysym Return = Control_R" +xmodmap -e "add Control = Control_R" +xmodmap -e "keycode any = Return" +xcape -e 'Control_R=Return' + # Make eject an Insert xmodmap -e "keysym XF86Eject = Insert" diff --git a/bin/bin/tmux_attach b/bin/bin/tmux_attach index b4b35ee..b5a613c 100755 --- a/bin/bin/tmux_attach +++ b/bin/bin/tmux_attach @@ -5,13 +5,14 @@ ATTACHED_SESSIONS=$(tmux list-sessions | grep attached | cut -d':' -f1) TMUXINATOR=$(tmuxinator list | sed '1d' | sed 's/\s\+/\n/g') UNION=$(cat <(echo "$SESSIONS") <(echo "$TMUXINATOR") | sort | uniq | sed "/^$/d") -SESSION=$(echo "$UNION" | dmenu -i -p "Session:" | tr -d '[[:space:]]') +SESSION=$(echo "$UNION" | dmenu -i -p "Session:" | tr -d '[:space:]') [[ -n $SESSION ]] || exit # Rename i3 workspace +# `command -v` to check that i3-msg is a command ! grep -Fxq "$SESSION" <(echo "$ATTACHED_SESSIONS") \ && command -v i3-msg \ - && $HOME/bin/workspace gw $SESSION + && "$HOME"/bin/workspace gw "$SESSION" grep -Fxq "$SESSION" <(echo "$TMUXINATOR") \ && COMMAND="tmuxinator start $SESSION" \ diff --git a/git/.gitconfig b/git/.gitconfig index 0c86393..4bfe639 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -10,7 +10,7 @@ [status] submodulesummary = 1 [alias] - saveandsync = !git commit -am "Update" && git push origin master + saveandsync = !git add . && git commit -m "Update" && git push origin master [core] fileMode = false [http] diff --git a/i3/.config/i3/config b/i3/.config/i3/config index 2688f18..3b39417 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -15,7 +15,7 @@ set $mod Mod4 # is used in the bar {} block below. # This font is widely installed, provides lots of unicode glyphs, right-to-left # text rendering and scalability on retina/hidpi displays (thanks to pango). -font pango:DejaVu Sans Mono 8 +font pango:DejaVu Sans Mono, Awesome 8 # Before i3 v4.8, we used to recommend this one as the default: # font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 # The font above is very space-efficient, that is, it looks good, sharp and diff --git a/i3/.config/i3blocks/bin/battery b/i3/.config/i3blocks/bin/battery new file mode 100755 index 0000000..b345f16 --- /dev/null +++ b/i3/.config/i3blocks/bin/battery @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +if [ ! -d /sys/class/power_supply/BAT0 ]; then + echo " No battery" + exit +fi + +output="$(acpi -b)" +remaining_time=$(echo "$output" | grep -o "[0-9][0-9]:[0-9][0-9]") +<<<<<<< HEAD + +if [ -d /sys/class/power_supply/BAT0 ]; then + now_charge=$(cat /sys/class/power_supply/BAT0/now_charge) + full_charge=$(cat /sys/class/power_supply/BAT0/full_charge) + charge=$(( (100*now_charge) / full_charge )) +else + echo "" + exit +fi +======= +now_charge=$(cat /sys/class/power_supply/BAT0/now_charge) +full_charge=$(cat /sys/class/power_supply/BAT0/full_charge) +charge=$(( (100*now_charge) / full_charge )) +# charge=$(echo "$output" | grep -oP "..(?=%)") +>>>>>>> de29d3a... Add minor updates + +if grep -q "Discharging" <(echo "$output"); then + remaining_time=$(echo "$output" | grep -oP "..:..(?=:.. remaining)") + if [[ $charge -lt 20 ]]; then + icon="" + color="#FF0000" + elif [[ $charge -lt 40 ]]; then + icon="" + color="#FFAE00" + elif [[ $charge -lt 60 ]]; then + icon="" + color="#FFF600" + elif [[ $charge -lt 80 ]]; then + icon="" + color="#A8FF00" + else + icon="" + color="#00FF00" + fi +else + icon= + color="lightblue" +fi + +echo "$icon $charge% ($remaining_time)" +echo "$icon $charge% ($remaining_time)" diff --git a/i3/.config/i3blocks/bin/email b/i3/.config/i3blocks/bin/email index ab875e0..f83f4b0 100755 --- a/i3/.config/i3blocks/bin/email +++ b/i3/.config/i3blocks/bin/email @@ -1,10 +1,9 @@ #!/usr/bin/env bash nMails=$(find $HOME/.mail -path '*/new/*' -type f -not -path '*/rss/*' -not -path '*/lists/*' | wc -l) -echo -e "${nMails}\n${nMails}" if [[ ${nMails} -eq 0 ]]; then - echo \#FFFFFF + echo -e " ${nMails}" else - echo \#00FF00 + echo -e " ${nMails}" fi diff --git a/i3/.config/i3blocks/bin/repos b/i3/.config/i3blocks/bin/repos new file mode 100755 index 0000000..48b8b27 --- /dev/null +++ b/i3/.config/i3blocks/bin/repos @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +color_changes() { + if [[ $1 -gt 100 ]]; then + echo 'red' + elif [[ $1 -gt 10 ]]; then + echo 'yellow' + elif [[ $1 -gt 0 ]]; then + echo 'lightgreen' + else + echo 'gray' + fi +} + +if command -v mr > /dev/null; then + total_changes=0 + for title_dir in $BLOCK_INSTANCE; do + title="${title_dir%:*}" + cd "${title_dir##*:}" || exit + n_changes=$(mr status | grep -vc "^$\\|^mr") + [[ n_changes -gt total_changes ]] && total_changes=n_changes + color=$(color_changes "$n_changes") + output+="$sep$title:$n_changes" + sep=" - " + done + color_label=$(color_changes $total_changes) + echo " $output" +fi diff --git a/i3/.config/i3blocks/bin/updates b/i3/.config/i3blocks/bin/updates new file mode 100755 index 0000000..325b485 --- /dev/null +++ b/i3/.config/i3blocks/bin/updates @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +if command -v checkupdates > /dev/null; then + n_updates=$(checkupdates | wc -l) + if [[ n_updates -gt 50 ]]; then + color='red' + elif [[ n_updates -gt 10 ]]; then + color='yellow' + else + color='gray' + fi + echo " $n_updates" +fi diff --git a/i3/.config/i3blocks/bin/wifi b/i3/.config/i3blocks/bin/wifi index 434c508..bc24672 100755 --- a/i3/.config/i3blocks/bin/wifi +++ b/i3/.config/i3blocks/bin/wifi @@ -6,10 +6,16 @@ wifi_address=$(ip addr show wlp2s0 2>/dev/null | grep -oP -m1 "(?<=inet ).*(?=/) eth_address=$(ip addr show eno1 2>/dev/null | grep -oP -m1 "(?<=inet ).*(?=/)") if [[ -n $eth_address ]]; then - echo "eno1: $eth_address" + full_text="eno1: $eth_address" + ip_addr="$eth_address" elif [[ -n $wifi_address ]]; then - echo "wlp2s0: (${quality}% at ${ssid}) ${wifi_address}" + full_text="wlp2s0: (${quality}% at ${ssid}) ${wifi_address}" + ip_addr="$wifi_address" else echo "No connection" fi +case $BLOCK_BUTTON in + 1) echo "$full_text" ;; + *) echo -e "$ip_addr" ;; +esac diff --git a/i3/.config/i3blocks/config b/i3/.config/i3blocks/config index 2e149bf..48faf62 100644 --- a/i3/.config/i3blocks/config +++ b/i3/.config/i3blocks/config @@ -26,49 +26,62 @@ # Each block command defaults to the script name to avoid boilerplate. command=/usr/lib/i3blocks/$BLOCK_NAME separator_block_width=15 -markup=none +markup=pango +[primary] +label= +command=echo "$(xclip -o | cut -c1-9)" +min_width=15 +interval=5 -# Volume indicator -# -# The first parameter sets the step (and units to display) -# The second parameter overrides the mixer selection -# See the script for details. -[volume] -label=♪ +[clipboard] +label= +command=echo "$(xclip -o -selection "clipboard" | cut -c1-9)" instance=Master interval=5 -[wifi] -label=W: -command=~/dotfiles/i3/.config/i3blocks/bin/wifi -separator=true +[volume] +label= +instance=Master interval=5 +[repos] +command=~/dotfiles/i3/.config/i3blocks/bin/repos +instance=Phd:/home/urbain/phd Home:/home/urbain +interval=1000 + +[updates-arch] +command=~/dotfiles/i3/.config/i3blocks/bin/updates +interval=1000 + [email] -label=Mail: command=~/dotfiles/i3/.config/i3blocks/bin/email separator=true interval=5 -[disk] -label=HOME -interval=30 - -[cpu_usage] -label=CPU -interval=10 -min_width=CPU: 100.00% +[wifi] +label= +command=~/dotfiles/i3/.config/i3blocks/bin/wifi +separator=true +interval=5 [battery] -label=BAT +command=~/dotfiles/i3/.config/i3blocks/bin/battery interval=30 +[diskhome] +label= +command=/usr/lib/i3blocks/disk +instance=/home/urbain +interval=60 + +[diskroot] +label= +command=/usr/lib/i3blocks/disk +instance=/ +interval=60 + [time] +label= command=date '+%Y-%m-%d %H:%M' interval=5 - -[mediaplayer] -instance=spotify -interval=5 -signal=10 diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config deleted file mode 100644 index 8561697..0000000 --- a/i3/.config/i3status/config +++ /dev/null @@ -1,58 +0,0 @@ -# i3status configuration file. -# see "man i3status" for documentation. - -# It is important that this file is edited as UTF-8. -# The following line should contain a sharp s: -# ß -# If the above line is not correctly displayed, fix your editor first! - -general { - colors = true - interval = 5 - output_format = "none" -} - -# order += "ipv6" -# order += "disk /" -# order += "run_watch DHCP" -# order += "run_watch VPN" -order += "wireless _first_" -order += "ethernet _first_" -order += "battery 0" -# order += "load" -order += "tztime local" - -wireless _first_ { - format_up = "W: (%quality at %essid) %ip" - format_down = "W: down" -} - -ethernet _first_ { - # if you use %speed, i3status requires root privileges - format_up = "E: %ip (%speed)" - format_down = "E: down" -} - -battery 0 { - format = "%status %percentage %remaining" -} - -run_watch DHCP { - pidfile = "/var/run/dhclient*.pid" -} - -run_watch VPN { - pidfile = "/var/run/vpnc/pid" -} - -tztime local { - format = "%Y-%m-%d %H:%M" -} - -load { - format = "%1min" -} - -disk "/" { - format = "%avail" -} diff --git a/mutt/.mutt/colors.muttrc b/mutt/.mutt/colors.muttrc deleted file mode 100644 index c868b9f..0000000 --- a/mutt/.mutt/colors.muttrc +++ /dev/null @@ -1,25 +0,0 @@ -color normal blue default -color error red default -color tilde black default -color message cyan default -color markers red white -color attachment white default -color search brightmagenta default -color status green black -color indicator brightblack yellow - -color index blue default "~R" -color index brightblue default "~N" -color index cyan default "~U" -color index green default "~Q" -color index red default "~D" -color index magenta default "~F" - -color quoted cyan default -color quoted1 magenta default -color quoted2 red default - -color header green default "^(From)" -color header yellow default "^(To)" -color header magenta default "^(Subject)" -color header red default "^(CC)" diff --git a/mutt/.mutt/colors/base.muttrc b/mutt/.mutt/colors/base.muttrc new file mode 100644 index 0000000..7bc1aae --- /dev/null +++ b/mutt/.mutt/colors/base.muttrc @@ -0,0 +1,29 @@ +color normal color247 default +color attachment color110 default +color error red default +color search brightmagenta default +color status color107 color8 +color indicator color232 color178 + +color sidebar_divider color100 default +color sidebar_flagged color6 default +color sidebar_indicator color232 color178 +color sidebar_new color2 default + +color index color248 default "~R" +color index color69 default "~N" +color index color140 default "~U" +color index color2 default "~Q" +color index color1 default "~D" +color index color136 default "~F" + +color quoted cyan default +color quoted1 magenta default +color quoted2 red default + +color header green default "^(From)" +color header yellow default "^(To)" +color header magenta default "^(Subject)" +color header red default "^(CC)" + +# vim: ft=muttrc diff --git a/mutt/.mutt/colors/nord.muttrc b/mutt/.mutt/colors/nord.muttrc new file mode 100644 index 0000000..977750d --- /dev/null +++ b/mutt/.mutt/colors/nord.muttrc @@ -0,0 +1,6 @@ +color status green black +color index color14 default "~F" +color index color13 default "~O" +color index color13 default "~N" + +# vim: ft=muttrc diff --git a/mutt/.mutt/colors/solarized.light.muttrc b/mutt/.mutt/colors/solarized.light.muttrc new file mode 100644 index 0000000..2d4d05a --- /dev/null +++ b/mutt/.mutt/colors/solarized.light.muttrc @@ -0,0 +1,5 @@ +color status green white +color normal color11 default +color index color11 default "~R" + +# vim: ft=muttrc diff --git a/mutt/.mutt/muttrc b/mutt/.mutt/muttrc index bb1c122..b86f6c2 100644 --- a/mutt/.mutt/muttrc +++ b/mutt/.mutt/muttrc @@ -8,7 +8,8 @@ set mailcap_path = ~/.mutt/mailcap set tmpdir = ~/.mutt/temp # Source crypto, aliases, mailboxes -# source ~/.mutt/colors +source ~/.mutt/colors/base.muttrc +source ~/.mutt/colors/$COLORSCHEME.muttrc source ~/.mutt/crypto source ~/.mutt/alias source ~/.mutt/mailboxes @@ -92,11 +93,6 @@ macro index,pager gr " +Misc/rss" macro index,pager gl " +Misc/lists" folder-hook 'Misc/rss|Misc/lists' 'unset trash; unset from' -# Source mutt solarized -`[[ "$COLORSCHEME" = "solarized" && "$BACKGROUND" = "light" ]] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-light-16.muttrc || echo set` -`[[ "$COLORSCHEME" = "solarized" && "$BACKGROUND" = "dark" ]] && echo source $HOME/.mutt/solarized/mutt-colors-solarized-dark-16.muttrc || echo set` -`[[ "$COLORSCHEME" != "solarized" ]] && echo source $HOME/.mutt/colors.muttrc || echo set` - # Identities set reverse_name alternates "*@urbainvaes.com" diff --git a/pkgs/base-packages/PKGBUILD b/pkgs/base-packages/PKGBUILD index 3e78e75..038e4d5 100644 --- a/pkgs/base-packages/PKGBUILD +++ b/pkgs/base-packages/PKGBUILD @@ -8,14 +8,15 @@ depends=(alsa-utils autocutsel autopep8 awesome-terminal-fonts biber cmus gnuplot grub htop hub i3-gaps i3blocks i3lock i3status inotify-tools ipython isync lsof mencoder mlocate moreutils mpv msmtp mumble mutt ncmpcpp neovim network-manager-applet networkmanager networkmanager-openvpn - networkmanager-pptp nmap npm pandoc pass pkgfile pulseaudio pulseaudio-alsa - python-jedi python-matplotlib python-neovim python-pip python-unidecode - python2-matplotlib python2-neovim qemu qutebrowser redshift ripgrep rofi - rsync rxvt-unicode shellcheck sshfs stow surfraw texlive-bibtexextra - texlive-core texlive-fontsextra texlive-formatsextra texlive-games - texlive-humanities texlive-latexextra texlive-pictures texlive-pstricks - texlive-publishers texlive-science tig tldr tmux ttf-dejavu - ttf-ubuntu-font-family urxvt-perls vifm weechat xcape xclip xdotool - xfce4-screenshooter xorg-server xorg-server-common xorg-setxkbmap - xorg-xbacklight xorg-xev xorg-xkill xorg-xmodmap xorg-xrandr xorg-xrdb xsel - youtube-dl zathura zathura-djvu zathura-pdf-mupdf zathura-ps zenity zsh) + networkmanager-pptp nmap npm pandoc pass perl-file-mimeinfo pkgfile + pulseaudio pulseaudio-alsa python-jedi python-matplotlib python-neovim + python-pip python-unidecode python2-matplotlib python2-neovim qemu + qutebrowser redshift ripgrep rofi rsync rxvt-unicode shellcheck sshfs stow + surfraw texlive-bibtexextra texlive-core texlive-fontsextra + texlive-formatsextra texlive-games texlive-humanities texlive-latexextra + texlive-pictures texlive-pstricks texlive-publishers texlive-science tig + tldr tmux ttf-dejavu ttf-ubuntu-font-family urxvt-perls vifm weechat xcape + xclip xdotool xfce4-screenshooter xorg-server xorg-server-common + xorg-setxkbmap xorg-xbacklight xorg-xev xorg-xkill xorg-xmodmap xorg-xrandr + xorg-xrdb xsel youtube-dl zathura zathura-djvu zathura-pdf-mupdf zathura-ps + zenity zsh) diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 78c06ee..1553d3e 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -19,5 +19,8 @@ bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" +bind -n C-Left previous-window +bind -n C-Right next-window + bind-key P swap-window -t -1 bind-key N swap-window -t +1 diff --git a/vim/.vimrc b/vim/.vimrc index b8d494b..5c9d42a 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -293,13 +293,15 @@ nnoremap w :update nnoremap q :q nnoremap d :bd! -nnoremap tn :tabnew -nnoremap te :tabedit -nnoremap tl :+tabmove -nnoremap th :-tabmove -nnoremap tm :tabmove -nnoremap t0 :tabmove 0 -nnoremap t$ :tabmove +nnoremap ,bd :ls:bd + +nnoremap ,tn :tabnew +nnoremap ,te :tabedit +nnoremap ,tl :+tabmove +nnoremap ,th :-tabmove +nnoremap ,tm :tabmove +nnoremap ,t0 :tabmove 0 +nnoremap ,t$ :tabmove nnoremap c :!rm ~/.vim/swap/\%* @@ -311,7 +313,7 @@ nnoremap goT :call system('urxvt -cd '.expand("%:p:h").' &') nnoremap gof :call system('urxvt -e vifm '.getcwd().' '.getcwd().' &') nnoremap goF :call system('urxvt -e vifm '.expand("%:p:h").' '.expand("%:p:h").' &') -nnoremap h :e %:p:s,.hpp$,.X123X,:s,.cpp$,.hpp,:s,.X123X$,.cpp, +nnoremap h :e %:p:s,.hpp$,.X123X,:s,.cpp$,.hpp,:s,.X123X$,.cpp, nnoremap Y y$ nnoremap fw :%s/\s\+$// @@ -322,12 +324,11 @@ cnoremap cnoremap cnoremap -nnoremap -nnoremap >b :BufSurfForward -nnoremap :bd! # -nnoremap >B :BufSurfForward:bd! # -nnoremap [B [b:bd! # -nnoremap ]B ]b:bd! # +" Overwrite unimpaired mappings +nnoremap [b :BufSurfBack +nnoremap ]b :BufSurfForward +nnoremap [B :BufSurfBack:bd! # +nnoremap ]B :BufSurfForward:bd! # " }}} "" Colorscheme {{{ @@ -337,30 +338,32 @@ function! SaveColo(...) execute 'AirlineTheme' a:3 execute 'colorscheme' a:2 endif - execute 'silent !echo "set background='.a:1.'" > ~/.color.vim' - execute 'silent !echo "colorscheme '.a:2.'" >> ~/.color.vim' - execute 'silent !echo "let g:airline_theme=\"'.a:3.'\"" >> ~/.color.vim' + execute 'silent !echo "set background='.a:1.'" > ~/.local/colors.vim' + execute 'silent !echo "colorscheme '.a:2.'" >> ~/.local/colors.vim' + execute 'silent !echo "let g:airline_theme=\"'.a:3.'\"" >> ~/.local/colors.vim' endfunction function! MyColo(colorscheme) - if a:colorscheme == "solarized" + if a:colorscheme == "solarized-light" call SaveColo("light","solarized","solarized") + elseif a:colorscheme == "solarized-dark" + call SaveColo("dark","solarized","solarized") elseif a:colorscheme == "seoul" call SaveColo("dark","seoul256","deus") endif endfunction -if filereadable($HOME."/.color.vim") - source ~/.color.vim -else - call MyColo("seoul") +if filereadable($HOME."/.local/colors.vim") + source ~/.local/colors.vim endif nnoremap ,c :call MyColo("") -nnoremap ,cl :call MyColo("solarized") +nnoremap ,cl :call MyColo("solarized-light") +nnoremap ,cd :call MyColo("solarized-dark") nnoremap ,cs :call MyColo("seoul") " }}} "" Autocommands {{{ augroup vimrc autocmd! - autocmd BufWritePost *vimrc,*exrc :source % + autocmd BufWritePost *vimrc,*exrc :call feedkeys(":source %\") + " autocmd BufWritePost *vimrc,*exrc :source % autocmd BufNewFile,Bufread /tmp/mutt-* setlocal tw=72 autocmd BufWritePre * \ if !isdirectory(expand(':p:h')) | @@ -377,6 +380,7 @@ augroup vimrc autocmd FileType gnuplot setlocal makeprg=gnuplot\ % autocmd FileType gnuplot setlocal commentstring=#%s autocmd FileType cpp setlocal commentstring=//%s + autocmd FileType cmake setlocal commentstring=#%s autocmd FileType freefem comp freefem autocmd FileType dirvish setlocal relativenumber autocmd FileType dirvish setlocal errorformat=%f @@ -440,11 +444,24 @@ nnoremap cog :let g:my_searchprg=(g:my_searchprg+1)%len(g:my_searchprgs nnoremap cof :let g:my_findprg=(g:my_findprg+1)%len(g:my_findprgs):echom g:my_findprgs[g:my_findprg] " }}} -"" Neovim terminal {{{ +"" Neovim {{{ if has("nvim") nnoremap goh :let @a=getcwd() \| lcd %:h \| terminal:execute 'lcd '.@aA tnoremap :bd! # nnoremap :b # \| norm A tnoremap + + tnoremap h + tnoremap j + tnoremap k + tnoremap l + inoremap h + inoremap j + inoremap k + inoremap l + nnoremap h + nnoremap j + nnoremap k + nnoremap l endif -" }}} +" }}} \ No newline at end of file diff --git a/xdg-open/.config/mimeapps.list b/xdg-open/.config/mimeapps.list index 4e02c94..c1a342a 100644 --- a/xdg-open/.config/mimeapps.list +++ b/xdg-open/.config/mimeapps.list @@ -1,5 +1,6 @@ [Default Applications] text/plain=nvim.desktop; +image/jpeg=feh.desktop; inode/directory=vifm.desktop;nautilus.desktop; text/html=qutebrowser.desktop;firefox.desktop; application/pdf=zathura.desktop; diff --git a/xinit/.xinitrc b/xinit/.xinitrc index 31b6f70..276d21d 100755 --- a/xinit/.xinitrc +++ b/xinit/.xinitrc @@ -7,16 +7,12 @@ $HOME/bin/keyboard # Load Xresources to light colorscheme -source $HOME/.local/share/zsh/colors.zsh -xrdb $HOME/.Xresources/$XRESOURCE +source $HOME/.local/colors.zsh +xrdb $HOME/.Xresources/$COLORSCHEME # Background feh --bg-fill /home/urbain/documents/wallpapers/pagoda.jpg -# Synchronise primary and clipboard -autocutsel -fork & -autocutsel -selection PRIMARY -fork & - # Disable screen going blank xset -dpms xset s off diff --git a/zsh/.zsh/.zshrc b/zsh/.zsh/.zshrc index 95e989e..07009b8 100644 --- a/zsh/.zsh/.zshrc +++ b/zsh/.zsh/.zshrc @@ -78,15 +78,14 @@ zle -N z # }}} ## Colors {{{ -[[ -z ${ZSH_COLORS} ]] && ZSH_COLORS=${HOME}/.local/share/zsh/colors.zsh -[[ -f ${ZSH_COLORS} ]] && source ${ZSH_COLORS} +[[ -f $HOME/.local/colors.zsh ]] && source $HOME/.local/colors.zsh colorschemes=$(ls ${HOME}/.Xresources) function colo { - XRESOURCE=$1 - XRESOURCE_FILE=${HOME}/.Xresources/${XRESOURCE} + COLORSCHEME=$1 + XRESOURCE_FILE=${HOME}/.Xresources/$COLORSCHEME # Change colors for current session if [[ ! -z "$TMUX" ]]; then @@ -105,11 +104,23 @@ function colo { # Change color for future sessions xrdb ${XRESOURCE_FILE} + + echo "export COLORSCHEME=$1" > $HOME/.local/colors.zsh + source $HOME/.local/colors.zsh } # Completion for colorschemes (-M -> Case insensitive) compctl -k "(${colorschemes})" -M 'm:{a-z}={A-Z}' colo +function show256 { + for i in {0..255} ; do + printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" + if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then + printf "\n"; + fi + done +} + # }}} ## Aliases {{{ -- cgit v1.2.3