Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6068019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:40:15+00:00 2026-05-23T09:40:15+00:00

Let’s say I have single Vim tab displaying 9 buffers (equally separated, like a

  • 0

Let’s say I have single Vim tab displaying 9 buffers (equally separated, like a 3×3 table).

Currently, to get from the top left window to the bottom right one, I have to press 3, Ctrl+W, J, and then 3, Ctrl+W, L. This is cumbersome, and I would like to just be able to press Ctrl+9 to go to the 9th window, and Ctrl+3 to go to the 3rd window, etc.

Is there any easy way I can map something like this in Vim?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T09:40:16+00:00Added an answer on May 23, 2026 at 9:40 am

    There’s a much simpler solution than using the mouse or hard-set movement mappings; they will break if the window numberings are different from what you have in mind for a 3×3 matrix, or if you decide to work with less than 9 windows. Here’s how:

    Include the following in your .vimrc:

    let i = 1
    while i <= 9
        execute 'nnoremap <Leader>' . i . ' :' . i . 'wincmd w<CR>'
        let i = i + 1
    endwhile
    

    Now you can just press <Leader><number> and be taken to the window number you want. I wouldn’t recommend going beyond 9, because IMO, the utility of having multiple viewports follows a Rayleigh distribution and quickly becomes useless with too many viewports in one window.

    It will be helpful if you have the window number displayed in your statusline to aid you in quickly figuring out which window you’re on and which window you want to go to. To do that, use this little function and add it accordingly in your statusline.

    function! WindowNumber()
        let str=tabpagewinnr(tabpagenr())
        return str
    endfunction
    

    See it in action in your statusline:

    set laststatus=2
    set statusline=win:%{WindowNumber()}
    

    Note that the above line will replace your statusline. It was just meant for illustration purposes, to show how to call the function. You should place it where ever you think is appropriate in your statusline. Here’s what mine looks like:

    enter image description here


    Update

    romainl asked for my status line in the comments, so here it is:

    "statusline
    hi StatusLine term=bold cterm=bold ctermfg=White ctermbg=235
    hi StatusHostname term=bold cterm=bold ctermfg=107 ctermbg=235 guifg=#799d6a
    hi StatusGitBranch term=bold cterm=bold ctermfg=215 ctermbg=235 guifg=#ffb964
    
    function! MyGitBranchStyle()
        let branch = GitBranch()
        if branch == ''
            let branchStyle = ''
        else
            let branchStyle = 'git:' . branch
        end
        return branchStyle
    endfunction
    
    function! WindowNumber()
        let str=tabpagewinnr(tabpagenr())
        return str
    endfunction
    
    set laststatus=2
    set statusline=%#StatusLine#%F%h%m%r\ %h%w%y\ col:%c\ lin:%l\,%L\ buf:%n\ win:%{WindowNumber()}\ reg:%{v:register}\ %#StatusGitBranch#%{MyGitBranchStyle()}\ \%=%#StatusLine#%{strftime(\"%d/%m/%Y-%H:%M\")}\ %#StatusHostname#%{hostname()}
    

    The last line should be a single line (be careful if your setup automatically breaks it into multiple lines). I know there are ways to keep it organized with incremental string joins in each step, but I’m too lazy to change it. 🙂 The GitBranch() function (with other git capabilities) is provided by the git.vim plugin. There’s a bug in it as noted here and I use the fork with the bug fix. However, I’m leaving both links and the blog here to give credit to all.

    Also, note that I use a dark background, so you might have to change the colours around a bit if you are using a light scheme (and also to suit your tastes).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say you have a database with a single table like... --------------------------------------------- | Name
let say i have one table, which have data like: name status bob single
Let's say I have a web page that currently accepts a single ID value
Let's say I have a dynamically-created table that is filled with data from a
Let say I have an array like: Array ( [0] => Array ( [Data]
let say i have function like below function doSomethingNow(){ callSomethingInFutureNotExistNow(); } at the moment
Let's say I have the simplest single-file Sinatra app. The hello world on their
Let's say I have two DataTables DT1 and DT2 with a single row. DT1
Let's say I have allocated several pages of continuous memory using VirtualAlloc() from 0x06000000
Let's say you have a table with a integer primary key named 'table_id' Is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.