最後のwindowをquitする時に確認してくれるようにする(vim)

NeoBundle 'tyru/vim-altercmd'

command Q :call s:gentle_quitman()

function! s:gentle_quitman()
  let window_counter = 0
  windo let window_counter = window_counter + 1

  if window_counter == 1
    let a = input("Really quit last window? [n]|y")
    if a == "y"
      q
    endif
  else
    q
  endif
endfunction

call altercmd#load()
AlterCommand q Q
AlterCommand Q q

参考

pluginにした

https://github.com/ToQoz/gentle_quitman.vim