GithubHelp home page GithubHelp logo

millrocious / material.nvim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marko-cerovac/material.nvim

0.0 0.0 0.0 9.46 MB

:trident: Material colorscheme for NeoVim written in Lua with built-in support for native LSP, TreeSitter and many more plugins

License: GNU General Public License v2.0

Lua 99.55% Vim Script 0.45%

material.nvim's Introduction

material.nvim

Neovim Lua

The original Material theme now available for NeoVim


๐Ÿ”ฑ Info

A port of Material colorscheme for NeoVim written in Lua

Material.nvim is meant to be a fast and modern colorscheme written in Lua that supports a lot of the new features added to NeoVim like built-in LSP and TreeSitter

๐ŸŒŠ Features

โšก๏ธ Requirements

  • Neovim >= 0.7.0

โš“ Installation

Install via your favourite package manager:

" If you are using Vim-Plug
Plug 'marko-cerovac/material.nvim'
-- If you are using Packer
use 'marko-cerovac/material.nvim'

๐Ÿฌ Usage

Enable the colorscheme:

"Vim-Script:
colorscheme material
--Lua:
vim.cmd 'colorscheme material'

For a comlete guide on usage and configuration of the theme, see :help material.nvim.

โš™๏ธ Configuration

  • There are 5 different styles available:
    • darker
    • lighter
    • oceanic
    • palenight
    • deep ocean

Set the desired style using:

"Vim-Script:
let g:material_style = "darker"
--Lua:
vim.g.material_style = "deep ocean"

The configuration of different options is done trough a setup function

lua << EOF
require('material').setup()
EOF

This is an example of the function with the default values

require('material').setup({

	contrast = {
		sidebars = false, -- Enable contrast for sidebar-like windows ( for example Nvim-Tree )
		floating_windows = false, -- Enable contrast for floating windows
		line_numbers = false, -- Enable contrast background for line numbers
		sign_column = false, -- Enable contrast background for the sign column
		cursor_line = false, -- Enable darker background for the cursor line
		non_current_windows = false, -- Enable darker background for non-current windows
		popup_menu = false, -- Enable lighter background for the popup menu
	},

	italics = {
		comments = false, -- Enable italic comments
		keywords = false, -- Enable italic keywords
		functions = false, -- Enable italic functions
		strings = false, -- Enable italic strings
		variables = false -- Enable italic variables
	},

	contrast_filetypes = { -- Specify which filetypes get the contrasted (darker) background
		"terminal", -- Darker terminal background
		"packer", -- Darker packer background
		"qf" -- Darker qf list background
	},

	high_visibility = {
		lighter = false, -- Enable higher contrast text for lighter style
		darker = false -- Enable higher contrast text for darker style
	},

	disable = {
		colored_cursor = false, -- Disable the colored cursor
		borders = false, -- Disable borders between verticaly split windows
		background = false, -- Prevent the theme from setting the background (NeoVim then uses your teminal background)
		term_colors = false, -- Prevent the theme from setting terminal colors
		eob_lines = false -- Hide the end-of-buffer lines
	},

	lualine_style = "default", -- Lualine style ( can be 'stealth' or 'default' )

	async_loading = true, -- Load parts of the theme asyncronously for faster startup (turned on by default)

	custom_highlights = {} -- Overwrite highlights with your own

	plugins = { -- Here, you can disable(set to false) plugins that you don't use or don't want to apply the theme to
		trouble = true,
		nvim_cmp = true,
		neogit = true,
		gitsigns = true,
		git_gutter = true,
		telescope = true,
		nvim_tree = true,
		sidebar_nvim = true,
		lsp_saga = true,
		nvim_dap = true,
		nvim_navic = true,
		which_key = true,
		sneak = true,
		hop = true,
		indent_blankline = true,
		nvim_illuminate = true,
		mini = true,
	}
})

After passing the configuration to a setup function, make sure to enable the colorscheme:

colorscheme material
vim.cmd 'colorscheme material'

This is an example of overwriting the default highlights (most users will never need to do this)

require('material').setup{
	custom_highlights = {
		LineNr = { bg = '#FF0000' }
		CursorLine = { fg = '#0000FF', underline = true },

		-- This is a list of possible values
		YourHighlightGroup = {
			fg = "#SOME_COLOR", -- foreground color
			bg = "#SOME_COLOR", -- background color
			sp = "#SOME_COLOR", -- special color (for colored underlines, undercurls...)
			bold = false, -- make group bold
			italic = false, -- make group italic
			underline = false, -- make group underlined
			undercurl = false, -- make group undercurled
			underdot = false, -- make group underdotted
			underdash = false -- make group underdotted
			striketrough = false, -- make group striked trough
			reverse = false, -- reverse the fg and bg colors
			link = "SomeOtherGroup" -- link to some other highlight group
		}
	}
}

To enable the lualine themes, first set the theme in your lualine settings to auto or material

require('lualine').setup {
  options = {
    -- ... your lualine config
    theme = 'auto'
    or
    theme = 'material'
    -- ... your lualine config
  }
}

Then, choose the style trough a variable called lualine_style in the theme setup function

require('material').setup({
	lualine_style = 'default' -- the default style
	or
	lualine_style = 'stealth' -- the stealth style
})

If the theme, doesn't look right, it's probably because material.nvim is being loaded before lualine, causing the other material theme that comes built-in to lualine to be used. To fix this, either load material.nvim after lualine (preferred way) or set the lualine theme to one of these two values in your lualine settings

require('lualine').setup {
  options = {
    -- ... your lualine config
    theme = 'material-nvim' -- the default style
    or
    theme = 'material-stealth' -- the stealth style
    -- ... your lualine config
  }
}

โ›ต Functions

  • Toggle the style live without the need to exit NeoVim

toggle_style

Just call the function for style switching

"Vim-Script
:lua require('material.functions').toggle_style()
"This command toggles the style

The command can also be mapped to a key for fast style switching

"Vim-Script:
nnoremap <leader>mm :lua require('material.functions').toggle_style()<CR>
--Lua:
vim.api.nvim_set_keymap('n', '<leader>mm', [[<Cmd>lua require('material.functions').toggle_style()<CR>]], { noremap = true, silent = true })
  • Toggle the end of buffer lines ( ~ )

Call the built in function for toggling buffer lines

"Vim-Script
:lua require('material.functions').toggle_eob()
"This command toggles the end of buffer lines

The command can also be mapped to a key to toggle the lines live

"Vim-Script:
nnoremap <leader>me :lua require('material.functions').toggle_eob()<CR>
--Lua:
vim.api.nvim_set_keymap('n', '<leader>me', [[<Cmd>lua require('material.functions').toggle_eob()<CR>]], { noremap = true, silent = true })
  • Change the style to a desired one using the function change_style("desired style")
"Vim-Script:
:lua require('material.functions').change_style("palenight")
"This command changes the style to palenight

The command can also be mapped to a key for fast style switching

"Vim-Script:
nnoremap <leader>ml :lua require('material.functions').change_style('lighter')<CR>
nnoremap <leader>md :lua require('material.functions').change_style('darker')<CR>
--Lua:
vim.api.nvim_set_keymap('n', '<leader>ml', [[<Cmd>lua require('material.functions').change_style('lighter')<CR>]], { noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<leader>md', [[<Cmd>lua require('material.functions').change_style('darker')<CR>]], { noremap = true, silent = true })

material.nvim's People

Contributors

aceforeverd avatar chaitanyabsprip avatar christsou avatar echasnovski avatar gi-yt avatar hi-jklmn avatar hoprr avatar huyvohcmc avatar ianhomer avatar marko-cerovac avatar millrocious avatar raafatturki avatar rti avatar scthijsse avatar shubham-cpp avatar smiteshp avatar tmeister avatar vxio avatar yagua avatar

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.