moonfly is a dark charcoal theme for classic Vim & modern Neovim.
Note, moonfly is a hybrid theme; Vimscript is used for common Vim and Neovim highlights whilst Lua is used for Neovim exclusive highlights.
👉 I maintain another dark theme named nightfly which may be of interest.
Vim & Neovim compatible:
- ALE
- BufExplorer
- clever-f
- CtrlP
- Fern
- fzf.vim (works best with matching fly16 bat theme)
- GitGutter
- indentLine
- lightline
- NERDTree
- Signify
- Tagbar
- vim-airline
Neovim-only:
- Neovim Treesitter
- Neovim Diagnostic
- Barbar
- Bufferline
- Dashboard
- Gitsigns
- Hop
- Indent BlankLine
- Lazy
- lspsaga.nvim
- Lualine
- mason.nvim
- Mini
- Neo-tree
- Noice
- nvim-cmp
- nvim-navic
- nvim-notify
- NvimTree
- Telescope
moonfly is now a GUI-only colorscheme.
A GUI client, such as Gvim, or a modern terminal version of Vim or Neovim with
the termguicolors
option enabled in a true-color terminal, is required.
Details about true-color terminals are listed
here.
moonfly explicitly no longer supports the 256 color cterm
version of Vim or
Neovim except via the legacy cterm-compat
branch.
Install the bluz71/vim-moonfly-colors colorscheme with your preferred plugin manager.
Plug 'bluz71/vim-moonfly-colors', { 'as': 'moonfly' }
use { "bluz71/vim-moonfly-colors", as = "moonfly" }
{ "bluz71/vim-moonfly-colors", name = "moonfly", lazy = true, priority = 1000 },
Enable the colorscheme after the plugin declaration.
" Vimscript initialization file
colorscheme moonfly
-- Lua initialization file
vim.cmd [[colorscheme moonfly]]
- The moonfly theme supports lightline. To enable the moonfly lightline theme please add the following to your initialization file:
let g:lightline = { 'colorscheme': 'moonfly' }
-
The moonfly theme supports vim-airline. The moonfly theme will load once vim-airline starts.
-
The moonfly theme supports lualine. The moonfly theme will load once Lualine starts.
-
My linefly
statusline
plugin supports the moonfly theme. -
Lastly, my legacy mistfly-statusline plugin also supports the moonfly theme.
Option | Default State |
---|---|
moonflyCursorColor | Disabled |
moonflyItalics | Enabled |
moonflyNormalFloat | Disabled |
moonflyTerminalColors | Enabled |
moonflyTransparent | Disabled |
moonflyUndercurls | Enabled |
moonflyUnderlineMatchParen | Disabled |
moonflyVirtualTextColor | Disabled |
moonflyWinSeparator | 1 |
The moonflyCursorColor
option specifies whether to color the cursor or not.
By default the cursor will NOT be colored. If you prefer a colored cursor
then add the following to your initialization file:
" Vimscript initialization file
let g:moonflyCursorColor = v:true
-- Lua initialization file
vim.g.moonflyCursorColor = true
The moonflyItalics
option specifies whether to use italics for comments and
certain HTML elements in GUI versions of Vim. By default this option is
enabled. If you do not like the appearance of italics then add the following
to your initialization file:
" Vimscript initialization file
let g:moonflyItalics = v:false
-- Lua initialization file
vim.g.moonflyItalics = false
The moonflyNormalFloat
option specifies whether to use moonfly background
and foreground colors in Neovim floating windows. By default this option is
disabled, hence, Neovim floating windows will usually be styled with popup
menu colors. If you would like to use moonfly colors instead then add the
following to your configuration:
" Vimscript initialization file
let g:moonflyNormalFloat = v:true
-- Lua initialization file
vim.g.moonflyNormalFloat = true
💡 If the above option is set then it is highly recommended to enable floating window borders to distinguish between the edit and floating windows in Neovim's LSP client, for example:
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = "single"
}
)
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signatureHelp, {
border = "single"
}
)
vim.diagnostic.config({ float = { border = "single" } })
💡 Likewise, nvim-cmp may be
configured as follows for nicer display when g:moonflyNormalFloat
is enabled:
local winhighlight = {
winhighlight = "Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel",
}
require('cmp').setup({
window = {
completion = cmp.config.window.bordered(winhighlight),
documentation = cmp.config.window.bordered(winhighlight),
}
})
The moonflyTerminalColors
option specifies whether to use the moonfly color
palette in :terminal
windows when termguicolors
is set. By default this
option is enabled. If you prefer not to use the moonfly color palette for
the first 16 terminal colors then add the following to your initialization file:
" Vimscript initialization file
let g:moonflyTerminalColors = v:false
-- Lua initialization file
vim.g.moonflyTerminalColors = false
The moonflyTransparent
option specifies whether to use an opaque or
transparent background in GUI versions of Vim. By default this option is
disabled. If you would like a transparent background then add the following
to your initialization file:
" Vimscript initialization file
let g:moonflyTransparent = v:true
-- Lua initialization file
vim.g.moonflyTransparent = true
The moonflyUndercurls
option specifies whether to use undercurls for
spelling and linting errors in GUI versions of Vim, including terminal Vim with
termguicolors
set. By default this option is enabled. If you do not like
the appearance of undercurls then add the following to your initialization file:
" Vimscript initialization file
let g:moonflyUndercurls = v:false
-- Lua initialization file
vim.g.moonflyUndercurls = false
The moonflyUnderlineMatchParen
option specifies whether to underline
matching parentheses. By default this option is disabled. If you want to
underline matching parentheses then add the following to your initialization
file:
" Vimscript initialization file
let g:moonflyUnderlineMatchParen = v:true
-- Lua initialization file
vim.g.moonflyUnderlineMatchParen = true
The moonflyVirtualTextColor
option specifies whether to display diagnostic
virtual text in color. By default this option is disabled. If you want to
display diagnostic virtual text in color then add the following to your
initialization file:
" Vimscript initialization file
let g:moonflyVirtualTextColor = v:true
-- Lua initialization file
vim.g.moonflyVirtualTextColor = true
The moonflyWinSeparator
option specifies the style of window separators:
-
0
will display no window separators -
1
will display block separators; this is the default -
2
will diplay line separators
For example, if line separators are desired then add the following to your configuration:
" Vimscript initialization file
let g:moonflyWinSeparator = 2
-- Lua initialization file
vim.g.moonflyWinSeparator = 2
🎁 If using Neovim 0.7 (or later), the following configuration will improve
the look of line separators (if option 2
has been chosen) by selecting thicker
characters for the separators:
" Vimscript initialization file
set fillchars=horiz:━,horizup:┻,horizdown:┳,vert:┃,vertleft:┨,vertright:┣,verthoriz:╋
-- Lua initialization file
vim.opt.fillchars = { horiz = '━', horizup = '┻', horizdown = '┳', vert = '┃', vertleft = '┫', vertright = '┣', verthoriz = '╋', }
If a certain highlight of this theme does not suit then it is recommended to use
an autocmd
to override that desired highlight.
For example, if one wishes to highlight functions in bold then simply add the following to your initialization file prior to setting the colorscheme:
" Vimscript initialization file
augroup CustomHighlight
autocmd!
autocmd ColorScheme moonfly highlight Function guifg=#74b2ff gui=bold
augroup END
-- Lua initialization file
local custom_highlight = vim.api.nvim_create_augroup("CustomHighlight", {})
vim.api.nvim_create_autocmd("ColorScheme", {
pattern = "moonfly",
callback = function()
vim.api.nvim_set_hl(0, "Function", { fg = "#74b2ff", bold = true })
end,
group = custom_highlight,
})
Many modern terminals support 24-bit true
colors. Current versions of Vim &
Neovim, on such terminals, support true colors when the termguicolors
option
is enabled.
A list of popular terminals that support true colors:
On terminals that support true colors, and when termguicolors
is set, the
moonfly colorscheme will not require any terminal configuration to emit the
correct theme colors.
For the true color moonfly colorscheme to display correctly inside tmux the following setting will usually be required in ~/.tmux.conf:
set -ga terminal-overrides ',xterm-256color:Tc'
Vim, as against Neovim, inside tmux, will also require the following settings
be added to the ~/.vimrc
file:
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
A collection of moonfly-flavoured terminal themes are provided for those using
moonfly with termguicolors
(cterm
users should refer to the next section
and not use these terminal themes):
-
iTerm2 users on macOS can import this colorscheme.
-
Alacritty users can copy this theme into their
alacritty.yml
configuration. -
Windows Terminal users can copy this theme into their
settings.json
configuration. -
Gnome Terminal users can run this script to create a Moonfly profile. Before executing the script, please install the
dconf-cli
command line utility for modern versions of Gnome (3.28 and later), for examplesudo apt install dconf-cli
. After executing the script, please set the cursor and selection colors by hand, with the appropriate color values listed above, inPreferences
/Moonfly
/Colors
.
For other terminals please configure appropriately with the following colors: