Giter VIP home page Giter VIP logo

onedark.nvim's Introduction

Deprecated!

As of Jul 11th 2022, onedark.nvim is fully deprecated. No new changes are expected to land. In fact, none have landed for some time.

Check the this another awesome port of atom's onedark theme or migrate to parent repo.

onedark.nvim
Atom's iconic One Dark theme for Neovim, written in Lua

monsonjeremy/onedark.nvim GitHub Action Linting Twitter

Features

  • Supports the latest Neovim 0.5 features like TreeSitter and LSP
  • Minimal inactive StatusLine
  • Vim terminal colors
  • Darker background for sidebar-like windows
  • Color configs for Kitty and Alacritty
  • Beautiful lualine theme

Requirements

  • Neovim >= 0.5.0

Installation

Install the theme with your preferred package manager:

vim-plug

Plug 'ful1e5/onedark.nvim'

packer

use 'ful1e5/onedark.nvim'

Usage

Enable the colorscheme:

" Vim Script
colorscheme onedark
-- Lua
require('onedark').setup()

Configuration

Option Default Description
colors {} You can override specific color groups to use other groups or a hex color.
comment_style italic Highlight style for comments (check :help highlight-args for options)
dark_float false Float windows like the lsp diagnostics windows get a darker background.
dark_sidebar true Sidebar like windows like NvimTree get a darker background.
dev false Developer Mode.
function_style NONE Highlight style for functions (check :help highlight-args for options)
hide_end_of_buffer true Enabling this option, will hide filler lines (~) after the end of the buffer.
hide_inactive_statusline true Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard StatusLine.
highlight_linenumber false Enabling this option, will enable dark color to LineNr, SignColumn and CursorLineNr highlights.(also support gitsigns plugin)
keyword_style italic Highlight style for keywords (check :help highlight-args for options)
lualine_bold false When true, section headers in the lualine theme will be bold.
msg_area_style NONE Highlight style for messages and cmdline (check :help highlight-args for options)
overrides function Override specific highlight groups. The function accpet colors as argument. You can also add a non-exists highlight by enabling the dev mode.
sidebars {} Set a darker background on sidebar-like windows. For example: {"qf", "vista_kind", "terminal", "packer"}
transparent false Enable this to disable setting the background color.
transparent_sidebar false Sidebar like windows like NvimTree get a transparent background.
variable_style NONE Highlight style for variables and identifiers (check :help highlight-args for options)
" Example config in VimScript
" configuration needs to be set BEFORE loading the color scheme with `colorscheme` command
let g:onedark_function_style = "italic"
let g:onedark_sidebars = ["qf", "vista_kind", "terminal", "packer"]

" Change the "hint" color to the "orange0" color, and make the "error" color bright red
let g:onedark_colors = {
  \ 'hint': 'orange0',
  \ 'error': '#ff0000'
\ }

" Load the colorscheme
colorscheme onedark
-- Example config in Lua
require("onedark").setup({
  function_style = "italic",
  sidebars = {"qf", "vista_kind", "terminal", "packer"},

  -- Change the "hint" color to the "orange0" color, and make the "error" color bright red
  colors = {hint = "orange0", error = "#ff0000"},

  -- Overwrite the highlight groups
  overrides = function(c)
    return {
      htmlTag = {fg = c.red0, bg = "#282c34", sp = c.hint, style = "underline"},
      DiagnosticHint = {link = "LspDiagnosticsDefaultHint"},
      -- this will remove the highlight groups
      TSField = {},
    }
  end
})

Lualine Support

To enable the onedark theme for Lualine, simply specify it in your lualine settings:

require('lualine').setup {
  options = {
    theme = 'onedark-nvim',
    -- ... your lualine config
  }
}

normal insert visual command terminal

Terminal Themes

To generate the configs make terminal or :luafile lua/onedark/terminal/init.lua

Extra color configs for kitty, and Alacritty can be found in terminal directory. To use them, refer to their respective documentation.

Making undercurls work properly in Tmux

To have undercurls show up and in color, add the following to your Tmux config file:

# Undercurl
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'  # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'  # underscore colours - needs tmux-3.0

Plugin Support

Inspirations

Screenshot

onedark

Default

Default

Normal

" VimScript
let g:onedark_comment_style = "NONE"
let g:onedark_keyword_style = "NONE"
let g:onedark_function_style = "NONE"
let g:onedark_variable_style = "NONE"
-- Lua
require("onedark").setup({
  comment_style = "NONE",
  keyword_style = "NONE",
  function_style = "NONE",
  variable_style = "NONE"
  -- ... your onedark config
})

Normal

Italic

" VimScript
let g:onedark_comment_style = "italic"
let g:onedark_keyword_style = "italic"
let g:onedark_function_style = "italic"
let g:onedark_variable_style = "italic"
-- Lua
require("onedark").setup({
  comment_style = "italic",
  keyword_style = "italic",
  function_style = "italic",
  variable_style = "italic"
  -- ... your onedark config
})

Italic

Minimal

" VimScript
let g:onedark_hide_inactive_statusline = 1
let g:onedark_dark_sidebar = 0
let g:onedark_dark_float = 0
-- Lua
require("onedark").setup({
  hide_inactive_statusline = true,
  dark_sidebar = false,
  dark_float = false
  -- ... your onedark config
})

Minimal

Highlight Line-Number

" VimScript
let g:onedark_highlight_linenumber = 1
-- Lua
require("onedark").setup({
  highlight_linenumber = true
  -- ... your onedark config
})

Highlight Line-Number

Telescope

Telescope plugin

onedark.nvim's People

Contributors

ful1e5 avatar mawkler avatar monosans avatar morazow avatar shivamashtikar avatar stelth avatar yioneko avatar yochem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

onedark.nvim's Issues

Typescript Decorator syntax highlighting wrong

Hey @ful1e5, I've found an issue regarding nest.js decorators and the syntax highlighting in the theme.
The "@" and the decorator name are different colors. Do you mind changing this? Please review the attached image below.

image

Seems to mess up lualine

Lualine installed by itself with the theme set to onedark looks fine. But once I install this onedark theme plugin, I get the error:

Error executing vim.schedule lua callback: ...pack/packer/start/lualine.nvim/lua/lualine/hi
ghlight.lua:29: Vim(highlight):E411: highlight group not found: lualine_c_normal
Press ENTER or type command to continue

My config for reference:

local fn = vim.fn
local cmd = vim.cmd
local opt = vim.opt

opt.expandtab = true
opt.shiftwidth = 4
opt.tabstop = 4
opt.smartindent = true

opt.termguicolors = true
opt.number = true

-- PLUGINS

local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
local packer_missing = fn.empty(fn.glob(install_path)) > 0
if packer_missing then
    fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
    cmd([[packadd packer.nvim]])
end

require('packer').startup(function()
    use 'wbthomason/packer.nvim'

    use 'b3nj5m1n/kommentary'

    use {
      'hoob3rt/lualine.nvim',
      requires = {'kyazdani42/nvim-web-devicons', opt = true},
      config = function()
          require('lualine').setup({
              options = {
                  theme='onedark',
          }
          })
      end
    }

    use {
      'ful1e5/onedark.nvim',
      config = function()
          require('onedark').setup({
              hideInactiveStatusline = true
          })
      end
    }

    use {
      'nvim-treesitter/nvim-treesitter',
      run = ':TSUpdate',
      config = function()
          require('nvim-treesitter.configs').setup {
              ensure_installed = {"lua", "python"},
              highlight = {enable = true}
          }
      end
    }


    use {
      'lewis6991/gitsigns.nvim',
      requires = { 'nvim-lua/plenary.nvim' },
      config = function() require('gitsigns').setup() end 
    }
end)

Even if I have onedark.nvim simply installed without having `.setup()` run, this issue occurs.

Toggleterm colors don't match terminal theme

First of all, thanks for this plugin. I'm having an issue where the wrong colors are applied to text in the toggleterm buffer. The text autocompletion in the pictures below looks too dark, and so does the gray part of the prompt. Is there an option that lets me correct this?

Terminal in nvim:
Screenshot from 2022-01-15 18-17-38

Terminal outside nvim:
Screenshot from 2022-01-15 18-18-21

Wrong background for CursorLineNr

I've configured onedark to have a darker background

  use { 'ful1e5/onedark.nvim',
        config = require('onedark').setup({ colors = {bg0 = '#1e2127', bg_linenumber =  '#1e2127'},
                                           dark_sidebar = true,
                                           dark_float = true}),
      }

Then the CursorLineNr has the wrong color, I think line 42 in theme.lua should be using bg_highlight

    CursorLineNr = { fg = c.fg0, bg = cfg.transparent and c.none or c.bg_highlight }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.

instead of bg_linenumber

    CursorLineNr = { fg = c.fg0, bg = cfg.transparent and c.none or c.bg_linenumber }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.

Highlighting cannot be overwritten

Hi, I am not able to overwrite the vim-illuminate highlights with the following configuration

require("onedark").setup()
vim.cmd([[hi illuminatedCurWord ctermbg=242 guibg=#393f4a]])
vim.cmd([[hi illuminatedWord ctermbg=242 guibg=#393f4a]])

Thanks for the colorscheme

db5b0f441d4bc47bc95593c59a724be62a23851c causes issues on older nvim 0.7 builds

Hi there.

I had to update to the latest neovim nightly build to fix the error, even though I was already on nvim 0.7

This is the error emitted:

Error detected while processing /home/apoc/.config/nvim/init.lua:
E5113: Error while calling lua chunk: /home/apoc/.config/nvim/init.lua:10: Vim(lua):E5108: Error executing lua .../pack/
packer/start/onedark.nvim/lua/onedark/autocmds.lua:32: attempt to call field 'nvim_create_augroup' (a nil value)
stack traceback:
        .../pack/packer/start/onedark.nvim/lua/onedark/autocmds.lua:32: in function 'native_cmds'
        ...site/pack/packer/start/onedark.nvim/lua/onedark/util.lua:232: in function 'load'
        ...site/pack/packer/start/onedark.nvim/lua/onedark/init.lua:15: in function 'setup'
        [string ":lua"]:1: in main chunk
        [C]: in function 'nvim_exec'
        /home/apoc/.config/nvim/init.lua:10: in main chunk
stack traceback:
        [C]: in function 'nvim_exec'
        /home/apoc/.config/nvim/init.lua:10: in main chunk

This was my output of nvim --version before I updated:

NVIM v0.7.0-dev+1054-g851252f79
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az242-530

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

This is nvim --version after the update

NVIM v0.7.0-dev+1446-g18152cf6f
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az243-502

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/share/nvim"

Run :checkhealth for more info

I looked at the changes in db5b0f4 and this here has caught my eye:

  local autocmds = require('onedark.autocmds')
  if vim.fn.has('nvim-0.7') == 1 then
    autocmds.native_cmds(hi.config)
  else
    autocmds.viml_cmds(hi.config)
  end

(in lua/onedark/util.lua)

I suspect this check needs to be more thorough, as you can see in the version output above, not all neovim 0.7 builds seem to have the nvim_create_augroup function.

Cheers :)

Minimal Status Line Bug

Here's what I found in my repo helped fix the issue for me.

In my packer config I did the following

  use {
    'monsonjeremy/onedark.nvim',
    config = function()
      local utils = require('utils')
      require('plugins.onedark').setupOneDark()
      utils.apply_colorscheme("onedark", "dark")
    end
  }

and then inside of plugins.onedark I have

local M = {}

function M.setupOneDark()
  local utils = require('utils')

  utils.apply_globals({
    onedark_hide_inactive_statusline = true,
  })
end

return M

and utils:

local M = {}

function M.apply_globals(globals)
  for k, v in pairs(globals) do vim.g[k] = v end
end

function M.apply_colorscheme(name, mode)
  M.apply_options({
    termguicolors = true,
    background = mode
  })

  M.apply_globals({
    colors_name = name
  })

  vim.api.nvim_command('colorscheme ' .. name)
end

return M

Basically what I believe to be the issue is that the onedark_hide_inactive_statusline was not being set in time which was causing the highlights to be applied improperly. In order to fix that I tried to make sure that the value was set before the colorscheme was set.

Example:
Screen Shot 2021-06-14 at 6 22 50 PM

nvim-treesitter lua queries break

This colorscheme seems to break with newer versions of nvim-treesitter, see this issue. Here's the output form the healthcheck:

## The following errors have been detected:
  - ERROR: lua(highlights): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid syntax at position 0
    lua(highlights) is concatenated from the following files:
    | [ERROR]:"/home/apoc/.vim/plugged/onedark.nvim/queries/lua/highlights.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid syntax at position 0
    |    [OK]:"/home/apoc/.vim/plugged/nvim-treesitter/queries/lua/highlights.scm"
  - ERROR: tlaplus(highlights): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 1069
    tlaplus(highlights) is concatenated from the following files:
    | [ERROR]:"/home/apoc/.vim/plugged/nvim-treesitter/queries/tlaplus/highlights.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 1069
  - ERROR: tlaplus(locals): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 113
    tlaplus(locals) is concatenated from the following files:
    | [ERROR]:"/home/apoc/.vim/plugged/nvim-treesitter/queries/tlaplus/locals.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 113
  - ERROR: tlaplus(injections): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 17
    tlaplus(injections) is concatenated from the following files:
    | [ERROR]:"/home/apoc/.vim/plugged/nvim-treesitter/queries/tlaplus/injections.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: invalid node type at position 17
  - ERROR: latex(highlights): /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: error at position 5758
    latex(highlights) is concatenated from the following files:
    | [ERROR]:"/home/apoc/.vim/plugged/nvim-treesitter/queries/latex/highlights.scm", failed to load: /usr/share/nvim/runtime/lua/vim/treesitter/query.lua:172: query: error at position 5758

How to configure nested colors (e.g. diffs, etc)

I see that we can override colors in the config via:

require("onedark").setup({
  colors = {hint = "orange", error = "#ff0000"}
})

Is there something similar for changing things like git diffs? Maybe I'm just messing up the syntax (I'm newer to lua in general)?

Text not visible in git diff

These are the steps to reproduce the bug:

  1. A commented line is changed
  2. start a git diff (I am using fugitive for git)
  3. I have seen this in lua file not tried in other type of files

That modified commented line is becomes highlighted by opaque grey color, therefore make it unable to read.
If I do visual selection then only I can see the text.

I have latest nightly version of neovim and latest version of your plugin.

image

After visually selecting the lines:
image

Error when switching themes

When trying to switch between some colorschemes, I get this error: apparently something is conflicting with telescope:

k.nvim/lua/onedark/util.lua:154: Vim:E492: Not an editor command: slient! autocmd! onedark                                                                      
stack traceback:                                                                                                                                                
        [C]: in function 'cmd'                                                                                                                                  
        ...site/pack/packer/start/onedark.nvim/lua/onedark/util.lua:154: in function 'on_colorscheme'                                                           
        [string ":lua"]:1: in main chunk                                                                                                                        
        [C]: in function 'cmd'                                                                                                                                  
        .../start/telescope.nvim/lua/telescope/builtin/internal.lua:900: in function 'run_replace_or_original'                                                  
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:51: in function 'key_func'                                                                  
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'                                                           
        [string ":lua"]:1: in main chunk                                                                                                                        
stack traceback:                                                                                                                                                
        [C]: in function 'cmd'                                                                                                                                  
        .../start/telescope.nvim/lua/telescope/builtin/internal.lua:900: in function 'run_replace_or_original'                                                  
        ...packer/start/telescope.nvim/lua/telescope/actions/mt.lua:51: in function 'key_func'                                                                  
        ...k/packer/start/telescope.nvim/lua/telescope/mappings.lua:242: in function 'execute_keymap'                                                           
        [string ":lua"]:1: in main chunk                                                                                                                        
1 line less; before #90  0 seconds ago ```.
And yes I'm on the latest version, I have tried updating and this issue persists.

Allow adding custom highlight groups that are not in theme.lua

This PR added the ability to customze highlight groups, which is awesome and a drastically better way of setting highlight compared to using the builtin highlight command. However onedark.nvim currently only allows customizing highlight groups that are already defined in theme.lua, and not new highlight groups that don't yet exist in theme.lua. Would it be possible to allow adding any highlight group when calling require('onedark').setup()?

Tiny issue with Bufferline.

I am having a tiny issue with bufferline. The "background" of each tab doesn't match the back of the bar.
2021-11-13_14-46

I thought maybe it was because I didn't enable transparency, but enabling that made it worse.
2021-11-13_14-36

So I went back to my original settings.
2021-11-13_14-37

Can't find the respective color group for the line numbers themselves

I've tried to find a way to change the colors of line numbers (not the vertical line number as a whole), but found none . The docs does mention that it can be addressed with their color group but there isn't any listing of any !
If there is a direct method to alter this very component, then that would do that job. However if there's a more encompassing thorough list of all the alterable colors groups / components then that would be much more convenient, for further customization .

Tmux support

Is this colorscheme supposed to look the same in tmux? To me the colors look odd in tmux. I've read online that the following should make colorschemes look the same in tmux, but it doesn't seem to work. Is it became this colorscheme doesn't support 24-bit RGB colors?

if exists('$TMUX')
  set notermguicolors
endif

To the left in the screenshot below is what the colorscheme looks when not using tmux, and to the right is how it looks when Neovim is running inside of tmux:

neovim in tmux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.