Skip to content

Commit

Permalink
Fix creating of extra buffer
Browse files Browse the repository at this point in the history
When re-opening a neoterm sometimes it creates a new empty buffer.
To avoid that, check for neoterm buffer before falling back to `enew`.

Fixes #294.
  • Loading branch information
kassio committed Jul 27, 2020
1 parent 0018225 commit e4ce8b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Dynamically set neoterm window size with `:Topen resize=N` and
`:Ttoggle resize=N`. ([\#289](https://github.com/kassio/neoterm/issues/289))
- Add a CHANGELOG enforcer action.
- Fixes creation of extra buffer. ([\#294](https://github.com/kassio/neoterm/issues/294))

### 26/07/2020
- Add option `g:neoterm_bracketed_paste` to allow sending text to terminal in bracketed paste mode. ([\#295](https://github.com/kassio/neoterm/issues/295))
Expand Down
6 changes: 2 additions & 4 deletions autoload/neoterm.vim
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,11 @@ function! s:create_window(instance) abort
endif

let &hidden=l:hidden
elseif get(a:instance, 'buffer_id', 0) > 0 && bufnr('') != a:instance.buffer_id
exec printf('buffer %s', a:instance.buffer_id)
else
enew
end

if get(a:instance, 'buffer_id', 0) > 0 && bufnr('') != a:instance.buffer_id
exec printf('buffer %s', a:instance.buffer_id)
end
endfunction

function! s:navigate_with(callback) abort
Expand Down

0 comments on commit e4ce8b1

Please sign in to comment.