# Equivalent of Vim's -O and -o?

**URL:** <https://discuss.kakoune.com/t/equivalent-of-vims-o-and-o/311>\
**Category:** Recipes & Guides\
**Created:** [February 4, 2019, 12:42am UTC](https://discuss.kakoune.com/t/equivalent-of-vims-o-and-o/311 "2019-02-04T00:42:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nathan-hoad](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/nathan-hoad/32/88_2.png) [@nathan-hoad](https://discuss.kakoune.com/u/nathan-hoad)\
**Post date:** [February 4, 2019, 12:42am UTC](https://discuss.kakoune.com/t/equivalent-of-vims-o-and-o/311/1 "2019-02-04T00:42:31Z")

</div>

I use vim’s -O and -o modes a lot, which open a window per file, e.g. `vim -O *.py` will open all files in the current directory ending with .py in its own vim window.

The solution for this isn’t straightforward, so I thought I’d ask if anyone else had written something before embarking on my own journey.

---

<div class="post-metadata">

**Author:** ![Screwtapello](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/screwtapello/32/12_2.png) [@Screwtapello](https://discuss.kakoune.com/u/Screwtapello)\
**Post date:** [February 4, 2019, 2:00am UTC](https://discuss.kakoune.com/t/equivalent-of-vims-o-and-o/311/2 "2019-02-04T02:00:56Z")

</div>

One reason it’s not straightforward is that Kakoune doesn’t have windows the same way Vim does.

If you start Kakoune with `kak *.py` then you’ll be editing the first file, and all the other files will be open in hidden buffers. You can switch between them with the `:buffer` command.

On the other hand, Kakoune comes with a `:new` command that will launch a new top-level window (as distinct from Vim’s windows, which are all inside a single top-level window). It would be pretty cool to have a command that would open all hidden buffers in new windows, but I’m not sure how to determine which buffers are hidden. The buffer in the current client (wherever you run the command from) is _not_ hidden, but other buffers _might_ be hidden, or they might already be visible in other windows.

I guess you’d have to use `%val{client_list}` to get the list of clients, do something with `:eval -client X` and `%val{bufname}` to get the active buffer for each client, subtract the active buffers from `%val{buflist}` to find the hidden buffers, and then for each hidden buffer do `:new buffer Y` to open a new client for it.
