How to get the list of all installed color schemes in Vim?

前端 未结 11 858

Is there a way to get a list of all installed color schemes in Vim? That would make very easy to select one without looking at the .vim directory.

11条回答
  •  走了就别回头了
    2021-01-29 17:48

    Here is a small function I wrote to try all the colorschemes in $VIMRUNTIME/colors directory.

    Add the below function to your vimrc, then open your source file and call the function from command.

    function! DisplayColorSchemes()
       let currDir = getcwd()
       exec "cd $VIMRUNTIME/colors"
       for myCol in split(glob("*"), '\n')
          if myCol =~ '\.vim'
             let mycol = substitute(myCol, '\.vim', '', '')
             exec "colorscheme " . mycol
             exec "redraw!"
             echo "colorscheme = ". myCol
             sleep 2
          endif
       endfor
       exec "cd " . currDir
    endfunction
    

提交回复
热议问题