Permalink
Browse files

Added functionality to customize intero window size and position (#147)

  • Loading branch information...
chris-bacon authored and parsonsmatt committed Apr 26, 2018
1 parent 2d7242d commit 26d340ab0d6e8d40cbafaf72dac0588ae901c117
Showing with 25 additions and 5 deletions.
  1. +7 −0 README.md
  2. +18 −5 autoload/intero/process.vim
@@ -156,6 +156,13 @@ let g:intero_start_immediately = 0
" Enable type information on hover (when holding cursor at point for ~1 second).
let g:intero_type_on_hover = 1
" Change the intero window size; default is 10.
let g:intero_window_size = 15
" Sets the intero window to split vertically; default is horizontal
let g:intero_vertical_split = 1
" OPTIONAL: Make the update time shorter, so the type info will trigger faster.
set updatetime=1000
```
@@ -97,17 +97,21 @@ function! intero#process#hide() abort
endfunction
function! intero#process#open() abort
" Opens the Intero REPL. If the REPL isn't currently running, then this
" Opens the Intero REPL with a default size of 10. If the REPL isn't currently running, then this
" creates it. If the REPL is already running, this is a noop. Returns the
" window ID.
if !exists('g:intero_window_size')
let g:intero_window_size = 10
endif
call intero#process#initialize()
let l:intero_win = intero#util#get_intero_window()
if l:intero_win != -1
return l:intero_win
elseif exists('g:intero_buffer_id')
let l:current_window = winnr()
silent! call s:open_window(10)
silent! call s:open_window(g:intero_window_size)
exe 'silent! buffer ' . g:intero_buffer_id
normal! G
exe 'silent! ' . l:current_window . 'wincmd w'
@@ -272,9 +276,18 @@ function! s:new_response(cmd, response) abort
endfunction
function! s:open_window(height) abort
" Opens a window of a:height and moves it to the very bottom.
exe 'below ' . a:height . ' split'
normal! <C-w>J
" Opens a window of a:height and moves it to the very bottom as a default.
if !exists('g:intero_vertical_split')
let g:intero_vertical_split = 0
endif
if g:intero_vertical_split == 1
exe 'below ' . a:height . ' vsplit'
normal! <C-w>J
else
exe 'below ' . a:height . ' split'
normal! <C-w>J
endif
endfunction
function! s:hide_buffer() abort

0 comments on commit 26d340a

Please sign in to comment.