Skip to content

Commit 317a978

Browse files
author
Stanislas Polu
committed
Merge pull request spolu#21 from afriggeri/master
Relative width for master pane
2 parents 53e0ef4 + 8f61d55 commit 317a978

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

doc/dwm.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,14 @@ If enabled, dwm maps control keys to the commands.
9797

9898
*'g:dwm_master_pane_width'*
9999
Default: ?
100-
Set the width of the master pane.
100+
Set the width of the master pane. If the value is given as a string, the width
101+
will be set to a relative percentage of the editor's width.
101102
>
103+
"set master pane width to 85 columns
102104
let g:dwm_master_pane_width=85
105+
106+
"set master pane width to 66% of editor width
107+
let g:dwm_master_pane_width="66%"
103108
<
104109

105110

plugin/dwm.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ endfunction
102102
function DWM_ResizeMasterPaneWidth()
103103
" resize the master pane if user defined it
104104
if exists('g:dwm_master_pane_width')
105-
exec 'vertical resize ' . g:dwm_master_pane_width
105+
if type(g:dwm_master_pane_width) == type("")
106+
exec 'vertical resize ' . ((str2nr(g:dwm_master_pane_width)*&columns)/100)
107+
else
108+
exec 'vertical resize ' . g:dwm_master_pane_width
109+
endif
106110
endif
107111
endfunction
108112

0 commit comments

Comments
 (0)