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

  • Home
  • SEARCH
  • 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 9040333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:57:39+00:00 2026-06-16T09:57:39+00:00

To ask in a more precise way: is there a function that works like

  • 0

To ask in a more precise way: is there a function that works like winnr(), but returns a non-changed value for each window?

I’m trying to use hotkeys to switch between buffers in my vim. It all worked fine. But when I put my cursor in another window like NERDTree’s and press the hotkey, NERDTree just disappear and its window switched to another buffer. To fix this, I think I should enable the hotkeys if only if the cursor is in the first window opened with vim. Is there a function like is_first_window() in vim script?

Thank you.

  • 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-06-16T09:57:40+00:00Added an answer on June 16, 2026 at 9:57 am

    A window can display any buffer at any time; buffers are not (permanently) attached to particular windows, so there is no such unique ID.

    What you want is a way to distinguish special windows (like those showing NERDTree) from regular buffers. The way to do this is via the buffer name, to be obtained via bufname('%'), as romainl has suggested. Your mapping can contain a list of known names of special buffers (like NERD_tree_1), or you could try to generically check for special windows, as most of them have &buftype == 'nofile'. Many plugins also have their own special marker variables, NERDTree for example allows to check for its window like this:

    echo exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) == winnr()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to ask if there is a more elegant way to write
I normally like to ask much more precise questions but in this one I
There are some discussions about the same question but I would like to ask
I see that people have ask more specific questions, but mine is broad, why
I would like to ask for more an opinion than a question: What would
First sorry I'm a big beginner. Would like to ask a more experienced developers
I would like to ask for more information on how Chamfer Matching algorithm (an
It's too late to change the question, but more precise would have been to
I found that when I ask something more to Python, python doesn't use my
I've just asked question about Task but realized that I actually want to ask

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.