Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def base16(arg):
- # Helpers
- def s(cmd):
- return cmd.strip('\n') if type(cmd) is str else cmd
- def l(cmd):
- return cmd.split("\n")[:-1] if type(cmd) is str else cmd
- def all_themes():
- for theme in l(s($(ls -1 $BASE16_SHELL/scripts))):
- yield theme[7:-3]
- # Declaration of variables
- if not arg:
- return 'Dont select theme. Write \033[0;32mlist\033[0;0m to list the themes.'
- theme = arg[0]
- if (theme == 'list'):
- themes = [theme for theme in all_themes()]
- return '\n'.join(themes)
- script = $BASE16_SHELL + "scripts/base16-" + theme + ".sh"
- # Checking if exist theme
- if (isfile(script)):
- bash @(script)
- ln -fs @(script) ~/.base16_theme
- $BASE16_THEME = theme
- template = f"if !exists('g:colors_name') || g:colors_name != 'base16-{theme}'\n colorscheme base16-{theme}\nendif"
- echo -e @(template) > ~/.vimrc_background
- return True
- else:
- print("Not exists theme.")
- return False
- # TODO: Terminate Hooks
- # code ...
- aliases['base16'] = base16
Add Comment
Please, Sign In to add comment