Guest User

Untitled

a guest
Dec 12th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. def base16(arg):
  2. # Helpers
  3. def s(cmd):
  4. return cmd.strip('\n') if type(cmd) is str else cmd
  5.  
  6. def l(cmd):
  7. return cmd.split("\n")[:-1] if type(cmd) is str else cmd
  8.  
  9. def all_themes():
  10. for theme in l(s($(ls -1 $BASE16_SHELL/scripts))):
  11. yield theme[7:-3]
  12.  
  13. # Declaration of variables
  14. if not arg:
  15. return 'Dont select theme. Write \033[0;32mlist\033[0;0m to list the themes.'
  16. theme = arg[0]
  17. if (theme == 'list'):
  18. themes = [theme for theme in all_themes()]
  19. return '\n'.join(themes)
  20. script = $BASE16_SHELL + "scripts/base16-" + theme + ".sh"
  21.  
  22. # Checking if exist theme
  23. if (isfile(script)):
  24. bash @(script)
  25. ln -fs @(script) ~/.base16_theme
  26. $BASE16_THEME = theme
  27. template = f"if !exists('g:colors_name') || g:colors_name != 'base16-{theme}'\n colorscheme base16-{theme}\nendif"
  28. echo -e @(template) > ~/.vimrc_background
  29. return True
  30. else:
  31. print("Not exists theme.")
  32. return False
  33. # TODO: Terminate Hooks
  34. # code ...
  35.  
  36.  
  37. aliases['base16'] = base16
Add Comment
Please, Sign In to add comment