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,6 +83,8 @@ require('packer').startup(function(use)
use 'maxbrunsfeld/vim-yankstack'
use 'ntpeters/vim-better-whitespace'
use "rafamadriz/friendly-snippets"
use {
"zbirenbaum/copilot.lua",
cmd = "Copilot",
@ -126,6 +128,21 @@ require('packer').startup(function(use)
use { 'hashivim/vim-terraform', ft = 'terraform' }
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
local has_plugins, plugins = pcall(require, 'custom.plugins')
if has_plugins then
@ -232,6 +249,38 @@ vim.api.nvim_create_autocmd('TextYankPost', {
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
-- See `:help lualine.txt`
require('lualine').setup {
@ -241,6 +290,11 @@ require('lualine').setup {
component_separators = '|',
section_separators = '',
},
sections = {
lualine_c = {
{ require('nvim-navic').get_location, cond = require('nvim-navic').is_available }
}
}
}
require("bufferline").setup {}
@ -374,10 +428,6 @@ require("todo-comments").setup {
}
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { desc = desc })
end
@ -398,6 +448,7 @@ vim.api.nvim_create_autocmd('BufEnter', {
pattern = "*[^(.rmd|.snippets)]",
command = "EnableStripWhitespaceOnSave"
})
vim.api.nvim_create_autocmd('BufEnter', {
pattern = "*.snippets",
command = "DisableStripWhitespaceOnSave"
@ -482,6 +533,7 @@ local on_attach = function(client, bufnr)
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>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()
print(vim.inspect(vim.lsp.buf.list_workspace_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.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
-- Enable navic
if client.server_capabilities.documentSymbolProvider then
require('nvim-navic').attach(client, bufnr)
end
end
-- Enable the following language servers
@ -501,11 +558,17 @@ local servers = {
-- clangd = {},
-- gopls = {},
pyright = {},
bashls = {},
ansiblels = {},
marksman = {},
rust_analyzer = {},
yamlls = {},
texlab = {}, -- latex
ltex = {
ltex = {
language = 'en-US',
languageToolHttpServerUri = 'http://localhost:8081',
checkFrequency = "save",
additionalRules = {
enablePickyRules = true,
motherTongue = 'de-DE',
@ -517,6 +580,7 @@ local servers = {
-- },
-- },
}, -- languagetool
},
-- tsserver = {},
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`
-- vim: ts=2 sts=2 sw=2 et