feat(nvim): improve colorscheme

This commit is contained in:
Bruno Carlin 2025-02-11 15:23:05 +01:00
parent e688de9762
commit 51483c94de
8 changed files with 305 additions and 223 deletions

View file

@ -50,36 +50,66 @@ function highlight(opts)
assert(opts.name, "The name of the group is missing")
local histr = "highlight! " .. opts.name .. " "
local args = { }
if opts.fg then
histr = histr .. "ctermfg=" .. opts.fg[1] .. " "
histr = histr .. "guifg=" .. opts.fg[2] .. " "
args.ctermfg = opts.fg[1]
args.fg = opts.fg[2]
end
if opts.bg then
histr = histr .. "ctermbg=" .. opts.bg[1] .. " "
histr = histr .. "guibg=" .. opts.bg[2] .. " "
args.ctermbg = opts.bg[1]
args.bg = opts.bg[2]
end
if opts.sp then
histr = histr .. "guisp=" .. opts.sp[2] .. " "
args.sp = opts.sp[2]
end
if opts.attrs then
histr = histr .. "cterm=" .. table.concat(opts.attrs, ",") .. " "
histr = histr .. "gui=" .. table.concat(opts.attrs, ",") .. " "
for _, attr in pairs(opts.attrs) do
if attr == "NONE" then
args.bold = false
args.standout = false
args.underline = false
args.undercurl = false
args.underdotted = false
args.underdashed = false
args.strikethrough = false
args.italic = false
args.reverse = false
args.nocombine = false
break
end
if opts.sp then
histr = histr .. "guisp=" .. opts.sp[2] .. " "
args[attr] = true
end
end
if opts.link then
histr = "highlight! link " .. opts.name .. " " .. opts.link
args = { link = opts.link }
end
if opts.clear then
histr = "highlight! clear " .. opts.name
args = {}
end
vim.api.nvim_set_hl(0, opts.name, { })
vim.cmd(histr)
vim.api.nvim_set_hl(0, opts.name, args)
--vim.cmd(histr)
end
local config = {
@ -87,42 +117,50 @@ local config = {
}
local colors = {
base03 = { "8", "#002b36" },
base02 = { "0", "#073642" },
base01 = { "10", "#586e75" },
base00 = { "11", "#657b83" },
base0 = { "12", "#839496" },
base1 = { "14", "#93a1a1" },
base2 = { "7", "#eee8d5" },
base3 = { "15", "#fdf6e3" },
yellow = { "3", "#b58900" },
orange = { "9", "#cb4b16" },
red = { "1", "#dc322f" },
magenta = { "5", "#d33682" },
violet = { "13", "#6c71c4" },
blue = { "4", "#268bd2" },
cyan = { "6", "#2aa198" },
green = { "2", "#859900" },
base03 = { 8, "#002b36" },
base02 = { 0, "#073642" },
base01 = { 10, "#586e75" },
base00 = { 11, "#657b83" },
base0 = { 12, "#839496" },
base1 = { 14, "#93a1a1" },
base2 = { 7, "#eee8d5" },
base3 = { 15, "#fdf6e3" },
yellow = { 3, "#b58900" },
orange = { 9, "#cb4b16" },
red = { 1, "#dc322f" },
magenta = { 5, "#d33682" },
violet = { 13, "#6c71c4" },
blue = { 4, "#268bd2" },
cyan = { 6, "#2aa198" },
green = { 2, "#859900" },
none = { "NONE", "NONE" },
back = { "8", "#002b36" },
back = { 8, "#002b36" },
}
colors.background = colors.base03
colors.backgroundHighlight = colors.base02
colors.normal = colors.base0
colors.emphasized = colors.base1
colors.comments = colors.base01
colors.secondary = colors.base01
if config.termtrans then
colors.back = colors.none
end
local attrs = {
none = "NONE",
bbold = "",
bold = "bold",
underline = "underline",
italic = "italic",
curly = "undercurl",
reverse = "reverse",
standout = "standout",
double = "underdouble",
dotted = "underdotted",
dashed = "underdashed",
strike = "strikethrough",
ou = "",
ob = "",
reverse = "reverse",
inverse = "reverse",
italic = "italic",
nocombine = "nocombine",
}
vim.cmd [[
@ -132,7 +170,7 @@ vim.cmd [[
endif
]]
--vim.g.colors_name = "bsolarized2"
vim.g.colors_name = "bsolarized2"
-- ----------------------------------------------------------------------
-- Builtin groups
@ -173,6 +211,11 @@ highlight {name="DiffAdd", fg=colors.green, bg=colors.base02, attrs={attrs.bold}
highlight {name="DiffChange", fg=colors.yellow, bg=colors.base02, attrs={attrs.bold}}
highlight {name="DiffDelete", fg=colors.red, bg=colors.base02, attrs={attrs.bold}}
highlight {name="DiffText", fg=colors.blue, bg=colors.base02, attrs={attrs.bold}}
highlight {name="DiffAdded", link="DiffAdd"}
highlight {name="DiffRemoved", link="DiffDelete"}
highlight {name="DiffFile", fg=colors.blue}
highlight {name="DiffNewFile", fg=colors.red}
highlight {name="DiffLine", fg=colors.blue}
-- EndOfBuffer filler lines (~) after the end of the buffer. By default,
-- this is highlighted like |hl-NonText|.
@ -185,7 +228,7 @@ highlight {name="DiffText", fg=colors.blue, bg=colors.base02, attrs={attrs.bold}
--KEEP DEFAULT
-- ErrorMsg error messages on the command line
highlight {name="ErrorMsg", fg=colors.base03, bg=colors.red, attrs={attrs.bold}}
highlight {name="ErrorMsg", link="Error"}
-- WinSeparator separators between window splits
highlight {name="WinSeparator", link="Normal"}
@ -198,7 +241,6 @@ highlight {name="Folded", fg=colors.base0, bg=colors.base02, sp=colors.base03, a
highlight {name="FoldColumn", fg=colors.base0, bg=colors.base02}
-- SignColumn column where |signs| are displayed
--highlight {name="SignColumn", fg=colors.base0, attrs={attrs.none}}
highlight {name="SignColumn", link="LineNr"}
-- IncSearch 'incsearch' highlighting; also used for the text replaced
@ -225,7 +267,7 @@ highlight {name="CursorLineNr", fg=colors.base0, bg=colors.back, attrs={attrs.bo
-- MatchParen The character under the cursor or just before it, if it is
-- a paired bracket, and its match. |pi_paren.txt|
highlight {name="MatchParen", fg=colors.red, bg=colors.base00, attrs={attrs.bold}}
highlight {name="MatchParen", bg=colors.base00, attrs={attrs.bold}}
-- ModeMsg 'showmode' message (e.g., "-- INSERT --")
highlight {name="ModeMsg", fg=colors.blue}
@ -246,7 +288,7 @@ highlight {name="MoreMsg", fg=colors.blue}
highlight {name="NonText", fg=colors.base01, attrs={attrs.none}}
-- Normal normal text
highlight {name="Normal", fg=colors.base0, bg=colors.back, attr={attrs.none}}
highlight {name="Normal", fg=colors.base0, bg=colors.black, attr={attrs.none}}
-- NormalFloat Normal text in floating windows.
highlight {name="NormalFloat", link="Normal"}
@ -271,7 +313,7 @@ highlight {name="Question", fg=colors.cyan, bg=colors.none, attrs={attrs.bold}}
-- QuickFixLine Current |quickfix| item in the quickfix window. Combined
-- with |hl-CursorLine| when the cursor is there.
--KEEP DEFAULT : links to Search
highlight {name="QuickFixLine", bg=colors.base02}
-- Search Last search pattern highlighting (see 'hlsearch'). Also
-- used for similar items that need to stand out.
@ -310,7 +352,7 @@ highlight {name="TabLineFill", fg=colors.base0, bg=colors.base02, attrs={attrs.u
highlight {name="TabLineSel", fg=colors.base01, bg=colors.base2, attrs={attrs.underline, attrs.reverse}, sp=colors.base0}
-- Title titles for output from ":set all", ":autocmd" etc.
highlight {name="Title", fg=colors.orange, attrs={attrs.bold}}
highlight {name="Title", fg=colors.blue, attrs={attrs.bold}}
-- Visual Visual mode selection
-- VisualNOS Visual mode selection when vim is "Not Owning the
@ -319,7 +361,7 @@ highlight {name="Visual", fg=colors.base01, bg=colors.base03, attrs={attrs.rever
highlight {name="VisualNOS", fg=colors.none, bg=colors.base03, attrs={attrs.reverse, attrs.standout}}
-- WarningMsg warning messages
highlight {name="WarningMsg", fg=colors.red, bg=colors.none, attrs={attrs.bold}}
highlight {name="WarningMsg", fg=colors.orange, bg=colors.none, attrs={attrs.bold}}
-- Whitespace "nbsp", "space", "tab" and "trail" in 'listchars'
-- KEEP DEFAULT : links to NonText
@ -327,9 +369,8 @@ highlight {name="WarningMsg", fg=colors.red, bg=colors.none, attrs={attrs.bold}}
-- WildMenu current match in 'wildmenu' completion
highlight {name="WildMenu", fg=colors.base2, bg=colors.base02, attrs={attrs.reverse}}
highlight {name="Changed", fg=colors.yellow}
highlight {name="Bold", attrs={attrs.bold}}
highlight {name="Italic", attrs={attrs.italic}}
-- ----------------------------------------------------------------------
-- Syntax groups
@ -344,12 +385,15 @@ highlight {name="Comment", fg=colors.base01, attrs={attrs.italic}}
-- Number a number constant: 234, 0xff
-- Boolean a boolean constant: TRUE, false
-- Float a floating point constant: 2.3e10
highlight {name="Constant", fg=colors.cyan}
highlight {name="Constant", fg=colors.orange}
highlight {name="String", fg=colors.cyan}
highlight {name="Character", link="String"}
highlight {name="Number", fg=colors.cyan}
highlight {name="Boolean", fg=colors.cyan}
highlight {name="Float", fg=colors.cyan}
-- *Identifier any variable name
-- Function function name (also: methods for classes)
clear_highlight "Identifier"
highlight {name="Identifier", fg=colors.blue}
highlight {name="Function", fg=colors.blue}
@ -361,20 +405,20 @@ highlight {name="Function", fg=colors.blue}
-- Keyword any other keyword
-- Exception try, catch, throw
highlight {name="Statement", fg=colors.green}
highlight {name="Operator", fg=colors.red}
highlight {name="Operator", fg=colors.base1}
-- *PreProc generic Preprocessor
-- Include preprocessor #include
-- Define preprocessor #define
-- Macro same as Define
-- PreCondit preprocessor #if, #else, #endif, etc.
highlight {name="PreProc", fg=colors.orange}
highlight {name="PreProc", fg=colors.red}
-- *Type int, long, char, etc.
-- StorageClass static, register, volatile, etc.
-- Structure struct, union, enum, etc.
-- Typedef A typedef
highlight {name="Type", fg=colors.yellow, attrs={attrs.bold}}
highlight {name="Type", fg=colors.yellow}
-- *Special any special symbol
-- SpecialChar special character in a constant
@ -382,11 +426,11 @@ highlight {name="Type", fg=colors.yellow, attrs={attrs.bold}}
-- Delimiter character that needs attention
-- SpecialComment special things inside a comment
-- Debug debugging statements
highlight {name="Special", fg=colors.red}
highlight {name="Delimiter", fg=colors.red}
highlight {name="Special", fg=colors.base1}
highlight {name="Delimiter", fg=colors.base1}
-- *Underlined text that stands out, HTML links
highlight {name="Underlined", fg=colors.violet}
highlight {name="Underlined", fg=colors.violet, attrs={attrs.underline}}
-- *Ignore left blank, hidden |hl-Ignore|
highlight {name="Ignore", fg=colors.none, bg=colors.none, attrs={attrs.none}}
@ -399,66 +443,195 @@ highlight {name="Error", fg=colors.base03, bg=colors.red, attrs={attrs.bold}}
highlight {name="Todo", fg=colors.magenta, bg=colors.none, attrs={attrs.bold}}
highlight {name="Added", link="DiffAdd"}
highlight {name="Changed", link="DiffChange"}
highlight {name="Removed", link="DiffDelete"}
-- ----------------------------------------------------------------------
-- Semantic tokens
-- Diagnostics
-- ----------------------------------------------------------------------
highlight {name="DiagnosticHint", fg=colors.cyan}
highlight {name="DiagnosticInfo", fg=colors.blue}
highlight {name="DiagnosticWarn", fg=colors.yellow}
highlight {name="DiagnosticError", fg=colors.red}
highlight {name="DiagnosticOk", fg=colors.green}
highlight {name="DiagnosticUnderlineHint", sp=colors.cyan, attrs={attrs.underline}}
highlight {name="DiagnosticUnderlineInfo", sp=colors.blue, attrs={attrs.underline}}
highlight {name="DiagnosticUnderlineWarn", sp=colors.yellow, attrs={attrs.underline}}
highlight {name="DiagnosticUnderlineError", sp=colors.red, attrs={attrs.underline}}
highlight {name="DiagnosticUnderlineOk", sp=colors.green, attrs={attrs.underline}}
highlight {name="DiagnosticDeprecated", fg=colors.base01, attrs={attrs.strike}}
highlight {name="DiagnosticUnnecessary", fg=colors.base01}
-- ----------------------------------------------------------------------
-- Semantic tokens
-- Treesitter
-- ----------------------------------------------------------------------
highlight {name = "@lsp.type.namespace", fg=colors.base0 }
highlight {name = "@lsp.type.parameter", fg=colors.magenta }
highlight {name = "@lsp.type.variable", fg=colors.blue, attrs={attrs.italic} }
highlight {name = "@lsp.type.function", link="Function" }
highlight {name = "@lsp.type.method", link="Function" }
highlight {name="@variable", link="Normal"}
highlight {name="@variable.builtin", link="Keyword"}
highlight {name="@variable.parameter", fg=colors.magenta}
highlight {name="@variable.parameter.builtin", link="@variable.parameter"}
highlight {name="@variable.member", fg=colors.base1}
highlight {name = "@lsp.mod.readonly", fg=colors.orange}
highlight {name="@constant", link="Constant"}
highlight {name="@constant.builtin", link="Keyword"}
highlight {name="@constant.macro", link="@constant"}
highlight {name="@module", link="Normal"}
highlight {name="@module.builtin", link="Keyword"}
highlight {name="@label", link="Statement"}
highlight {name="@string", link="String"}
highlight {name="@string.regexp", link="Special"}
highlight {name="@string.escape", link="Special"}
highlight {name="@string.special", link="Special"}
highlight {name="@string.special.symbol", link="@string.special"}
highlight {name="@string.special.path", link="@string.special"}
highlight {name="@string.special.url", link="Underlined"}
highlight {name="@character", link="Character"}
highlight {name="@character.special", link="Special"}
highlight {name="@boolean", link="Boolean"}
highlight {name="@number", link="Number"}
highlight {name="@number.float", link="Float"}
highlight {name="@type", link="Type"}
highlight {name="@type.builtin", link="Keyword"}
highlight {name="@type.definition", fg=colors.yellow}
highlight {name="@type.modifier", link="Keyword"}
highlight {name="@attribute", link="Identifier"}
highlight {name="@attribute.builtin", link="Keyword"}
highlight {name="@property", link="Identifier"}
highlight {name="@function", fg=colors.blue}
highlight {name="@function.builtin", link="Keyword"}
highlight {name="@function.macro", link="PreProc"}
highlight {name="@function.call", link="Function"}
highlight {name="@function.method", link="@function"}
highlight {name="@function.method.call", link="@function.call"}
highlight {name="@constructor", link="@function"}
highlight {name="@operator", link="Operator"}
highlight {name="@keyword", link="Keyword"}
highlight {name="@keyword.coroutine", link="@keyword"}
highlight {name="@keyword.function", link="@keyword"}
highlight {name="@keyword.operator", link="@keyword"}
highlight {name="@keyword.import", link="@keyword"}
highlight {name="@keyword.type", link="@keyword"}
highlight {name="@keyword.modifier", link="@keyword"}
highlight {name="@keyword.repeat", link="Statement"}
highlight {name="@keyword.return", link="Statement"}
highlight {name="@keyword.debug", link="@keyword"}
highlight {name="@keyword.exception", link="@keyword"}
highlight {name="@keyword.conditional", link="Statement"}
highlight {name="@keyword.conditional.ternary", link="Statement"}
highlight {name="@keyword.directive", link="PreProc"}
highlight {name="@keyword.directive.value", link="@keyword.directive"}
highlight {name="@punctuation.delimiter", link="Delimiter"}
highlight {name="@punctuation.bracket", link="Delimiter"}
highlight {name="@punctuation.special", link="Delimiter"}
highlight {name="@comment", link="Comment"}
highlight {name="@comment.documentation", link="Comment"}
highlight {name="@comment.error", link="DiagnosticError"}
highlight {name="@comment.warning", link="DiagnosticWarn"}
highlight {name="@comment.note", link="DiagnosticInfo"}
highlight {name="@comment.todo", link="Todo"}
highlight {name="@markup.strong", link="Bold"}
highlight {name="@markup.italic", link="Italic"}
highlight {name="@markup.strikethrough", attrs={attrs.strike}}
highlight {name="@markup.underline", attrs={attrs.underline}}
highlight {name="@markup.heading", link="Heading"}
highlight {name="@markup.heading.1", link="Heading"}
highlight {name="@markup.heading.2", link="Heading"}
highlight {name="@markup.heading.3", link="Heading"}
highlight {name="@markup.heading.4", link="Heading"}
highlight {name="@markup.heading.5", link="Heading"}
highlight {name="@markup.heading.6", link="Heading"}
highlight {name="@markup.quote", fg=colors.cyan}
highlight {name="@markup.math", fg=colors.red}
highlight {name="@markup.link", link="Underlined"}
highlight {name="@markup.link.url", link="Underlined"}
highlight {name="@markup.link.label", link="Underlined"}
highlight {name="@markup.raw", link="Special"}
highlight {name="@markup.raw.block", link="Special"}
highlight {name="@markup.list", fg=colors.blue}
highlight {name="@markup.list.checked", link="@markup.list"}
highlight {name="@markup.list.unchecked", link="@markup.list"}
highlight {name="@diff.plus", link="DiffAdd"}
highlight {name="@diff.minus", link="DiffDelete"}
highlight {name="@diff.delta", link="DiffChange"}
highlight {name="@tag", link="Identifier"}
highlight {name="@tag.builtin", link="@tag"}
highlight {name="@tag.attribute", link="Special"}
highlight {name="@tag.delimiter", link="Delimiter"}
-- ----------------------------------------------------------------------
-- LSP semantic tokens
-- ----------------------------------------------------------------------
highlight {name="@lsp.type.class", link="@type"}
highlight {name="@lsp.type.comment", link="@comment"}
highlight {name="@lsp.type.decorator", link="@attribute"}
highlight {name="@lsp.type.enum", link="@type"}
highlight {name="@lsp.type.enumMember", link="@constant"}
highlight {name="@lsp.type.event", link="@type"}
highlight {name="@lsp.type.function", link="@function"}
highlight {name="@lsp.type.interface", link="@type"}
highlight {name="@lsp.type.keyword", link="@keyword"}
highlight {name="@lsp.type.macro", link="@function.macro"}
highlight {name="@lsp.type.method", link="@function.method"}
highlight {name="@lsp.type.modifier", link="@type.modifier"}
highlight {name="@lsp.type.namespace", link="@module"}
highlight {name="@lsp.type.number", link="@number"}
highlight {name="@lsp.type.operator", link="@operator"}
highlight {name="@lsp.type.parameter", link="@variable.parameter"}
highlight {name="@lsp.type.property", link="@property"}
highlight {name="@lsp.type.regexp", link="@string.regexp"}
highlight {name="@lsp.type.string", link="@string"}
highlight {name="@lsp.type.struct", link="@type"}
highlight {name="@lsp.type.type", link="@type"}
highlight {name="@lsp.type.typeParameter", link="@variable.parameter"}
highlight {name="@lsp.type.variable", link="@variable"}
--highlight {name = "@lsp.mod.abstract", link="Constant"}
--highlight {name = "@lsp.mod.async", link="Constant"}
highlight {name = "@lsp.mod.declaration", attrs={attrs.bold}}
--highlight {name = "@lsp.mod.defaultLibrary", link="Constant"}
highlight {name = "@lsp.mod.definition", attrs={attrs.bold}}
highlight {name = "@lsp.mod.deprecated", attrs={attrs.strike}}
-- ----------------------------------------------------------------------
-- NvimTree syntax
-- ----------------------------------------------------------------------
highlight {name="NvimTreeSymlink", fg=colors.violet}
highlight {name="NvimTreeFolderName", link="Directory"}
highlight {name="NvimTreeRootFolder", link="Directory"}
highlight {name="NvimTreeFolderIcon", link="Directory"}
highlight {name="NvimTreeEmptyFolderName", link="Directory"}
highlight {name="NvimTreeOpenedFolderName", link="Directory"}
highlight {name="NvimTreeExecFile", fg=colors.blue}
highlight {name="NvimTreeOpenedFile", attrs={attrs.bold}}
highlight {name="NvimTreeSpecialFile", fg=colors.magenta}
highlight {name="NvimTreeImageFile", fg=colors.cyan}
highlight {name="NvimTreeIndentMarker", fg=colors.base01}
highlight {name="NvimTreeExpander", fg=colors.base01}
highlight {name="NvimTreeGitDirty", fg=colors.yellow, attrs={attrs.bold}}
highlight {name="NvimTreeGitStaged", fg=colors.green, attrs={attrs.bold}}
highlight {name="NvimTreeGitMerge", fg=colors.orange, attrs={attrs.bold}}
highlight {name="NvimTreeGitRenamed", fg=colors.green, attrs={attrs.bold}}
highlight {name="NvimTreeGitNew", fg=colors.green, attrs={attrs.bold}}
highlight {name="NvimTreeGitDeleted", fg=colors.red, attrs={attrs.strike}}
--highlight {name="NvimTreeWindowPicker", link=""}
highlight {name = "@lsp.mod.documentation", attris={attrs.italic}}
highlight {name = "@lsp.mod.readonly", link="Constant"}
--highlight {name = "@lsp.mod.static", attrs={attrs.bold} }
-- ----------------------------------------------------------------------
-- NeoTree syntax
-- ----------------------------------------------------------------------
highlight {name="NeoTreeIndentMarker", fg=colors.base01}
highlight {name="NeoTreeIndentMarker", fg=colors.secondary}
highlight {name="NeoTreeFilename", fg=colors.normal}
highlight {name="NeoTreeExpander", link="NeoTreeIndentMarker"}
highlight {name="NeoTreeDiagTotalCount", fg=colors.normal, attrs={attrs.bold}}
-- ----------------------------------------------------------------------
-- Goc
@ -467,3 +640,12 @@ highlight {name="NeoTreeExpander", link="NeoTreeIndentMarker"}
highlight {name="GocNormal", link="Comment"}
highlight {name="GocCovered", fg=colors.green, attrs={attrs.bold}}
highlight {name="GocUncovered", fg=colors.red, attrs={attrs.bold}}
-- ----------------------------------------------------------------------
-- Indent Blank Line
-- ----------------------------------------------------------------------
highlight { name="IblIndent", fg=colors.backgroundHighlight }
highlight { name="IblWhitespace", fg=colors.backgroundHighlight }
highlight { name="IblScope", fg=colors.base01, attrs={attrs.bold} }

View file

@ -65,7 +65,3 @@ require('gitsigns').setup {
end
}
vim.cmd [[
highlight! link GitSignsAdd DiffAdd
]]

View file

@ -1,7 +1,15 @@
--vim.g.indent_blankline_char='│'
vim.api.nvim_set_hl(0, "IblScope", { ctermfg=2, bold=true})
require("ibl").setup {
indent = { char = "" },
indent = {
char = "",
highlight = "IblIndent",
},
whitespace = {
highlight = "IblWhitespace",
},
scope = {
highlight = "IblScope",
},
}

View file

@ -5,13 +5,11 @@ require "plugins.diffview"
require "plugins.dotenv"
require "plugins.firenvim"
require "plugins.gitsigns"
require "plugins.indent"
require "plugins.lsp_signature"
require "plugins.lualine"
require "plugins.neogit"
require "plugins.nvimgo"
require "plugins.nvimgoc"
require "plugins.nvimtree"
require "plugins.sidebar"
require "plugins.snippy"
require "plugins.telescope"
@ -19,3 +17,4 @@ require "plugins.treesitter"
require "plugins.treesitter_textobject"
require "plugins.neotree"
require "plugins.vimwiki"
require "plugins.indent"

View file

@ -24,12 +24,7 @@ return require('packer').startup(function(use)
"nvim-lua/plenary.nvim",
"kyazdani42/nvim-web-devicons", -- not strictly required, but recommended
"MunifTanjim/nui.nvim",
},
}
use {
'kyazdani42/nvim-tree.lua',
requires = {
'kyazdani42/nvim-web-devicons', -- optional, for file icon
"3rd/image.nvim",
},
}
use 'folke/twilight.nvim'

View file

@ -1,19 +1,18 @@
-- See ":help neo-tree-highlights" for a list of available highlight groups
vim.cmd [[
"highlight clear NeoTreeDirectoryName
"highlight! link NeoTreeDirectoryName Directory
"highlight! link NeoTreeDirectoryIcon NeoTreeDirectoryName
highlight! NeoTreeIndentMarker ctermfg=11
"highlight! NeoTreeDimText ctermfg=11
]]
local config = {
close_if_last_window = false, -- Close Neo-tree if it is the last window left in the tab
popup_border_style = "rounded",
enable_git_status = true,
enable_diagnostics = true,
sources = {
"filesystem",
"buffers",
"git_status",
"document_symbols",
},
source_selector = {
winbar = false,
statusline = false,
},
default_component_configs = {
container = {
enable_character_fade = true
@ -86,12 +85,21 @@ local config = {
-- ["s"] = "vsplit_with_window_picker",
["t"] = "open_tabnew",
["w"] = "open_with_window_picker",
["P"] = {
"toggle_preview",
config = {
use_float = true,
use_image_nvim = true,
-- title = 'Neo-tree Preview',
},
},
["C"] = "close_node",
["a"] = {
"add",
-- some commands may take optional config options, see `:h neo-tree-mappings` for details
config = {
show_path = "none" -- "none", "relative", "absolute"
show_path = "relative" -- "none", "relative", "absolute"
}
},
["A"] = "add_directory", -- also accepts the config.show_path option.
@ -122,7 +130,7 @@ local config = {
},
["templ"] = {
pattern = "(.*)%.templ$",
files = { "%1_templ.go" },
files = { "%1_templ.go", "%1_templ.txt" },
},
},
filesystem = {
@ -133,6 +141,7 @@ local config = {
hide_hidden = true, -- only works on Windows for hidden files/directories
hide_by_name = {
".git",
".jj",
},
hide_by_pattern = { -- uses glob style patterns
--"*.meta"
@ -150,7 +159,7 @@ local config = {
-- "open_current", -- netrw disabled, opening a directory opens within the
-- window like netrw would, regardless of window.position
-- "disabled", -- netrw left alone, neo-tree does not handle opening dirs
use_libuv_file_watcher = false, -- This will use the OS level file watchers to detect changes
use_libuv_file_watcher = true, -- This will use the OS level file watchers to detect changes
-- instead of relying on nvim autocmd events.
window = {
mappings = {
@ -191,12 +200,14 @@ local config = {
["gg"] = "git_commit_and_push",
}
}
}
},
}
require("neo-tree").setup(config)
vim.cmd [[
nnoremap <leader>n :Neotree reveal<cr>
nnoremap <C-n> :Neotree close<cr>
]]
vim.keymap.set("n", "<leader>n", ":Neotree reveal<cr>")
vim.keymap.set("n", "<leader>nf", ":Neotree reveal<cr>")
vim.keymap.set("n", "<leader>nb", ":Neotree reveal buffers<cr>")
vim.keymap.set("n", "<leader>ng", ":Neotree reveal git_status<cr>")
vim.keymap.set("n", "<leader>no", ":Neotree reveal document_symbols<cr>")
vim.keymap.set("n", "<leader>nd", ":Neotree reveal diagnostics<cr>")

View file

@ -1,109 +0,0 @@
vim.cmd [[
nnoremap <C-n> :NvimTreeClose<CR>
nnoremap <leader>n :NvimTreeFocus<CR>
]]
-- NvimTreeOpen, NvimTreeClose, NvimTreeFocus, NvimTreeFindFileToggle, and NvimTreeResize are also available if you need them
vim.cmd [[
highlight! NvimTreeIndentMarker ctermfg=11
]]
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
require('nvim-tree').setup {
create_in_closed_folder = false,
hijack_netrw = true,
auto_reload_on_write = true,
open_on_tab = false,
hijack_cursor = false,
update_cwd = false,
respect_buf_cwd = true,
hijack_unnamed_buffer_when_opening = true,
hijack_directories = {
enable = true,
auto_open = true,
},
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
git = {
enable = true,
ignore = false,
},
filters = {
dotfiles = false,
custom = { '.git' }
},
view = {
width = 30,
side = 'left',
},
renderer = {
add_trailing = true,
group_empty = true,
highlight_git = true,
highlight_opened_files = "all",
root_folder_modifier = ":~",
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
none = " ",
},
},
icons = {
padding = " ",
symlink_arrow = " -> ",
webdev_colors = true,
show = {
file = true,
folder = true,
folder_arrow = false,
git = true,
},
glyphs = {
default = "",
symlink = "",
bookmark = "",
folder = {
arrow_closed = "",
arrow_open = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = "",
},
},
},
},
actions = {
open_file = {
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
}

View file

@ -9,7 +9,7 @@ vim.diagnostic.config({
},
signs = {
text = {
[vim.diagnostic.severity.HINT] = '💡',
[vim.diagnostic.severity.HINT] = '󰌵',
[vim.diagnostic.severity.INFO] = '',
[vim.diagnostic.severity.WARN] = '',
[vim.diagnostic.severity.ERROR] = '',