Nvim: More config :peepoHappy:
This commit is contained in:
parent
75a125c57f
commit
d933f8866a
107
nvim/init.lua
107
nvim/init.lua
@ -83,6 +83,8 @@ 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",
|
||||||
@ -126,6 +128,21 @@ require('packer').startup(function(use)
|
|||||||
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')
|
||||||
if has_plugins then
|
if has_plugins then
|
||||||
@ -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 {}
|
||||||
@ -374,10 +428,6 @@ require("todo-comments").setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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"
|
||||||
@ -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,11 +558,17 @@ local servers = {
|
|||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
-- gopls = {},
|
||||||
pyright = {},
|
pyright = {},
|
||||||
|
bashls = {},
|
||||||
|
ansiblels = {},
|
||||||
|
marksman = {},
|
||||||
rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
|
yamlls = {},
|
||||||
texlab = {}, -- latex
|
texlab = {}, -- latex
|
||||||
|
ltex = {
|
||||||
ltex = {
|
ltex = {
|
||||||
language = 'en-US',
|
language = 'en-US',
|
||||||
languageToolHttpServerUri = 'http://localhost:8081',
|
languageToolHttpServerUri = 'http://localhost:8081',
|
||||||
|
checkFrequency = "save",
|
||||||
additionalRules = {
|
additionalRules = {
|
||||||
enablePickyRules = true,
|
enablePickyRules = true,
|
||||||
motherTongue = 'de-DE',
|
motherTongue = 'de-DE',
|
||||||
@ -517,6 +580,7 @@ local servers = {
|
|||||||
-- },
|
-- },
|
||||||
-- },
|
-- },
|
||||||
}, -- 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
|
||||||
|
Loading…
Reference in New Issue
Block a user