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 672419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:28:59+00:00 2026-05-14T00:28:59+00:00

I am writing a vim plugin in which i need to determine all those

  • 0

I am writing a vim plugin in which i need to determine all those files which are currently being diffed. That is the ones for which diff is set. I have been going through the manual but could not find much.

Is it possible to do this.

This question is actually related to question how-to-detect-the-position-of-window-in-vim.
In that question i was trying to get the position of window, so as to detect which one of the diffs is the right one and which is left one. The solution i got was to use winnr()

That solution can work only if there are only 2 windows(the ones being diffed). I want to make it generic so that even if multiple windows are open in vim, i can determine which one is on left and which one is right.
This is what i was thinking to solve the problem

  1. Get a list of all listed buffers
  2. For each of this buffers determine if diff is 1 for that
  3. If diff is 1 use bufwinnr() to gets it window number.
  4. From the window numbers determine which one is left and which one is right. left one will have smaller window number
  5. And then determine if current buffer(in which alt-left`alt-right` is pressed) is left or right using winnr of current buffer.

Now the pieces that are missing are 1 and 2. For 1 ls can be used but i need to parse its output. Is there a straightfwd way to get list of all listed buffers. And then is there a way to check if for that buffer diff is 1 or not.

Any suggestions for a simpler solution are also appreciated.

  • 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-14T00:29:00+00:00Added an answer on May 14, 2026 at 12:29 am
    1. Cycle through all possible buffer numbers from 0 to bufnr('$') and check, whether this buffer exists using bufexists(nr).
    2. Save current buffer number using let curbuf=bufnr('%').
    3. For each existing buffer do execute "buffer ".bufnumber and check &diff variable. Remember two numbers, but do not check bufwinnr().
    4. Do execute "buffer ".curbuf.
    5. Finally call bufwinnr(nr) for two numbers found in step 3.

    UPD: another solution

    let g:wlist={"0": [], "1":[]}
    windo call add(g:wlist[&diff], bufnr('%'))
    let g:diffbuffers=g:wlist.1
    " here you have list of buffers with &diff option set in g:diffbuffers
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 343k
  • Answers 343k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The "" are the cause of these problems. Change sum… May 14, 2026 at 5:25 am
  • Editorial Team
    Editorial Team added an answer usleep(500000) May 14, 2026 at 5:25 am
  • Editorial Team
    Editorial Team added an answer You could do something like this: function disableClick(domNode) { //… May 14, 2026 at 5:25 am

Related Questions

I am writing a Cocoa application with Mono embedded. I want to run and
I am writing a terminal-based application, but I want the user to be able
I am writing an editor which has lot of parameters that could be easily
I am writing an application that I would like to release binaries for on
I'm a VIM beginner, and I have a weird problem. I started using vim

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.