乐闻世界logo
搜索文章和话题

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

1个答案

1
  1. Open Vim: Launch the Vim editor.

  2. Use Vim Commands: Within Vim, browse through all available color schemes by executing :colorscheme followed by a space and pressing the Tab key. Vim will automatically display a list of color schemes, and you can continue pressing Tab to cycle through the list.

  3. View Color Scheme Files: Another method is to directly inspect the Vim color scheme directory. Typically, these files reside in the colors/ folder within Vim's installation directory. Use command-line tools to list all files in this directory. For example, on Unix-like systems, run:

    bash
    ls ~/.vim/colors/

    Alternatively, if using Vim's default installation path, check:

    bash
    ls /usr/share/vim/vim81/colors/

    Here, vim81 denotes the Vim version number, which may differ based on your installation.

  4. Use Functions in Vim Scripts: If familiar with Vim scripting, create a simple function to retrieve all color schemes. The following example iterates through the colors/ directory and prints the names of all .vim files, which typically correspond to color schemes:

    vim
    function! ListColorSchemes() echo "Available Color Schemes:" for file in split(globpath(&rtp, "colors/*.vim"), "\n") echomsg fnamemodify(file, ':t:r') endfor endfunction

    Add this function to your .vimrc configuration file and invoke it in Vim using :call ListColorSchemes().

Using these approaches, you can efficiently view and select color schemes in Vim to further tailor your editing environment.

2024年7月20日 15:21 回复

你的答案