• Stars
    star
    114
  • Rank 297,958 (Top 7 %)
  • Language
    Vim Script
  • Created almost 11 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Makes it easy to quickly switch between color schemes in Vim

Color scheme switcher for Vim

The colorscheme switcher plug-in for the [Vim text editor] vim makes it easy to quickly switch between [colorschemes] cs. It defines commands and mappings to switch to the next and previous color schemes.

Installation

Please refer to the [installation instructions] howto-install available on GitHub. Once you've installed the plug-in you can try it out by executing :NextColorScheme to switch to the next color scheme.

If you didn't change the plug-in's configuration you can use the F8 and Shift-F8 keys to switch to the next/previous color scheme and Control-F8 to switch to a random color scheme.

Commands

The :NextColorScheme command

Switch to the next color scheme. After the last color scheme the cycle repeats from the first color scheme.

The :PrevColorScheme command

Switch to the previous color scheme. After the first color scheme the cycle repeats from the last color scheme.

The :RandomColorScheme command

Switch to a random color scheme. Because Vim doesn't actually expose random numbers the microseconds of the current time are used to improvise a source of randomness. It's nothing like real randomness but convincing enough for this plug-in :-).

Options

The colorscheme switcher plug-in should work out of the box, but you can change the configuration defaults if you want to change how the plug-in works.

The g:colorscheme_switcher_define_mappings option

By default the plug-in maps the following keys in insert and normal mode:

  • F8 switches to the next color scheme
  • Shift-F8 switches to the previous color scheme

To disable these mappings (e.g. because you're already using them for a different purpose) you can set the option g:colorscheme_switcher_define_mappings to 0 (false) in your [vimrc script] vimrc.

The g:colorscheme_switcher_keep_background option

If you set this variable to 1 (true) and cycle to the next/previous color scheme, the plug-in will skip color schemes with a different ['background'] bg. By default this is set to 0 (false).

This is useful when you want to see only light or dark color schemes, for example because the sun is shining (you'll want a light background) or because it's late at night (then you'll likely prefer a dark background).

The g:colorscheme_switcher_exclude option

A list with names of color schemes to be ignored by the plug-in. By default the list is empty. Here's an example of how you can set this:

:let g:colorscheme_switcher_exclude = ['default', 'test']

The g:colorscheme_switcher_exclude_builtins option

If you set this variable to 1 (true) the color schemes bundled with Vim (installed in $VIMRUNTIME) are ignored and instead only the color schemes that you specifically installed in your Vim profile are used.

The g:colorscheme_switcher_command option

This option is a string specifying the Vim command used to switch between color schemes. It defaults to the [:colorscheme] cs command. You can set this option to integrate the vim-colorscheme-switcher plug-in with other plug-ins like colorsupport.vim and guicolorscheme.vim.

See also

The vim-colorscheme-manager plug-in is an add-on for vim-colorscheme-switcher that adds features like more convenient blacklist management and automatic loading of the last used color scheme when Vim starts up or a session is loaded.

Known problems

The way Vim color schemes are written isn't really compatible with the idea of quickly switching between lots of color schemes. In my opinion this is an ugly implementation detail of how Vim works internally, in other words I think it's a bug that should be fixed... Here are some references that explain the problem in some detail:

Since this behavior hinders cycling through color schemes, the colorscheme switcher plug-in includes a workaround that should hide the problem:

  1. At startup a dictionary is created which will be used to remember links between highlighting groups;
  2. Before and after loading a color scheme, the colorscheme switcher plug-in runs the [:highlight] hi command without any arguments to find links between highlighting groups. Each link that is found is added to the dictionary. Existing entries are updated. This is done by calling xolox#colorscheme_switcher#find_links().
  3. After loading a color scheme, the colorscheme switcher plug-in runs the [:highlight] hi command without any arguments to find highlighting groups in the state 'cleared'. For each of these groups, if they were previously linked, the link is restored. This is done by calling xolox#colorscheme_switcher#restore_links().

Probably this solution is still not perfect, but it's a lot better than the behavior out of the box: Before I implemented the steps above, when I would cycle through my color schemes, Vim would eventually end up with black text on a white background and nothing else! With the steps above, I can cycle as many times as I want and all of the color schemes I've checked so far look fine.

Contact

If you have questions, bug reports, suggestions, etc. the author can be contacted at [email protected]. The latest version is available at http://peterodding.com/code/vim/colorscheme-switcher/ and http://github.com/xolox/vim-colorscheme-switcher. If you like this plug-in please vote for it on [Vim Online] vim_online.

License

This software is licensed under the [MIT license] mit. Β© 2015 Peter Odding <[email protected]>.

More Repositories

1

vim-notes

Easy note taking in Vim
Vim Script
1,585
star
2

vim-easytags

Automated tag file generation and syntax highlighting of tags in Vim
Vim Script
1,018
star
3

vim-session

Extended session management for Vim (:mksession on steroids)
Vim Script
961
star
4

python-coloredlogs

Colored terminal output for Python's logging module
Python
517
star
5

vim-misc

Miscellaneous auto-load Vim scripts
Vim Script
363
star
6

python-humanfriendly

Human friendly input/output for text interfaces using Python
Python
302
star
7

vim-lua-ftplugin

Lua file type plug-in for the Vim text editor
Vim Script
185
star
8

vim-shell

Improved integration between Vim and its environment (fullscreen, open URL, background command execution)
Vim Script
170
star
9

python-rotate-backups

Simple command line interface for backup rotation
Python
160
star
10

dedupfs

A Python FUSE file system that features transparent deduplication and compression which make it ideal for archiving backups.
Python
122
star
11

python-executor

Programmer friendly subprocess wrapper
Python
98
star
12

vim-lua-inspect

Semantic highlighting for Lua in Vim
Lua
94
star
13

vim-reload

Automatic reloading of Vim scripts ((file-type) plug-ins, auto-load/syntax/indent scripts, color schemes)
Vim Script
79
star
14

lua-lxsh

Lexing & Syntax Highlighting in Lua (using LPeg)
Lua
70
star
15

lua-apr

Apache Portable Runtime binding for Lua
C
57
star
16

python-rsync-system-backup

Linux system backups powered by rsync
Python
48
star
17

vim-tools

Python scripts that make it easier (for me) to publish Vim plug-ins
Python
42
star
18

python-negotiator

Scriptable KVM/QEMU guest agent implemented in Python
Python
41
star
19

python-apt-mirror-updater

Automated, robust apt-get mirror selection for Debian and Ubuntu
Python
41
star
20

python-deb-pkg-tools

Debian packaging tools
Python
40
star
21

python-verboselogs

Verbose logging for Python's logging module
Python
33
star
22

vim-pyref

A plug-in for the Vim text editor that provides context-sensitive documentation for Python source code.
Vim Script
31
star
23

python-capturer

Easily capture stdout/stderr of the current process and subprocesses
Python
29
star
24

python-proc

Simple interface to Linux process information
Python
22
star
25

python-chat-archive

Easy to use offline chat archive
Python
18
star
26

python-redock

Human friendly wrapper around Docker
Python
16
star
27

sync-dotfiles

Quickly push your dotfiles from your workstation to your servers.
16
star
28

python-auto-adjust-display-brightness

Automatically adjust Linux display brightness
Python
15
star
29

vim-publish

A Vim plug-in that helps you publish hyperlinked, syntax highlighted source code
Vim Script
14
star
30

python-property-manager

Useful property variants for Python programming
Python
13
star
31

python-qpass

Frontend for pass (the standard unix password manager)
Python
13
star
32

python-vcs-repo-mgr

Version control repository manager
Python
12
star
33

python-naturalsort

Simple natural order sorting API for Python that just works
Python
12
star
34

mopidy-simple-webclient

Simple and minimalistic Mopidy HTTP client, touch friendly, works in most (mobile) web browsers
JavaScript
12
star
35

mpd-myfm

A client for Music Player Daemon that fills your playlist based on similar artists from Last.fm
Python
10
star
36

lua-buildbot

A build bot for popular Lua projects (Lua 5.1, LuaJIT 1 & LuaJIT 2)
Lua
8
star
37

python-preview-markup

Live preview Markdown and reStructuredText files as HTML in a web browser
Python
8
star
38

python-debuntu-tools

Debian and Ubuntu system administration tools
Python
7
star
39

python-linux-utils

Linux system administration tools for Python
Python
7
star
40

python-apache-manager

Monitor and control Apache web server workers from Python
Python
6
star
41

python-npm-accel

Accelerator for npm, the Node.js package manager
Python
6
star
42

python-update-dotdee

Generic modular configuration file manager
Python
6
star
43

vim-tlv-mode

Transaction-Level Verilog support for Vim
Vim Script
5
star
44

python-pdiffcopy

Fast large file synchronization inspired by rsync
Python
5
star
45

python-crypto-drive-manager

Unlock all your encrypted drives with one pass phrase
Python
5
star
46

python-gentag

Simple and powerful tagging for Python objects
Python
4
star
47

python-dwim

Location aware application launcher
Python
3
star