Skip to content

Instantly share code, notes, and snippets.

@jcbwlkr
Created October 10, 2014 14:06
Show Gist options
  • Save jcbwlkr/f0b4f964ef0d0581ee75 to your computer and use it in GitHub Desktop.
Save jcbwlkr/f0b4f964ef0d0581ee75 to your computer and use it in GitHub Desktop.
Tmux Vim Sync Status
# ... Snip most of my config ...
# This tmux statusbar config was originally created by tmuxline.vim
set -g status-interval 1 # the sync-status script is never called on demand. It is only called per this interval
set -g status-utf8 on
set -g status-justify "left"
set -g status "on"
set -g status-bg "colour238"
set -g status-utf8 "on"
set -g status-right-length "100"
set -g status-left-length "100"
setw -g window-status-activity-attr "none"
setw -g window-status-separator ""
set -g status-left "#[fg=colour236,bg=colour150] #S #[fg=colour150,bg=colour238,nobold,nounderscore,noitalics]ᐳ #($HOME/.tmux/sync-status) ᐳ" # the #(script) part is the key
set -g status-right "#[fg=colour249,bg=colour238]ᐸ %Y-%m-%d ᐸ %I:%M %p #[fg=colour150,bg=colour238,nobold,nounderscore,noitalics]ᐸ#[fg=colour236,bg=colour150] #h "
setw -g window-status-format "#[fg=colour249,bg=colour238] #I ᐳ#[fg=colour249,bg=colour238] #W "
setw -g window-status-current-format "#[fg=colour150,bg=colour237] #I ᐳ#[fg=colour150,bg=colour237] #W "
" ~/.vimrc.local
" Sync out changes in TimeIPS-server whenever you save
function! RunGits()
silent execute "!(touch ~/.vim/syncing; rm -f ~/.vim/sync-failed 2>/dev/null; function sync() {make build && gits && notify-send --hint=int:transient:1 'Done syncing'}; sync || touch ~/.vim/sync-failed; rm ~/.vim/syncing) > /dev/null 2>&1 &"
execute "redraw!"
endfunction
autocmd BufWritePost * call RunGits()
#!/bin/bash
# ~/.tmux/sync-status
if [[ -e $HOME/.vim/syncing ]]; then
echo "↻"
elif [[ -e $HOME/.vim/sync-failed ]]; then
echo "✘"
else
echo "✔"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment