Skip to content

Commit a1edd85

Browse files
authored
Support initial height for the split of FlutterSplit,-Run,-Attach (#48)
1 parent 32b9fa0 commit a1edd85

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ flutter using `:FlutterRun`; it can have one of the following values:
4545
* `"hidden"` or `0`: Do not open the log by default, can be opened later with `FlutterSplit` etc.
4646
* `g:flutter_show_log_on_attach` - Identical to `g:flutter_show_log_on_run` but affecting
4747
the `:FlutterAttach` command.
48+
* `g:flutter_split_height` - Initial height of the window opened by `:FlutterSplit` (or `:FlutterRun` and
49+
`:FlutterAttach`, when `g:flutter_show_log_on_run` is set to `"split"`); defaults to standard vim behavior,
50+
which is splitting the window in half.
4851
* `g:flutter_autoscroll` - Autoscroll the flutter log when `1`, defaults to `0`.
4952
* `g:flutter_use_last_run_option` - When set to `1` then `:FlutterRun` will use the arguments from
5053
the previous call when no arguments are specified.

autoload/flutter.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function! flutter#run_or_attach(type, show, use_last_option, args) abort
127127
tabnew __Flutter_Output__
128128
tabm -1
129129
else
130-
split __Flutter_Output__
130+
execute g:flutter_split_height."split" "__Flutter_Output__"
131131
endif
132132
normal! ggdG
133133
setlocal buftype=nofile

plugin/flutter.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ if !exists('g:flutter_command')
88
let g:flutter_command='flutter'
99
endif
1010

11+
if !exists('g:flutter_split_height')
12+
let g:flutter_split_height=''
13+
endif
14+
1115
if !exists('g:flutter_autoscroll')
1216
let g:flutter_autoscroll=0
1317
endif
@@ -59,7 +63,7 @@ if g:flutter_hot_restart_on_save
5963
autocmd! BufWritePost *.dart call flutter#hot_restart_quiet()
6064
endif
6165

62-
command! FlutterSplit :split __Flutter_Output__ | call flutter#scroll_to_bottom()
66+
command! FlutterSplit :execute g:flutter_split_height."split" "__Flutter_Output__" | call flutter#scroll_to_bottom()
6367
command! FlutterVSplit :vsplit __Flutter_Output__ | call flutter#scroll_to_bottom()
6468
command! FlutterTab :tabnew __Flutter_Output__ | call flutter#scroll_to_bottom()
6569

0 commit comments

Comments
 (0)