tmuxline.vim 948 B

12345678910111213141516171819202122232425262728
  1. " MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
  2. " Plugin: https://github.com/edkolev/tmuxline.vim
  3. " vim: et ts=2 sts=2 sw=2
  4. scriptencoding utf-8
  5. if !exists(':Tmuxline')
  6. finish
  7. endif
  8. let s:tmuxline_snapshot_file = get(g:, 'airline#extensions#tmuxline#snapshot_file', '')
  9. let s:color_template = get(g:, 'airline#extensions#tmuxline#color_template', 'normal')
  10. function! airline#extensions#tmuxline#init(ext)
  11. call a:ext.add_theme_func('airline#extensions#tmuxline#set_tmux_colors')
  12. endfunction
  13. function! airline#extensions#tmuxline#set_tmux_colors(palette)
  14. let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal'
  15. let mode_palette = a:palette[color_template]
  16. let tmuxline_theme = tmuxline#api#create_theme_from_airline(mode_palette)
  17. call tmuxline#api#set_theme(tmuxline_theme)
  18. if strlen(s:tmuxline_snapshot_file)
  19. call tmuxline#api#snapshot(s:tmuxline_snapshot_file)
  20. endif
  21. endfunction