Nvim: More config :peepoHappy:

This commit is contained in:
Tobias Manske 2023-01-24 21:19:34 +01:00
parent 75a125c57f
commit d933f8866a
Signed by: tobias
GPG Key ID: E83C743C1FC2F79A

View File

@ -83,16 +83,18 @@ require('packer').startup(function(use)
use 'maxbrunsfeld/vim-yankstack' use 'maxbrunsfeld/vim-yankstack'
use 'ntpeters/vim-better-whitespace' use 'ntpeters/vim-better-whitespace'
use "rafamadriz/friendly-snippets"
use { use {
"zbirenbaum/copilot.lua", "zbirenbaum/copilot.lua",
cmd = "Copilot", cmd = "Copilot",
event = "InsertEnter", event = "InsertEnter",
config = function () config = function()
vim.schedule(function() vim.schedule(function()
require("copilot").setup() require("copilot").setup()
end) end)
end, end,
} }
use 'majutsushi/tagbar' use 'majutsushi/tagbar'
@ -102,8 +104,8 @@ require('packer').startup(function(use)
-- Todo comment highlight + diagnostics + navigation -- Todo comment highlight + diagnostics + navigation
use { use {
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
requires = "nvim-lua/plenary.nvim", requires = "nvim-lua/plenary.nvim",
} }
-- Smart Buffer management -- Smart Buffer management
@ -115,16 +117,31 @@ require('packer').startup(function(use)
use 'johann2357/nvim-smartbufs' use 'johann2357/nvim-smartbufs'
-- Latex preview -- Latex preview
use {'xuhdev/vim-latex-live-preview', ft = 'tex', bufread = true} use { 'xuhdev/vim-latex-live-preview', ft = 'tex', bufread = true }
-- LTeX local code actions -- LTeX local code actions
use { "barreiroleo/ltex-extra.nvim" } use { "barreiroleo/ltex-extra.nvim" }
-- DevOps Quatsch -- DevOps Quatsch
use {'cespare/vim-toml', ft = 'toml'} use { 'cespare/vim-toml', ft = 'toml' }
use {'mrk21/yaml-vim', ft = 'yaml'} use { 'mrk21/yaml-vim', ft = 'yaml' }
use {'hashivim/vim-terraform', ft = 'terraform'} use { 'hashivim/vim-terraform', ft = 'terraform' }
use {'pedrohdz/vim-yaml-folds', ft = 'yaml'} use { 'pedrohdz/vim-yaml-folds', ft = 'yaml' }
use {
"folke/zen-mode.nvim",
config = function()
require("zen-mode").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
end
}
use {
"SmiteshP/nvim-navic",
requires = "neovim/nvim-lspconfig"
}
-- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua -- Add custom plugins to packer from ~/.config/nvim/lua/custom/plugins.lua
local has_plugins, plugins = pcall(require, 'custom.plugins') local has_plugins, plugins = pcall(require, 'custom.plugins')
@ -232,6 +249,38 @@ vim.api.nvim_create_autocmd('TextYankPost', {
pattern = '*', pattern = '*',
}) })
require('nvim-navic').setup {
icons = {
File = '',
Module = '',
Namespace = '',
Package = '',
Class = '',
Method = '',
Property = '',
Field = '',
Constructor = '',
Enum = '',
Interface = '',
Function = '',
Variable = '',
Constant = '',
String = '',
Number = '',
Boolean = '',
Array = '',
Object = '',
Key = '',
Null = '',
EnumMember = '',
Struct = '',
Event = '',
Operator = '',
TypeParameter = ''
},
highlight = true,
}
-- Set lualine as statusline -- Set lualine as statusline
-- See `:help lualine.txt` -- See `:help lualine.txt`
require('lualine').setup { require('lualine').setup {
@ -241,6 +290,11 @@ require('lualine').setup {
component_separators = '|', component_separators = '|',
section_separators = '', section_separators = '',
}, },
sections = {
lualine_c = {
{ require('nvim-navic').get_location, cond = require('nvim-navic').is_available }
}
}
} }
require("bufferline").setup {} require("bufferline").setup {}
@ -368,16 +422,12 @@ require('nvim-treesitter.configs').setup {
} }
require("todo-comments").setup { require("todo-comments").setup {
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the configuration section below -- refer to the configuration section below
} }
local nmap = function(keys, func, desc) local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { desc = desc }) vim.keymap.set('n', keys, func, { desc = desc })
end end
@ -398,6 +448,7 @@ vim.api.nvim_create_autocmd('BufEnter', {
pattern = "*[^(.rmd|.snippets)]", pattern = "*[^(.rmd|.snippets)]",
command = "EnableStripWhitespaceOnSave" command = "EnableStripWhitespaceOnSave"
}) })
vim.api.nvim_create_autocmd('BufEnter', { vim.api.nvim_create_autocmd('BufEnter', {
pattern = "*.snippets", pattern = "*.snippets",
command = "DisableStripWhitespaceOnSave" command = "DisableStripWhitespaceOnSave"
@ -445,12 +496,12 @@ local on_attach = function(client, bufnr)
if client.name == "ltex" then if client.name == "ltex" then
print("loaded ltex extra") print("loaded ltex extra")
require("ltex_extra").setup{ require("ltex_extra").setup {
load_langs = { "de-DE", "en-US" }, -- table <string> : languages for witch dictionaries will be loaded load_langs = { "de-DE", "en-US" }, -- table <string> : languages for witch dictionaries will be loaded
init_check = true, -- boolean : whether to load dictionaries on startup init_check = true, -- boolean : whether to load dictionaries on startup
path = "/home/rad4day/.config/nvim/ltex", -- string : path to store dictionaries. Relative path uses current working directory path = "/home/rad4day/.config/nvim/ltex", -- string : path to store dictionaries. Relative path uses current working directory
log_level = "none", -- string : "none", "trace", "debug", "info", "warn", "error", "fatal" log_level = "none", -- string : "none", "trace", "debug", "info", "warn", "error", "fatal"
} }
end end
-- many times. -- many times.
@ -482,6 +533,7 @@ local on_attach = function(client, bufnr)
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
nmap('<leader>bf', vim.lsp.buf.format, '[B]uffer: [F]ormat')
nmap('<leader>wl', function() nmap('<leader>wl', function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders())) print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, '[W]orkspace [L]ist Folders') end, '[W]orkspace [L]ist Folders')
@ -490,6 +542,11 @@ local on_attach = function(client, bufnr)
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format() vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' }) end, { desc = 'Format current buffer with LSP' })
-- Enable navic
if client.server_capabilities.documentSymbolProvider then
require('nvim-navic').attach(client, bufnr)
end
end end
-- Enable the following language servers -- Enable the following language servers
@ -501,22 +558,29 @@ local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
pyright = {}, pyright = {},
bashls = {},
ansiblels = {},
marksman = {},
rust_analyzer = {}, rust_analyzer = {},
yamlls = {},
texlab = {}, -- latex texlab = {}, -- latex
ltex = { ltex = {
language = 'en-US', ltex = {
languageToolHttpServerUri = 'http://localhost:8081', language = 'en-US',
additionalRules = { languageToolHttpServerUri = 'http://localhost:8081',
enablePickyRules = true, checkFrequency = "save",
motherTongue = 'de-DE', additionalRules = {
}, enablePickyRules = true,
-- dictionary = { motherTongue = 'de-DE',
-- customEntries = { },
-- 'foo', -- dictionary = {
-- 'bar', -- customEntries = {
-- }, -- 'foo',
-- }, -- 'bar',
}, -- languagetool -- },
-- },
}, -- languagetool
},
-- tsserver = {}, -- tsserver = {},
sumneko_lua = { sumneko_lua = {
@ -604,5 +668,40 @@ cmp.setup {
}, },
} }
require("luasnip.loaders.from_vscode").lazy_load()
local hl = vim.api.nvim_set_hl
-- Navic
hl(0, "NavicIconsFile", { link = 'CmpItemKindFile' })
hl(0, "NavicIconsModule", { link = 'CmpItemKindModule' })
hl(0, "NavicIconsNamespace", { link = 'CmpItemKindModule' })
hl(0, "NavicIconsPackage", { link = 'CmpItemKindModule' })
hl(0, "NavicIconsClass", { link = 'CmpItemKindClass' })
hl(0, "NavicIconsMethod", { link = 'CmpItemKindMethod' })
hl(0, "NavicIconsProperty", { link = 'CmpItemKindProperty' })
hl(0, "NavicIconsField", { link = 'CmpItemKindField' })
hl(0, "NavicIconsConstructor", { link = 'CmpItemKindConstructor' })
hl(0, "NavicIconsEnum", { link = 'CmpItemKindEnum' })
hl(0, "NavicIconsInterface", { link = 'CmpItemKindInterface' })
hl(0, "NavicIconsFunction", { link = 'CmpItemKindFunction' })
hl(0, "NavicIconsVariable", { link = 'CmpItemKindVariable' })
hl(0, "NavicIconsConstant", { link = 'CmpItemKindConstant' })
hl(0, "NavicIconsString", { link = 'String' })
hl(0, "NavicIconsNumber", { link = 'Number' })
hl(0, "NavicIconsBoolean", { link = 'Boolean' })
hl(0, "NavicIconsArray", { link = 'CmpItemKindClass' })
hl(0, "NavicIconsObject", { link = 'CmpItemKindClass' })
hl(0, "NavicIconsKey", { link = 'CmpItemKindKeyword' })
hl(0, "NavicIconsKeyword", { link = 'CmpItemKindKeyword' })
hl(0, "NavicIconsNull", { link = '@none' })
hl(0, "NavicIconsEnumMember", { link = 'CmpItemKindEnumMember' })
hl(0, "NavicIconsStruct", { link = 'CmpItemKindStruct' })
hl(0, "NavicIconsEvent", { link = 'CmpItemKindEvent' })
hl(0, "NavicIconsOperator", { link = 'CmpItemKindOperator' })
hl(0, "NavicIconsTypeParameter", { link = 'CmpItemKindTypeParameter' })
hl(0, "NavicText", { link = '@keyword' })
hl(0, "NavicSeparator", { link = '@punctuation.delimiter' })
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et