From 22d151396e2d894388e2f5d2ff1585a559f5f745 Mon Sep 17 00:00:00 2001 From: Marcin Binkowski <33808280+fridgelord@users.noreply.github.com> Date: Sun, 11 Oct 2020 21:01:59 +0200 Subject: [PATCH 1/2] add option for default height/width --- plugin/split-term.vim | 3 ++- readme.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/split-term.vim b/plugin/split-term.vim index 6eab3bb..ed1e7c8 100644 --- a/plugin/split-term.vim +++ b/plugin/split-term.vim @@ -2,6 +2,7 @@ let s:force_vertical = exists('g:split_term_vertical') ? 1 : 0 let s:map_keys = exists('g:disable_key_mappings') ? 0 : 1 let s:default_shell = exists('g:split_term_default_shell') ? g:split_term_default_shell : 0 +let s:default_height_width = exists('g:split_term_height') ? g:split_term_height : 25 " utilities around neovim's :term @@ -46,7 +47,7 @@ endfunction " specify the number of visible columns or rows. fun! s:openBuffer(count, vertical) let cmd = a:vertical ? 'vnew' : 'new' - let cmd = a:count ? a:count . cmd : cmd + let cmd = a:count ? a:count . cmd : s:default_height_width . cmd exe cmd endf diff --git a/readme.md b/readme.md index 102b9ab..eae2401 100644 --- a/readme.md +++ b/readme.md @@ -101,6 +101,8 @@ let g:split_term_default_shell = "bash" `g:disable_key_mappings` - disable key mappings of the plugin +`g:split_term_height` - set default height/width at which terminal will be open + ## Mappings The plugin remaps specifically a few keys for a better terminal buffer experience. This From 69b793f03362d4272e9462a1b5433d3001be6d6d Mon Sep 17 00:00:00 2001 From: Marcin Binkowski <33808280+fridgelord@users.noreply.github.com> Date: Sun, 18 Oct 2020 12:26:07 +0200 Subject: [PATCH 2/2] add options for default split width and height --- plugin/split-term.vim | 9 +++++++-- readme.md | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugin/split-term.vim b/plugin/split-term.vim index ed1e7c8..55c046b 100644 --- a/plugin/split-term.vim +++ b/plugin/split-term.vim @@ -2,7 +2,8 @@ let s:force_vertical = exists('g:split_term_vertical') ? 1 : 0 let s:map_keys = exists('g:disable_key_mappings') ? 0 : 1 let s:default_shell = exists('g:split_term_default_shell') ? g:split_term_default_shell : 0 -let s:default_height_width = exists('g:split_term_height') ? g:split_term_height : 25 +let s:default_height = exists('g:split_term_height') ? string(g:split_term_height) : '' +let s:default_width = exists('g:split_term_width') ? string(g:split_term_width) : '' " utilities around neovim's :term @@ -47,7 +48,11 @@ endfunction " specify the number of visible columns or rows. fun! s:openBuffer(count, vertical) let cmd = a:vertical ? 'vnew' : 'new' - let cmd = a:count ? a:count . cmd : s:default_height_width . cmd + if cmd == 'vnew' + let cmd = a:count ? a:count . cmd : s:default_width . cmd + else + let cmd = a:count ? a:count . cmd : s:default_height . cmd + endif exe cmd endf diff --git a/readme.md b/readme.md index eae2401..bdd8f55 100644 --- a/readme.md +++ b/readme.md @@ -101,7 +101,9 @@ let g:split_term_default_shell = "bash" `g:disable_key_mappings` - disable key mappings of the plugin -`g:split_term_height` - set default height/width at which terminal will be open +`g:split_term_height` - set default height at which horizontal terminal will be open + +`g:split_term_width` - set default width at which vertical terminal will be open ## Mappings