Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add options to set default height (for vertical split) or width (for horizontal) of newly opened terminal #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion plugin/split-term.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +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 = 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

Expand Down Expand Up @@ -46,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 : 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

Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ let g:split_term_default_shell = "bash"

`g:disable_key_mappings` - disable key mappings of the plugin

`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

The plugin remaps specifically a few keys for a better terminal buffer experience. This
Expand Down