Commit 9d08b625a866214486d6d100e2fe9291c61fc47a Parent: 279465acef73d893c7038798b365ebfb8f76432f Author: mcol <mcol@posteo.net> Date: 2019-02-09 10:22:40 +0000 Committer: mcol <mcol@posteo.net> Committed: 2019-02-09 10:22:40 +0000 bsptm into repo
vimrc Modified
@@ -19,16 +19,19 @@ call vundle#begin() Plugin 'VundleVim/Vundle.vim' " required +if hostname() == "zenbook" + Plugin 'mcolligan/vimlab' " vimlab + Plugin 'git@192.168.0.65:/media/usbhdd1/git/vim-myspell' " my spelling + Plugin 'vimwiki/vimwiki' " vimwiki +endif +Plugin 'junegunn/goyo.vim' Plugin 'mcolligan/vim-misc' " my vimrc and misc functions -Plugin 'mcolligan/vimlab' " vimlab Plugin 'mcolligan/tide' " tmux ide -Plugin 'git@192.168.0.65:/media/usbhdd1/git/vim-myspell' " my spelling Plugin 'christoomey/vim-tmux-navigator' " navigate vim and tmux splits seamlessly -Plugin 'vimwiki/vimwiki' " vimwiki call vundle#end() " required filetype plugin indent on " required -" + " Brief help " :PluginList - lists configured plugins " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate @@ -84,10 +87,6 @@ set wildignorecase " disable wildmenu case sensitivity set wildmode=full:list " format wildmenu to expand and scroll with tab -if hostname() == "zenbook" - packadd! matchit " needed for matlab indentation functionality -endif - set autochdir " cwd to current file @@ -109,10 +108,9 @@ " machine specific settings if hostname() == "zenbook" + packadd! matchit " needed for matlab indentation functionality let g:mlint_path_to_mlint = expand("$HOME") . "/applications/MATLAB/R2018b/bin/glnxa64/mlint" let g:vimwiki_list = [{'path': '~/work/research/research.wiki/', 'path_html': '~/work/research/research.wiki.html/'}] -else - let g:mlint_path_to_mlint = "to be filled in later" endif " session saving
tmux.conf Modified
@@ -1,4 +1,4 @@ -# symlink this to ~/.tmux.conf +# tmux.conf # make C-a prefix unbind C-b @@ -8,8 +8,8 @@ # bindings bind r source-file ~/.tmux.conf #bind-key C-a last-window -bind-key | split-window -hb \; run-shell "bsptm" -bind-key -n C-d kill-pane \; run-shell "bsptm" +bind-key | split-window -hb \; run-shell "~/.vim/bundle/vim-misc/bsptm" +bind-key -n C-d kill-pane \; run-shell "~/.vim/bundle/vim-misc/bsptm" bind C-l send-keys 'C-l' # general settings
bsptm Added
@@ -0,0 +1,70 @@ +#!/bin/sh +# +# binary space partitioning for tmux panes + +# Written in 2016 by Suraj N. Kurapati <https://github.com/sunaku> +# Documented at <https://sunaku.github.io/tmux-layout-dwindle.html> +# and modified + +# parse any orientation flags specified among the command-line arguments +spiral_tb=+ +spiral_lr=+ +modulo_hv=1 is_vertical=true +is_spiral=true + + +# gather information about the current state of the window and its panes +set -- $(tmux list-panes -F '#{pane_id}') +selected_pane=$(tmux display-message -p '#{pane_id}') +window_height=$(tmux display-message -p '#{window_height}') +historic_pane=$(tmux last-pane 2>/dev/null \;\ + display-message -p '#{pane_id}' \;\ + last-pane) ||: # exit 1 - no last pane + +# execute all tmux commands in one shot to avoid flickering and slowness +exec tmux $({ +# flatten current layout, stacking all panes vertically like pancakes +echo select-layout even-vertical +# transform pane stack into binary space partitions of dwindling size +count=1 +for pane_id; do + if [ $count -eq $# ]; then + break # skip last pane because .+1 wraps around to the first pane + elif [ $(( count % 2 )) -eq $modulo_hv ]; then + move_h=+ + if $is_spiral && [ $(( count % 5 )) -gt 2 ] + then move_b=$spiral_lr + fi + else + move_h= + if $is_spiral && [ $(( count % 5 )) -gt 2 ] + then move_b=$spiral_tb + fi + fi + echo resize-pane -t $pane_id -y $window_height # make room for move + echo select-pane -t $pane_id # for relative pane addressing in move + echo move-pane -d -s .+1 -t . ${move_h:+-h} ${move_b:+-b} # move it + count=$(( count + 1 )) +done +# divide available space evenly among panes (binary space partitions) +branch_height=$window_height +count=1 +for pane_id; do + if [ $count -eq $# ] && ! $is_vertical; then + break # skip last pane because it will already be sized correctly + elif [ $(( count % 2 )) -eq 1 ]; then + # every other pane is a branch in the binary space partition tree + parent_height=$branch_height + branch_height=$(( 62 * branch_height / 100 )) + if $is_vertical + then resize_y=$parent_height + else resize_y=$branch_height + fi + echo resize-pane -t $pane_id -y $resize_y + fi + count=$(( count + 1 )) +done +# restore pane selection back to how it was before we did any of this +test -n "$historic_pane" && echo select-pane -t $historic_pane +echo select-pane -t $selected_pane +} | sed 's/$/ ;/')