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

前端 未结 11 855

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:47

    Try

    set wildmenu
    set wildmode=list:full
    set wildcharm=<C-z>
    let mapleader=','
    nnoremap <leader>c :colorscheme <C-z><S-Tab>
    

    in your ~/.vimrc.

    The first two lines make possible matches appear as lists. You can use either or both.

    The fourth line makes leader , instead of the default \.

    The last line allows you to simply type ,c to get a list and a prompt to change your colorscheme.

    The third line effectively allows for Tabs to appear in key maps.

    (Of course, all of these strategies I've learned from the internet, and mostly SO, very recently.)

    0 讨论(0)
  • 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
    
    0 讨论(0)
  • 2021-01-29 17:56

    i know i am late for this answer but the correct answer seems to be

    See :help getcompletion():

    :echo getcompletion('', 'color')
    

    which you can assign to a variable:

    :let foo = getcompletion('', 'color')
    

    or use in an expression register:

    :put=getcompletion('', 'color')
    

    This is not my answer, this solution is provided by u/romainl in this post on reddit.

    0 讨论(0)
  • 2021-01-29 17:57

    Another simpler way is while you are editing a file - tabe ~/.vim/colors/ ENTER Will open all the themes in a new tab within vim window.

    You may come back to the file you were editing using - CTRL + W + W ENTER

    Note: Above will work ONLY IF YOU HAVE a .vim/colors directory within your home directory for current $USER (I have 70+ themes)

    [user@host ~]$ ls -l ~/.vim/colors | wc -l

    72

    0 讨论(0)
  • 2021-01-29 18:02

    Type

    :colorscheme then Space followed by TAB.

    or as Peter said,

    :colorscheme then Space followed by CTRLd

    The short version of the command is :colo so you can use it in the two previous commands, instead of using the "long form".

    If you want to find and preview more themes, there are various websites like Vim colors

    0 讨论(0)
提交回复
热议问题