<commit_before>if has('nvim') && !exists("g:go_term_mode")
    let g:go_term_mode = 'vsplit'
endif

" s:jobs is a global reference to all jobs started with new()
let s:jobs = {}

" new creates a new terminal with the given command. Mode is set based on the
" global variable g:go_term_mode, which is by default set to :vsplit
function! go#term#new(cmd)
	call go#term#newmode(a:cmd, g:go_term_mode)
endfunction

" new creates a new terminal with the given command and window mode.
function! go#term#newmode(cmd, mode)
	execute a:mode.' new'
  call s:init_view()

  let job = { 
        \ 'on_stdout': function('s:on_stdout'),
        \ 'on_stderr': function('s:on_stderr'),
        \ 'on_exit' : function('s:on_exit'),
        \ }

  let id = termopen(a:cmd, job)
	let job.id = id
  let s:jobs[id] = job
	startinsert
	return id
endfunction

"init_view initializes the view for a new terminal buffer
function! s:init_view()
  sil file `="[term]"`
	setlocal bufhidden=delete
	setlocal buftype=nofile
	setlocal winfixheight
	setlocal noswapfile
	setlocal nobuflisted
	setlocal cursorline		" make it easy to distinguish
endfunction

function! s:on_stdout(job_id, data)
endfunction

function! s:on_stderr(job_id, data)
endfunction

function! s:on_exit(job_id, data)
  unlet s:jobs[a:job_id]
endfunction<commit_msg>term: add go_term_height and go_term_width settings<commit_after>if has('nvim') && !exists("g:go_term_mode")
    let g:go_term_mode = 'vsplit'
endif

" s:jobs is a global reference to all jobs started with new()
let s:jobs = {}

" new creates a new terminal with the given command. Mode is set based on the
" global variable g:go_term_mode, which is by default set to :vsplit
function! go#term#new(cmd)
	call go#term#newmode(a:cmd, g:go_term_mode)
endfunction

" new creates a new terminal with the given command and window mode.
function! go#term#newmode(cmd, mode)
	execute a:mode.' new'


  sil file `="[term]"`
	setlocal bufhidden=delete
	setlocal buftype=nofile
	setlocal winfixheight
	setlocal noswapfile
	setlocal nobuflisted
	setlocal cursorline		" make it easy to distinguish

  let job = { 
        \ 'on_stdout': function('s:on_stdout'),
        \ 'on_stderr': function('s:on_stderr'),
        \ 'on_exit' : function('s:on_exit'),
        \ }

  let id = termopen(a:cmd, job)
	let job.id = id
	startinsert

	" resize new term if needed.
	let height = get(g:, 'go_term_height', winheight(0))
	let width = get(g:, 'go_term_width', winwidth(0))

	" we are careful how to resize. for example it's vertical we don't change
	" the height
	if a:mode == "vertical"
		exe 'vertical resize ' . width
	elseif a:mode == "split"
		exe 'resize ' . height
	endif

	call jobresize(id, width, height)

  let s:jobs[id] = job
	return id
endfunction

function! s:on_stdout(job_id, data)
endfunction

function! s:on_stderr(job_id, data)
endfunction

function! s:on_exit(job_id, data)
  unlet s:jobs[a:job_id]
endfunction
{'fraction_non_alphanumeric': 0.10894141829393628, 'fraction_numerical': 0.0006851661527920521, 'mean_word_length': 4.377532228360957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3996020', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1024, 'n_words': 316}