Skip to content

neovim nvim embedded terminal support request #445

Closed

Description

@robcmills

I tried to run opencode inside a neovim embedded terminal buffer. Results were not great.

  • whole layout severely broken
  • header appeared to be off-screen above
  • every other line appeared to be blank, maybe some kind of text wrapping bug
  • I could not focus the primary prompt input correctly, insert mode was putting characters into the buffer below the input

Image

Image

Image

Activity

  1. Hippo0o commented on Jun 30, 2025

    @Hippo0o

    setting the theme to system seems to fix this issue for me.

  2. kbnopro commented on Jul 7, 2025

    @kbnopro

    I encountered the same issue, but not as severe.
    When trying to run opencode in floating terminal (toggleterm.nvim), the layout seems to be shifted up a bit:

    Image

    After some investication and comparison with lazygit (which works correctly), it seems that the bottom bar is overflowing because opencode read the width of the current app, not the terminal itself.

  3. nickjvandyke commented on Jul 14, 2025

    @nickjvandyke

    setting the theme to system seems to fix this issue for me.

    Initially this didn't work for me, but after upgrading to v0.3.5, it looks correct so far! Other themes still get messy but not a big deal.

    Image
  4. adamdotdevin commented on Jul 14, 2025

    @adamdotdevin
    Member

    i think someone was working on an opencode.nvim plugin, too, which will be another solution

  5. nickjvandyke commented on Jul 14, 2025

    @nickjvandyke

    @adamdotdevin that might be me haha https://github.com/NickvanDyke/opencode.nvim

    It's affected by this bug, unless I'm missing some way to work around it.

    Related, it'd be helpful to expose a --theme CLI option so I can default to 'system' in the plugin rather than instruct users to manually modify their opencode config 😀

  6. adamdotdevin commented on Jul 14, 2025

    @adamdotdevin
    Member

    @adamdotdevin that might be me haha https://github.com/NickvanDyke/opencode.nvim

    It's affected by this bug, unless I'm missing some way to work around it.

    Related, it'd be helpful to expose a --theme CLI option so I can default to 'system' in the plugin rather than instruct users to manually modify their opencode config 😀

    will add this flag

  7. kbnopro commented on Jul 15, 2025

    @kbnopro

    Just want to let you guys know the new version 0.3.5 is now working for me when setting theme to system

  8. nickjvandyke commented on Jul 15, 2025

    @nickjvandyke

    oops, I just noticed there is also https://github.com/sudo-tee/opencode.nvim - did not mean to steal any thunder 😀

    It seems to work around this limitation by making its own UI over opencode run

  9. geekmdtravis commented on Jul 15, 2025

    @geekmdtravis

    I was having the same issue. Using ghostty, on macOS, with Neovim running the TokyoNight theme.

    Image

    I can confirm that the problem resolves by setting the theme to system, which is a reasonable workaround for now.

    Image
  10. nickjvandyke commented on Jul 22, 2025

    @nickjvandyke

    will add this flag

    I just migrated https://github.com/NickvanDyke/opencode.nvim to call opencode's server API rather than send text to the necessarily embedded TUI, so --theme is now much lower priority from my perspective 🙂

  11. robcmills commented on Jul 23, 2025

    @robcmills
    Author

    Update:

    Thanks to Hippo0o for suggesting switching to system theme which did improve things for me.

    However, it appears I am unable to scroll back/up to see the full session output?

    Image

    Maybe this is a personal config issue? Any ideas?

  12. nickjvandyke commented on Jul 23, 2025

    @nickjvandyke

    @robcmills it looks like you're in Normal mode - you have to be in Terminal mode (Insert mode, essentially) to send inputs like scrolling to the TUI

  13. robcmills commented on Jul 23, 2025

    @robcmills
    Author

    @NickvanDyke thanks for responding. I see. I guess this is a result of fundamental design/architecture decisions with regard to the TUI.

    I was comparing it to Claude Code, which appears to just output to stdout in the terminal, sequentially appending. Whereas Opencode is rendering "fullscreen" and scrolling has to be accomplished through opencode, by sending keybindings that do not conflict with the environment, whether that is the parent terminal itself, or in this case neovim. Is this an accurate assessment?

    This is somewhat disappointing to me, because the primary reason I use embedded terminal buffers in neovim is so that I can hit escape to switch to normal mode, and navigate terminal output the same way I navigate normal buffer contents, with all the same keybindings I am accustomed to in neovim, e.g. gg to go to start of session, G to go to bottom, navigating to specific lines, marks, etc.

    I wonder if this is something worth accommodating for in opencode? Or am I just ignorant of the justifications for these choices?

    Maybe offer some sort of configuration layout option, that is either "fullscreen" (current layout) or "append" (more like Claude Code, in that output is just appended to stdout)?

    That could be one way to address/workaround this issue, as well as a whole class of other TUI layout bugs...

  14. blaadje commented on Aug 26, 2025

    @blaadje

    This is somewhat disappointing to me, because the primary reason I use embedded terminal buffers in neovim is so that I can hit escape to switch to normal mode, and navigate terminal output the same way I navigate normal buffer contents, with all the same keybindings I am accustomed to in neovim, e.g. gg to go to start of session, G to go to bottom, navigating to specific lines, marks, etc.

    I agree 💯

  15. blaadje commented on Sep 10, 2025

    @blaadje

    @adamdotdevin (sorry to ping), any thought on that ☝️ ?

  16. uloco commented on Sep 11, 2025

    @uloco

    I also cannot use shift+enter for linebreaks in the embedded terminal. Does anybody else have this issue?

  17. Hippo0o commented on Sep 11, 2025

    @Hippo0o

    @uloco i had the same issue. I solved it by binding: tnoremap <S-CR> <M-CR>/vim.keymap.set("t", "<S-CR>", "<M-CR>") and binding alt+enter in opencode.

    Depending on your terminal you might have to make S-CR work in vim/neovim first tho.

    In alacritty i needed:

    [[keyboard.bindings]]
    chars = "\u001B[13;2u"
    key = "Return"
    mods = "Shift"

    hope it helps.

  18. Muizzyranking commented on Nov 2, 2025

    @Muizzyranking

    I just installed opencode and the system theme does not come installed, do i have to install it separately??

  19. rekram1-node commented on Nov 2, 2025

    @rekram1-node
    Contributor

    @Muizzyranking #3688 we are gonna fix that, we just shipped v1 and it has some behavior changes

  20. garrett-hopper commented on Nov 9, 2025

    @garrett-hopper

    Seems like nvim terminal may not support passing through OSC 4 like tmux does. Only briefly looking through #3688; seems like nvim may need a similar PR to fix it unless I'm missing something.

  21. uloco commented on Jan 28, 2026

    @uloco

    would be really cool to be able to scroll by just going to normal mode and <c-u> / <c-d> and also visual select then etc.

  22. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

  23. added a commit that references this issue on May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions