promptline.vim 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. " MIT License. Copyright (c) 2013-2021 Bailey Ling et al.
  2. " Plugin: https://github.com/edkolev/promptline.vim
  3. " vim: et ts=2 sts=2 sw=2
  4. scriptencoding utf-8
  5. if !exists(':PromptlineSnapshot')
  6. finish
  7. endif
  8. if !exists('airline#extensions#promptline#snapshot_file') || !len('airline#extensions#promptline#snapshot_file')
  9. finish
  10. endif
  11. let s:prompt_snapshot_file = get(g:, 'airline#extensions#promptline#snapshot_file', '')
  12. let s:color_template = get(g:, 'airline#extensions#promptline#color_template', 'normal')
  13. function! airline#extensions#promptline#init(ext)
  14. call a:ext.add_theme_func('airline#extensions#promptline#set_prompt_colors')
  15. endfunction
  16. function! airline#extensions#promptline#set_prompt_colors(palette)
  17. let color_template = has_key(a:palette, s:color_template) ? s:color_template : 'normal'
  18. let mode_palette = a:palette[color_template]
  19. if !has_key(g:, 'promptline_symbols')
  20. let g:promptline_symbols = {
  21. \ 'left' : g:airline_left_sep,
  22. \ 'right' : g:airline_right_sep,
  23. \ 'left_alt' : g:airline_left_alt_sep,
  24. \ 'right_alt' : g:airline_right_alt_sep}
  25. endif
  26. let promptline_theme = promptline#api#create_theme_from_airline(mode_palette)
  27. call promptline#api#create_snapshot_with_theme(s:prompt_snapshot_file, promptline_theme)
  28. endfunction