├── lua ├── hardline │ ├── parts │ │ ├── filetype.lua │ │ ├── cwd.lua │ │ ├── treesitter-context.lua │ │ ├── filename.lua │ │ ├── mode.lua │ │ ├── line.lua │ │ ├── lsp.lua │ │ ├── wordcount.lua │ │ ├── git.lua │ │ └── whitespace.lua │ ├── common.lua │ ├── themes │ │ ├── catppuccin_minimal.lua │ │ ├── gruvbox_minimal.lua │ │ ├── codeschool_dark.lua │ │ ├── codeschool_light.lua │ │ ├── jellybeans.lua │ │ ├── oxocarbon.lua │ │ ├── custom_colors.lua │ │ ├── default.lua │ │ ├── nord.lua │ │ ├── one.lua │ │ ├── gruvbox.lua │ │ ├── nordic.lua │ │ └── dracula.lua │ └── bufferline.lua └── hardline.lua ├── plugin └── hardline.vim ├── LICENSE └── README.md /lua/hardline/parts/filetype.lua: -------------------------------------------------------------------------------- 1 | local function get_item() 2 | return vim.bo.filetype 3 | end 4 | 5 | return { 6 | get_item = get_item, 7 | } 8 | -------------------------------------------------------------------------------- /lua/hardline/parts/cwd.lua: -------------------------------------------------------------------------------- 1 | local function get_item() 2 | return vim.fn.fnamemodify(vim.fn.getcwd(), ':~') 3 | end 4 | 5 | return { 6 | get_item = get_item, 7 | } 8 | -------------------------------------------------------------------------------- /plugin/hardline.vim: -------------------------------------------------------------------------------- 1 | " nvim-hardline 2 | " By Olivier Roques 3 | " github.com/ojroques 4 | 5 | if exists('g:loaded_hardline') 6 | finish 7 | endif 8 | 9 | let g:loaded_hardline = 1 10 | -------------------------------------------------------------------------------- /lua/hardline/parts/treesitter-context.lua: -------------------------------------------------------------------------------- 1 | local ok, gps = pcall(require, 'nvim-gps') 2 | if not ok then gps = nil end 3 | 4 | local function get_context() 5 | if not gps or not gps.is_available() then 6 | return '' 7 | end 8 | return gps.get_location() 9 | end 10 | 11 | local function get_item() 12 | return get_context() 13 | end 14 | 15 | return { 16 | get_item = get_item, 17 | } 18 | -------------------------------------------------------------------------------- /lua/hardline/parts/filename.lua: -------------------------------------------------------------------------------- 1 | local function get_name() 2 | return vim.fn.expand('%:~:.') 3 | end 4 | 5 | local function get_readonly() 6 | if vim.bo.readonly then 7 | return '[RO]' 8 | end 9 | return '' 10 | end 11 | 12 | local function get_modified() 13 | if vim.bo.modified then 14 | return '[+]' 15 | end 16 | if not vim.bo.modifiable then 17 | return '[-]' 18 | end 19 | return '' 20 | end 21 | 22 | local function get_item() 23 | local name = get_name() 24 | local flags = table.concat({get_readonly(), get_modified()}) 25 | if flags ~= '' then 26 | flags = ' ' .. flags 27 | end 28 | return table.concat({name, flags}) 29 | end 30 | 31 | return { 32 | get_item = get_item, 33 | } 34 | -------------------------------------------------------------------------------- /lua/hardline/parts/mode.lua: -------------------------------------------------------------------------------- 1 | local common = require('hardline.common') 2 | local fmt = string.format 3 | 4 | local function get_mode() 5 | local mode = common.modes[vim.fn.mode()] or common.modes['?'] 6 | return mode.text 7 | end 8 | 9 | local function get_paste() 10 | if not vim.o.paste then 11 | return '' 12 | end 13 | return 'PASTE' 14 | end 15 | 16 | local function get_spell() 17 | if not vim.wo.spell then 18 | return '' 19 | end 20 | return fmt('SPELL[%s]', string.upper(vim.bo.spelllang)) 21 | end 22 | 23 | local function get_item() 24 | local mode, paste, spell = get_mode(), get_paste(), get_spell() 25 | if paste ~= '' then 26 | paste = ' ' .. paste 27 | end 28 | if spell ~= '' then 29 | spell = ' ' .. spell 30 | end 31 | return table.concat({mode, paste, spell}) 32 | end 33 | 34 | return { 35 | get_item = get_item, 36 | } 37 | -------------------------------------------------------------------------------- /lua/hardline/parts/line.lua: -------------------------------------------------------------------------------- 1 | local fmt = string.format 2 | 3 | local function pad(c, m) 4 | local padch = '·' 5 | return string.rep(padch, string.len(tostring(m)) - string.len(tostring(c))) 6 | end 7 | 8 | local function get_line() 9 | local nbline = vim.fn.line('$') 10 | local line = vim.fn.line('.') 11 | return fmt('%s%d/%d', pad(line, nbline), line, nbline) 12 | end 13 | 14 | local function get_column() 15 | local nbcol = vim.fn.col('$') - 1 16 | local col = vim.fn.col('.') 17 | return fmt('%s%d/%s%d', pad(col, 100), col, pad(nbcol, 100), nbcol) 18 | end 19 | 20 | local function get_percent() 21 | local nb_lines = vim.fn.line('$') 22 | local line = vim.fn.line('.') 23 | local percent = math.floor(line * 100 / nb_lines) 24 | return fmt('%s%d%%%%', pad(percent, 100), percent) 25 | end 26 | 27 | local function get_item() 28 | return table.concat({get_line(), get_column(), get_percent()}, ' ') 29 | end 30 | 31 | return { 32 | get_item = get_item, 33 | } 34 | -------------------------------------------------------------------------------- /lua/hardline/common.lua: -------------------------------------------------------------------------------- 1 | local fmt = string.format 2 | local M = {} 3 | 4 | M.modes = { 5 | [''] = {text = 'S-BLOCK', state = 'visual'}, 6 | [''] = {text = 'V-BLOCK', state = 'visual'}, 7 | ['?'] = {text = '???', state = 'inactive'}, 8 | ['R'] = {text = 'REPLACE', state = 'replace'}, 9 | ['S'] = {text = 'S-LINE', state = 'visual'}, 10 | ['V'] = {text = 'V-LINE', state = 'visual'}, 11 | ['c'] = {text = 'COMMAND', state = 'command'}, 12 | ['i'] = {text = 'INSERT', state = 'insert'}, 13 | ['n'] = {text = 'NORMAL', state = 'normal'}, 14 | ['r'] = {text = 'PROMPT', state = 'replace'}, 15 | ['s'] = {text = 'SELECT', state = 'visual'}, 16 | ['t'] = {text = 'TERMINAL', state = 'command'}, 17 | ['v'] = {text = 'VISUAL', state = 'visual'}, 18 | } 19 | 20 | function M.echo(msg, hlgroup) 21 | vim.api.nvim_echo({{fmt('[hardline] %s', msg), hlgroup}}, false, {}) 22 | end 23 | 24 | function M.set_cache_autocmds(augroup) 25 | vim.cmd(fmt([[ 26 | augroup %s 27 | autocmd! 28 | autocmd CursorHold,BufWritePost * unlet! b:%s 29 | augroup END 30 | ]], augroup, augroup)) 31 | end 32 | 33 | return M 34 | -------------------------------------------------------------------------------- /lua/hardline/parts/lsp.lua: -------------------------------------------------------------------------------- 1 | local fmt = string.format 2 | 3 | local function get_diagnostic(prefix, severity) 4 | local count 5 | if vim.fn.has('nvim-0.6') == 0 then 6 | count = vim.lsp.diagnostic.get_count(0, severity) 7 | else 8 | local severities = { 9 | ['Warning'] = vim.diagnostic.severity.WARN, 10 | ['Error'] = vim.diagnostic.severity.ERROR, 11 | } 12 | count = #vim.diagnostic.get(0, {severity=severities[severity]}) 13 | end 14 | if count < 1 then 15 | return '' 16 | end 17 | return fmt('%s:%d', prefix, count) 18 | end 19 | 20 | local function get_error() 21 | return get_diagnostic('E', 'Error') 22 | end 23 | 24 | local function get_warning() 25 | return get_diagnostic('W', 'Warning') 26 | end 27 | 28 | local function get_lsp_clients() 29 | local clients = vim.lsp.buf_get_clients() 30 | if next(clients) == nil then 31 | return "none" 32 | end 33 | 34 | local c = {} 35 | for _, client in pairs(clients) do 36 | table.insert(c, client.name) 37 | end 38 | return table.concat(c, "|") 39 | end 40 | 41 | return { 42 | get_error = get_error, 43 | get_warning = get_warning, 44 | get_lsp_clients = get_lsp_clients, 45 | } 46 | -------------------------------------------------------------------------------- /lua/hardline/parts/wordcount.lua: -------------------------------------------------------------------------------- 1 | local common = require('hardline.common') 2 | local fmt = string.format 3 | 4 | local enabled = false 5 | local cache = '' 6 | local options = { 7 | filetypes = { 8 | 'asciidoc', 9 | 'help', 10 | 'mail', 11 | 'markdown', 12 | 'nroff', 13 | 'org', 14 | 'pandoc', 15 | 'plaintex', 16 | 'rst', 17 | 'tex', 18 | 'text', 19 | }, 20 | max_lines = 5000, 21 | } 22 | 23 | local function in_visual() 24 | local mode = common.modes[vim.fn.mode()] or common.modes['?'] 25 | return mode.state == 'visual' 26 | end 27 | 28 | local function get_wordcount() 29 | local query = in_visual() and 'visual_words' or 'words' 30 | local wordcount = vim.fn.wordcount()[query] 31 | return fmt('%d words', wordcount) 32 | end 33 | 34 | local function get_item() 35 | if not enabled then 36 | common.set_cache_autocmds('hardline_wordcount') 37 | enabled = true 38 | end 39 | if not vim.tbl_contains(options.filetypes, vim.bo.filetype) then 40 | return '' 41 | end 42 | if vim.fn.line('$') > options.max_lines then 43 | return '' 44 | end 45 | if vim.b.hardline_wordcount and not in_visual() then 46 | return cache 47 | end 48 | vim.b.hardline_wordcount = true 49 | cache = get_wordcount() 50 | return cache 51 | end 52 | 53 | return { 54 | get_item = get_item, 55 | } 56 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2020, Olivier Roques 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /lua/hardline/parts/git.lua: -------------------------------------------------------------------------------- 1 | local fmt = string.format 2 | 3 | local function concat_hunks(hunks) 4 | return vim.tbl_isempty(hunks) and '' or table.concat({ 5 | fmt('+%d', hunks[1]), 6 | fmt('~%d', hunks[2]), 7 | fmt('-%d', hunks[3]), 8 | }, ' ') 9 | end 10 | 11 | local function get_hunks() 12 | local hunks = {} 13 | if vim.g.loaded_gitgutter then 14 | hunks = vim.fn.GitGutterGetHunkSummary() 15 | elseif vim.g.loaded_signify then 16 | hunks = vim.fn['sy#repo#get_stats']() 17 | hunks = hunks[1] == -1 and {} or hunks 18 | elseif vim.b.gitsigns_status_dict then 19 | hunks = { 20 | vim.b.gitsigns_status_dict.added, 21 | vim.b.gitsigns_status_dict.changed, 22 | vim.b.gitsigns_status_dict.removed, 23 | } 24 | end 25 | return concat_hunks(hunks) 26 | end 27 | 28 | local function get_branch() 29 | local branch = '' 30 | if vim.g.loaded_fugitive then 31 | branch = vim.fn.FugitiveHead() 32 | elseif vim.g.loaded_gina then 33 | branch = vim.fn['gina#component#repo#branch']() 34 | elseif vim.g.loaded_gitbranch then 35 | branch = vim.fn['gitbranch#name']() 36 | elseif vim.b.gitsigns_head ~= nil then 37 | branch = vim.b.gitsigns_head 38 | end 39 | return branch ~= '' and fmt('(%s)', branch) or '' 40 | end 41 | 42 | local function get_item() 43 | local hunks, branch = get_hunks(), get_branch() 44 | if hunks == concat_hunks({0, 0, 0}) and branch == '' then 45 | hunks = '' 46 | end 47 | if hunks ~= '' and branch ~= '' then 48 | branch = ' ' .. branch 49 | end 50 | return table.concat({hunks, branch}) 51 | end 52 | 53 | return { 54 | get_item = get_item, 55 | } 56 | -------------------------------------------------------------------------------- /lua/hardline/themes/catppuccin_minimal.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | transparent = {gui = 'NONE', cterm = '16', cterm16 = '0'}, 3 | grey_medium = {gui = '#1E1E2E', cterm = '17', cterm16 = '0'}, 4 | grey_inactive = {gui = '#7E84A0', cterm = '61', cterm16 = '8'}, 5 | grey_light = {gui = '#969DBC', cterm = '69', cterm16 = '7'}, 6 | black = {gui = '#07070A', cterm = '16', cterm16 = '0'}, 7 | white = {gui = '#AEB7D9', cterm = '189', cterm16 = '15'}, 8 | red = {gui = '#F38BA8', cterm = '218', cterm16 = '9'}, 9 | yellow = {gui = '#F9E2AF', cterm = '223', cterm16 = '11'}, 10 | } 11 | 12 | local inactive = { 13 | guifg = colors.grey_inactive.gui, 14 | guibg = colors.transparent.gui, 15 | ctermfg = colors.grey_inactive.cterm, 16 | ctermbg = colors.transparent.cterm, 17 | } 18 | 19 | local common_light = { 20 | guifg = colors.black.gui, 21 | guibg = colors.grey_light.gui, 22 | ctermfg = colors.black.cterm, 23 | ctermbg = colors.grey_light.cterm, 24 | } 25 | 26 | local common_dark = { 27 | guifg = colors.white.gui, 28 | guibg = colors.grey_medium.gui, 29 | ctermfg = colors.white.cterm, 30 | ctermbg = colors.grey_medium.cterm, 31 | } 32 | 33 | return { 34 | mode = { 35 | inactive = inactive, 36 | normal = common_light, 37 | insert = common_light, 38 | replace = common_light, 39 | visual = common_light, 40 | command = common_light, 41 | }, 42 | low = { 43 | active = common_dark, 44 | inactive = inactive, 45 | }, 46 | med = { 47 | active = common_dark, 48 | inactive = inactive, 49 | }, 50 | high = { 51 | active = common_dark, 52 | inactive = inactive, 53 | }, 54 | error = { 55 | active = { 56 | guifg = colors.red.gui, 57 | guibg = colors.grey_medium.gui, 58 | ctermfg = colors.red.cterm, 59 | ctermbg = colors.grey_medium.cterm, 60 | }, 61 | inactive = inactive, 62 | }, 63 | warning = { 64 | active = { 65 | guifg = colors.yellow.gui, 66 | guibg = colors.grey_medium.gui, 67 | ctermfg = colors.yellow.cterm, 68 | ctermbg = colors.grey_medium.cterm, 69 | }, 70 | inactive = inactive, 71 | }, 72 | bufferline = { 73 | separator = inactive, 74 | current = common_light, 75 | current_modified = common_light, 76 | background = inactive, 77 | background_modified = inactive, 78 | }, 79 | } 80 | -------------------------------------------------------------------------------- /lua/hardline/themes/gruvbox_minimal.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | grey_dark = {gui = '#3b3836', cterm = '240', cterm16 = '0'}, 3 | grey_medium = {gui = '#4f4945', cterm = '245', cterm16 = '0'}, 4 | grey_inactive = {gui = '#897e70', cterm = '247', cterm16 = '8'}, 5 | grey_light = {gui = '#beb297', cterm = '250', cterm16 = '8'}, 6 | black = {gui = '#1d2021', cterm = '234', cterm16 = '0'}, 7 | white = {gui = '#fbf1c7', cterm = '228', cterm16 = '15'}, 8 | red = {gui = '#fb4934', cterm = '167', cterm16 = '9'}, 9 | yellow = {gui = '#fabd2f', cterm = '214', cterm16 = '11'}, 10 | } 11 | 12 | local inactive = { 13 | guifg = colors.grey_inactive.gui, 14 | guibg = colors.grey_dark.gui, 15 | ctermfg = colors.grey_inactive.cterm, 16 | ctermbg = colors.grey_dark.cterm, 17 | } 18 | 19 | local common_light = { 20 | guifg = colors.black.gui, 21 | guibg = colors.grey_light.gui, 22 | ctermfg = colors.black.cterm, 23 | ctermbg = colors.grey_light.cterm, 24 | } 25 | 26 | local common_dark = { 27 | guifg = colors.white.gui, 28 | guibg = colors.grey_medium.gui, 29 | ctermfg = colors.white.cterm, 30 | ctermbg = colors.grey_medium.cterm, 31 | } 32 | 33 | return { 34 | mode = { 35 | inactive = inactive, 36 | normal = common_light, 37 | insert = common_light, 38 | replace = common_light, 39 | visual = common_light, 40 | command = common_light, 41 | }, 42 | low = { 43 | active = common_dark, 44 | inactive = inactive, 45 | }, 46 | med = { 47 | active = common_dark, 48 | inactive = inactive, 49 | }, 50 | high = { 51 | active = common_dark, 52 | inactive = inactive, 53 | }, 54 | error = { 55 | active = { 56 | guifg = colors.red.gui, 57 | guibg = colors.grey_medium.gui, 58 | ctermfg = colors.red.cterm, 59 | ctermbg = colors.grey_medium.cterm, 60 | }, 61 | inactive = inactive, 62 | }, 63 | warning = { 64 | active = { 65 | guifg = colors.yellow.gui, 66 | guibg = colors.grey_medium.gui, 67 | ctermfg = colors.yellow.cterm, 68 | ctermbg = colors.grey_medium.cterm, 69 | }, 70 | inactive = inactive, 71 | }, 72 | bufferline = { 73 | separator = inactive, 74 | current = common_light, 75 | current_modified = common_light, 76 | background = common_dark, 77 | background_modified = common_dark, 78 | }, 79 | } 80 | -------------------------------------------------------------------------------- /lua/hardline/parts/whitespace.lua: -------------------------------------------------------------------------------- 1 | local common = require('hardline.common') 2 | local fmt = string.format 3 | 4 | local enabled = false 5 | local cache = '' 6 | local options = { 7 | c_langs = {'arduino', 'c', 'cpp', 'cuda', 'go', 'javascript', 'ld', 'php'}, 8 | max_lines = 5000, 9 | } 10 | 11 | local function search(prefix, pattern) 12 | local line = vim.fn.search(pattern, 'nw') 13 | if line == 0 then 14 | return '' 15 | end 16 | return fmt('[%s:%d]', prefix, line) 17 | end 18 | 19 | local function check_trailing() 20 | if vim.tbl_contains({'markdown'}, vim.bo.filetype) then 21 | return '' 22 | end 23 | return search('trailing', [[\s$]]) 24 | end 25 | 26 | local function check_mix_indent() 27 | local tst = [[(^\t* +\t\s*\S)]] 28 | local tls = fmt([[(^\t+ {%d,}\S)]], vim.bo.tabstop) 29 | local pattern = fmt([[\v%s|%s]], tst, tls) 30 | return search('mix-indent', pattern) 31 | end 32 | 33 | local function check_mix_indent_file() 34 | local head_spc = [[\v(^ +)]] 35 | if vim.tbl_contains(options.c_langs, vim.bo.filetype) then 36 | head_spc = [[\v(^ +\*@!)]] 37 | end 38 | local indent_tabs = vim.fn.search([[\v(^\t+)]], 'nw') 39 | local indent_spc = vim.fn.search(head_spc, 'nw') 40 | if indent_tabs == 0 or indent_spc == 0 then 41 | return '' 42 | end 43 | return fmt('[mix-indent-file:%d,%d]', indent_spc, indent_tabs) 44 | end 45 | 46 | local function check_conflict() 47 | local annotation = [[\%([0-9A-Za-z_.:]\+\)\?]] 48 | local raw_pattern = [[^\%%(\%%(<\{7} %s\)\|\%%(=\{7\}\)\|\%%(>\{7\} %s\)\)$]] 49 | if vim.bo.filetype == 'rst' then 50 | raw_pattern = [[^\%%(\%%(<\{7} %s\)\|\%%(>\{7\} %s\)\)$]] 51 | end 52 | local pattern = fmt(raw_pattern, annotation, annotation) 53 | return search('conflict', pattern) 54 | end 55 | 56 | local function get_item() 57 | if not enabled then 58 | common.set_cache_autocmds('hardline_whitespace') 59 | enabled = true 60 | end 61 | if vim.bo.readonly or not vim.bo.modifiable then 62 | return '' 63 | end 64 | if vim.fn.line('$') > options.max_lines then 65 | return '' 66 | end 67 | if vim.b.hardline_whitespace then 68 | return cache 69 | end 70 | vim.b.hardline_whitespace = true 71 | cache = table.concat({ 72 | check_trailing(), 73 | check_mix_indent(), 74 | check_mix_indent_file(), 75 | check_conflict(), 76 | }) 77 | return cache 78 | end 79 | 80 | return { 81 | get_item = get_item, 82 | } 83 | -------------------------------------------------------------------------------- /lua/hardline/bufferline.lua: -------------------------------------------------------------------------------- 1 | local fmt = string.format 2 | 3 | local function is_excluded(bufnr, settings) 4 | local excluded = true 5 | excluded = excluded and vim.fn.buflisted(bufnr) == 0 6 | excluded = excluded or vim.fn.getbufvar(bufnr, '&filetype') == 'qf' 7 | if settings.exclude_terminal then 8 | excluded = excluded or vim.fn.getbufvar(bufnr, '&buftype') == 'terminal' 9 | end 10 | return excluded 11 | end 12 | 13 | local function get_head(path, tail) 14 | local result = vim.fn.fnamemodify(path, ':p') 15 | for i = 1, #vim.split(tail, '/') do 16 | result = vim.fn.fnamemodify(result, ':h') 17 | end 18 | return vim.fn.fnamemodify(result, ':t') 19 | end 20 | 21 | local function unique_tail(buffers) 22 | local hist = {} 23 | local duplicate = false 24 | for _, buffer in ipairs(buffers) do 25 | if not hist[buffer.name] then 26 | hist[buffer.name] = 1 27 | elseif buffer.name ~= '' then 28 | hist[buffer.name] = hist[buffer.name] + 1 29 | end 30 | duplicate = duplicate or hist[buffer.name] > 1 31 | end 32 | if not duplicate then 33 | return 34 | end 35 | for _, buffer in ipairs(buffers) do 36 | if hist[buffer.name] > 1 then 37 | local parent = get_head(vim.fn.bufname(buffer.bufnr), buffer.name) 38 | buffer.name = fmt('%s/%s', parent, buffer.name) 39 | end 40 | end 41 | unique_tail(buffers) 42 | end 43 | 44 | local function to_section(buffer, idx, settings) 45 | local flags = {} 46 | local item = buffer.name == '' and '[No Name]' or buffer.name 47 | if buffer.flags.modified then 48 | table.insert(flags, '[+]') 49 | end 50 | if not buffer.flags.modifiable then 51 | table.insert(flags, '[-]') 52 | end 53 | if buffer.flags.readonly then 54 | table.insert(flags, '[RO]') 55 | end 56 | flags = table.concat(flags) 57 | item = flags == '' and item or fmt('%s %s', item, flags) 58 | if settings.show_index then 59 | item = fmt(' %d:%s ', idx, item) 60 | else 61 | item = fmt(' %s ', item) 62 | end 63 | return { 64 | class = 'bufferline', 65 | item = item, 66 | modified = buffer.flags.modified, 67 | current = buffer.current, 68 | } 69 | end 70 | 71 | local function get_buffers(settings) 72 | local buffers = {} 73 | for nr = 1, vim.fn.bufnr('$') do 74 | if not is_excluded(nr, settings) then 75 | table.insert(buffers, { 76 | bufnr = nr, 77 | name = vim.fn.fnamemodify(vim.fn.bufname(nr), ':t'), 78 | current = nr == vim.fn.bufnr('%'), 79 | flags = { 80 | modified = vim.fn.getbufvar(nr, '&modified') == 1, 81 | modifiable = vim.fn.getbufvar(nr, '&modifiable') == 1, 82 | readonly = vim.fn.getbufvar(nr, '&readonly') == 1, 83 | }, 84 | }) 85 | end 86 | end 87 | unique_tail(buffers) 88 | return buffers 89 | end 90 | 91 | return { 92 | to_section = to_section, 93 | get_buffers = get_buffers, 94 | } 95 | -------------------------------------------------------------------------------- /lua/hardline/themes/codeschool_dark.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#182227', cterm = '236'}, 3 | blue = {gui = '#68a9eb', cterm = '39'}, 4 | cyan = { gui = '#b5d8f6', cterm = '38'}, 5 | green = {gui = '#8bb664', cterm = '113'}, 6 | grey_comment = {gui = '#9a9a9a', cterm = '59'}, 7 | grey_cursor = {gui = '#3f4b52', cterm = '236'}, 8 | grey_menu = {gui = '#555e61', cterm = '237'}, 9 | purple = {gui = '#bfabcb', cterm = '163'}, 10 | red = {gui = '#dda790', cterm = '166'}, 11 | white = {gui = '#d5d5d5', cterm = '251'}, 12 | yellow = {gui = '#e9c062', cterm = '178'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.blue.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.blue.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.green.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.green.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.cyan.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.cyan.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.blue.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.blue.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.green.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.green.cterm, 114 | }, 115 | background = { 116 | guifg = colors.blue.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.blue.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.yellow.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.yellow.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/codeschool_light.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#fbfbfb', cterm = '236'}, 3 | blue = {gui = '#94aadb', cterm = '39'}, 4 | cyan = { gui = '#89bdff', cterm = '38'}, 5 | green = {gui = '#babb63', cterm = '113'}, 6 | grey_comment = {gui = '#a8a8a8', cterm = '59'}, 7 | grey_cursor = {gui = '#bdbdbd', cterm = '236'}, 8 | grey_menu = {gui = '#d5d5d5', cterm = '237'}, 9 | purple = {gui = '#675e6e', cterm = '163'}, 10 | red = {gui = '#a03b1e', cterm = '166'}, 11 | white = {gui = '#f2f2f2', cterm = '251'}, 12 | yellow = {gui = '#c59820', cterm = '178'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.blue.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.blue.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.green.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.green.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.cyan.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.cyan.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.blue.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.blue.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.green.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.green.cterm, 114 | }, 115 | background = { 116 | guifg = colors.blue.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.blue.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.yellow.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.yellow.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/jellybeans.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#3b3b3b', cterm = '236'}, 3 | blue = {gui = '#597bc5', cterm = '39'}, 4 | cyan = { gui = '#71b9f8', cterm = '38'}, 5 | green = {gui = '#99ad6a', cterm = '113'}, 6 | grey_comment = {gui = '#5C6370', cterm = '59'}, 7 | grey_cursor = {gui = '#2C323C', cterm = '236'}, 8 | grey_menu = {gui = '#3E4452', cterm = '237'}, 9 | purple = {gui = '#a037b0', cterm = '163'}, 10 | red = {gui = '#cf6a4c', cterm = '166'}, 11 | white = {gui = '#adadad', cterm = '251'}, 12 | yellow = {gui = '#d8ad4c', cterm = '178'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.blue.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.blue.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.yellow.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.yellow.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.green.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.green.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.blue.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.blue.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.yellow.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.yellow.cterm, 114 | }, 115 | background = { 116 | guifg = colors.blue.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.blue.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.yellow.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.yellow.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/oxocarbon.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | base00 = { gui = "#161616", cterm = "16" }, 3 | base01 = { gui = "#262626", cterm = "8" }, 4 | base02 = { gui = "#393939", cterm = "235" }, 5 | base03 = { gui = "#525252", cterm = "59" }, 6 | base04 = { gui = "#dde1e6", cterm = "252" }, 7 | base05 = { gui = "#f2f4f8", cterm = "255" }, 8 | base06 = { gui = "#ffffff", cterm = "15" }, 9 | base07 = { gui = "#08bdba", cterm = "14" }, 10 | base08 = { gui = "#3ddbd9", cterm = "81" }, 11 | base09 = { gui = "#78a9ff", cterm = "75" }, 12 | base0A = { gui = "#ee5396", cterm = "205" }, 13 | base0B = { gui = "#33b1ff", cterm = "39" }, 14 | base0C = { gui = "#ff7eb6", cterm = "205" }, 15 | base0D = { gui = "#42be65", cterm = "71" }, 16 | base0E = { gui = "#be95ff", cterm = "183" }, 17 | base0F = { gui = "#82cfff", cterm = "75" }, 18 | } 19 | 20 | local inactive = { 21 | guifg = colors.base06.gui, 22 | guibg = colors.base01.gui, 23 | ctermfg = colors.base06.cterm, 24 | ctermbg = colors.base01.cterm, 25 | } 26 | 27 | return { 28 | mode = { 29 | inactive = inactive, 30 | normal = { 31 | guifg = colors.base00.gui, 32 | guibg = colors.base09.gui, 33 | ctermfg = colors.base00.cterm, 34 | ctermbg = colors.base09.cterm, 35 | }, 36 | insert = { 37 | guifg = colors.base01.gui, 38 | guibg = colors.base0A.gui, 39 | ctermfg = colors.base01.cterm, 40 | ctermbg = colors.base0A.cterm, 41 | }, 42 | replace = { 43 | guifg = colors.base00.gui, 44 | guibg = colors.base08.gui, 45 | ctermfg = colors.base00.cterm, 46 | ctermbg = colors.base08.cterm, 47 | }, 48 | visual = { 49 | guifg = colors.base00.gui, 50 | guibg = colors.base0D.gui, 51 | ctermfg = colors.base00.cterm, 52 | ctermbg = colors.base0D.cterm, 53 | }, 54 | command = { 55 | guifg = colors.base00.gui, 56 | guibg = colors.base0D.gui, 57 | ctermfg = colors.base00.cterm, 58 | ctermbg = colors.base0D.cterm, 59 | }, 60 | }, 61 | low = { 62 | active = { 63 | guifg = colors.base01.gui, 64 | guibg = colors.base00.gui, 65 | ctermfg = colors.base01.cterm, 66 | ctermbg = colors.base00.cterm, 67 | }, 68 | inactive = inactive, 69 | }, 70 | med = { 71 | active = { 72 | guifg = colors.base04.gui, 73 | guibg = colors.base01.gui, 74 | ctermfg = colors.base04.cterm, 75 | ctermbg = colors.base01.cterm, 76 | }, 77 | inactive = inactive, 78 | }, 79 | high = { 80 | active = { 81 | guifg = colors.base04.gui, 82 | guibg = colors.base01.gui, 83 | ctermfg = colors.base04.cterm, 84 | ctermbg = colors.base01.cterm, 85 | }, 86 | inactive = inactive, 87 | }, 88 | error = { 89 | active = { 90 | guifg = colors.base0C.gui, 91 | guibg = colors.base01.gui, 92 | ctermfg = colors.base0C.cterm, 93 | ctermbg = colors.base01.cterm, 94 | }, 95 | inactive = inactive, 96 | }, 97 | warning = { 98 | active = { 99 | guifg = colors.base0E.gui, 100 | guibg = colors.base01.gui, 101 | ctermfg = colors.base0E.cterm, 102 | ctermbg = colors.base01.cterm, 103 | }, 104 | inactive = inactive, 105 | }, 106 | bufferline = { 107 | separator = inactive, 108 | current = { 109 | guifg = colors.base00.gui, 110 | guibg = colors.base09.gui, 111 | ctermfg = colors.base00.cterm, 112 | ctermbg = colors.base09.cterm, 113 | }, 114 | current_modified = { 115 | guifg = colors.base00.gui, 116 | guibg = colors.base0E.gui, 117 | ctermfg = colors.base00.cterm, 118 | ctermbg = colors.base0E.cterm, 119 | }, 120 | background = { 121 | guifg = colors.base04.gui, 122 | guibg = colors.base01.gui, 123 | ctermfg = colors.base04.cterm, 124 | ctermbg = colors.base01.cterm, 125 | }, 126 | background_modified = { 127 | guifg = colors.base0E.gui, 128 | guibg = colors.base01.gui, 129 | ctermfg = colors.base0E.cterm, 130 | ctermbg = colors.base01.cterm, 131 | }, 132 | }, 133 | } 134 | -------------------------------------------------------------------------------- /lua/hardline/themes/custom_colors.lua: -------------------------------------------------------------------------------- 1 | -- Custom colorscheme 2 | 3 | local M = {} 4 | 5 | M.set = function(color_table) 6 | local inactive = { 7 | guifg = color_table.inactive_comment.gui, 8 | guibg = color_table.inactive_cursor.gui, 9 | ctermfg = color_table.inactive_comment.cterm, 10 | ctermbg = color_table.inactive_cursor.cterm, 11 | } 12 | 13 | return { 14 | mode = { 15 | inactive = inactive, 16 | normal = { 17 | guifg = color_table.text.gui, 18 | guibg = color_table.normal.gui, 19 | ctermfg = color_table.text.cterm, 20 | ctermbg = color_table.normal.cterm, 21 | }, 22 | insert = { 23 | guifg = color_table.text.gui, 24 | guibg = color_table.insert.gui, 25 | ctermfg = color_table.text.cterm, 26 | ctermbg = color_table.insert.cterm, 27 | }, 28 | replace = { 29 | guifg = color_table.text.gui, 30 | guibg = color_table.replace.gui, 31 | ctermfg = color_table.text.cterm, 32 | ctermbg = color_table.replace.cterm, 33 | }, 34 | visual = { 35 | guifg = color_table.text.gui, 36 | guibg = color_table.visual.gui, 37 | ctermfg = color_table.text.cterm, 38 | ctermbg = color_table.visual.cterm, 39 | }, 40 | command = { 41 | guifg = color_table.text.gui, 42 | guibg = color_table.command.gui, 43 | ctermfg = color_table.text.cterm, 44 | ctermbg = color_table.command.cterm, 45 | }, 46 | }, 47 | low = { 48 | active = { 49 | guifg = color_table.alt_text.gui, 50 | guibg = color_table.inactive_cursor.gui, 51 | ctermfg = color_table.alt_text.cterm, 52 | ctermbg = color_table.inactive_cursor.cterm, 53 | }, 54 | inactive = inactive, 55 | }, 56 | med = { 57 | active = { 58 | guifg = color_table.alt_text.gui, 59 | guibg = color_table.inactive_cursor.gui, 60 | ctermfg = color_table.alt_text.cterm, 61 | ctermbg = color_table.inactive_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | high = { 66 | active = { 67 | guifg = color_table.alt_text.gui, 68 | guibg = color_table.inactive_menu.gui, 69 | ctermfg = color_table.alt_text.cterm, 70 | ctermbg = color_table.inactive_menu.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | error = { 75 | active = { 76 | guifg = color_table.text.gui, 77 | guibg = color_table.command.gui, 78 | ctermfg = color_table.text.cterm, 79 | ctermbg = color_table.command.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | warning = { 84 | active = { 85 | guifg = color_table.text.gui, 86 | guibg = color_table.warning.gui, 87 | ctermfg = color_table.text.cterm, 88 | ctermbg = color_table.warning.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | bufferline = { 93 | separator = inactive, 94 | current = { 95 | guifg = color_table.text.gui, 96 | guibg = color_table.normal.gui, 97 | ctermfg = color_table.text.cterm, 98 | ctermbg = color_table.normal.cterm, 99 | }, 100 | current_modified = { 101 | guifg = color_table.text.gui, 102 | guibg = color_table.insert.gui, 103 | ctermfg = color_table.text.cterm, 104 | ctermbg = color_table.insert.cterm, 105 | }, 106 | background = { 107 | guifg = color_table.normal.gui, 108 | guibg = color_table.text.gui, 109 | ctermfg = color_table.normal.cterm, 110 | ctermbg = color_table.text.cterm, 111 | }, 112 | background_modified = { 113 | guifg = color_table.insert.gui, 114 | guibg = color_table.text.gui, 115 | ctermfg = color_table.insert.cterm, 116 | ctermbg = color_table.text.cterm, 117 | }, 118 | }, 119 | } 120 | end 121 | 122 | return M 123 | -------------------------------------------------------------------------------- /lua/hardline/themes/default.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#282C34', cterm = '235', cterm16 = '0'}, 3 | blue = {gui = '#61AFEF', cterm = '39', cterm16 = '4'}, 4 | cyan = { gui = '#56B6C2', cterm = '38', cterm16 = '6'}, 5 | green = {gui = '#98C379', cterm = '114', cterm16 = '2'}, 6 | grey_comment = {gui = '#5C6370', cterm = '59', cterm16 = '15'}, 7 | grey_cursor = {gui = '#2C323C', cterm = '236', cterm16 = '8'}, 8 | grey_menu = {gui = '#3E4452', cterm = '237', cterm16 = '8'}, 9 | purple = {gui = '#C678DD', cterm = '170', cterm16 = '5'}, 10 | red = {gui = '#E06C75', cterm = '204', cterm16 = '1'}, 11 | white = {gui = '#ABB2BF', cterm = '145', cterm16 = '7'}, 12 | yellow = {gui = '#E5C07B', cterm = '180', cterm16 = '3'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.green.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.green.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.blue.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.blue.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.cyan.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.cyan.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.green.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.green.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.blue.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.blue.cterm, 114 | }, 115 | background = { 116 | guifg = colors.green.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.green.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.blue.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.blue.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/nord.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#2E3440', cterm = '235', cterm16 = '0'}, 3 | blue = { gui = '#88C0D0', cterm = '110', cterm16 = '14'}, 4 | cyan = {gui = '#5E81AC', cterm = '67', cterm16 = '12'}, 5 | green = {gui = '#81A1C1', cterm = '109', cterm16 = '4'}, 6 | grey_comment = {gui = '#4C566A', cterm = '59', cterm16 = '8'}, 7 | grey_cursor = {gui = '#434C5E', cterm = '59', cterm16 = '8'}, 8 | grey_menu = {gui = '#3B4252', cterm = '59', cterm16 = '8'}, 9 | purple = {gui = '#B48EAD', cterm = '139', cterm16 = '5'}, 10 | red = {gui = '#BF616A', cterm = '131', cterm16 = '1'}, 11 | white = {gui = '#D8DEE9', cterm = '188', cterm16 = '7'}, 12 | yellow = {gui = '#EBCB8B', cterm = '222', cterm16 = '3'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.green.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.green.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.blue.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.blue.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.cyan.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.cyan.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.green.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.green.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.blue.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.blue.cterm, 114 | }, 115 | background = { 116 | guifg = colors.green.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.green.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.blue.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.blue.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/one.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#282C34', cterm = '235', cterm16 = '0'}, 3 | blue = {gui = '#61AFEF', cterm = '39', cterm16 = '4'}, 4 | cyan = { gui = '#56B6C2', cterm = '38', cterm16 = '6'}, 5 | green = {gui = '#98C379', cterm = '114', cterm16 = '2'}, 6 | grey_comment = {gui = '#5C6370', cterm = '59', cterm16 = '15'}, 7 | grey_cursor = {gui = '#2C323C', cterm = '236', cterm16 = '8'}, 8 | grey_menu = {gui = '#3E4452', cterm = '237', cterm16 = '8'}, 9 | purple = {gui = '#C678DD', cterm = '170', cterm16 = '5'}, 10 | red = {gui = '#E06C75', cterm = '204', cterm16 = '1'}, 11 | white = {gui = '#ABB2BF', cterm = '145', cterm16 = '7'}, 12 | yellow = {gui = '#E5C07B', cterm = '180', cterm16 = '3'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.green.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.green.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.blue.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.blue.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.cyan.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.cyan.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.green.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.green.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.blue.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.blue.cterm, 114 | }, 115 | background = { 116 | guifg = colors.green.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.green.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.blue.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.blue.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/gruvbox.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#32302f', cterm = '236', cterm16 = '0'}, 3 | blue = { gui = '#83a598', cterm = '109', cterm16 = '12'}, 4 | cyan = {gui = '#8ec07c', cterm = '108', cterm16 = '14'}, 5 | green = {gui = '#b8bb26', cterm = '142', cterm16 = '10'}, 6 | grey_comment = {gui = '#928374', cterm = '244', cterm16 = '8'}, 7 | grey_cursor = {gui = '#665c54', cterm = '241', cterm16 = '8'}, 8 | grey_menu = {gui = '#7c6f64', cterm = '243', cterm16 = '8'}, 9 | purple = {gui = '#d3869b', cterm = '175', cterm16 = '13'}, 10 | red = {gui = '#fb4934', cterm = '167', cterm16 = '9'}, 11 | white = {gui = '#f2e5bc', cterm = '228', cterm16 = '15'}, 12 | yellow = {gui = '#fabd2f', cterm = '214', cterm16 = '11'}, 13 | } 14 | 15 | local inactive = { 16 | guifg = colors.grey_comment.gui, 17 | guibg = colors.grey_cursor.gui, 18 | ctermfg = colors.grey_comment.cterm, 19 | ctermbg = colors.grey_cursor.cterm, 20 | } 21 | 22 | return { 23 | mode = { 24 | inactive = inactive, 25 | normal = { 26 | guifg = colors.black.gui, 27 | guibg = colors.green.gui, 28 | ctermfg = colors.black.cterm, 29 | ctermbg = colors.green.cterm, 30 | }, 31 | insert = { 32 | guifg = colors.black.gui, 33 | guibg = colors.blue.gui, 34 | ctermfg = colors.black.cterm, 35 | ctermbg = colors.blue.cterm, 36 | }, 37 | replace = { 38 | guifg = colors.black.gui, 39 | guibg = colors.cyan.gui, 40 | ctermfg = colors.black.cterm, 41 | ctermbg = colors.cyan.cterm, 42 | }, 43 | visual = { 44 | guifg = colors.black.gui, 45 | guibg = colors.purple.gui, 46 | ctermfg = colors.black.cterm, 47 | ctermbg = colors.purple.cterm, 48 | }, 49 | command = { 50 | guifg = colors.black.gui, 51 | guibg = colors.red.gui, 52 | ctermfg = colors.black.cterm, 53 | ctermbg = colors.red.cterm, 54 | }, 55 | }, 56 | low = { 57 | active = { 58 | guifg = colors.white.gui, 59 | guibg = colors.grey_cursor.gui, 60 | ctermfg = colors.white.cterm, 61 | ctermbg = colors.grey_cursor.cterm, 62 | }, 63 | inactive = inactive, 64 | }, 65 | med = { 66 | active = { 67 | guifg = colors.yellow.gui, 68 | guibg = colors.grey_cursor.gui, 69 | ctermfg = colors.yellow.cterm, 70 | ctermbg = colors.grey_cursor.cterm, 71 | }, 72 | inactive = inactive, 73 | }, 74 | high = { 75 | active = { 76 | guifg = colors.white.gui, 77 | guibg = colors.grey_menu.gui, 78 | ctermfg = colors.white.cterm, 79 | ctermbg = colors.grey_menu.cterm, 80 | }, 81 | inactive = inactive, 82 | }, 83 | error = { 84 | active = { 85 | guifg = colors.black.gui, 86 | guibg = colors.red.gui, 87 | ctermfg = colors.black.cterm, 88 | ctermbg = colors.red.cterm, 89 | }, 90 | inactive = inactive, 91 | }, 92 | warning = { 93 | active = { 94 | guifg = colors.black.gui, 95 | guibg = colors.yellow.gui, 96 | ctermfg = colors.black.cterm, 97 | ctermbg = colors.yellow.cterm, 98 | }, 99 | inactive = inactive, 100 | }, 101 | bufferline = { 102 | separator = inactive, 103 | current = { 104 | guifg = colors.black.gui, 105 | guibg = colors.green.gui, 106 | ctermfg = colors.black.cterm, 107 | ctermbg = colors.green.cterm, 108 | }, 109 | current_modified = { 110 | guifg = colors.black.gui, 111 | guibg = colors.blue.gui, 112 | ctermfg = colors.black.cterm, 113 | ctermbg = colors.blue.cterm, 114 | }, 115 | background = { 116 | guifg = colors.green.gui, 117 | guibg = colors.black.gui, 118 | ctermfg = colors.green.cterm, 119 | ctermbg = colors.black.cterm, 120 | }, 121 | background_modified = { 122 | guifg = colors.blue.gui, 123 | guibg = colors.black.gui, 124 | ctermfg = colors.blue.cterm, 125 | ctermbg = colors.black.cterm, 126 | }, 127 | }, 128 | } 129 | -------------------------------------------------------------------------------- /lua/hardline/themes/nordic.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | black = {gui = '#2E3440', cterm = '235', cterm16 = '0'}, 3 | blue = { gui = '#5E81AC', cterm = '110', cterm16 = '14'}, 4 | bluegreen = { gui = '#8FBCBB', cterm = '115', cterm = '14'}, 5 | cyan = {gui = '#88C0D0', cterm = '67', cterm16 = '12'}, 6 | green = {gui = '#A3BE8C', cterm = '108', cterm16 = '4'}, 7 | grey_comment = {gui = '#616E88', cterm = '59', cterm16 = '8'}, 8 | grey_cursor = {gui = '#3B4252', cterm = '59', cterm16 = '8'}, 9 | grey_menu = {gui = '#4C566A', cterm = '59', cterm16 = '8'}, 10 | purple = {gui = '#B48EAD', cterm = '139', cterm16 = '5'}, 11 | red = {gui = '#BF616A', cterm = '131', cterm16 = '1'}, 12 | white = {gui = '#E5E9F0', cterm = '188', cterm16 = '7'}, 13 | yellow = {gui = '#EBCB8B', cterm = '222', cterm16 = '3'}, 14 | } 15 | 16 | local inactive = { 17 | guifg = colors.grey_comment.gui, 18 | guibg = colors.grey_cursor.gui, 19 | ctermfg = colors.grey_comment.cterm, 20 | ctermbg = colors.grey_cursor.cterm, 21 | } 22 | 23 | return { 24 | mode = { 25 | inactive = inactive, 26 | normal = { 27 | guifg = colors.black.gui, 28 | guibg = colors.cyan.gui, 29 | ctermfg = colors.black.cterm, 30 | ctermbg = colors.cyan.cterm, 31 | }, 32 | insert = { 33 | guifg = colors.black.gui, 34 | guibg = colors.white.gui, 35 | ctermfg = colors.black.cterm, 36 | ctermbg = colors.white.cterm, 37 | }, 38 | replace = { 39 | guifg = colors.black.gui, 40 | guibg = colors.yellow.gui, 41 | ctermfg = colors.black.cterm, 42 | ctermbg = colors.yellow.cterm, 43 | }, 44 | visual = { 45 | guifg = colors.black.gui, 46 | guibg = colors.bluegreen.gui, 47 | ctermfg = colors.black.cterm, 48 | ctermbg = colors.bluegreen.cterm, 49 | }, 50 | command = { 51 | guifg = colors.black.gui, 52 | guibg = colors.cyan.gui, 53 | ctermfg = colors.black.cterm, 54 | ctermbg = colors.cyan.cterm, 55 | }, 56 | }, 57 | low = { 58 | active = { 59 | guifg = colors.white.gui, 60 | guibg = colors.grey_cursor.gui, 61 | ctermfg = colors.white.cterm, 62 | ctermbg = colors.grey_cursor.cterm, 63 | }, 64 | inactive = inactive, 65 | }, 66 | med = { 67 | active = { 68 | guifg = colors.white.gui, 69 | guibg = colors.grey_cursor.gui, 70 | ctermfg = colors.white.cterm, 71 | ctermbg = colors.grey_cursor.cterm, 72 | }, 73 | inactive = inactive, 74 | }, 75 | high = { 76 | active = { 77 | guifg = colors.white.gui, 78 | guibg = colors.grey_menu.gui, 79 | ctermfg = colors.white.cterm, 80 | ctermbg = colors.grey_menu.cterm, 81 | }, 82 | inactive = inactive, 83 | }, 84 | error = { 85 | active = { 86 | guifg = colors.black.gui, 87 | guibg = colors.red.gui, 88 | ctermfg = colors.black.cterm, 89 | ctermbg = colors.red.cterm, 90 | }, 91 | inactive = inactive, 92 | }, 93 | warning = { 94 | active = { 95 | guifg = colors.black.gui, 96 | guibg = colors.yellow.gui, 97 | ctermfg = colors.black.cterm, 98 | ctermbg = colors.yellow.cterm, 99 | }, 100 | inactive = inactive, 101 | }, 102 | bufferline = { 103 | separator = inactive, 104 | current = { 105 | guifg = colors.black.gui, 106 | guibg = colors.cyan.gui, 107 | ctermfg = colors.black.cterm, 108 | ctermbg = colors.cyan.cterm, 109 | }, 110 | current_modified = { 111 | guifg = colors.black.gui, 112 | guibg = colors.cyan.gui, 113 | ctermfg = colors.black.cterm, 114 | ctermbg = colors.cyan.cterm, 115 | }, 116 | background = { 117 | guifg = colors.cyan.gui, 118 | guibg = colors.black.gui, 119 | ctermfg = colors.cyan.cterm, 120 | ctermbg = colors.black.cterm, 121 | }, 122 | background_modified = { 123 | guifg = colors.cyan.gui, 124 | guibg = colors.black.gui, 125 | ctermfg = colors.cyan.cterm, 126 | ctermbg = colors.black.cterm, 127 | }, 128 | }, 129 | } 130 | -------------------------------------------------------------------------------- /lua/hardline/themes/dracula.lua: -------------------------------------------------------------------------------- 1 | local colors = { 2 | base00 = {gui = '#2E3440', cterm = '0'}, 3 | base01 = {gui = '#282828', cterm = '18'}, 4 | base02 = {gui = '#383838', cterm = '19'}, 5 | base03 = {gui = '#585858', cterm = '8'}, 6 | base04 = {gui = '#B8B8B8', cterm = '20'}, 7 | base05 = {gui = '#D8D8D8', cterm = '7'}, 8 | base06 = {gui = '#E8E8E8', cterm = '21'}, 9 | base07 = {gui = '#F8F8F8', cterm = '15'}, 10 | base08 = {gui = '#AB4642', cterm = '1'}, 11 | base09 = {gui = '#DC9656', cterm = '16'}, 12 | base0A = {gui = '#F7CA88', cterm = '3'}, 13 | base0B = {gui = '#A1B56C', cterm = '2'}, 14 | base0C = {gui = '#86C1B9', cterm = '6'}, 15 | base0D = {gui = '#7CAFC2', cterm = '4'}, 16 | base0E = {gui = '#BA8BAF', cterm = '5'}, 17 | base0F = {gui = '#A16946', cterm = '17'}, 18 | } 19 | 20 | local inactive = { 21 | guifg = colors.base06.gui, 22 | guibg = colors.base01.gui, 23 | ctermfg = colors.base06.cterm, 24 | ctermbg = colors.base01.cterm, 25 | } 26 | 27 | return { 28 | mode = { 29 | inactive = inactive, 30 | normal = { 31 | guifg = colors.base00.gui, 32 | guibg = colors.base0D.gui, 33 | ctermfg = colors.base00.cterm, 34 | ctermbg = colors.base0D.cterm, 35 | }, 36 | insert = { 37 | guifg = colors.base01.gui, 38 | guibg = colors.base0D.gui, 39 | ctermfg = colors.base01.cterm, 40 | ctermbg = colors.base0D.cterm, 41 | }, 42 | replace = { 43 | guifg = colors.base00.gui, 44 | guibg = colors.base08.gui, 45 | ctermfg = colors.base00.cterm, 46 | ctermbg = colors.base08.cterm, 47 | }, 48 | visual = { 49 | guifg = colors.base00.gui, 50 | guibg = colors.base08.gui, 51 | ctermfg = colors.base00.cterm, 52 | ctermbg = colors.base08.cterm, 53 | }, 54 | command = { 55 | guifg = colors.base00.gui, 56 | guibg = colors.base08.gui, 57 | ctermfg = colors.base00.cterm, 58 | ctermbg = colors.base08.cterm, 59 | }, 60 | }, 61 | low = { --TODO 62 | active = { 63 | guifg = colors.base01.gui, 64 | guibg = colors.base00.gui, 65 | ctermfg = colors.base01.cterm, 66 | ctermbg = colors.base00.cterm, 67 | }, 68 | inactive = inactive, 69 | }, 70 | med = { 71 | active = { 72 | guifg = colors.base04.gui, 73 | guibg = colors.base01.gui, 74 | ctermfg = colors.base04.cterm, 75 | ctermbg = colors.base01.cterm, 76 | }, 77 | inactive = inactive, 78 | }, 79 | high = { 80 | active = { 81 | guifg = colors.base01.gui, 82 | guibg = colors.base0D.gui, 83 | ctermfg = colors.base01.cterm, 84 | ctermbg = colors.base0D.cterm, 85 | }, 86 | inactive = inactive, 87 | }, 88 | error = { 89 | active = { 90 | guifg = colors.base00.gui, 91 | guibg = colors.base08.gui, 92 | ctermfg = colors.base00.cterm, 93 | ctermbg = colors.base08.cterm, 94 | }, 95 | inactive = inactive, 96 | }, 97 | warning = { 98 | active = { 99 | guifg = colors.base00.gui, 100 | guibg = colors.base0B.gui, 101 | ctermfg = colors.base00.cterm, 102 | ctermbg = colors.base0B.cterm, 103 | }, 104 | inactive = inactive, 105 | }, 106 | bufferline = { 107 | separator = inactive, 108 | current = { 109 | guifg = colors.base00.gui, 110 | guibg = colors.base0D.gui, 111 | ctermfg = colors.base00.cterm, 112 | ctermbg = colors.base0D.cterm, 113 | }, 114 | current_modified = { 115 | guifg = colors.base00.gui, 116 | guibg = colors.base0E.gui, 117 | ctermfg = colors.base00.cterm, 118 | ctermbg = colors.base0E.cterm, 119 | }, 120 | background = { 121 | guifg = colors.base04.gui, 122 | guibg = colors.base01.gui, 123 | ctermfg = colors.base04.cterm, 124 | ctermbg = colors.base01.cterm, 125 | }, 126 | background_modified = { 127 | guifg = colors.base0E.gui, 128 | guibg = colors.base01.gui, 129 | ctermfg = colors.base0E.cterm, 130 | ctermbg = colors.base01.cterm, 131 | }, 132 | }, 133 | } 134 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # nvim-hardline 2 | 3 | A statusline / bufferline for Neovim written in Lua. It is inspired by 4 | [vim-airline](https://github.com/vim-airline/vim-airline) but aims to 5 | be as light and simple as possible. 6 | 7 | _**Note**: I won't add new features/parts/themes if I don't need them. Feel free 8 | to submit PRs or fork the plugin though._ 9 | 10 | ![screenshot](https://user-images.githubusercontent.com/23409060/188603562-aff6f003-69bc-4bd2-b4c5-83007f338d25.png) 11 | 12 | ## Installation 13 | With [packer.nvim](https://github.com/wbthomason/packer.nvim): 14 | ```lua 15 | use {'ojroques/nvim-hardline'} 16 | ``` 17 | 18 | With [paq-nvim](https://github.com/savq/paq-nvim): 19 | ```lua 20 | paq {'ojroques/nvim-hardline'} 21 | ``` 22 | 23 | With [lazy.nvim](https://github.com/folke/lazy.nvim): 24 | ```lua 25 | -- init.lua: 26 | {'ojroques/nvim-hardline'}, 27 | 28 | -- plugins/hardline.lua: 29 | return { 30 | 'ojroques/nvim-hardline', 31 | } 32 | ``` 33 | 34 | ## Usage 35 | In your *init.lua*: 36 | ```lua 37 | require('hardline').setup {} 38 | ``` 39 | 40 | If you're using a *.vimrc* or *init.vim*: 41 | ```vim 42 | lua require('hardline').setup {} 43 | ``` 44 | 45 | ## Configuration 46 | You can pass options to the `setup()` function. Here are all available options 47 | with their default settings: 48 | ```lua 49 | require('hardline').setup { 50 | bufferline = false, -- disable bufferline 51 | bufferline_settings = { 52 | exclude_terminal = false, -- don't show terminal buffers in bufferline 53 | show_index = false, -- show buffer indexes (not the actual buffer numbers) in bufferline 54 | }, 55 | theme = 'default', -- change theme 56 | sections = { -- define sections 57 | {class = 'mode', item = require('hardline.parts.mode').get_item}, 58 | {class = 'high', item = require('hardline.parts.git').get_item, hide = 100}, 59 | {class = 'med', item = require('hardline.parts.filename').get_item}, 60 | '%<', 61 | {class = 'med', item = '%='}, 62 | {class = 'low', item = require('hardline.parts.wordcount').get_item, hide = 100}, 63 | {class = 'error', item = require('hardline.parts.lsp').get_error}, 64 | {class = 'warning', item = require('hardline.parts.lsp').get_warning}, 65 | {class = 'warning', item = require('hardline.parts.whitespace').get_item}, 66 | {class = 'high', item = require('hardline.parts.filetype').get_item, hide = 60}, 67 | {class = 'mode', item = require('hardline.parts.line').get_item}, 68 | }, 69 | } 70 | ``` 71 | 72 | You can define your own sections using the `sections` list. Each element of 73 | that list is a table with the following attributes: 74 | * `class`: the section colorscheme. The following classes are currently 75 | available: 76 | * `mode`: change color based on the current mode. 77 | * `low`, `med`, `high`: colors for different levels of importance. 78 | * `bufferline`: colors for the bufferline. 79 | * `error`, `warning`: colors for the diagnostics of Neovim built-in LSP 80 | client. 81 | * `item`: the actual text being displayed. Must be a string or a function 82 | returning a string. 83 | * `hide`: threshold (in number of characters) below which the section will be 84 | hidden. 85 | 86 | ## Available section parts 87 | | Part | Description | 88 | |------|-------------| 89 | | `cwd` | Current working directory | 90 | | `filename` | Filename and file status (readonly, modified, ...) | 91 | | `filetype` | Filetype | 92 | | `git` | Git hunks (requires [vim-gitgutter](https://github.com/airblade/vim-gitgutter) / [vim-signify](https://github.com/mhinz/vim-signify) / [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)) and Git branch (requires [vim-fugitive](https://github.com/tpope/vim-fugitive) / [gina.vim](https://github.com/lambdalisue/gina.vim) / [vim-branchname](https://github.com/itchyny/vim-gitbranch) / [gitsigns.nvim](https://github.com/lewis6991/gitsigns.nvim)) | 93 | | `line` | Line and column positions | 94 | | `lsp` | Diagnostics from Neovim LSP client | 95 | | `mode` | Current mode | 96 | | `treesitter-context` | Current treesitter node (requires [nvim-gps](https://github.com/SmiteshP/nvim-gps)) | 97 | | `whitespace` | Trailing whitespaces, mixed indent and Git conflict markers warnings | 98 | | `wordcount` | Current word count (enabled only for [some filetypes](https://github.com/ojroques/nvim-hardline/blob/5fc738bb7991f7d7890be14e7a74a50e21f0bd81/lua/hardline/parts/wordcount.lua#L8-L19)) | 99 | 100 | ## License 101 | [LICENSE](./LICENSE) 102 | -------------------------------------------------------------------------------- /lua/hardline.lua: -------------------------------------------------------------------------------- 1 | -- nvim-hardline 2 | -- By Olivier Roques 3 | -- github.com/ojroques 4 | 5 | -------------------- VARIABLES ----------------------------- 6 | local common = require('hardline.common') 7 | local bufferline = require('hardline.bufferline') 8 | local custom_colors = require('hardline.themes.custom_colors') 9 | local fmt = string.format 10 | local M = {} 11 | 12 | -------------------- OPTIONS ------------------------------- 13 | M.options = { 14 | bufferline = false, 15 | bufferline_settings = { 16 | exclude_terminal = false, 17 | show_index = false, 18 | separator = '|', 19 | }, 20 | theme = 'default', 21 | sections = { 22 | {class = 'mode', item = require('hardline.parts.mode').get_item}, 23 | {class = 'high', item = require('hardline.parts.git').get_item, hide = 100}, 24 | {class = 'med', item = require('hardline.parts.filename').get_item}, 25 | '%<', 26 | {class = 'med', item = '%='}, 27 | {class = 'low', item = require('hardline.parts.wordcount').get_item, hide = 100}, 28 | {class = 'error', item = require('hardline.parts.lsp').get_error}, 29 | {class = 'warning', item = require('hardline.parts.lsp').get_warning}, 30 | {class = 'warning', item = require('hardline.parts.whitespace').get_item}, 31 | {class = 'high', item = require('hardline.parts.filetype').get_item, hide = 60}, 32 | {class = 'mode', item = require('hardline.parts.line').get_item}, 33 | }, 34 | custom_theme = { 35 | text = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 36 | normal = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 37 | insert = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 38 | replace = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 39 | inactive_comment = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 40 | inactive_cursor = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 41 | inactive_menu = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 42 | visual = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 43 | command = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 44 | alt_text = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 45 | warning = {gui = "NONE", cterm = "NONE", cterm16 = "NONE"}, 46 | }, 47 | } 48 | 49 | -------------------- SECTION MANAGEMENT -------------------- 50 | -- Merge sections with same 'class' attribute and add spacing. For instance this: 51 | -- {class = 'low', item = 'first'}, 52 | -- {class = 'med', item = 'second'}, 53 | -- {class = 'med', item = 'third'}, 54 | -- {class = 'high', item = 'fourth'}, 55 | -- will become this: 56 | -- {class = 'low', item = ' first '}, 57 | -- {class = 'med', item = ' second third '}, 58 | -- {class = 'high', item = ' fourth '}, 59 | local function aggregate_sections(sections) 60 | local aggregated, piv = {}, 1 61 | while piv <= #sections do 62 | if type(sections[piv]) == 'table' then 63 | local items = {} 64 | for j = piv, #sections + 1 do 65 | if j == #sections + 1 or sections[j].class ~= sections[piv].class then 66 | table.insert(aggregated, { 67 | class = sections[piv].class, 68 | item = fmt(' %s ', table.concat(items, ' ')), 69 | }) 70 | piv = j 71 | break 72 | end 73 | table.insert(items, sections[j].item) 74 | end 75 | else 76 | table.insert(aggregated, sections[piv]) 77 | piv = piv + 1 78 | end 79 | end 80 | return aggregated 81 | end 82 | 83 | local function remove_empty_sections(sections) 84 | local filter = function(section) 85 | if type(section) == 'table' then 86 | return section.item ~= '' 87 | end 88 | return section ~= '' 89 | end 90 | return vim.tbl_filter(filter, sections) 91 | end 92 | 93 | local function load_sections(sections) 94 | function load_section(section) 95 | if type(section) == 'string' then 96 | return section 97 | end 98 | if type(section) == 'function' then 99 | return section() 100 | end 101 | if type(section) == 'table' then 102 | return { 103 | class = section.class or 'none', 104 | item = load_section(section.item), 105 | } 106 | end 107 | common.echo('Invalid section', 'WarningMsg') 108 | return '' 109 | end 110 | return vim.tbl_map(load_section, sections) 111 | end 112 | 113 | local function remove_hidden_sections(sections) 114 | local filter = function(section) 115 | return not section.hide or section.hide <= vim.fn.winwidth(0) 116 | end 117 | return vim.tbl_filter(filter, sections) 118 | end 119 | 120 | -------------------- SECTION HIGHLIGHTING ------------------ 121 | local function get_section_state(section, is_active) 122 | if section.class == 'mode' then 123 | if is_active then 124 | local mode = common.modes[vim.fn.mode()] or common.modes['?'] 125 | return mode.state 126 | end 127 | end 128 | if section.class == 'bufferline' then 129 | if section.separator then 130 | return 'separator' 131 | end 132 | local state = section.current and 'current' or 'background' 133 | if section.modified then 134 | state = fmt('%s_modified', state) 135 | end 136 | return state 137 | end 138 | return is_active and 'active' or 'inactive' 139 | end 140 | 141 | local function highlight_sections(sections, is_active) 142 | function highlight_section(section) 143 | if type(section) ~= 'table' then 144 | return section 145 | end 146 | if section.class == 'none' then 147 | return section.item 148 | end 149 | local state = get_section_state(section, is_active) 150 | local hlgroup = fmt('Hardline_%s_%s', section.class, state) 151 | if vim.fn.hlexists(hlgroup) == 0 then 152 | return section.item 153 | end 154 | return fmt('%%#%s#%s%%*', hlgroup, section.item) 155 | end 156 | return vim.tbl_map(highlight_section, sections) 157 | end 158 | 159 | -------------------- STATUSLINE ---------------------------- 160 | function M.update_statusline(is_active) 161 | local sections = M.options.sections 162 | sections = remove_hidden_sections(sections) 163 | sections = load_sections(sections) 164 | sections = remove_empty_sections(sections) 165 | sections = aggregate_sections(sections) 166 | sections = highlight_sections(sections, is_active) 167 | return table.concat(sections) 168 | end 169 | 170 | -------------------- BUFFERLINE ---------------------------- 171 | function M.update_bufferline() 172 | local sections = {} 173 | local settings = M.options.bufferline_settings 174 | local buffers = bufferline.get_buffers(settings) 175 | for i, buffer in ipairs(buffers) do 176 | table.insert(sections, bufferline.to_section(buffer, i, settings)) 177 | if i < #buffers then 178 | table.insert(sections, M.options.bufferline_settings.separator) 179 | end 180 | end 181 | return table.concat(highlight_sections(sections)) 182 | end 183 | 184 | -------------------- SETUP ----------------------------- 185 | local function set_theme() 186 | if type(M.options.theme) ~= 'string' then 187 | return 188 | end 189 | if M.options.theme == 'custom' then 190 | M.options.theme = custom_colors.set(M.options.custom_theme) 191 | else 192 | local theme = fmt('hardline.themes.%s', M.options.theme) 193 | M.options.theme = require(theme) 194 | end 195 | end 196 | 197 | local function set_hlgroups() 198 | for class, attr in pairs(M.options.theme) do 199 | for state, args in pairs(attr) do 200 | local hlgroup = fmt('Hardline_%s_%s', class, state) 201 | local a = {} 202 | for k, v in pairs(args) do 203 | table.insert(a, fmt('%s=%s', k, v)) 204 | end 205 | a = table.concat(a, ' ') 206 | vim.cmd(fmt('autocmd VimEnter,ColorScheme * hi %s %s', hlgroup, a)) 207 | end 208 | end 209 | end 210 | 211 | local function set_statusline() 212 | vim.opt.showmode = false 213 | vim.opt.statusline = [[%{%luaeval('require("hardline").update_statusline(false)')%}]] 214 | vim.cmd([[ 215 | augroup hardline 216 | autocmd! 217 | autocmd WinEnter,BufEnter * setlocal statusline=%{%luaeval('require(\"hardline\").update_statusline(true)')%} 218 | autocmd WinLeave,BufLeave * setlocal statusline=%{%luaeval('require(\"hardline\").update_statusline(false)')%} 219 | augroup END 220 | ]]) 221 | end 222 | 223 | local function set_bufferline() 224 | vim.opt.showtabline = 2 225 | vim.opt.tabline = [[%!luaeval('require("hardline").update_bufferline()')]] 226 | end 227 | 228 | function M.setup(user_options) 229 | if user_options then 230 | M.options = vim.tbl_extend('force', M.options, user_options) 231 | end 232 | set_theme() 233 | set_hlgroups() 234 | set_statusline() 235 | if M.options.bufferline then 236 | set_bufferline() 237 | end 238 | end 239 | 240 | ------------------------------------------------------------ 241 | return M 242 | --------------------------------------------------------------------------------