348

GitHub - bluz71/vim-nightfly-guicolors: A dark color scheme for Vim

 4 years ago
source link: https://github.com/bluz71/vim-nightfly-guicolors
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

nightfly

nightfly is a dark GUI color scheme for Vim and Neovim heavily inspired by Sarah Drasner's Night Owl theme mixed with a dash of my own moonfly theme, hence the name nightfly.

Be aware, the nightfly color scheme does incrementally change from time to time, primarily with regard to language and plugin theming.

Prerequisites

nightfly is a GUI-only Vim color scheme.

A GUI client, such as gvim, or a modern terminal version of Vim/Neovim, with termguicolors enabled in a true-color terminal, will be required. Details about true-color terminals are listed below.

nightfly explicitly does not support color terminal versions of Vim, including 256 cterm, due to the number of custom colors required. Color terminals only allow 16 custom colors. I encourage terminal users to use a true-color terminal, such as iTerm2 or GNOME Terminal, and enable the termguicolors option available in modern terminal versions of Vim and Neovim.

Primary Colors

Normal Color Bright Color Background background Foreground foreground Red red Watermelon watermelon Green green Emerald emerald Yellow yellow Tan tan Blue blue Purple purple Violet violet Turquoise turquoise Orange orange Peach peach

Screenshots

Ruby

ruby

JavaScript

javascript

The font in use is Iosevka.

Languages explicitly styled

  • C/C++
  • Clojure
  • CoffeeScript
  • Crystal
  • Elixir
  • Elm
  • Dart
  • Go
  • Haskell
  • Java
  • JavaScript
  • Lua
  • Markdown
  • PHP
  • PureScript
  • Python
  • Ruby
  • Rust
  • Scala
  • Shell
  • TypeScript

Plugins explicity styled

Installation

use your favoured plugin manager to install bluz71/vim-nightfly-guicolors then set the colorscheme in your vimrc file.

If using vim-plug do the following:

  1. Add Plug 'bluz71/vim-nightfly-guicolors' to your vimrc
  2. Run :PlugInstall
  3. Add colorscheme nightfly to your vimrc, make sure this line appears after the Plug declaration.

Status line

The nightfly color scheme supports lightline.vim. To enable the nightfly lightline colorscheme, after the lightline.vim plugin has been installed, please add the following to your vimrc:

let g:lightline = { 'colorscheme': 'nightfly' }

The nightfly color scheme also supports vim-airline. With modern versions of vim-airline the nightfly theme will be automatically loaded.

Alternatively, vim-moonfly-statusline is available for those that want a simple yet informative status line. After the vim-moonfly_statusline plugin has been installed, please add the following to your vimrc:

let g:moonflyHonorUserDefinedColors = 1

This option will tell moonfly-statusline to not use the default moonfly colors of that plugin, but instead use the specified statusline colors defined by this nightfly theme.

Options

The g:nightflyCursorColor 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 vimrc:

let g:nightflyCursorColor = 1

The g:nightflyTerminalColors option specifies whether to use the nightfly color palette in :terminal windows when termguicolors is set. By default this option is enabled. If you prefer not to use the nightfly color palette for the first 16 terminal colors then add the following to your vimrc:

let g:nightflyTerminalColors = 0

The g:nightflyUnderlineMatchParen 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 vimrc:

let g:nightflyUnderlineMatchParen = 1

The g:nightflyUndercurls 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 vimrc:

let g:nightflyUndercurls = 0

The g:nightflyItalics option specifies whether to use italics for comments and certain html elements 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 italics then add the following to your vimrc:

let g:nightflyItalics = 0

The g:nightflyFloatingFZF option specifies whether to style the fzf.vim plugin for display in a floating window. By default this option is disabled, fzf will be styled for display in a split window in that case. If one configures fzf to display in a floating window then add the following to your vimrc:

let g:nightflyFloatingFZF = 1

Here is an example user configuration that displays fzf in a Neovim floating window:

if has('nvim')
    function! FloatingFZF()
        let width = float2nr(&columns * 0.85)
        let height = float2nr(&lines * 0.70)
        let opts = { 'relative': 'editor',
                    \ 'row': (&lines - height) / 2,
                    \ 'col': (&columns - width) / 2,
                    \ 'width': width,
                    \ 'height': height,
                    \ 'style': 'minimal'}

        let win = nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts)
    endfunction

    let g:fzf_layout = { 'window': 'call FloatingFZF()' }
endif

True Color Terminals

Many modern terminal programs support 24-bit true colors. Current versions of Vim and Neovim, on such terminals, support true colors when set termguicolors is enabled.

A list of common terminals that support true colors:

💣Terminal.app on macOS and xterm on Unix do not support true colors.

On terminals that support true colors, and when termguicolors is set, the nightfly color scheme will emit the correct theme colors.

For the nightfly color scheme to display correctly inside tmux the following setting will be required in ~/.tmux.conf:

set -ga terminal-overrides ',xterm-256color:Tc'

Vim, as against Neovim, inside tmux, will also require the following setting be added to vimrc:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

Repeating, the above t_8* settings are not required for Neovim.

Color Values

RGB values for the nightfly colors:

Name Value Color Name Value Color Red fc514e background Background 011627 background Green a1cd5e background Foreground c3ccdc background Yellow e7d37a background Black Blue 081e2f background Blue 82aaff background Dark Blue 092236 background Violet c792ea background Deep Blue 0e293f background Orange f78c6c background Slate Blue 2c3043 background Watermelon ff5874 background Regal Blue 1d3b53 background Emerald 21c7a8 background Cyan Blue 296596 background Tan ecc48d background Steel Blue 4b6479 background Purple ae81ff background Grey Blue 7c8f8f background Turquoise 7fdbca background Cadet Blue a1aab8 background Peach ffcb8b background White Blue d6deeb background

Tip: Relative Number Column Highlighting only for the Active Window

Historically, when relativenumber was set whilst cursorline was not set, Vim would automatically highlight the cursor line in the number column with the CursorLineNR highlight group. However, newer versions of Vim no longer do that by default unless cursorline is set and the new cursorlineopt option is also set accordingly.

At the same time I also like disabling relativenumber for inactive windows.

To achieve all that please add something similar to the following to your vimrc:

set relativenumber
if exists('&cursorlineopt')
    set cursorlineopt=number
    set cursorline
endif

function! RelativeNumberActivity(mode)
    if &diff
        " For diffs, do nothing since we want relativenumbers in all windows.
        return
    endif
    if &buftype == "nofile" || &buftype == "nowrite"
        setlocal nonumber
    elseif a:mode == "active"
        setlocal relativenumber
        if exists('&cursorlineopt')
            setlocal cursorline
        endif
    else
        setlocal norelativenumber
        if exists('&cursorlineopt')
            setlocal nocursorline
        endif
    endif
endfunction

augroup CustomWindowActivity
    autocmd!
    autocmd WinEnter * call RelativeNumberActivity("active")
    autocmd WinLeave * call RelativeNumberActivity("inactive")
    if exists('&cursorlineopt')
        autocmd FileType nerdtree setlocal cursorlineopt=both
    endif
augroup END

Feel free to change, or ignore, per your needs.

License

MIT


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK