windowswap.vim 922 B

123456789101112131415161718192021222324252627282930
  1. " MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
  2. " Plugin: https://github.com/wesQ3/vim-windowswap
  3. " vim: et ts=2 sts=2 sw=2
  4. scriptencoding utf-8
  5. if !exists('g:loaded_windowswap')
  6. finish
  7. endif
  8. let s:spc = g:airline_symbols.space
  9. if !exists('g:airline#extensions#windowswap#indicator_text')
  10. let g:airline#extensions#windowswap#indicator_text = 'WS'
  11. endif
  12. function! airline#extensions#windowswap#init(ext)
  13. call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status')
  14. endfunction
  15. function! airline#extensions#windowswap#get_status()
  16. " use new tab-aware api if WS is up to date
  17. let s:mark = exists('*WindowSwap#IsCurrentWindowMarked') ?
  18. \WindowSwap#IsCurrentWindowMarked() :
  19. \(WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr())
  20. if s:mark
  21. return g:airline#extensions#windowswap#indicator_text.s:spc
  22. endif
  23. return ''
  24. endfunction