Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to unlist Terminal buffer so it doesn't show up in buffer list #97

Open
dseeni opened this issue Apr 21, 2020 · 11 comments
Open

Comments

@dseeni
Copy link

dseeni commented Apr 21, 2020

EDIT FROM MAINTAINER:

Give me the ability to unlist the terminal buffer so it doesn't show up in buffer list.

ORIGINAL ASK:

Is there anyway to close the powershell integrated console in neovim? It keeps on launching, even if I kill the buffer it automatically recreates itself.

@dseeni dseeni closed this as completed Apr 21, 2020
@dseeni dseeni reopened this Apr 21, 2020
@dseeni
Copy link
Author

dseeni commented Apr 21, 2020

Reopening this issue
there is no way to close the integrated console buffer? it automatically recreates itself
image

@TylerLeonhardt
Copy link
Collaborator

you can set this setting:

"powershell.integratedConsole.showOnStartup": true

or use the CocAction powershell.toggleTerminal

@dseeni
Copy link
Author

dseeni commented Apr 23, 2020

Tyler, @TylerLeonhardt
Neither CocAction OR showOnStartup solve this issue, if it were so I would be very pleased.

Unfortunately that does NOT make the seperate powershell integrated console disappear. There is literally no way to close the buffer or quit.

The only work around I have for this is setting up an autocmd to unlist the buffer, like so:
image

There is literally no way to get rid of the powershell buffer, the small window yes you can toggle hide it and set showOnStartup:False (Which I have done).. this works for the small window on startup, but not the seperate powershell buffer.

Reading into it it seems this running live instance of the integrated console is necessary for Microsoft's LSP completion and documentation in Coc-Powershell. Which is fine, I like that stuff, so the unlisted buffer seems best, "out of sight out of mind" you know?

This is a very hacky solution, but it works because I can launch my own powershell 7 nvim terminals by binding "pwsh" and exposing it to the env path. Those terminals don't share the full pwsh7 path as the buffers "file name" as the integrated console. They simply register as 'pwsh' and don't become unlisted by this autocmd.

@TylerLeonhardt
Copy link
Collaborator

Like you said, all of the language features come from the Integrated Console if you get rid of that, then you don't have any of the goodness that coc-powershell provides.

The reason why the Integrated Console is displayed by default is because this extension is attempting to replicate the experience that a lot of PowerShell users expect:

  • script on top
  • REPL on bottom
  • some ability to run parts of the script on top in the REPL below (via powershell.Execute CocAction)

This experience was made famous in the PowerShell ISE and the PowerShell extension for VS Code.

The CocAction to toggle and the settings were specifically added for the purpose of hiding it for those that don't want to see it but it's still something that needs to exist for language features.

Is there a reason this isn't good enough? I'm just trying to understand what your scenario is.

@dseeni
Copy link
Author

dseeni commented Apr 23, 2020

I just like my buffer list to be buffers I want to be seeing. When you cycle through buffers, say I'm working with only 2 files, its nice to swap between them, rather than have a mandatory 3rd buffer (the powershell ISE) in between. Really just a preference thing.

Of course, the CocAction to hide the split in the powershell file could also unlist the ISE buffer (basically my autocmd). And 'show' could list that separate buffer. Would basically be the same thing. Anyway my workaround has me satisfied, I get all the benefits of Coc-Powershell without an unnecessary buffer in my bufferlist.

@TylerLeonhardt TylerLeonhardt changed the title Any way to close powershell integrated console in neovim?? Ability to unlist Terminal buffer Apr 23, 2020
@TylerLeonhardt TylerLeonhardt changed the title Ability to unlist Terminal buffer Ability to unlist Terminal buffer so it doesn't show up in buffer list Apr 23, 2020
@yatli
Copy link
Member

yatli commented Apr 23, 2020

Yes I think this is a preference, and our current implementation complies to the nvim defaults (terms are listed). You can use something like https://github.com/yatli/vmux.vim to automatically unlist the terminal buffers.

@TylerLeonhardt
Copy link
Collaborator

Yeah we call to coc.nvim to create the terminal buffer and we call hide on it:

this.consoleTerminal.hide();

I think that method could also unlist or maybe there can be an unlist API as well. @chemzqm do you have any thoughts here?

@chemzqm
Copy link

chemzqm commented Apr 24, 2020

could also unlist or maybe there can be an unlist API as well.

No, it just hide the buffer. Use autocmd in your vimrc if you want to unlist terminal buffer, but looks like @dseeni want to destroy the buffer.

@dseeni
Copy link
Author

dseeni commented Apr 29, 2020

No, it just hide the buffer. Use autocmd in your vimrc if you want to unlist terminal buffer, but looks like @dseeni want to destroy the buffer.

@yatli if it goes against standards then disregard, but I have tried all linked plugins including what you posted, and the powershell integrated console refuses to die haha. If I kill it, it will respawn, even using things like vim-bufkill, even if all powershell files are closed.

2 wishlist changes by priority:

  1. Allow the User to destroy the Powershell Integrated Console buffer when there are no longer .ps1 buffers in the buffer list or buffloaded.

    • If this clean up could be done automatically that's great, but at least give the user the power to destroy the buffer when it's no longer even needed (no powershell files open). At the moment the user has to start a new neovim session just to get rid of the buffer.
  2. the autocmd vs hide option = unlist are virtually the same thing. If it's an option that's nice, since it would make 'hide console' actually more useful. You could simply toggle buffadd vs bufunlist in vimscript, same as the autocmd above I think?

Thanks for taking the time to look into this :)

@chemzqm
Copy link

chemzqm commented Apr 29, 2020

My suggestion is use a subprocess to start language server, and use prompt buffer (which is quite new on neovim) for interactive.

@bgmonroe
Copy link

bgmonroe commented Dec 8, 2020

Reopening this issue
there is no way to close the integrated console buffer? it automatically recreates itself

You can close the REPL (only after closing the editor buffer unfortunately) by using the '[Environment]::Exit(1)' command. But to be honest, it (the REPL buffer) should:

  1. Be closable with 'exit', 'Exit', or ^d. I think the current behavior is a side effect of how the pwsh process gets spun up by the extension.
  2. Close when the editor buffer closes.
  3. Be configurable to not open by default (I like that it opens but it should be user configurable with a simple bool var in the coc-settings.json).

To Note and FWIW: I'm using a Mac with VIM 8.2 and PS 7.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants