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 committia_status_window_max_height #64

Open
wants to merge 1 commit 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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ If committia.vim is in multi-columns mode, specifies the width of the edit windo

Minimum height of a status window.

### `g:committia_status_window_max_height` (default: `-1`)

If non-negative, the maximum height of the status window.

## Future

- Cooperate with [vim-fugitive](https://github.com/tpope/vim-fugitive).
Expand Down
6 changes: 5 additions & 1 deletion autoload/committia.vim
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let g:committia_diff_window_opencmd = get(g:, 'committia_diff_window_opencmd', '
let g:committia_status_window_opencmd = get(g:, 'committia_status_window_opencmd', 'belowright split')
let g:committia_singlecolumn_diff_window_opencmd = get(g:, 'committia_singlecolumn_diff_window_opencmd', 'belowright split')
let g:committia_status_window_min_height = get(g:, 'committia_status_window_min_height', 0)
let g:committia_status_window_max_height = get(g:, 'committia_status_window_max_height', -1)
let g:committia_hooks = get(g:, 'committia_hooks', {})

inoremap <silent> <Plug>(committia-scroll-diff-down-half) <C-o>:call committia#scroll_window('diff', 'C-d')<CR>
Expand Down Expand Up @@ -59,7 +60,10 @@ function! s:open_status_window(vcs, info) abort
let buf_height = line('$')
let height = g:committia_status_window_min_height > buf_height ?
\ g:committia_status_window_min_height : buf_height
if height < status_winheight
if g:committia_status_window_max_height >= 0
let height = min([height, g:committia_status_window_max_height])
endif
if height != status_winheight
execute 'resize' height
endif
return 1
Expand Down