Code Monkey home page Code Monkey logo

Comments (5)

jordwalke avatar jordwalke commented on August 13, 2024

config:

set hidden
let g:tabSystem = 'wintabs'
let g:wintabs_autoclose=1
let g:wintabs_autoclose_vim=1
let g:wintabs_switchbuf='useopen,usetab'
let g:wintabs_ui_modified*
let g:wintabs_ui_active_higroup = 'TabLineSel'

from vim-wintabs.

jordwalke avatar jordwalke commented on August 13, 2024

let g:wintabs_autoclose=2 seems to work but let g:wintabs_autoclose=1 doesn't.

from vim-wintabs.

zefei avatar zefei commented on August 13, 2024

Should be fixed in the latest commit. This is a very edge case that I can't fix completely due to how confirm/hidden interact with each other. The new behavior is that you can close a modified buffer if it's currently shown in another window or vimtab, with no confirm dialog. I think this behavior is less broken than not closing with no error/confirm.

Let me know if this is fixed for you, and if it feels "more correct" than before.

from vim-wintabs.

jordwalke avatar jordwalke commented on August 13, 2024

I'll check it out: For posterity here's the workaround I created. You might find it useful to handle some edge cases - I basically just detect whether or not there are unsaved changes before even calling wintabs#close(). The problem is that in this workaround, if you have the file open in another split, it resets the modifications to the files to the last saved version even in the other split. I think an improvement would be to first see if the file is open anywhere else before resetting, or before even asking if they want to save changes upon 'close'.

function MaybeCloseWinTab()
  if &modified
    let choice = confirm("File has unsaved changes!", "&Save\n&Cancel\n&Don't Save", 2)
    if choice == 3
      " Don't save: Reset the file then call WintabsClose
      execute "silent earlier 1f"
      call wintabs#close()
    elseif choice == 2 || choice == 0
      " Cancel
    elseif choice == 1
      execute ":w"
      call wintabs#close()
    endif
  else
    call wintabs#close()
  endif
endfunction

from vim-wintabs.

zefei avatar zefei commented on August 13, 2024

Closing this as I implemented your suggestion.

from vim-wintabs.

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.