Skip to content

Commit

Permalink
Support initial height for the split of FlutterSplit,-Run,-Attach (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimgerth authored Jun 3, 2023
1 parent 32b9fa0 commit a1edd85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ flutter using `:FlutterRun`; it can have one of the following values:
* `"hidden"` or `0`: Do not open the log by default, can be opened later with `FlutterSplit` etc.
* `g:flutter_show_log_on_attach` - Identical to `g:flutter_show_log_on_run` but affecting
the `:FlutterAttach` command.
* `g:flutter_split_height` - Initial height of the window opened by `:FlutterSplit` (or `:FlutterRun` and
`:FlutterAttach`, when `g:flutter_show_log_on_run` is set to `"split"`); defaults to standard vim behavior,
which is splitting the window in half.
* `g:flutter_autoscroll` - Autoscroll the flutter log when `1`, defaults to `0`.
* `g:flutter_use_last_run_option` - When set to `1` then `:FlutterRun` will use the arguments from
the previous call when no arguments are specified.
Expand Down
2 changes: 1 addition & 1 deletion autoload/flutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function! flutter#run_or_attach(type, show, use_last_option, args) abort
tabnew __Flutter_Output__
tabm -1
else
split __Flutter_Output__
execute g:flutter_split_height."split" "__Flutter_Output__"
endif
normal! ggdG
setlocal buftype=nofile
Expand Down
6 changes: 5 additions & 1 deletion plugin/flutter.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ if !exists('g:flutter_command')
let g:flutter_command='flutter'
endif

if !exists('g:flutter_split_height')
let g:flutter_split_height=''
endif

if !exists('g:flutter_autoscroll')
let g:flutter_autoscroll=0
endif
Expand Down Expand Up @@ -59,7 +63,7 @@ if g:flutter_hot_restart_on_save
autocmd! BufWritePost *.dart call flutter#hot_restart_quiet()
endif

command! FlutterSplit :split __Flutter_Output__ | call flutter#scroll_to_bottom()
command! FlutterSplit :execute g:flutter_split_height."split" "__Flutter_Output__" | call flutter#scroll_to_bottom()
command! FlutterVSplit :vsplit __Flutter_Output__ | call flutter#scroll_to_bottom()
command! FlutterTab :tabnew __Flutter_Output__ | call flutter#scroll_to_bottom()

Expand Down

0 comments on commit a1edd85

Please sign in to comment.