Skip to content

Instantly share code, notes, and snippets.

@mattn
Forked from c9s/.vimrc
Created October 28, 2011 08:12
Show Gist options
  • Save mattn/1321853 to your computer and use it in GitHub Desktop.
Save mattn/1321853 to your computer and use it in GitHub Desktop.
vim colorscheme selector
function! s:SelectColorScheme()
let files = sort(map(split(globpath(&rtp, 'colors/*.vim'), "\n"), 'fnamemodify(v:val, ":t:r")'))
silent 15vnew
call setline(1, files)
silent file `="SelectColorScheme"`
setlocal bufhidden=wipe buftype=nofile nonu nomodifiable cursorline
nnoremap <buffer> <silent> j j:<c-u>exe 'color' getline('.')<cr>
nnoremap <buffer> <silent> k k:<c-u>exe 'color' getline('.')<cr>
nnoremap <buffer> <silent> q :<c-u>close<cr>
endfunction
command! SelectColorScheme call s:SelectColorScheme()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment