migrated to lazy.nvim
This commit is contained in:
parent
80c19ac1fa
commit
3583fa3c2a
26 changed files with 482 additions and 327 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
packer_compiled.lua
|
packer_compiled.lua
|
||||||
|
lazy-lock.json
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl( 0, "PmenuSel", { fg = 'NONE', bg = '#141617' } )
|
|
||||||
vim.api.nvim_set_hl( 0, "Pmenu", { fg = 'NONE', bg = '#1d2021' } )
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl( 0, "CmpItemMenu", { fg = 'NONE', bg = '#141617' } )
|
|
||||||
vim.api.nvim_set_hl( 0, "CmpItemMenuDefault", { fg = 'NONE', bg = '#141617' } )
|
|
||||||
|
|
||||||
vim.api.nvim_set_hl( 0, "CmpItemKindFunction", { fg = '#d3869b', bg = 'NONE', italic = true } )
|
|
||||||
vim.api.nvim_set_hl( 0, "CmpItemKindSnippet", { fg = '#d8a657', bg = 'NONE', italic = true } )
|
|
||||||
vim.api.nvim_set_hl( 0, "CmpItemKindText", {fg = '#ddc7a1', bg = 'NONE', italic = true } )
|
|
||||||
vim.api.nvim_set_hl( 0, "CmpItemKindVariable", {fg = '#7daea3', bg = 'NONE', italic = true } )
|
|
||||||
-- vim.api.nvim_set_hl( 0, "", {fg = '#', bg = 'NONE', italic = true } )
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
vim.opt.list = true
|
|
||||||
-- vim.opt.listchars:append "space:⋅"
|
|
||||||
|
|
||||||
require("indent_blankline").setup {
|
|
||||||
space_char_blankline = " ",
|
|
||||||
}
|
|
|
@ -1,88 +0,0 @@
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
|
||||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
-- Mappings.
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
|
||||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, bufopts)
|
|
||||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
|
||||||
vim.keymap.set('n', '<leader><C-k>', vim.lsp.buf.signature_help, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>wl', function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
|
||||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
|
||||||
vim.keymap.set('n', '<space>fm', function() vim.lsp.buf.format { async = true } end, bufopts)
|
|
||||||
end
|
|
||||||
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
|
||||||
for type, icon in pairs(signs) do
|
|
||||||
local hl = "DiagnosticSign" .. type
|
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl })
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local border = {
|
|
||||||
{ "╭", "FloatBorder" },
|
|
||||||
{ "─", "FloatBorder" },
|
|
||||||
{ "╮", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
{ "╯", "FloatBorder" },
|
|
||||||
{ "─", "FloatBorder" },
|
|
||||||
{ "╰", "FloatBorder" },
|
|
||||||
{ "│", "FloatBorder" },
|
|
||||||
}
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
float = { border = border },
|
|
||||||
virtual_text = {
|
|
||||||
prefix = '▎', -- Could be '●', '■', 'x'
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
-- LSP settings (for overriding per client)
|
|
||||||
local handlers = {
|
|
||||||
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }),
|
|
||||||
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }),
|
|
||||||
}
|
|
||||||
|
|
||||||
require("mason").setup({
|
|
||||||
ui = {
|
|
||||||
border = "rounded",
|
|
||||||
icons = {
|
|
||||||
package_installed = "✔",
|
|
||||||
package_pending = "➜",
|
|
||||||
package_uninstalled = "✘"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup({
|
|
||||||
ensure_installed = { "sumneko_lua", "clangd" }
|
|
||||||
})
|
|
||||||
|
|
||||||
require("mason-lspconfig").setup_handlers {
|
|
||||||
-- The first entry (without a key) will be the default handler
|
|
||||||
-- and will be called for each installed server that doesn't have
|
|
||||||
-- a dedicated handler.
|
|
||||||
function(server_name) -- default handler (optional)
|
|
||||||
require("lspconfig")[server_name].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
handlers = handlers,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,12 +0,0 @@
|
||||||
local null_ls = require('null-ls')
|
|
||||||
|
|
||||||
local sources = {
|
|
||||||
null_ls.builtins.diagnostics.trail_space.with{
|
|
||||||
disabled_filetypes = { "lua" }
|
|
||||||
},
|
|
||||||
null_ls.builtins.diagnostics.shellcheck,
|
|
||||||
}
|
|
||||||
|
|
||||||
null_ls.setup({
|
|
||||||
sources = sources,
|
|
||||||
})
|
|
|
@ -1,160 +0,0 @@
|
||||||
-- Set up nvim-cmp with luasnip
|
|
||||||
|
|
||||||
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 has_words_before = function()
|
|
||||||
unpack = unpack or table.unpack
|
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local cmp = require'cmp'
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
formatting = {
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
-- Kind icons
|
|
||||||
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates 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]",
|
|
||||||
buffer = "",
|
|
||||||
nvim_lsp = "",
|
|
||||||
luasnip = "",
|
|
||||||
nvim_lua = "",
|
|
||||||
latex_symbols = "",
|
|
||||||
})[entry.source.name]
|
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
snippet = {
|
|
||||||
-- REQUIRED - you must specify a snippet engine
|
|
||||||
expand = function(args)
|
|
||||||
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
|
||||||
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
|
||||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
|
||||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- completion = {
|
|
||||||
-- autocomplete = false,
|
|
||||||
-- },
|
|
||||||
|
|
||||||
window = {
|
|
||||||
completion = cmp.config.window.bordered(),
|
|
||||||
documentation = cmp.config.window.bordered(),
|
|
||||||
},
|
|
||||||
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
|
||||||
-- ['<C-Space>'] = cmp.mapping.complete(),
|
|
||||||
-- ['<C-e>'] = cmp.mapping.abort(),
|
|
||||||
['<C-e>'] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.abort()
|
|
||||||
else
|
|
||||||
cmp.complete()
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_next_item()
|
|
||||||
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
|
||||||
-- they way you will only jump inside the snippet region
|
|
||||||
elseif luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
|
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
|
||||||
if cmp.visible() then
|
|
||||||
cmp.select_prev_item()
|
|
||||||
elseif luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
else
|
|
||||||
fallback()
|
|
||||||
end
|
|
||||||
end, { "i", "s" }),
|
|
||||||
}),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'nvim_lsp' },
|
|
||||||
-- { name = 'vsnip' }, -- For vsnip users.
|
|
||||||
{ name = 'luasnip' }, -- For luasnip users.
|
|
||||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
|
||||||
-- { name = 'snippy' }, -- For snippy users.
|
|
||||||
{ name = 'buffer' },
|
|
||||||
}, {
|
|
||||||
})
|
|
||||||
})
|
|
||||||
-- Set configuration for specific filetype.
|
|
||||||
cmp.setup.filetype('gitcommit', {
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
|
||||||
}, {
|
|
||||||
{ name = 'buffer' },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline({ '/', '?' }, {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = {
|
|
||||||
{ name = 'buffer' }
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
||||||
cmp.setup.cmdline(':', {
|
|
||||||
mapping = cmp.mapping.preset.cmdline(),
|
|
||||||
sources = cmp.config.sources({
|
|
||||||
{ name = 'path' }
|
|
||||||
}, {
|
|
||||||
{ name = 'cmdline' }
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set up lspconfig.
|
|
||||||
-- local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
-- -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
|
||||||
-- require('lspconfig')['<YOUR_LSP_SERVER>'].setup {
|
|
||||||
-- capabilities = capabilities
|
|
||||||
-- }
|
|
|
@ -1,5 +0,0 @@
|
||||||
local builtin = require('telescope.builtin')
|
|
||||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
|
||||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
|
||||||
vim.keymap.set('n', '<leader>fG', builtin.git_files, {})
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
require'nvim-treesitter.configs'.setup {
|
|
||||||
-- A list of parser names, or "all"
|
|
||||||
ensure_installed = { "c", "lua", "rust", "latex", "bibtex", "python", "vim" },
|
|
||||||
|
|
||||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
|
||||||
sync_install = false,
|
|
||||||
|
|
||||||
-- Automatically install missing parsers when entering buffer
|
|
||||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
|
||||||
auto_install = true,
|
|
||||||
|
|
||||||
highlight = {
|
|
||||||
-- `false` will disable the whole extension
|
|
||||||
enable = true,
|
|
||||||
|
|
||||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
|
||||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
|
||||||
-- the name of the parser)
|
|
||||||
-- list of language that will be disabled
|
|
||||||
disable = { "markdown" },
|
|
||||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
|
||||||
additional_vim_regex_highlighting = false,
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1 +1,17 @@
|
||||||
require("user")
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
vim.fn.system({
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--filter=blob:none",
|
||||||
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
require("core.settings")
|
||||||
|
require("core.remap")
|
||||||
|
require("lazy").setup("plugin")
|
||||||
|
require("core.autocmd")
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
-- setting colors
|
-- setting colors
|
||||||
-- everforest
|
-- everforest
|
||||||
vim.api.nvim_set_var("everforest_background", "hard")
|
-- vim.api.nvim_set_var("everforest_background", "hard")
|
||||||
vim.api.nvim_set_var("everforest_transparent_background", "1")
|
-- vim.api.nvim_set_var("everforest_transparent_background", "1")
|
||||||
vim.api.nvim_set_var("everforest_ui_contrast", "low")
|
-- vim.api.nvim_set_var("everforest_ui_contrast", "low")
|
||||||
vim.api.nvim_set_var("everforest_show_eob", "0")
|
-- vim.api.nvim_set_var("everforest_show_eob", "0")
|
||||||
vim.api.nvim_set_var("everforest_enable_bold", "1")
|
-- vim.api.nvim_set_var("everforest_enable_bold", "1")
|
||||||
vim.api.nvim_set_var("everforest_enable_italic", "1")
|
-- vim.api.nvim_set_var("everforest_enable_italic", "1")
|
||||||
vim.api.nvim_set_var("everforest_better_performance", "1")
|
-- vim.api.nvim_set_var("everforest_better_performance", "1")
|
||||||
|
|
||||||
-- gruvbox
|
-- gruvbox
|
||||||
vim.api.nvim_set_var("gruvbox_material_background", "hard")
|
-- vim.api.nvim_set_var("gruvbox_material_background", "hard")
|
||||||
vim.api.nvim_set_var("gruvbox_material_transparent_background", "1")
|
-- vim.api.nvim_set_var("gruvbox_material_transparent_background", "1")
|
||||||
vim.api.nvim_set_var("gruvbox_material_ui_contrast", "low")
|
-- vim.api.nvim_set_var("gruvbox_material_ui_contrast", "low")
|
||||||
vim.api.nvim_set_var("gruvbox_material_show_eob", "0")
|
-- vim.api.nvim_set_var("gruvbox_material_show_eob", "0")
|
||||||
vim.api.nvim_set_var("gruvbox_material_enable_bold", "1")
|
-- vim.api.nvim_set_var("gruvbox_material_enable_bold", "1")
|
||||||
vim.api.nvim_set_var("gruvbox_material_enable_italic", "1")
|
-- vim.api.nvim_set_var("gruvbox_material_enable_italic", "1")
|
||||||
vim.api.nvim_set_var("gruvbox_material_better_performance", "1")
|
-- vim.api.nvim_set_var("gruvbox_material_better_performance", "1")
|
||||||
|
|
||||||
-- setting colorscheme
|
-- setting colorscheme
|
||||||
vim.cmd [[colo gruvbox-material]]
|
vim.cmd [[colo gruvbox-material]]
|
|
@ -1,7 +1,7 @@
|
||||||
require("user.packer")
|
-- require("user.packer")
|
||||||
require("user.settings")
|
require("user.settings")
|
||||||
require("user.remap")
|
require("user.remap")
|
||||||
require("user.autocmd")
|
require("user.autocmd")
|
||||||
require("user.statusline")
|
require("user.statusline")
|
||||||
require("user.colors")
|
-- require("user.colors")
|
||||||
|
|
|
@ -38,7 +38,7 @@ vim.api.nvim_set_option("scrolloff",999)
|
||||||
|
|
||||||
-- spellchecking
|
-- spellchecking
|
||||||
vim.wo.spell = true
|
vim.wo.spell = true
|
||||||
vim.bo.spelllang = "de,en_us"
|
vim.bo.spelllang = "de"
|
||||||
|
|
||||||
-- highlight the current linenumber
|
-- highlight the current linenumber
|
||||||
vim.wo.cursorline = true
|
vim.wo.cursorline = true
|
7
nvim/.config/nvim/lua/plugin/commenting.lua
Normal file
7
nvim/.config/nvim/lua/plugin/commenting.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"tpope/vim-commentary",
|
||||||
|
event = "BufReadPost",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
4
nvim/.config/nvim/lua/plugin/devicons.lua
Normal file
4
nvim/.config/nvim/lua/plugin/devicons.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
return {
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
lazy = true,
|
||||||
|
}
|
40
nvim/.config/nvim/lua/plugin/gruvbox-material.lua
Normal file
40
nvim/.config/nvim/lua/plugin/gruvbox-material.lua
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"sainnhe/gruvbox-material",
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
-- Settings for colorscheme
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_background", "hard")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_transparent_background", "1")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_ui_contrast", "low")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_show_eob", "0")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_enable_bold", "1")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_enable_italic", "1")
|
||||||
|
vim.api.nvim_set_var("gruvbox_material_better_performance", "1")
|
||||||
|
vim.cmd([[colo gruvbox-material]])
|
||||||
|
|
||||||
|
-- Settings to override colorscheme
|
||||||
|
vim.api.nvim_set_hl(0, "ModeMsg", { bold = true, fg = "#d8a657"})
|
||||||
|
-- colors of tabline
|
||||||
|
vim.api.nvim_set_hl(0, "TabLine", {bg = "#3c3836", fg = "#89b482"})
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineFil", {bg = "#1d2021"})
|
||||||
|
vim.api.nvim_set_hl(0, "TabLineSel", {bold = true, bg = "none", fg = "#d8a657"})
|
||||||
|
-- color of statusline
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLine", {bold = false, bg = "#1d2021", fg = "#89b482"})
|
||||||
|
vim.api.nvim_set_hl(0, "StatusLineNC", {bg = "#1d2021", fg = "#5b534d"})
|
||||||
|
-- color of vertical split line
|
||||||
|
vim.api.nvim_set_hl(0, "VertSplit", {bg = "#141617", fg = "#141617"})
|
||||||
|
-- color of the cursorline and cursorlinenumber
|
||||||
|
vim.api.nvim_set_hl(0, "Cursorline", {bg = "#141617"})
|
||||||
|
vim.api.nvim_set_hl(0, "CursorLineNr", {bold = true, bg = "#141617", fg = "#d8a657"})
|
||||||
|
-- color of Floats and FloatBorders
|
||||||
|
vim.api.nvim_set_hl(0, "NormalFloat", {bg = none, fg = none })
|
||||||
|
vim.api.nvim_set_hl(0, "FloatBorder", {bg = none, fg = "#d4be98"})
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingWarn", {bg = none, fg = "#d8a657"})
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingError", {bg = none, fg = "#ea6962"})
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingHint", {bg = none, fg = "#a9b665"})
|
||||||
|
vim.api.nvim_set_hl(0, "DiagnosticFloatingInfo", {bg = none, fg = "#d4be98"})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
12
nvim/.config/nvim/lua/plugin/indent-blankline.lua
Normal file
12
nvim/.config/nvim/lua/plugin/indent-blankline.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
event = "BufReadPre",
|
||||||
|
opts = {
|
||||||
|
-- char = "│",
|
||||||
|
filetype_exclude = { "help", "lazy" },
|
||||||
|
show_trailing_blankline_indent = true,
|
||||||
|
show_current_context = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
113
nvim/.config/nvim/lua/plugin/lspconfig.lua
Normal file
113
nvim/.config/nvim/lua/plugin/lspconfig.lua
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = "BufReadPre",
|
||||||
|
config = function()
|
||||||
|
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||||
|
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
-- Mappings.
|
||||||
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
|
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||||
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader>K', vim.lsp.buf.hover, bufopts)
|
||||||
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||||
|
vim.keymap.set('n', '<leader><C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>wl', function()
|
||||||
|
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||||
|
end, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||||
|
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||||
|
vim.keymap.set('n', '<space>fm', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||||
|
end
|
||||||
|
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local border = {
|
||||||
|
{ "╭", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╮", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
{ "╯", "FloatBorder" },
|
||||||
|
{ "─", "FloatBorder" },
|
||||||
|
{ "╰", "FloatBorder" },
|
||||||
|
{ "│", "FloatBorder" },
|
||||||
|
}
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
float = { border = border },
|
||||||
|
virtual_text = {
|
||||||
|
prefix = '▎', -- Could be '●', '■', 'x'
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
-- LSP settings (for overriding per client)
|
||||||
|
local handlers = {
|
||||||
|
["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border }),
|
||||||
|
["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = border }),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
cmd = "Mason",
|
||||||
|
config = function()
|
||||||
|
require("mason").setup({
|
||||||
|
ui = {
|
||||||
|
border = "rounded",
|
||||||
|
icons = {
|
||||||
|
package_installed = "✔",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✘"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
event = "BufReadPre",
|
||||||
|
config = function()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"sumneko_lua",
|
||||||
|
"clangd",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup_handlers {
|
||||||
|
-- The first entry (without a key) will be the default handler
|
||||||
|
-- and will be called for each installed server that doesn't have
|
||||||
|
-- a dedicated handler.
|
||||||
|
function(server_name) -- default handler (optional)
|
||||||
|
require("lspconfig")[server_name].setup {
|
||||||
|
on_attach = on_attach,
|
||||||
|
handlers = handlers,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
19
nvim/.config/nvim/lua/plugin/null-ls.lua
Normal file
19
nvim/.config/nvim/lua/plugin/null-ls.lua
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
event = "BufReadPost",
|
||||||
|
opts = function()
|
||||||
|
local null_ls = require('null-ls')
|
||||||
|
return {
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.diagnostics.trail_space.with{
|
||||||
|
disabled_filetypes = { "lua" }
|
||||||
|
},
|
||||||
|
null_ls.builtins.diagnostics.shellcheck,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
195
nvim/.config/nvim/lua/plugin/nvim-cmp.lua
Normal file
195
nvim/.config/nvim/lua/plugin/nvim-cmp.lua
Normal file
|
@ -0,0 +1,195 @@
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- snippets
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
lazy = true,
|
||||||
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
config = function()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
vim.api.nvim_set_hl( 0, "PmenuSel", { fg = 'NONE', bg = '#141617' } )
|
||||||
|
vim.api.nvim_set_hl( 0, "Pmenu", { fg = 'NONE', bg = '#1d2021' } )
|
||||||
|
vim.api.nvim_set_hl( 0, "CmpItemMenu", { fg = 'NONE', bg = '#141617' } )
|
||||||
|
vim.api.nvim_set_hl( 0, "CmpItemMenuDefault", { fg = 'NONE', bg = '#141617' } )
|
||||||
|
vim.api.nvim_set_hl( 0, "CmpItemKindFunction", { fg = '#d3869b', bg = 'NONE', italic = true } )
|
||||||
|
vim.api.nvim_set_hl( 0, "CmpItemKindSnippet", { fg = '#d8a657', bg = 'NONE', italic = true } )
|
||||||
|
vim.api.nvim_set_hl( 0, "CmpItemKindText", {fg = '#ddc7a1', bg = 'NONE', italic = true } )
|
||||||
|
vim.api.nvim_set_hl( 0, "CmpItemKindVariable", {fg = '#7daea3', bg = 'NONE', italic = true } )
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- completion
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
version = false,
|
||||||
|
event = {
|
||||||
|
-- "InsertEnter",
|
||||||
|
-- "CmdlineEnter",
|
||||||
|
"BufWinEnter",
|
||||||
|
},
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-cmdline",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
},
|
||||||
|
opts = function()
|
||||||
|
-- Set up nvim-cmp with luasnip
|
||||||
|
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 has_words_before = function()
|
||||||
|
unpack = unpack or table.unpack
|
||||||
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
return{
|
||||||
|
formatting = {
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
-- Kind icons
|
||||||
|
vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates 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]",
|
||||||
|
buffer = "",
|
||||||
|
nvim_lsp = "",
|
||||||
|
luasnip = "",
|
||||||
|
nvim_lua = "",
|
||||||
|
latex_symbols = "",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
snippet = {
|
||||||
|
-- REQUIRED - you must specify a snippet engine
|
||||||
|
expand = function(args)
|
||||||
|
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||||
|
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||||
|
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||||
|
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- completion = {
|
||||||
|
-- autocomplete = false,
|
||||||
|
-- },
|
||||||
|
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||||
|
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||||
|
-- ['<C-Space>'] = cmp.mapping.complete(),
|
||||||
|
-- ['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<C-e>'] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.abort()
|
||||||
|
else
|
||||||
|
cmp.complete()
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
-- You could replace the expand_or_jumpable() calls with expand_or_locally_jumpable()
|
||||||
|
-- they way you will only jump inside the snippet region
|
||||||
|
elseif luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
|
||||||
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" }),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
-- { name = 'vsnip' }, -- For vsnip users.
|
||||||
|
{ name = 'luasnip' }, -- For luasnip users.
|
||||||
|
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||||
|
-- { name = 'snippy' }, -- For snippy users.
|
||||||
|
{ name = 'buffer' },
|
||||||
|
}, {
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- Set configuration for specific filetype.
|
||||||
|
cmp.setup.filetype('gitcommit', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
|
||||||
|
}, {
|
||||||
|
{ name = 'buffer' },
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline({ '/', '?' }, {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer' }
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
mapping = cmp.mapping.preset.cmdline(),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
6
nvim/.config/nvim/lua/plugin/plenary.lua
Normal file
6
nvim/.config/nvim/lua/plugin/plenary.lua
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
lazy = true,
|
||||||
|
},
|
||||||
|
}
|
19
nvim/.config/nvim/lua/plugin/telescope.lua
Normal file
19
nvim/.config/nvim/lua/plugin/telescope.lua
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
lazy = true,
|
||||||
|
cmd = "Telescope",
|
||||||
|
version = false,
|
||||||
|
keys = {
|
||||||
|
{ "<leader>:", "<cmd>Telescope command_history<cr>", desc = "Command History" },
|
||||||
|
{ "<leader>,", "<cmd>Telescope buffers show_all_buffers=true<cr>", desc = "Switch Buffer" },
|
||||||
|
-- find
|
||||||
|
{"<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find Files" },
|
||||||
|
{"<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Grep Content in Files" },
|
||||||
|
{"<leader>/", "<cmd>Telescope live_grep<cr>", desc = "Grep Content in Files" },
|
||||||
|
{"<leader>fG", "<cmd>Telescope git_files<cr>", desc = "Find Git Files" },
|
||||||
|
{"<leader>fk", "<cmd>Telescope keymaps<cr>", desc = "Find Git Files" },
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
32
nvim/.config/nvim/lua/plugin/treesitter.lua
Normal file
32
nvim/.config/nvim/lua/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
version = false,
|
||||||
|
build = ":TSUpdate",
|
||||||
|
event = "BufReadPost",
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"c",
|
||||||
|
"lua",
|
||||||
|
"rust",
|
||||||
|
"latex",
|
||||||
|
"bibtex",
|
||||||
|
"python",
|
||||||
|
"vim",
|
||||||
|
"yaml",
|
||||||
|
"json",
|
||||||
|
},
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
disable = {
|
||||||
|
"markdown",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue