Extend nvim config. Setup nonicons usage

This commit is contained in:
Jan Eitzinger 2024-03-18 20:21:43 +01:00
parent 277de4cd4f
commit d5861f05e8
7 changed files with 557 additions and 254 deletions

View File

@ -16,6 +16,7 @@ LICENSE
.config/nvim/lazyvim.json .config/nvim/lazyvim.json
.config/nvim/stylua.toml .config/nvim/stylua.toml
.config/nvim/lua/config .config/nvim/lua/config
.config/nvim/lua/plugins/telescope.lua
.config/nvim/lua/plugins/core.lua .config/nvim/lua/plugins/core.lua
.config/nvim/lua/plugins/test.lua .config/nvim/lua/plugins/test.lua
.config/nvim/lua/plugins/disabled.lua .config/nvim/lua/plugins/disabled.lua

View File

@ -28,8 +28,6 @@ o.encoding = "utf-8"
o.backspace = "indent,eol,start" -- backspace works on every char in insert mode o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
o.completeopt = { 'menu', 'menuone', 'noselect' } o.completeopt = { 'menu', 'menuone', 'noselect' }
o.history = 1000 o.history = 1000
-- o.dictionary = '/home/jan/.vim/dict/words'
-- o.dictionary = '/usr/share/dict/words'
o.startofline = true o.startofline = true
o.title = true o.title = true
o.clipboard = 'unnamedplus' o.clipboard = 'unnamedplus'
@ -52,8 +50,8 @@ o.scrolloff = 8 -- always show 3 rows from edge of the screen
o.splitbelow = true o.splitbelow = true
o.splitright = true o.splitright = true
o.virtualedit = 'block' o.virtualedit = 'block'
o.synmaxcol = 300 -- stop syntax highlight after x lines for performance o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
o.laststatus = 2 -- always show status line o.laststatus = 2 -- always show status line
o.list = false -- do not display white characters o.list = false -- do not display white characters
o.termguicolors = true o.termguicolors = true
o.background = "dark" o.background = "dark"
@ -62,11 +60,11 @@ o.eol = false -- show if there's no eol char
o.showbreak = '↪' -- character to show when line is broken o.showbreak = '↪' -- character to show when line is broken
-- Folding -- Folding
o.foldenable = true -- o.foldenable = true
o.foldnestmax = 2 -- o.foldnestmax = 2
o.foldminlines = 10 -- o.foldminlines = 10
o.foldmethod = "expr" -- o.foldmethod = "expr"
o.foldexpr = "nvim_treesitter#foldexpr()" -- o.foldexpr = "nvim_treesitter#foldexpr()"
-- workaround for Telescope bug -- workaround for Telescope bug
vim.api.nvim_create_autocmd({ "BufEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter" }, {
@ -75,7 +73,7 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
}) })
-- Sidebar -- Sidebar
o.number = true -- line number on the left o.number = true -- line number on the left
o.relativenumber = true o.relativenumber = true
o.numberwidth = 3 -- always reserve 3 spaces for line number o.numberwidth = 3 -- always reserve 3 spaces for line number
o.signcolumn = 'yes' o.signcolumn = 'yes'
@ -87,10 +85,10 @@ o.ruler = false
o.showmode = false o.showmode = false
-- Search -- Search
o.incsearch = true -- starts searching as soon as typing, without enter needed o.incsearch = true -- starts searching as soon as typing, without enter needed
o.hlsearch = true -- highlighting of search matches o.hlsearch = true -- highlighting of search matches
o.ignorecase = true -- ignore letter case when searching o.ignorecase = true -- ignore letter case when searching
o.smartcase = true -- case insentive unless capitals used in search o.smartcase = true -- case insentive unless capitals used in search
o.wildignorecase = true o.wildignorecase = true
o.matchtime = 2 -- delay before showing matching paren o.matchtime = 2 -- delay before showing matching paren
@ -100,7 +98,7 @@ o.mps = vim.o.mps .. ",<:>"
o.smartindent = true o.smartindent = true
o.breakindent = true o.breakindent = true
o.tabstop = 4 o.tabstop = 4
o.shiftwidth = 4 -- indentation rule o.shiftwidth = 4 -- indentation rule
o.softtabstop = 4 o.softtabstop = 4
o.expandtab = true -- expand tab to spaces o.expandtab = true -- expand tab to spaces
o.smarttab = true o.smarttab = true
@ -120,18 +118,18 @@ o.formatoptions = o.formatoptions
+ { + {
c = false, c = false,
o = false, -- O and o, don't continue comments o = false, -- O and o, don't continue comments
r = true, -- Pressing Enter will continue comments r = true, -- Pressing Enter will continue comments
} }
-- Backup files -- Backup files
o.hidden = true o.hidden = true
o.autowrite = true o.autowrite = true
o.autoread = true o.autoread = true
o.backup = true -- use backup files o.backup = true -- use backup files
o.writebackup = false o.writebackup = false
o.swapfile = false -- do not use swap file o.swapfile = false -- do not use swap file
o.undofile = true o.undofile = true
o.undodir = HOME .. '/.local/share/nvim/dirs/undo//' -- undo files o.undodir = HOME .. '/.local/share/nvim/dirs/undo//' -- undo files
o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups
-- Commands mode -- Commands mode
@ -159,8 +157,8 @@ local map = vim.keymap.set
map({ 'n', 'v' }, '<Space>', "<Nop>", { silent = true }) map({ 'n', 'v' }, '<Space>', "<Nop>", { silent = true })
-- clear the search buffer when hitting return -- Clear search with <esc>
map('n', '<CR>', '{->v:hlsearch ? ":nohl\\<CR>" : "\\<CR>"}()', { expr = true }) map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
-- sane regexes -- sane regexes
map({ 'n', 'v' }, '/', '/\\v', { noremap = true, silent = true }) map({ 'n', 'v' }, '/', '/\\v', { noremap = true, silent = true })
@ -168,9 +166,13 @@ map({ 'n', 'v' }, '/', '/\\v', { noremap = true, silent = true })
-- don't jump when using * -- don't jump when using *
map('n', '*', '*<c-o>') map('n', '*', '*<c-o>')
-- keep search matches in the middle of the window -- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
map('n', 'n', 'nzzzv') map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" })
map('n', 'N', 'Nzzzv') map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
map("n", "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" })
map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
-- Same when jumping around -- Same when jumping around
map('n', 'g;', 'g;zz') map('n', 'g;', 'g;zz')
@ -179,6 +181,22 @@ map('n', 'g;', 'g;zz')
map('n', 'Q', '@q') map('n', 'Q', '@q')
map('v', 'Q', '<cmd>norm @q<CR>') map('v', 'Q', '<cmd>norm @q<CR>')
-- save file
map({ "i", "x", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
-- better indenting
map("v", "<", "<gv")
map("v", ">", ">gv")
-- lazy
map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
map("n", "<leader>xl", "<cmd>lopen<cr>", { desc = "Location List" })
map("n", "<leader>xq", "<cmd>copen<cr>", { desc = "Quickfix List" })
map("n", "[q", vim.cmd.cprev, { desc = "Previous quickfix" })
map("n", "]q", vim.cmd.cnext, { desc = "Next quickfix" })
-- Shortcut to close quickfix windows -- Shortcut to close quickfix windows
map('n', '<leader>a', '<cmd>windo lcl|ccl<CR>') map('n', '<leader>a', '<cmd>windo lcl|ccl<CR>')
@ -200,7 +218,11 @@ map('n', '<down>', '<cmd>resize +2<CR>')
map('n', '<left>', '<cmd>vertical resize -2<CR>') map('n', '<left>', '<cmd>vertical resize -2<CR>')
map('n', '<right>', '<cmd>vertical resize +2<CR>') map('n', '<right>', '<cmd>vertical resize +2<CR>')
map('n', '<leader>g', '<cmd>vertical rightbelow Git<cr>', { noremap = true, silent = true }) -- windows
map("n", "<leader>ww", "<C-W>p", { desc = "Other window", remap = true })
map("n", "<leader>wd", "<C-W>c", { desc = "Delete window", remap = true })
map("n", "<leader>-", "<C-W>s", { desc = "Split window below", remap = true })
map("n", "<leader>|", "<C-W>v", { desc = "Split window right", remap = true })
{{ else }} {{ else }}
-- bootstrap lazy.nvim, LazyVim and your plugins -- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy") require("config.lazy")

View File

@ -45,8 +45,35 @@ return {
}, },
opts = function() opts = function()
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
local kind_icons = {
Text = "",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "󰇽",
Variable = "󰂡",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "",
Event = "",
Operator = "󰆕",
TypeParameter = "󰅲",
}
local luasnip = require('luasnip') local luasnip = require('luasnip')
local lspkind = require('lspkind')
local cmp = require("cmp") local cmp = require("cmp")
local defaults = require("cmp.config.default")() local defaults = require("cmp.config.default")()
return { return {
@ -55,7 +82,7 @@ return {
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
require("luasnip").lsp_expand(args.body) luasnip.lsp_expand(args.body)
end, end,
}, },
mapping = cmp.mapping.preset.insert({ mapping = cmp.mapping.preset.insert({
@ -83,10 +110,19 @@ return {
{ name = "buffer", keyword_length = 3 }, { name = "buffer", keyword_length = 3 },
}), }),
formatting = { formatting = {
format = lspkind.cmp_format({ format = function(entry, vim_item)
mode = 'symbol_text', -- show only symbol annotations -- Kind icons
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatenates the icons with the name of the item kind
}) -- Source
vim_item.menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
luasnip = "[LuaSnip]",
nvim_lua = "[Lua]",
latex_symbols = "[LaTeX]",
})[entry.source.name]
return vim_item
end
}, },
experimental = { experimental = {
ghost_text = { ghost_text = {
@ -103,6 +139,17 @@ return {
require("cmp").setup(opts) require("cmp").setup(opts)
end, end,
}, },
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end
},
{{ else }} {{ else }}
{ {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
@ -112,11 +159,11 @@ return {
end, end,
}, },
{{ end }} {{ end }}
{ {
"windwp/nvim-autopairs", "windwp/nvim-autopairs",
event = "InsertEnter", event = "InsertEnter",
opts = { opts = {
fast_wrap = {}, fast_wrap = {},
},
}, },
},
} }

View File

@ -1,5 +1,4 @@
return { return {
-- Fuzzy finder. -- Fuzzy finder.
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
@ -7,15 +6,19 @@ return {
version = false, -- telescope did only one release, so use HEAD for now version = false, -- telescope did only one release, so use HEAD for now
dependencies = { dependencies = {
"nvim-telescope/telescope-fzf-native.nvim", "nvim-telescope/telescope-fzf-native.nvim",
"nvim-telescope/telescope-file-browser.nvim", build = "gmake",
config = function()
require("telescope").load_extension("fzf")
end,
}, },
keys = { keys = {
{ "<C-n>", "<cmd>Telescope file_browser<cr>", desc = "File browser" }, { "<leader><space>", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
{ "<leader>e", "<cmd>Telescope find_files<cr>", desc = "Find file" }, { "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
{ "<leader>b", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" }, { "<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Switch Buffer" },
{ "<leader>f", "<cmd>Telescope live_grep<cr>", desc = "Switch Buffer" }, { "<leader>sh", "<cmd>Telescope help_tags<cr>", desc = "Search help tags" },
{ "<leader>h", "<cmd>Telescope help_tags<cr>", desc = "Search help tags" }, { "<leader>sk", "<cmd>Telescope keymaps<cr>", desc = "Key Maps" },
{ "z=", "<cmd>Telescope spell_suggest<cr>", desc = "Spell options" }, { "z=", "<cmd>Telescope spell_suggest<cr>", desc = "Spell options" },
{ "<leader>ss", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Goto Symbol" },
}, },
opts = function() opts = function()
local actions = require("telescope.actions") local actions = require("telescope.actions")
@ -58,18 +61,20 @@ return {
} }
end, end,
}, },
{
-- add telescope-fzf-native 'numToStr/Comment.nvim',
{ opts = {
"telescope.nvim", -- add any options here
dependencies = { },
"nvim-telescope/telescope-fzf-native.nvim", lazy = false,
build = "gmake", },
config = function() {
require("telescope").load_extension("fzf") "windwp/nvim-autopairs",
end, event = "InsertEnter",
opts = {
fast_wrap = {},
},
}, },
},
-- which-key helps you remember key bindings by showing a popup -- which-key helps you remember key bindings by showing a popup
-- with the active keybindings of the command you started typing. -- with the active keybindings of the command you started typing.
@ -181,35 +186,6 @@ return {
}, },
}, },
-- buffer remove
{
"echasnovski/mini.bufremove",
keys = {
{
"<leader>bd",
function()
local bd = require("mini.bufremove").delete
if vim.bo.modified then
local choice = vim.fn.confirm(("Save changes to %q?"):format(vim.fn.bufname()),
"&Yes\n&No\n&Cancel")
if choice == 1 then -- Yes
vim.cmd.write()
bd(0)
elseif choice == 2 then -- No
bd(0, true)
end
else
bd(0)
end
end,
desc = "Delete Buffer",
},
-- stylua: ignore
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
},
},
-- better diagnostics list and others -- better diagnostics list and others
{ {
"folke/trouble.nvim", "folke/trouble.nvim",
@ -267,4 +243,16 @@ return {
{ "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" }, { "<leader>sT", "<cmd>TodoTelescope keywords=TODO,FIX,FIXME<cr>", desc = "Todo/Fix/Fixme" },
}, },
}, },
{
"folke/flash.nvim",
event = "VeryLazy",
opts = {},
keys = {
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
{ "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
{ "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
},
}
} }

View File

@ -2,10 +2,6 @@ return {
-- lspconfig -- lspconfig
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
dependencies = {
"onsails/lspkind.nvim",
"lukas-reineke/lsp-format.nvim",
},
opts = { opts = {
-- options for vim.diagnostic.config() -- options for vim.diagnostic.config()
diagnostics = { diagnostics = {
@ -35,7 +31,7 @@ return {
}, },
}, },
config = function(_, opts) config = function(_, opts)
local lsp= require('lspconfig') local lsp = require('lspconfig')
local lsp_defaults = lsp.util.default_config local lsp_defaults = lsp.util.default_config
lsp_defaults.capabilities = vim.tbl_deep_extend( lsp_defaults.capabilities = vim.tbl_deep_extend(
@ -58,16 +54,16 @@ return {
sign({ name = 'DiagnosticSignHint', text = '' }) sign({ name = 'DiagnosticSignHint', text = '' })
sign({ name = 'DiagnosticSignInfo', text = '' }) sign({ name = 'DiagnosticSignInfo', text = '' })
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = false, virtual_text = false,
severity_sort = true, severity_sort = true,
float = { float = {
border = 'rounded', border = 'rounded',
source = 'always', source = 'always',
header = '', header = '',
prefix = '', prefix = '',
}, },
}) })
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, vim.lsp.handlers.hover,
@ -92,66 +88,112 @@ vim.diagnostic.config({
end end
}) })
require("lsp-format").setup { local on_attach = function(client)
html = { local bufmap = function(mode, lhs, rhs)
exclude = { "html" } local opts = { buffer = true }
} vim.keymap.set(mode, lhs, rhs, opts)
end
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>')
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
bufmap('n', 'gA', '<cmd>Telescope diagnostics<cr>')
bufmap('n', 'gr', '<cmd>Telescope lsp_references<cr>')
bufmap('n', 'gi', '<cmd>Telescope lsp_implementations<cr>')
bufmap('n', '<leader>cr', '<cmd>lua vim.lsp.buf.rename()<cr>')
bufmap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<cr>')
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>')
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
end
lsp.gopls.setup {
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
shadow = true,
unusedvariable = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
semanticTokens = true
},
},
on_attach = on_attach
} }
lsp.clangd.setup {
local on_attach = function(client) settings = {
local bufmap = function(mode, lhs, rhs) clangd = {
local opts = {buffer = true} cmd = {
vim.keymap.set(mode, lhs, rhs, opts) "clangd",
end "--background-index",
require("lsp-format").on_attach(client) "--clang-tidy",
"--header-insertion=iwyu",
bufmap('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>') "--completion-style=detailed",
bufmap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<cr>') "--function-arg-placeholders",
bufmap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>') "--fallback-style=llvm",
bufmap('n', 'go', '<cmd>lua vim.lsp.buf.type_definition()<cr>') },
bufmap('n', 'gs', '<cmd>lua vim.lsp.buf.signature_help()<cr>') init_options = {
bufmap('n', 'gA', '<cmd>Telescope diagnostics<cr>') usePlaceholders = true,
bufmap('n', 'gr', '<cmd>Telescope lsp_references<cr>') completeUnimported = true,
bufmap('n', 'gi', '<cmd>Telescope lsp_implementations<cr>') clangdFileStatus = true,
bufmap('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>') },
bufmap('n', '<F3>', '<cmd>lua vim.lsp.buf.format({async = true})<cr>') },
bufmap('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>') },
bufmap('x', '<F4>', '<cmd>lua vim.lsp.buf.range_code_action()<cr>') on_attach = on_attach
bufmap('n', 'gl', '<cmd>lua vim.diagnostic.open_float()<cr>') }
bufmap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>') lsp.ltex.setup {
bufmap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>') on_attach = on_attach,
end filetypes = { "latex", "tex", "bib", "mkd", "gitcommit", "text" },
}
lsp.gopls.setup { lsp.svelte.setup { on_attach = on_attach }
settings = { lsp.tsserver.setup { on_attach = on_attach }
gopls = { lsp.lua_ls.setup {
analyses = { settings = {
unusedparams = true, Lua = {
unusedvariable = true, workspace = {
shadow = true checkThirdParty = false,
}, },
staticcheck = true, codeLens = {
}, enable = true,
}, },
on_attach = on_attach completion = {
} callSnippet = "Replace",
lsp.clangd.setup { on_attach = on_attach } },
lsp.ltex.setup { diagnostics = {
on_attach = on_attach, globals = { 'vim' }
filetypes = { "latex", "tex", "bib", "mkd", "gitcommit", "text" }, },
}
},
on_attach = on_attach
}
end
} }
lsp.svelte.setup { on_attach = on_attach }
lsp.tsserver.setup { on_attach = on_attach }
lsp.lua_ls.setup {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
},
}
},
on_attach = on_attach
}
end
}
} }

View File

@ -50,10 +50,30 @@ return {
vim.o.laststatus = 0 vim.o.laststatus = 0
end, end,
opts = { opts = {
icons_enabled = true, options = {
theme = 'auto', theme = 'auto',
component_separators = '|', icons_enabled = true,
section_separators = '', globalstatus = true,
component_separators = "|",
disabled_filetypes = { statusline = { "dashboard", "alpha", "starter" } },
},
sections = {
lualine_a = { "mode" },
lualine_b = { { "branch", icon = " " }, "diagnostics" },
lualine_c = { "filename" },
lualine_x = { "encoding",
{
"fileformat",
symbols = {
unix = " ",
dos = " ",
mac = " "
}
},
{ "filetype", icon_only = true } },
lualine_y = { "progress" },
lualine_z = { "location" },
},
}, },
}, },
@ -185,26 +205,178 @@ return {
}, },
}, },
-- -- lsp symbol navigation for lualine. This shows where -- icons
-- in the code structure you are - within functions, classes,
-- etc - in the statusline.
{ {
"SmiteshP/nvim-navic", "nvim-tree/nvim-web-devicons",
lazy = true, lazy = true,
opts = function() opts = function()
return { local devicons = require("nvim-web-devicons")
separator = " ", local palette = {
highlight = true, orange = "#d18616",
depth_limit = 5, black = "#586069",
lazy_update_context = true, bright_black = "#959da5",
white = "#d1d5da",
bright_white = "#fafbfc",
red = "#ea4a5a",
bright_red = "#f97583",
green = "#34d058",
bright_green = "#85e89d",
yellow = "#ffea7f",
bright_yellow = "#ffea7f",
blue = "#2188ff",
bright_blue = "#79b8ff",
magenta = "#b392f0",
bright_magenta = "#b392f0",
cyan = "#39c5cf",
bright_cyan = "#56d4dd",
} }
devicons.set_icon({
[".zshrc"] = {
icon = " ",
color = palette.bright_black,
name = "Zshrc",
},
["bash"] = {
icon = " ",
color = palette.bright_black,
name = "Bash",
},
["c"] = {
icon = " ",
color = palette.bright_blue,
name = "C",
},
["c++"] = {
icon = " ",
color = palette.bright_red,
name = "CPlusPlus",
},
["cc"] = {
icon = " ",
color = palette.bright_red,
name = "CPlusPlus",
},
["go"] = {
icon = " ",
color = palette.bright_blue,
name = "Go",
},
["js"] = {
icon = " ",
color = palette.yellow,
name = "Js",
},
["lua"] = {
icon = " ",
color = palette.bright_blue,
name = "Lua",
},
["markdown"] = {
icon = " ",
color = palette.bright_blue,
name = "Markdown",
},
["md"] = {
icon = " ",
color = palette.bright_blue,
name = "Md",
},
["mdx"] = {
icon = " ",
color = palette.bright_blue,
name = "Mdx",
},
["php"] = {
icon = " ",
color = palette.magenta,
name = "Php",
},
["pl"] = {
icon = " ",
color = palette.bright_blue,
name = "Pl",
},
["py"] = {
icon = " ",
color = palette.bright_blue,
name = "Py",
},
["pyc"] = {
icon = " ",
color = palette.bright_blue,
name = "Pyc",
},
["pyd"] = {
icon = " ",
color = palette.bright_blue,
name = "Pyd",
},
["pyo"] = {
icon = " ",
color = palette.bright_blue,
name = "Pyo",
},
["rake"] = {
icon = " ",
color = palette.bright_red,
name = "Rake",
},
["rakefile"] = {
icon = " ",
color = palette.bright_red,
name = "Rakefile",
},
["rb"] = {
icon = " ",
color = palette.bright_red,
name = "Rb",
},
["sh"] = {
icon = " ",
color = palette.bright_black,
name = "Sh",
},
["sql"] = {
icon = " ",
color = palette.bright_black,
name = "Sql",
},
["svelte"] = {
icon = " ",
color = palette.orange,
name = "Svelte"
},
["yaml"] = {
icon = " ",
color = palette.bright_black,
name = "Yaml",
},
["yml"] = {
icon = " ",
color = palette.bright_black,
name = "Yml",
},
["zsh"] = {
icon = " ",
color = palette.bright_black,
name = "Zsh",
},
["terminal"] = {
icon = " ",
color = palette.bright_black,
name = "Terminal",
},
})
end, end,
}, },
-- icons {
{ "nvim-tree/nvim-web-devicons", lazy = true }, "yamatsum/nvim-nonicons",
dependencies = { "nvim-tree/nvim-web-devicons" },
lazy = true
},
-- ui components -- ui components
{ "MunifTanjim/nui.nvim", lazy = true }, { "MunifTanjim/nui.nvim", lazy = true },
{{ else }} {{ else }}
-- change lualine -- change lualine
@ -216,39 +388,39 @@ return {
end, end,
}, },
{{ end }} {{ end }}
{ {
"RRethy/vim-illuminate", "RRethy/vim-illuminate",
config = function() config = function()
-- change the highlight style -- change the highlight style
vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" }) vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" }) vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" }) vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })
end, end,
}, },
{ {
"NvChad/nvim-colorizer.lua", "NvChad/nvim-colorizer.lua",
opts = function(_, opts) opts = function(_, opts)
opts.filetypes = { opts.filetypes = {
"html", "html",
"css", "css",
"scss", "scss",
"javascript", "javascript",
"typescript", "typescript",
"typescriptreact", "typescriptreact",
"javascriptreact", "javascriptreact",
"lua", "lua",
} }
opts.user_default_options = { opts.user_default_options = {
mode = "background", mode = "background",
tailwind = false, -- Enable tailwind colors tailwind = false, -- Enable tailwind colors
} }
end, end,
}, },
{ {
"nvimdev/dashboard-nvim", "nvimdev/dashboard-nvim",
event = "VimEnter", event = "VimEnter",
opts = function(_, opts) opts = function()
local logo = [[ local logo = [[
_ _ _ _ _ _ _ _
| | (_) | | | | | | (_) | | | |
_ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| | _ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| |
@ -257,48 +429,79 @@ return {
|_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_| |_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_|
]] ]]
logo = string.rep("\n", 8) .. logo .. "\n\n" logo = string.rep("\n", 8) .. logo .. "\n\n"
opts.config.header = vim.split(logo, "\n")
opts.theme = "doom" local opts = {
opts.config.center = { theme = "doom",
{ hide = {
action = "Telescope find_files", statusline = false,
desc = " Find file", },
icon = " ", config = {
key = "f", header = vim.split(logo, "\n"),
}, center = {
{ {
action = "Telescope oldfiles", action = "Telescope find_files",
desc = " Recent files", desc = " Find file",
icon = " ", icon = " ",
key = "r", key = "f",
}, },
{ {
action = "Telescope live_grep", action = "Telescope oldfiles",
desc = " Find text", desc = " Recent files",
icon = " ", icon = " ",
key = "g", key = "r",
}, },
{ {
action = [[lua require("lazyvim.util").telescope.config_files()()]], action = "Telescope live_grep",
desc = " Config", desc = " Find text",
icon = " ", icon = " ",
key = "c", key = "g",
}, },
{ {
action = "Neorg workspace notes", action = [[lua require("lazyvim.util").telescope.config_files()()]],
desc = " Neorg notes", desc = " Config",
icon = " ", icon = " ",
key = "n", key = "c",
}, },
{ {
action = "Lazy", action = "Neorg workspace notes",
desc = " Lazy", desc = " Neorg notes",
icon = "󰒲 ", icon = " ",
key = "l", key = "n",
}, },
{ action = "qa", desc = " Quit", icon = " ", key = "q" }, {
} action = "Lazy",
end, desc = " Lazy",
}, icon = "󰒲 ",
key = "l",
},
{ action = "qa", desc = " Quit", icon = " ", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
}
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
},
} }

View File

@ -70,5 +70,5 @@ source $HOME/perl5/perlbrew/etc/bashrc
export PATH=/opt/homebrew/bin:$PATH export PATH=/opt/homebrew/bin:$PATH
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}
eval "$(atuin init zsh)" eval "$(atuin init zsh)"
{{- end }}