Permalink
Browse files

Add _parse_config function

Will use this to enable more complex layout settings.

eg. TMUX_VIM_LAYOUT=mode:vim,split:h,width:80
  • Loading branch information...
1 parent 1844ed5 commit 7cf5b986a3c57e9106821de3d2ccec4008f43151 @sdt committed Jul 24, 2012
Showing with 14 additions and 1 deletion.
  1. +14 −1 tmux-vim
View
@@ -55,8 +55,21 @@ _die() {
exit 1
}
+# _parse_config cfg key default
+# - Given a $cfg like key1:value1,key2:value2,key3:value3
+# returns the value matching $key, defaulting to $default
+_parse_config() {
+ local cfg="$1"
+ local key=$2
+ local default=$3
+
+ local value=$( echo ,$cfg, | sed -E 's/^.*,'$key'://' | cut -d, -f 1 )
+ echo ${value:-$default}
+}
+
_tmux_window_id() {
- tmux lsp -a -F '#{pane_id}=#{window_index}' | grep ^$TMUX_PANE= | cut -d= -f2
+ tmux lsp -a -F '#{pane_id}=#{window_index}' |\
+ grep ^$TMUX_PANE= | cut -d= -f2
}
# _tmux_store key value

0 comments on commit 7cf5b98

Please sign in to comment.