Code Monkey home page Code Monkey logo

Comments (5)

nanozuki avatar nanozuki commented on June 12, 2024

I just found that, nvim already has key mapping for change tabs. In :help tabpage:

gt					*i_CTRL-<PageDown>* *i_<C-PageDown>*
		Go to the next tab page.  Wraps around from the last to the
		first one.
{count}gt	Go to tab page {count}.  The first tab page has number one.
g<Tab>		Go to previous (last accessed) tab page.
gT		Go to the previous tab page.  Wraps around from the first one
		to the last one.

One thing should be noticed that, the count of {count}gt is the position of a tab in tabline, not the tab id (displayed in presets). In nvim, there are not a keymapping or API for goto tab by tab id. It has some confuse but more useful. Because the tab id is only use for distinguish tab in script or use by unique name.

from tabby.nvim.

nanozuki avatar nanozuki commented on June 12, 2024

Maybe I should display the {count} , tab number in the label, instead of id.

from tabby.nvim.

EdenEast avatar EdenEast commented on June 12, 2024

From looking at the tabpage help it does look like the count is the number that is used for navigation. If you move your tabs around then the counts might not be in order. Having a way to select the tab based on where it is visually would be a nice helper function. Example:

function focus_tab(n)
  local list = vim.api.nvim_list_tabpages()
  if n > #list then
    return
  end
  vim.api.nvim_set_current_tabpage(list[n])
end

Having some helper functions that work on the visual location of the tabs instead of their id's or count's would be useful for mappings. Also if you allow the tab to be renamed.

from tabby.nvim.

nanozuki avatar nanozuki commented on June 12, 2024

The APIs of tab may be design many years before in vim, so it is a little confusing. In the {count}gt I mentioned below , {count} is what you want.
When i first time writle tabby I don't know this, so the number in presets is tab id, it is not useful to nav in tabs. I'm considering to replace to tab's position number. So, you can made it by using {count}gt or remap it.

from tabby.nvim.

nanozuki avatar nanozuki commented on June 12, 2024

Maybe I should display the {count} , tab number in the label, instead of id.

Updated. The number in tabs' label of presets is tab number now. You can use {number}gt to nav in tabs.

from tabby.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.