Ⅰ. 插件描述
Vim Theme Management - custom dark themes, cycle colorschemes, easily toggle or tweak syntax highlighting, italics, integrates with vim-airline and other pluginsⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'frescoraja/frescoraja-vim-themes'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'frescoraja/frescoraja-vim-themes'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'frescoraja/frescoraja-vim-themes'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/frescoraja/frescoraja-vim-themes
Ⅳ. 文档说明
# FrescoRaja Themes for Vim
A vim/neovim plugin wrapper that allows users to dynamically control several of Vim's visual elements and behavior:
cursor, textwidth and cursorcolumn, font, background, and colorscheme.
Table of Contents
- Installation
- Loading Custom Themes
- Theme/Colorscheme Switching
- Background Toggling
- Colorcolumn Toggling
- Colorize/Italicize
- Get Syntax Highlighting
- Cursor Shapes
- Reset Functions
- Default Key Mappings
- Dependencies/Integrations
Loading Customized Themes
Use CustomizeTheme to load specific theme of choice. Themes are a complementary colorscheme/vim-airline theme
combination, along with some highlighting tweaks I felt were beneficial or made theming more consistent. For example,
when a new theme is loaded, the background colors used by ALE are set to complement the
theme's existing background colors. See dependencies at the bottom for integrated plugins.
Use <Plug>CustomizeTheme to bring up autocompletion menu with available themes to load.
" define custom mapping:
nmap <F1> <Plug>CustomizeTheme
" Load a specific theme:
nmap <F12> :CustomizeTheme blayu<CR>Themes/Colorschemes Switching
Use <Plug>NextTheme to cycle forwards through available customized themes.
Use <Plug>PrevTheme to cycle backwards through available customized themes.
Use <Plug>NextColorscheme to cycle forwards through all available colorschemes.
Use <Plug>PrevColorscheme to cycle backwards through all available colorschemes.
Toggle Background Color and Transparency
Use <Plug>ToggleDark to toggle Vim background option value between dark and light
Use <Plug>ToggleBackground to toggle background color between the colorscheme's defined background and the
background color you have defined for your terminal. (sets guibg/ctermbg to none, making Vim background transparent)
Works in both gui mode and cterm mode.
Toggle ColorColumn/Textwidth
Use <Plug>SetTextwidth or SetTextwidth <num> to set &textwidth value
Use <Plug>ToggleColumn or SetTextwidth! to toggle the cursorcolumn
As an example, the following mapping would enable you to type tw=90 + Enter in normal mode to change the
textwidth to 90. (It will also move the colorcolumn to 90)
" Set textwidth
nmap tw= <Plug>SetTextwidthColorize/Italicize
Note Your terminal may not support displaying italicized fonts by default. See instructions
here for enabling italics in
iTerm2 and Mac default Terminal. You may also have to add the following lines to your .vimrc:
let &t_ZH="\e[3m"
let &t_ZR="\e[23m"
" OR
set t_ZH=^[[3m
set t_ZR=^[[23m
" OR have plugin enable italics
let g:custom_italics_enabled=1the
^[above is an escape sequence you can generate in insert mode by pressing CTRL+V then ESC
Use <Plug>ToggleItalics to toggle italics mode for Comments and some other predefined syntax groups like
HTML attribute args. You can italicize specific syntax groups by appending them as a comma-separated list to the<Plug>Italicize or :Italicize command:
:Italicize String,Comment
Use <Plug>Colorize or :ColorizeSyntaxGroup to apply a color to the syntax group of your choice.
For example, the following mapping would enable you to make the ColorColumn syntax group red by typing F1:
nmap <F1> <Plug>Colorize ColorColumn red<CR>when termguicolor is enabled, you can specify hex code colors ie #FF0000 (the # is optional when typing command)
You can toggle italics for any syntax group you'd like. Just use the Italicize! method followed by the syntax
group you want to toggle italics for. You can specify multiple groups separated by a comma. You can make a mapping if
you like to italicize specific groups frequently, or perhaps set an autocmd to do it for specific filetypes:
" Shift+F1 to toggle italics for comments, html attributes, WildMenu
nmap <S-F1> <Plug>ToggleItalics
" Shift+F2 to toggle italics for String, Statement, Identifier
nmap <S-F2> <Plug>Italicize String,Statement,Identifier<CR>
" Automatically italicize Identifier keywords when opening javascript files
autocmd FileType javascript* Italicize! IdentifierGet Syntax Highlighting
<Plug>GetSyntax This is useful for customizing themes and defining your own syntax highlighting colors. Will print
a statement in command line showing all the highlighting groups that apply to the word under the cursor, ie
<current word> => vimStatement, Statement
Custom Cursor Shapes
Set g:custom_cursors_enabled to apply the following cursors:
- block in normal mode - (
█) vertical line in insert mode (appears between characters so it's easier to see precisely where characters will be
inserted) - ( `▎` )- underline in replace mode (
_)
" enable custom cursors
let g:custom_cursors_enabled=1Reset functions
Use <Plug>DefaultTheme to reset custom theme to the default defined in g:custom_themes_name
Use <Plug>Refreshtheme to reload current custom theme
Note if you add a new colorscheme while vim is loaded, or if for some reason the list of available
themes/colorschemes is empty, you can refresh the cache:
Use <Plug>ReloadColorschemes to reload all available colorschemes (or type :ReloadColorschemes)
Use <Plug>ReloadThemes to reload all customized themes (or type :ReloadThemes)
Installation
I use and highly recommend vim-plug, in which case you would add something like
this to your .vimrc:
call plug#begin('/your-plugin-path')
Plug 'frescoraja/frescoraja-vim-themes'
call plug#end()Then, just type :PlugInstall from within Vim, or vim -c PlugInstall from the command line.
Alternatively, this repo can be cloned to a your plugin manager's defined location (like for
pathogen)
git clone https://github.com/frescoraja/frescoraja-vim-themes ~/.vim/bundleTo initialize theming functionality, set a global trigger in vimrc:
let g:custom_themes_enabled=1
" set a default theme to load on startup:
let g:custom_themes_name='default'
" set a random theme to load on startup:
let g:custom_themes_name='random'
" allow default key mappings
let g:custom_themes_mappings_enabled=1Or, you can just call the initializer directly if you don't want any theming applied by default, but want the plugin
functions available:
" this line would go after plugins loaded, ie after `call plug#end()` if using vim-plug
call frescoraja#init()Default Key Mappings
If g:custom_themes_mappings_enabled is set to 1, the following keyboard shortcuts will work automatically (if they
are not already mapped in your .vimrc or by other plugins loaded before this one. Vim will emit a warning if this
plugin tries to override any existing key mappings, and any mappings defined after plugin is loaded will override
mappings defined by this plugin):
F5 to select a custom theme from menu (see here for vim-clap alternative)
Shift + F5 to select a random theme
F7 to cycle backwards through customized theme list
F9 to cycle forwards through customized theme list
Shift+F7 to cycle backwards through colorschemes
Shift+F9 to cycle forwards through colorschemes
Integrations
Here is a list of plugins and colorschemes that frescoraja-vim-themes supports (They are not required)
Plugins
- ALE Warning, Error, and Info message highlights are customized
- (can be disabled by adding
let g:custom_themes_ale_highlights = 0tovimrc
- CoC Warning, Error, Info message as well as GitGutter highlights are customized
- (can be disabled by adding
let g:custom_themes_coc_highlights = 0tovimrc
Vim-Airline / Vim-Airline-Themes
- Vim-Airline automatically selects airline_theme based on colorscheme, this plugin makes some customizations
- (can be disabled by adding
let g:custom_themes_airline_highlights = 0tovimrc
- Vim-Better-Whitespace ExtraWhitespace highlight is underlined in red
- (can be disabled by adding
let g:custom_themes_extra_whitespace_highlights = 0tovimrc
- Define a custom
vim-clapprovider to quickly search and select color themes in a floating window
- Define a custom
To define a custom provider, add the following to your .vimrc:
let g:clap_provider_themes = {
\ 'source': function('frescoraja#get_themes_list'),
\ 'filter': function('frescoraja#get_custom_themes'),
\ 'sink': function('frescoraja#customize_theme')Then use the :Clap themes command to open
Colorschemes
- afterglow
- allomancer
- ayu
- blayu
- candid
- ceudah
- challenger_deep
- chito
- colorsbox
- deep-space
- default
- deus
- distill
- edar/elit
- edge
- forest-night
- gotham
- gruvbox
- gruvbox8
- gruvbox-material
- gummybears
- hybrid-material
- iceberg
- jellybeans
- kafka/dark
- kuroi
- mango
- material-monokai
- material-theme
- material
- maui
- maui-airline
- molokai
- neodark
- oceanic-next
- onedark
- onedarkafterglow
- plastic
- pink-moon
- quantum
- seabird
- spring-night
- srcery
- tender
- thaumaturge
- tokyo-metro
- Tomorrow-Night
- one
- two-firewatch
- yowish
- vim-material
The following colorschemes from vim-colorschemes
- busybee
- flatcolor
- znake
My appreciation goes to all the maintainers of above plugins/themes for their attention to aesthetics and detail.