Git Product home page Git Product logo

Comments (6)

khughitt avatar khughitt commented on August 13, 2024 1

Ah okay. In my case I often use knitr child documents to break up analyses into modular chunks, so when I open one of them in a new buffer, I usually still want to run commands from them in the console.

In case anyone else finds it useful, here are a couple other init.vim tweaks which make the terminals behave more like they did in vim-r + tmux:

" Use vim-bufkill to preserve splits when closing buffers
cabbrev bd :BD
map <C-w> :BD<cr>

" Automatically enter insert mode
autocmd BufWinEnter,WinEnter term://* startinsert

" Exclude from buffer list
autocmd TermOpen * set nobuflisted

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

After :bd, the terminal becomes the only visible buffer. This is what I expected. If I split the window again (<c-w>s) and open test.R again, I can keep sending lines and other commands to the R buffer. If instead of splitting the window again, I quit R, then test.R is displayed. I think this also is what is described by

:help :bd

If buffer [N] is the current buffer, another buffer will be displayed instead.

from nvim-r.

khughitt avatar khughitt commented on August 13, 2024

In that case, can you think of any work-around to preserve the split even after a buffer is closed?

I would much rather use the native Neovim terminal if possible, but the behavior of tmux with respect to the console is much more ideal: since the console was completely separate from Vim, :bd could be used to close buffers, and switching between buffers did not including the terminal window like it does in Neovim.

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

Sorry, but I don't know how to do what you want. Currently, the terminal buffer is already started as a new buffer and not simply as a split of the script buffer. We have this in R/nvimbuffer.vim:

silent below right new

If you can found a sequence of Vim commands that does what you want, I can implement the procedure in the plugin. For example, to get the current behavior, the sequence of Normal mode commands is:

:below right new
:terminal R

If you can't get the desired behavior, you may want to open an issue in Neovim, requesting the new feature. But if indeed it is necessary to change Neovim, the change will not be trivial.

I like the way that Neovim terminal works, and I guess that if it was exactly like Tmux, Neovim developers would not have been motivated to develop it.

from nvim-r.

khughitt avatar khughitt commented on August 13, 2024

Thanks for the suggestions - I think perhaps I just need some more time to get used to working with the Neovim terminal.

Do you often use multiple buffers along-side of the R console? If so, are there any strategies that work well for you?

In the meantime, I found vim-bufkill which get's me most of the way to the behavior I am used to.

from nvim-r.

jalvesaq avatar jalvesaq commented on August 13, 2024

When I need to open another buffer, I almost always use :tabnew because I prefer each buffer occupying the whole screen.

from nvim-r.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.