nvim: plugins and dependencies restructured

master
tiyn 1 year ago
parent e2f0d00ee3
commit 222b98d70b

@ -6,100 +6,74 @@ if not vim.loop.fs_stat(lazypath) then
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release "--branch=stable",
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
return require("lazy").setup({ return require("lazy").setup({
-- indicate git diff status of line
-- display git status per line
{ {
'lewis6991/gitsigns.nvim', 'lewis6991/gitsigns.nvim',
config = function() config = function()
require('gitsigns').setup() require('gitsigns').setup()
end, end
}, },
-- show indentation lines (in empty lines too) -- show indentation lines
{ {
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
config = function() config = function()
require("indent_blankline").setup({ require("indent_blankline").setup({
show_current_context = true, show_current_context = true,
show_current_context_start = true, show_current_context_start = true
}) })
end, end,
}, },
-- improved java syntax highlighting -- statusline
{
'uiiaoo/java-syntax.vim',
ft = { 'java' },
},
-- custom statusline
{ {
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons', }, dependencies = { 'nvim-tree/nvim-web-devicons', },
config = function() config = function()
require('lualine').setup({ require('lualine').setup({
options = { options = {
icons_enabled = true,
symbols = { symbols = {
error = Error_sign, error = Error_sign,
warn = Warn_sign, warn = Warn_sign,
hint = Hint_sign, hint = Hint_sign,
info = Info_sign, info = Info_sign
}, },
theme = 'tccs', theme = 'tccs',
component_separators = { left = '', right = '' }, component_separators = { left = '', right = '' },
section_separators = { left = '', right = '' }, section_separators = { left = '', right = '' }
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
}, },
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { 'filename' },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}) })
end, end
}, },
-- show signature while typing -- show function signature while typing
{
'ray-x/lsp_signature.nvim', 'ray-x/lsp_signature.nvim',
config = function()
require "lsp_signature".setup({
bind = true,
handler_opts = {
border = "none"
},
hint_prefix = Hint_sign,
hint_scheme = "DiagnosticSignHint"
})
end
},
-- preview for markdown filetypes -- preview for markdown filetypes
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
ft = { 'markdown' }, ft = { 'markdown' },
build = "cd app && yarn install", build = "cd app && yarn install"
}, },
-- latex asynchronous pdf rendering -- latex asynchronous pdf rendering
@ -108,13 +82,13 @@ return require("lazy").setup({
ft = { 'tex' }, ft = { 'tex' },
config = function() config = function()
vim.g.neotex_enabled = 2 vim.g.neotex_enabled = 2
end, end
}, },
-- nim language support -- nim language support
{ {
'zah/nim.vim', 'zah/nim.vim',
ft = { 'nim' }, ft = { 'nim' }
}, },
-- automatic closing of brackets -- automatic closing of brackets
@ -125,126 +99,134 @@ return require("lazy").setup({
end end
}, },
-- language server protocol -- lang server installations
{ {
'neovim/nvim-lspconfig', 'williamboman/mason.nvim',
dependencies = { dependencies = {
'SmiteshP/nvim-navbuddy', {
'hrsh7th/cmp-nvim-lsp', 'jose-elias-alvarez/null-ls.nvim',
'onsails/lspkind-nvim',
'SmiteshP/nvim-navic',
'MunifTanjim/nui.nvim',
},
config = function() config = function()
-- hrsh7th/cmp-nvim-lsp require("null-ls").setup({
local cmp_nvim_lsp = require("cmp_nvim_lsp") sources = {
require("null-ls-embedded").nls_source.with({
-- neovim/nvim-lspconfig filetypes = { "markdown" }
local nvim_lsp = require('lspconfig') }),
require("null-ls").builtins.formatting.black,
local servers = { "pyright", "bashls", "texlab", "nimls", "marksman" } require("null-ls").builtins.formatting.mdformat
-- smiteshp/nvim-navbuddy
local navbuddy = require("nvim-navbuddy")
local attach_func = function(client, bufnr)
navbuddy.attach(client, bufnr)
end
local capabilities = cmp_nvim_lsp.default_capabilities()
capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = attach_func,
capabilities = capabilities,
flags = {
debounce_text_changes = 150
}
} }
})
end end
require 'lspconfig'.jdtls.setup {
on_attach = attach_func,
capabilities = capabilities,
flags = {
debounce_text_changes = 150
}, },
cmd = { 'jdtls' } {
} 'jay-babu/mason-null-ls.nvim',
require 'lspconfig'.lua_ls.setup { config = function()
on_attach = attach_func, -- jay-babu/mason-null-ls.nvim
capabilities = capabilities, require("mason-null-ls").setup({
settings = { automatic_installation = true,
Lua = { ensure_installed = { "black", "mdformat" }
diagnostics = { globals = { 'vim' } }, })
telemetry = { enable = false }, end
}, },
'LostNeophyte/null-ls-embedded'
}, },
config = function()
require("mason").setup({
ui = {
icons = Install_icons
} }
end, })
end
}, },
-- lang server management -- lang server management
{ {
'williamboman/mason.nvim',
dependencies = {
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
'jose-elias-alvarez/null-ls.nvim', dependencies = {
'LostNeophyte/null-ls-embedded', 'neovim/nvim-lspconfig',
'jay-babu/mason-null-ls.nvim', {
'hrsh7th/cmp-nvim-lsp',
config = function()
Capabilities = require("cmp_nvim_lsp").default_capabilities()
Capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
end
}, },
-- navigation menu
{
'SmiteshP/nvim-navbuddy',
config = function() config = function()
-- jose-elias-alvarez/null-ls.nvim local navbuddy = require("nvim-navbuddy")
require("null-ls").setup({ Attach_func = function(client, bufnr)
sources = { navbuddy.attach(client, bufnr)
require("null-ls-embedded").nls_source.with({ end
filetypes = { "markdown" }, end,
}), dependencies = {
require("null-ls").builtins.formatting.black, 'SmiteshP/nvim-navic',
require("null-ls").builtins.formatting.mdformat, 'MunifTanjim/nui.nvim'
}
}, },
}) },
config = function()
-- williamboman/mason.nvim
require("mason").setup()
-- williamboman/mason-lspconfig.nvim
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
automatic_setup = true, automatic_setup = true,
ensure_installed = { "pyright", "bashls", "texlab", "nimls", "marksman", "jdtls", "lua_ls" } ensure_installed = {
"bashls",
"jdtls",
"lua_ls",
"marksman",
"nimls",
"pyright",
"texlab"
}
}) })
require("mason-lspconfig").setup_handlers({
-- jay-babu/mason-null-ls.nvim function(server_name)
require("mason-null-ls").setup({ require('lspconfig')[server_name].setup({
automatic_installation = true, on_attach = Attach_func,
ensure_installed = {} capabilities = Capabilities,
flags = {
debounce_text_changes = 150
}
}) })
end, end,
["lua_ls"] = function()
require 'lspconfig'.lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})
end
})
end
}, },
-- autocompletion and its sources -- autocompletion and its sources and snippets
{ {
'hrsh7th/nvim-cmp', 'hrsh7th/nvim-cmp',
dependencies = { dependencies = {
-- standalone cmp sources 'nvim-lua/plenary.nvim',
'onsails/lspkind-nvim',
-- cmp sources
'hrsh7th/cmp-buffer', 'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path', 'hrsh7th/cmp-path',
'lukas-reineke/cmp-under-comparator', 'lukas-reineke/cmp-under-comparator',
-- luasnip and cmp source -- luasnip
{
'l3mon4d3/luasnip', 'l3mon4d3/luasnip',
'saadparwaiz1/cmp_luasnip', config = function()
-- dependencies require("luasnip.loaders.from_snipmate").lazy_load()
'nvim-lua/plenary.nvim', end,
dependencies = { 'saadparwaiz1/cmp_luasnip' }
},
}, },
config = function() config = function()
-- hrsh7th/nvim-cmp
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip")
require("luasnip.loaders.from_snipmate").lazy_load()
cmp.setup { cmp.setup {
sorting = { sorting = {
comparators = { comparators = {
@ -255,20 +237,20 @@ return require("lazy").setup({
cmp.config.compare.kind, cmp.config.compare.kind,
cmp.config.compare.sort_text, cmp.config.compare.sort_text,
cmp.config.compare.length, cmp.config.compare.length,
cmp.config.compare.order, cmp.config.compare.order
}, },
}, },
snippet = { snippet = {
expand = function(args) expand = function(args)
luasnip.lsp_expand(args.body) require("luasnip").lsp_expand(args.body)
end, end
}, },
mapping = { mapping = {
['<S-Tab>'] = cmp.mapping(function(fallback) ['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_prev_item() cmp.select_prev_item()
elseif luasnip.jumpable(-1) then elseif require("luasnip").jumpable(-1) then
luasnip.jump(-1) require("luasnip").jump(-1)
else else
fallback() fallback()
end end
@ -276,8 +258,8 @@ return require("lazy").setup({
['<Tab>'] = cmp.mapping(function(fallback) ['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then elseif require("luasnip").expand_or_jumpable() then
luasnip.expand_or_jump() require("luasnip").expand_or_jump()
else else
fallback() fallback()
end end
@ -285,66 +267,26 @@ return require("lazy").setup({
['<C-e>'] = cmp.mapping.close(), ['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm { ['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,
select = true, select = true
} }
}, },
sources = { sources = {
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'path' }, { name = 'path' },
{ name = 'buffer' }, { name = 'buffer' },
{ name = 'luasnip' }, { name = 'luasnip' }
}, },
formatting = { formatting = {
format = require("lspkind").cmp_format({ format = require("lspkind").cmp_format({
mode = "symbol_text", mode = "symbol_text",
preset = "codicons", preset = "codicons",
maxwidth = 50, maxwidth = 50,
menu = { menu = Menu_signs,
nvim_lsp = "[LSP]", symbol_map = Symbol_map
path = "[PATH]",
buffer = "[BUF]",
luasnip = "[SNIP]",
},
symbol_map = {
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 = ""
},
}),
},
}
-- ray-x/lsp_signature.nvim
require "lsp_signature".setup({
bind = true,
handler_opts = {
border = "none"
},
hint_prefix = Hint_sign,
hint_scheme = "DiagnosticSignHint",
}) })
end, }
}
end
}, },
-- fix for cursorhold function -- fix for cursorhold function
@ -356,9 +298,9 @@ return require("lazy").setup({
config = function() config = function()
require('colorizer').setup({ require('colorizer').setup({
'*', '*',
'!markdown', '!markdown'
}) })
end, end
}, },
-- fileexplorer on the side -- fileexplorer on the side
@ -378,14 +320,18 @@ return require("lazy").setup({
}, },
filters = { filters = {
dotfiles = true, dotfiles = true,
}, }
}) })
end, end
}, },
-- better language highlighting by improved parsing -- better language highlighting by improved parsing
{ {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
dependencies = {
-- automatically close html-tags
'windwp/nvim-ts-autotag',
},
config = function() config = function()
require("nvim-treesitter.configs").setup({ require("nvim-treesitter.configs").setup({
ensure_installed = { ensure_installed = {
@ -399,15 +345,9 @@ return require("lazy").setup({
"latex", "latex",
"python", "python",
}, },
autotag = { enable = true }, autotag = { enable = true }
}) })
end, end
},
-- automatically close html-tags
{
'windwp/nvim-ts-autotag',
dependencies = { 'nvim-treesitter/nvim-treesitter' },
}, },
-- folding improvements -- folding improvements
@ -426,7 +366,7 @@ return require("lazy").setup({
pattern = { '*' }, pattern = { '*' },
command = 'lua require("ufo").openAllFolds()' command = 'lua require("ufo").openAllFolds()'
}) })
end, end
}, },
-- fuzzy finder -- fuzzy finder
@ -436,15 +376,16 @@ return require("lazy").setup({
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
config = function() config = function()
require("telescope").setup() require("telescope").setup()
end, end
}, },
-- clean up white spaces and empty lines before writing -- clean up white spaces and empty lines before writing
{ {
"mcauley-penney/tidy.nvim", "mcauley-penney/tidy.nvim",
event = "VeryLazy",
config = function() config = function()
require("tidy").setup({ require("tidy").setup({
filetype_exclude = {}, filetype_exclude = {}
}) })
end end
}, },
@ -455,93 +396,57 @@ return require("lazy").setup({
dependencies = { 'nvim-lua/plenary.nvim' }, dependencies = { 'nvim-lua/plenary.nvim' },
config = function() config = function()
require 'todo-comments'.setup { require 'todo-comments'.setup {
signs = true,
sign_priority = 8,
keywords = { keywords = {
ERRO = { icon = Error_sign, color = "error" }, ERRO = { icon = Error_sign, color = "error" },
WARN = { icon = Warn_sign, color = "warning" }, WARN = { icon = Warn_sign, color = "warning" },
HACK = { icon = Hack_sign, color = "warning" }, HACK = { icon = Hack_sign, color = "warning" },
HINT = { icon = Hint_sign, color = "hint" }, HINT = { icon = Hint_sign, color = "hint" },
TODO = { icon = Todo_sign, color = "hint" }, TODO = { icon = Todo_sign, color = "info" },
INFO = { icon = Info_sign, color = "info", alt = { "NOTE" } }, INFO = { icon = Info_sign, color = "hint", alt = { "NOTE" } },
PERF = { icon = Perfect_sign, color = "perfect" }, PERF = { icon = Perfect_sign, color = "default" },
TEST = { icon = Test_sign, color = "test" }, TEST = { icon = Test_sign, color = "test" }
},
gui_style = {
fg = "NONE",
bg = "BOLD",
},
merge_keywords = true,
highlight = {
multiline = true,
multiline_pattern = "^.",
multiline_context = 10,
before = "",
keyword = "wide",
after = "fg",
pattern = [[.*<(KEYWORDS)\s*:]],
comments_only = true,
max_line_len = 400,
exclude = {},
},
colors = {
error = "DiagnosticSignError",
warning = "DiagnosticSignWarn",
hint = "DiagnosticSignHint",
info = "DiagnosticSignInfo",
perfect = "Special",
test = "Identifier",
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
pattern = [[\b(KEYWORDS):]],
},
} }
end, }
end
}, },
-- git wrapper -- git wrapper
'tpope/vim-fugitive',
-- golang language support
{ {
'fatih/vim-go', 'tpope/vim-fugitive',
ft = { 'go' }, event = "VeryLazy"
config = function()
vim.g.go_def_mapping_enabled = 0
end,
}, },
-- markdown language support -- markdown language support
{ {
'preservim/vim-markdown', 'preservim/vim-markdown',
ft = { 'markdown' }, ft = { 'markdown' },
dependencies = { 'godlygeek/tabular' },
config = function() config = function()
vim.g.vim_markdown_folding_style_pythonic = 1 vim.g.vim_markdown_folding_style_pythonic = 1
vim.g.vim_markdown_folding_disabled = 0 vim.g.vim_markdown_folding_disabled = 0
vim.g.vim_markdown_conceal = 2 vim.g.vim_markdown_conceal = 2
end, end
}, },
-- bulk renamer -- bulk renamer
{
'qpkorr/vim-renamer', 'qpkorr/vim-renamer',
event = "VeryLazy"
},
-- additional quote/parantheses funtions -- additional quote/parantheses funtions
'tpope/vim-surround', {
"kylechui/nvim-surround",
event = "VeryLazy",
config = function()
require("nvim-surround").setup()
end
},
-- colorscheme -- colorscheme
{ {
'tiyn/vim-tccs', 'tiyn/vim-tccs',
config = function() config = function()
vim.cmd('colorscheme tccs') vim.cmd('colorscheme tccs')
end, end
}, }
}) })

@ -8,6 +8,47 @@ Todo_sign = " "
Perfect_sign = "" Perfect_sign = ""
Test_sign = "" Test_sign = ""
Menu_signs = {
nvim_lsp = "",
path = "",
buffer = "",
luasnip = "",
}
Symbol_map = {
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 = ""
}
Install_icons = {
package_installed = "",
package_pending = "",
package_uninstalled = ""
}
vim.fn.sign_define( vim.fn.sign_define(
"DiagnosticSignError", "DiagnosticSignError",
{ texthl = "DiagnosticSignError", text = Error_sign, numhl = "DiagnosticSignError" } { texthl = "DiagnosticSignError", text = Error_sign, numhl = "DiagnosticSignError" }

Loading…
Cancel
Save