├── README.md ├── Rakefile ├── autoload └── unite │ └── sources │ └── colorscheme.vim ├── doc └── unite-colorscheme.txt └── unite-colorscheme.vimup /README.md: -------------------------------------------------------------------------------- 1 | Check doc/unite-colorscheme.txt 2 | 3 | ## Author 4 | 5 | Tatsuhiro Ujihisa 6 | 7 | ## License 8 | 9 | GPLv3 or any later version, with the following exception clause. 10 | 11 | * You can distribute this Vim plugin "unite-colorscheme" with Vim, GVim or MacVim that released under Vim license. 12 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'fileutils' 2 | require 'pathname' 3 | 4 | files = Dir.glob('**/*.{vim,txt}').map {|f| Pathname(f) } 5 | name = 'unite-colorscheme' 6 | 7 | desc 'generate zip archive of the project, asking you the version' 8 | task :zip do 9 | print "version: " 10 | version = STDIN.gets.chomp 11 | print "OK? " 12 | exit unless STDIN.gets.chomp == 'y' 13 | 14 | sh "mkdir -p #{name}-#{version}" 15 | files.each do |f| 16 | sh "mkdir -p #{name}-#{version}/#{f.dirname}" 17 | sh "cp #{f} #{name}-#{version}/#{f}" 18 | end 19 | sh "zip -r #{name}-#{version}.zip #{name}-#{version}" 20 | sh "rm -r #{name}-#{version}" 21 | end 22 | -------------------------------------------------------------------------------- /autoload/unite/sources/colorscheme.vim: -------------------------------------------------------------------------------- 1 | let s:save_cpo = &cpo 2 | set cpo&vim 3 | 4 | let s:unite_source = { 5 | \ 'name': 'colorscheme', 6 | \ 'hooks': {}, 7 | \ 'action_table': {'*': {}}, 8 | \ } 9 | 10 | function! s:unite_source.hooks.on_init(args, context) 11 | let s:beforecolor = get(g:, 'colors_name', 'default') 12 | endfunction 13 | 14 | function! s:unite_source.hooks.on_close(args, context) 15 | if s:beforecolor == g:colors_name 16 | return 17 | endif 18 | execute s:colorscheme(s:beforecolor) 19 | endfunction 20 | 21 | let s:unite_source.action_table['*'].preview = { 22 | \ 'description' : 'preview this colorscheme', 23 | \ 'is_quit' : 0, 24 | \ } 25 | 26 | function! s:unite_source.action_table['*'].preview.func(candidate) 27 | execute a:candidate.action__command 28 | endfunction 29 | 30 | function! s:colorscheme(x) 31 | return printf("%s %s", 32 | \ get(g:, 'unite_colorscheme_command', 'colorscheme'), 33 | \ a:x) 34 | endfunction 35 | 36 | function! s:blacklist_colorschemes(colorlist) 37 | let blacklist = get(g:, 'unite_colorscheme_blacklist', []) 38 | let kept = [] 39 | for color in a:colorlist 40 | if index(blacklist, color[0]) < 0 41 | let kept = add(kept, color) 42 | endif 43 | endfor 44 | return kept 45 | endfunction 46 | 47 | function! s:unite_source.gather_candidates(args, context) 48 | " [(name, path)] 49 | " e.g. [('adaryn', '/Users/ujihisa/.vimbundles/ColorSamplerPack/colors/adaryn.vim'), ...] 50 | let colorlist = unite#util#sort_by(unite#util#uniq_by( 51 | \ map(split(globpath(&runtimepath, 'colors/*.vim'), '\n'), 52 | \'[fnamemodify(v:val, ":t:r"), fnamemodify(v:val, ":p")]'), 'v:val[0]'), 53 | \'v:val[0]') 54 | let colorlist = s:blacklist_colorschemes(colorlist) 55 | 56 | " "action__type" is necessary to avoid being added into cmdline-history. 57 | return map(colorlist, '{ 58 | \ "word": v:val[0], 59 | \ "source": "colorscheme", 60 | \ "kind": ["file", "command"], 61 | \ "action__command": s:colorscheme(v:val[0]), 62 | \ "action__type": ": ", 63 | \ "action__path": v:val[1], 64 | \ "action__directory": fnamemodify(v:val[1], ":h"), 65 | \ }') 66 | endfunction 67 | 68 | function! unite#sources#colorscheme#define() 69 | return s:unite_source 70 | endfunction 71 | 72 | 73 | "unlet s:unite_source 74 | 75 | let &cpo = s:save_cpo 76 | unlet s:save_cpo 77 | -------------------------------------------------------------------------------- /doc/unite-colorscheme.txt: -------------------------------------------------------------------------------- 1 | *unite-colorscheme.txt* A Unite plugin for changing your colorscheme. 2 | 3 | Author: ujihisa (Tatsuhiro Ujihisa) 4 | License: GPL-3 or later 5 | 6 | ============================================================================== 7 | INTRODUCTION *unite-colorscheme-introduction* 8 | 9 | *unite-colorscheme* is a Unite.vim plugin for changing your colorscheme. 10 | 11 | Requirement: 12 | - unite.vim 13 | 14 | Latest version: 15 | https://github.com/ujihisa/unite-colorscheme 16 | 17 | 18 | ============================================================================== 19 | CUSTOMIZING *unite-colorscheme-customizing* 20 | 21 | g:unite_colorscheme_command *g:unite_colorscheme_command* 22 | Specifies an alternative command to switch your colorscheme. You 23 | don't have to specify this value unless you are using your own 24 | customized pseudo colorscheme command including TabpageColorschem 25 | plugin. 26 | 27 | The default value is 'colorscheme'. 28 | 29 | g:unite_colorscheme_blacklist *g:unite_colorscheme_blacklist* 30 | Specify a list of colorschemes that should not show up as candidates 31 | 32 | For example, to disable all default colorschemes bundled with Vim: 33 | > 34 | let g:unite_colorscheme_blacklist = [ 35 | \ 'blue', 'darkblue', 'delek', 'evening', 36 | \ 'desert', 'elflord', 'koehler', 'morning', 37 | \ 'murphy', 'pablo', 'peachpuff', 'ron', 38 | \ 'slate', 'torte', 'zellner'] 39 | < 40 | The default value is `[]`, i.e. all colorschemes are shown. 41 | 42 | ============================================================================== 43 | vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl 44 | -------------------------------------------------------------------------------- /unite-colorscheme.vimup: -------------------------------------------------------------------------------- 1 | "script_name": unite-colorscheme 2 | "script_id": "3318" 3 | "script_type": utility 4 | "script_package": "{script_name}-{version}.zip" 5 | "required_vim_version": '7.3' 6 | "summary": A Unite.vim plugin for changing your colorscheme. 7 | "detailed_description": | 8 | A Unite.vim plugin for changing your colorscheme. See details in the following pages. 9 | 10 | * http://github.com/ujihisa/unite-colorscheme (development) 11 | * http://ujihisa.blogspot.com/2010/11/how-to-make-unite-plugin.html (for version 1.0) 12 | "install_details": | 13 | After you install Shougo's unite.vim, unarchive the zip file into a directory that is under &rtp of your Vim, including ~/.vim dir. 14 | "versions": 15 | - '2.0': | 16 | * Added g:unite_colorscheme_blacklist 17 | - '1.3': | 18 | * Preview 19 | - '1.2': | 20 | * Introducing g:unite_colorscheme_command to be able to custom colorscheme command 21 | - '1.1': | 22 | * Abandons kinds/colorscheme and uses Unite's kinds/command which is introduced for this plugin 23 | - '1.0': Initial upload 24 | # vim: filetype=yaml 25 | --------------------------------------------------------------------------------