Coder Social home page Coder Social logo

Disable popup while switching about cybu.nvim HOT 5 CLOSED

ghillb avatar ghillb commented on September 4, 2024
Disable popup while switching

from cybu.nvim.

Comments (5)

lucasrabiec avatar lucasrabiec commented on September 4, 2024 1

I found what I need: https://github.com/ton/vim-bufsurf. Thank you for your time. I think we can close this issue.

from cybu.nvim.

ghillb avatar ghillb commented on September 4, 2024

Hi! You can bind :bnext & :bprevious to switch between buffers. To go straight to the last used buffer, you can press/remap <c-6> or :b#, you don't need cybu for that.

vim.keymap.set("n", "L", ":bnext<cr>")
vim.keymap.set("n", "H", ":bprevious<cr>")
vim.keymap.set("n", "K", ":b#<cr>")

The show_on_autocmd config key lets you define an event (e.g. BufEnter)that triggers the cybu popup. The view for this mode can be changed by adapting the behavior.mode.auto.view key

behavior = {
  mode = {
    auto = {
      view = "rolling", -- paging, rolling
    },
  },
  show_on_autocmd = "BufEnter",
}

from cybu.nvim.

lucasrabiec avatar lucasrabiec commented on September 4, 2024

The show_on_autocmd config key lets you define an event (e.g. BufEnter)that triggers the cybu popup. The view for this mode can be changed by adapting the behavior.mode.auto.view key

Oh okay, I get it, TY

Hi! You can bind :bnext & :bprevious to switch between buffers. To go straight to the last used buffer, you can press/remap or :b#, you don't need cybu for that.

AFAIK :bnext and :bprevious switch buffers by their id not in the order that I opened them. I thought CybuLastusedPrev/Next do that but I noticed it also reorders buffers when I open the Next one.

E.g. with CybuLastusedPrev/Next
I opened 1.txt -> 2.txt -> 3.txt -> 4.txt. Number 4 is currently open then I hit Prev and it opens 1 (not 3?), then Prev and it opens 2, Prev and 3. When I hit Next then 2.txt is opened, and when I hit Next again, 3 is opened. Hitting Next at this point switches between 2 and 3. I don't know if it is desirable or bugged but for me, it doesn't make sense. Maybe I'm missing something.

I'm looking for something more like switching the tabs in a web browser that doesn't reorder them but stack buffers and goes forward and backward that stack (ideally per window). Bufferline.nvim does that but I don't like to have a tab line visible at all and AFAIK Bufferline needs to have it visible to work.

from cybu.nvim.

ghillb avatar ghillb commented on September 4, 2024

I'm looking for something more like switching the tabs in a web browser that doesn't reorder them but stack buffers and goes forward and backward that stack.

Currently, this only works, if you set behavior.last_used.switch = "on_close". Then the last used list is only changed once when the switch to the selected buffer happens on close of the window.

There are two things that could be improved here for the plugin

  1. Make it function with behavior.last_used.switch = "immediate" without changing the last used list
    • A new mechanism to keep track of the buffer history is needed (let's call it cybu stack) / this cybu stack only updates when the popup closes / or the timer (see 2.) expires
  2. Make it possible to use CybuLastusedPrev/Next without popup, so that the last used buffer switching through the cybu stack is possible without the context window. For this to properly work, there needs to be a timer, that starts after the last buffer switch with CybuLastusedPrev/Next and after its expiration the cybu stack updates

The non-trivial part is to make the cybu stack mechanism work correctly. I will take a look at it as soon as I have time.

(PRs are always welcome)

from cybu.nvim.

lucasrabiec avatar lucasrabiec commented on September 4, 2024

Is it possible to make something different than 1 and 2? Switching between the previous and next in history (recently opened) without any updates or reorders and also without showing the popup? Just the same behavior as in Chrome for example (ctrl+tab - next, ctrl+shift+tab - previous). No popups, no reorders, no updates of last used, just jumping +1/-1.

  1. 1 | 2 |3| 4 - where 3 is currently opened
  2. Next -> goes to 4
  3. Prev -> goes to 3
  4. Prev -> goes to 2
  5. I am closing 2
  6. New order: 1 |2| 3 - so the 3rd is the new 2 and 4th is the new 3
  7. Next -> goes to 3
  8. I am opening a file (added after 3rd)
  9. 1 | 2 | 3 |4

New files could always be added to the end

I'm new in Neovim and Lua so I don't know if it is possible and how much effort it will take but something like this would be great.

from cybu.nvim.

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.