Extend nvim config. Setup nonicons usage
This commit is contained in:
parent
277de4cd4f
commit
d5861f05e8
@ -16,6 +16,7 @@ LICENSE
|
||||
.config/nvim/lazyvim.json
|
||||
.config/nvim/stylua.toml
|
||||
.config/nvim/lua/config
|
||||
.config/nvim/lua/plugins/telescope.lua
|
||||
.config/nvim/lua/plugins/core.lua
|
||||
.config/nvim/lua/plugins/test.lua
|
||||
.config/nvim/lua/plugins/disabled.lua
|
||||
|
@ -28,8 +28,6 @@ o.encoding = "utf-8"
|
||||
o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
||||
o.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||
o.history = 1000
|
||||
-- o.dictionary = '/home/jan/.vim/dict/words'
|
||||
-- o.dictionary = '/usr/share/dict/words'
|
||||
o.startofline = true
|
||||
o.title = true
|
||||
o.clipboard = 'unnamedplus'
|
||||
@ -52,8 +50,8 @@ o.scrolloff = 8 -- always show 3 rows from edge of the screen
|
||||
o.splitbelow = true
|
||||
o.splitright = true
|
||||
o.virtualedit = 'block'
|
||||
o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
||||
o.laststatus = 2 -- always show status line
|
||||
o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
||||
o.laststatus = 2 -- always show status line
|
||||
o.list = false -- do not display white characters
|
||||
o.termguicolors = true
|
||||
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
|
||||
|
||||
-- Folding
|
||||
o.foldenable = true
|
||||
o.foldnestmax = 2
|
||||
o.foldminlines = 10
|
||||
o.foldmethod = "expr"
|
||||
o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
-- o.foldenable = true
|
||||
-- o.foldnestmax = 2
|
||||
-- o.foldminlines = 10
|
||||
-- o.foldmethod = "expr"
|
||||
-- o.foldexpr = "nvim_treesitter#foldexpr()"
|
||||
|
||||
-- workaround for Telescope bug
|
||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
@ -75,7 +73,7 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||
})
|
||||
|
||||
-- Sidebar
|
||||
o.number = true -- line number on the left
|
||||
o.number = true -- line number on the left
|
||||
o.relativenumber = true
|
||||
o.numberwidth = 3 -- always reserve 3 spaces for line number
|
||||
o.signcolumn = 'yes'
|
||||
@ -87,10 +85,10 @@ o.ruler = false
|
||||
o.showmode = false
|
||||
|
||||
-- Search
|
||||
o.incsearch = true -- starts searching as soon as typing, without enter needed
|
||||
o.hlsearch = true -- highlighting of search matches
|
||||
o.incsearch = true -- starts searching as soon as typing, without enter needed
|
||||
o.hlsearch = true -- highlighting of search matches
|
||||
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.matchtime = 2 -- delay before showing matching paren
|
||||
@ -100,7 +98,7 @@ o.mps = vim.o.mps .. ",<:>"
|
||||
o.smartindent = true
|
||||
o.breakindent = true
|
||||
o.tabstop = 4
|
||||
o.shiftwidth = 4 -- indentation rule
|
||||
o.shiftwidth = 4 -- indentation rule
|
||||
o.softtabstop = 4
|
||||
o.expandtab = true -- expand tab to spaces
|
||||
o.smarttab = true
|
||||
@ -120,18 +118,18 @@ o.formatoptions = o.formatoptions
|
||||
+ {
|
||||
c = false,
|
||||
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
|
||||
o.hidden = true
|
||||
o.autowrite = true
|
||||
o.autoread = true
|
||||
o.backup = true -- use backup files
|
||||
o.backup = true -- use backup files
|
||||
o.writebackup = false
|
||||
o.swapfile = false -- do not use swap file
|
||||
o.swapfile = false -- do not use swap file
|
||||
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
|
||||
|
||||
-- Commands mode
|
||||
@ -159,8 +157,8 @@ local map = vim.keymap.set
|
||||
|
||||
map({ 'n', 'v' }, '<Space>', "<Nop>", { silent = true })
|
||||
|
||||
-- clear the search buffer when hitting return
|
||||
map('n', '<CR>', '{->v:hlsearch ? ":nohl\\<CR>" : "\\<CR>"}()', { expr = true })
|
||||
-- Clear search with <esc>
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Escape and clear hlsearch" })
|
||||
|
||||
-- sane regexes
|
||||
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 *
|
||||
map('n', '*', '*<c-o>')
|
||||
|
||||
-- keep search matches in the middle of the window
|
||||
map('n', 'n', 'nzzzv')
|
||||
map('n', 'N', 'Nzzzv')
|
||||
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
|
||||
map("n", "n", "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" })
|
||||
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
|
||||
map('n', 'g;', 'g;zz')
|
||||
@ -179,6 +181,22 @@ map('n', 'g;', 'g;zz')
|
||||
map('n', 'Q', '@q')
|
||||
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
|
||||
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', '<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 }}
|
||||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
require("config.lazy")
|
||||
|
@ -45,8 +45,35 @@ return {
|
||||
},
|
||||
opts = function()
|
||||
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 lspkind = require('lspkind')
|
||||
local cmp = require("cmp")
|
||||
local defaults = require("cmp.config.default")()
|
||||
return {
|
||||
@ -55,7 +82,7 @@ return {
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
@ -83,10 +110,19 @@ return {
|
||||
{ name = "buffer", keyword_length = 3 },
|
||||
}),
|
||||
formatting = {
|
||||
format = lspkind.cmp_format({
|
||||
mode = 'symbol_text', -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
})
|
||||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
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 = {
|
||||
ghost_text = {
|
||||
@ -103,6 +139,17 @@ return {
|
||||
require("cmp").setup(opts)
|
||||
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 }}
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
@ -112,11 +159,11 @@ return {
|
||||
end,
|
||||
},
|
||||
{{ end }}
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
return {
|
||||
|
||||
-- Fuzzy finder.
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
@ -7,15 +6,19 @@ return {
|
||||
version = false, -- telescope did only one release, so use HEAD for now
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
build = "gmake",
|
||||
config = function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
},
|
||||
keys = {
|
||||
{ "<C-n>", "<cmd>Telescope file_browser<cr>", desc = "File browser" },
|
||||
{ "<leader>e", "<cmd>Telescope find_files<cr>", desc = "Find file" },
|
||||
{ "<leader>b", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||
{ "<leader>f", "<cmd>Telescope live_grep<cr>", desc = "Switch Buffer" },
|
||||
{ "<leader>h", "<cmd>Telescope help_tags<cr>", desc = "Search help tags" },
|
||||
{ "z=", "<cmd>Telescope spell_suggest<cr>", desc = "Spell options" },
|
||||
{ "<leader><space>", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
|
||||
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||
{ "<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Switch Buffer" },
|
||||
{ "<leader>sh", "<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" },
|
||||
{ "<leader>ss", "<cmd>Telescope lsp_document_symbols<cr>", desc = "Goto Symbol" },
|
||||
},
|
||||
opts = function()
|
||||
local actions = require("telescope.actions")
|
||||
@ -58,18 +61,20 @@ return {
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- add telescope-fzf-native
|
||||
{
|
||||
"telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "gmake",
|
||||
config = function()
|
||||
require("telescope").load_extension("fzf")
|
||||
end,
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
opts = {
|
||||
-- add any options here
|
||||
},
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
fast_wrap = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- which-key helps you remember key bindings by showing a popup
|
||||
-- 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
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
@ -267,4 +243,16 @@ return {
|
||||
{ "<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" },
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -2,10 +2,6 @@ return {
|
||||
-- lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"onsails/lspkind.nvim",
|
||||
"lukas-reineke/lsp-format.nvim",
|
||||
},
|
||||
opts = {
|
||||
-- options for vim.diagnostic.config()
|
||||
diagnostics = {
|
||||
@ -35,7 +31,7 @@ return {
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lsp= require('lspconfig')
|
||||
local lsp = require('lspconfig')
|
||||
local lsp_defaults = lsp.util.default_config
|
||||
|
||||
lsp_defaults.capabilities = vim.tbl_deep_extend(
|
||||
@ -58,16 +54,16 @@ return {
|
||||
sign({ name = 'DiagnosticSignHint', text = '⚑' })
|
||||
sign({ name = 'DiagnosticSignInfo', text = '' })
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
})
|
||||
vim.diagnostic.config({
|
||||
virtual_text = false,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover,
|
||||
@ -92,66 +88,112 @@ vim.diagnostic.config({
|
||||
end
|
||||
})
|
||||
|
||||
require("lsp-format").setup {
|
||||
html = {
|
||||
exclude = { "html" }
|
||||
}
|
||||
local on_attach = function(client)
|
||||
local bufmap = function(mode, lhs, rhs)
|
||||
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
|
||||
}
|
||||
|
||||
local on_attach = function(client)
|
||||
local bufmap = function(mode, lhs, rhs)
|
||||
local opts = {buffer = true}
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
require("lsp-format").on_attach(client)
|
||||
|
||||
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', '<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>')
|
||||
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 = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
unusedvariable = true,
|
||||
shadow = true
|
||||
},
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
on_attach = on_attach
|
||||
}
|
||||
lsp.clangd.setup { on_attach = on_attach }
|
||||
lsp.ltex.setup {
|
||||
on_attach = on_attach,
|
||||
filetypes = { "latex", "tex", "bib", "mkd", "gitcommit", "text" },
|
||||
lsp.clangd.setup {
|
||||
settings = {
|
||||
clangd = {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"--header-insertion=iwyu",
|
||||
"--completion-style=detailed",
|
||||
"--function-arg-placeholders",
|
||||
"--fallback-style=llvm",
|
||||
},
|
||||
init_options = {
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
clangdFileStatus = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
on_attach = on_attach
|
||||
}
|
||||
lsp.ltex.setup {
|
||||
on_attach = on_attach,
|
||||
filetypes = { "latex", "tex", "bib", "mkd", "gitcommit", "text" },
|
||||
}
|
||||
lsp.svelte.setup { on_attach = on_attach }
|
||||
lsp.tsserver.setup { on_attach = on_attach }
|
||||
lsp.lua_ls.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
},
|
||||
codeLens = {
|
||||
enable = true,
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
},
|
||||
}
|
||||
},
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -50,10 +50,30 @@ return {
|
||||
vim.o.laststatus = 0
|
||||
end,
|
||||
opts = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = '|',
|
||||
section_separators = '',
|
||||
options = {
|
||||
theme = 'auto',
|
||||
icons_enabled = true,
|
||||
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
|
||||
-- in the code structure you are - within functions, classes,
|
||||
-- etc - in the statusline.
|
||||
-- icons
|
||||
{
|
||||
"SmiteshP/nvim-navic",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
lazy = true,
|
||||
opts = function()
|
||||
return {
|
||||
separator = " ",
|
||||
highlight = true,
|
||||
depth_limit = 5,
|
||||
lazy_update_context = true,
|
||||
local devicons = require("nvim-web-devicons")
|
||||
local palette = {
|
||||
orange = "#d18616",
|
||||
black = "#586069",
|
||||
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,
|
||||
},
|
||||
-- icons
|
||||
{ "nvim-tree/nvim-web-devicons", lazy = true },
|
||||
{
|
||||
"yamatsum/nvim-nonicons",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
lazy = true
|
||||
},
|
||||
|
||||
-- ui components
|
||||
{ "MunifTanjim/nui.nvim", lazy = true },
|
||||
{ "MunifTanjim/nui.nvim", lazy = true },
|
||||
|
||||
{{ else }}
|
||||
-- change lualine
|
||||
@ -216,39 +388,39 @@ return {
|
||||
end,
|
||||
},
|
||||
{{ end }}
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
config = function()
|
||||
-- change the highlight style
|
||||
vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
opts = function(_, opts)
|
||||
opts.filetypes = {
|
||||
"html",
|
||||
"css",
|
||||
"scss",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"lua",
|
||||
}
|
||||
opts.user_default_options = {
|
||||
mode = "background",
|
||||
tailwind = false, -- Enable tailwind colors
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
opts = function(_, opts)
|
||||
local logo = [[
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
config = function()
|
||||
-- change the highlight style
|
||||
vim.api.nvim_set_hl(0, "IlluminatedWordText", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "IlluminatedWordRead", { link = "Visual" })
|
||||
vim.api.nvim_set_hl(0, "IlluminatedWordWrite", { link = "Visual" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
opts = function(_, opts)
|
||||
opts.filetypes = {
|
||||
"html",
|
||||
"css",
|
||||
"scss",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"lua",
|
||||
}
|
||||
opts.user_default_options = {
|
||||
mode = "background",
|
||||
tailwind = false, -- Enable tailwind colors
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimdev/dashboard-nvim",
|
||||
event = "VimEnter",
|
||||
opts = function()
|
||||
local logo = [[
|
||||
_ _ _ _
|
||||
| | (_) | | | |
|
||||
_ __ ___ ___ ___| |__ _ _ _ ___| |__ __ _ _ __ __| |
|
||||
@ -257,48 +429,79 @@ return {
|
||||
|_| |_| |_|\___/ \___|_.__/|_|\__,_|___/_.__/ \__,_|_| |_|\__,_|
|
||||
]]
|
||||
|
||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
opts.config.header = vim.split(logo, "\n")
|
||||
opts.theme = "doom"
|
||||
opts.config.center = {
|
||||
{
|
||||
action = "Telescope find_files",
|
||||
desc = " Find file",
|
||||
icon = " ",
|
||||
key = "f",
|
||||
},
|
||||
{
|
||||
action = "Telescope oldfiles",
|
||||
desc = " Recent files",
|
||||
icon = " ",
|
||||
key = "r",
|
||||
},
|
||||
{
|
||||
action = "Telescope live_grep",
|
||||
desc = " Find text",
|
||||
icon = " ",
|
||||
key = "g",
|
||||
},
|
||||
{
|
||||
action = [[lua require("lazyvim.util").telescope.config_files()()]],
|
||||
desc = " Config",
|
||||
icon = " ",
|
||||
key = "c",
|
||||
},
|
||||
{
|
||||
action = "Neorg workspace notes",
|
||||
desc = " Neorg notes",
|
||||
icon = " ",
|
||||
key = "n",
|
||||
},
|
||||
{
|
||||
action = "Lazy",
|
||||
desc = " Lazy",
|
||||
icon = " ",
|
||||
key = "l",
|
||||
},
|
||||
{ action = "qa", desc = " Quit", icon = " ", key = "q" },
|
||||
}
|
||||
end,
|
||||
},
|
||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
|
||||
local opts = {
|
||||
theme = "doom",
|
||||
hide = {
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
header = vim.split(logo, "\n"),
|
||||
center = {
|
||||
{
|
||||
action = "Telescope find_files",
|
||||
desc = " Find file",
|
||||
icon = " ",
|
||||
key = "f",
|
||||
},
|
||||
{
|
||||
action = "Telescope oldfiles",
|
||||
desc = " Recent files",
|
||||
icon = " ",
|
||||
key = "r",
|
||||
},
|
||||
{
|
||||
action = "Telescope live_grep",
|
||||
desc = " Find text",
|
||||
icon = " ",
|
||||
key = "g",
|
||||
},
|
||||
{
|
||||
action = [[lua require("lazyvim.util").telescope.config_files()()]],
|
||||
desc = " Config",
|
||||
icon = " ",
|
||||
key = "c",
|
||||
},
|
||||
{
|
||||
action = "Neorg workspace notes",
|
||||
desc = " Neorg notes",
|
||||
icon = " ",
|
||||
key = "n",
|
||||
},
|
||||
{
|
||||
action = "Lazy",
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
@ -70,5 +70,5 @@ source $HOME/perl5/perlbrew/etc/bashrc
|
||||
export PATH=/opt/homebrew/bin:$PATH
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
eval "$(atuin init zsh)"
|
||||
{{- end }}
|
||||
|
Loading…
Reference in New Issue
Block a user