Nvim: More config :peepoHappy:
This commit is contained in:
parent
75a125c57f
commit
d933f8866a
183
nvim/init.lua
183
nvim/init.lua
@ -83,16 +83,18 @@ require('packer').startup(function(use)
|
||||
use 'maxbrunsfeld/vim-yankstack'
|
||||
use 'ntpeters/vim-better-whitespace'
|
||||
|
||||
use "rafamadriz/friendly-snippets"
|
||||
|
||||
use {
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function ()
|
||||
vim.schedule(function()
|
||||
require("copilot").setup()
|
||||
end)
|
||||
end,
|
||||
}
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
vim.schedule(function()
|
||||
require("copilot").setup()
|
||||
end)
|
||||
end,
|
||||
}
|
||||
|
||||
use 'majutsushi/tagbar'
|
||||
|
||||
@ -102,8 +104,8 @@ require('packer').startup(function(use)
|
||||
|
||||
-- Todo comment highlight + diagnostics + navigation
|
||||
use {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
}
|
||||
|
||||
-- Smart Buffer management
|
||||
@ -115,16 +117,31 @@ require('packer').startup(function(use)
|
||||
use 'johann2357/nvim-smartbufs'
|
||||
|
||||
-- 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
|
||||
use { "barreiroleo/ltex-extra.nvim" }
|
||||
|
||||
-- DevOps Quatsch
|
||||
use {'cespare/vim-toml', ft = 'toml'}
|
||||
use {'mrk21/yaml-vim', ft = 'yaml'}
|
||||
use {'hashivim/vim-terraform', ft = 'terraform'}
|
||||
use {'pedrohdz/vim-yaml-folds', ft = 'yaml'}
|
||||
use { 'cespare/vim-toml', ft = 'toml' }
|
||||
use { 'mrk21/yaml-vim', ft = 'yaml' }
|
||||
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')
|
||||
@ -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 {}
|
||||
@ -368,16 +422,12 @@ require('nvim-treesitter.configs').setup {
|
||||
}
|
||||
|
||||
require("todo-comments").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
}
|
||||
|
||||
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"
|
||||
@ -445,12 +496,12 @@ local on_attach = function(client, bufnr)
|
||||
|
||||
if client.name == "ltex" then
|
||||
print("loaded ltex extra")
|
||||
require("ltex_extra").setup{
|
||||
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
|
||||
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"
|
||||
}
|
||||
require("ltex_extra").setup {
|
||||
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
|
||||
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"
|
||||
}
|
||||
end
|
||||
|
||||
-- many times.
|
||||
@ -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,22 +558,29 @@ local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
pyright = {},
|
||||
bashls = {},
|
||||
ansiblels = {},
|
||||
marksman = {},
|
||||
rust_analyzer = {},
|
||||
yamlls = {},
|
||||
texlab = {}, -- latex
|
||||
ltex = {
|
||||
language = 'en-US',
|
||||
languageToolHttpServerUri = 'http://localhost:8081',
|
||||
additionalRules = {
|
||||
enablePickyRules = true,
|
||||
motherTongue = 'de-DE',
|
||||
},
|
||||
-- dictionary = {
|
||||
-- customEntries = {
|
||||
-- 'foo',
|
||||
-- 'bar',
|
||||
-- },
|
||||
-- },
|
||||
}, -- languagetool
|
||||
ltex = {
|
||||
language = 'en-US',
|
||||
languageToolHttpServerUri = 'http://localhost:8081',
|
||||
checkFrequency = "save",
|
||||
additionalRules = {
|
||||
enablePickyRules = true,
|
||||
motherTongue = 'de-DE',
|
||||
},
|
||||
-- dictionary = {
|
||||
-- customEntries = {
|
||||
-- 'foo',
|
||||
-- 'bar',
|
||||
-- },
|
||||
-- },
|
||||
}, -- 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
|
||||
|
Loading…
Reference in New Issue
Block a user