Remove vim and add nvim config
This commit is contained in:
parent
92b6c017d1
commit
e06ce1a49a
26 changed files with 665 additions and 66 deletions
4
nvim/ftplugin/go.lua
Normal file
4
nvim/ftplugin/go.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.opt.spell = true
|
||||||
|
vim.opt.spelllang = "en_us"
|
||||||
|
vim.opt.colorcolumn = "120"
|
||||||
|
vim.opt.textwidth = 120
|
||||||
4
nvim/ftplugin/java.lua
Normal file
4
nvim/ftplugin/java.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.opt.spell = true
|
||||||
|
vim.opt.spelllang = "en_us"
|
||||||
|
vim.opt.colorcolumn = "120"
|
||||||
|
vim.opt.textwidth = 120
|
||||||
2
nvim/ftplugin/mail.vim
Normal file
2
nvim/ftplugin/mail.vim
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
setlocal colorcolumn=72
|
||||||
|
setlocal formatoptions+=aw
|
||||||
4
nvim/ftplugin/markdown.lua
Normal file
4
nvim/ftplugin/markdown.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.opt.spell = true
|
||||||
|
vim.opt.spelllang = "en_us"
|
||||||
|
vim.opt.colorcolumn = "80"
|
||||||
|
vim.opt.textwidth = 80
|
||||||
4
nvim/ftplugin/python.lua
Normal file
4
nvim/ftplugin/python.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
vim.opt.spell = true
|
||||||
|
vim.opt.spelllang = "en_us"
|
||||||
|
vim.opt.colorcolumn = "120"
|
||||||
|
vim.opt.textwidth = 80
|
||||||
3
nvim/ftplugin/tex.vim
Normal file
3
nvim/ftplugin/tex.vim
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
setlocal wrap
|
||||||
|
setlocal linebreak
|
||||||
|
setlocal nonumber
|
||||||
|
|
@ -7,14 +7,7 @@ set colorcolumn=120
|
||||||
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||||
let g:gruvbox_contrast_dark='hard'
|
let g:gruvbox_contrast_dark='hard'
|
||||||
let g:gruvbox_hls_cursor='red'
|
let g:gruvbox_hls_cursor='red'
|
||||||
colorscheme gruvbox
|
|
||||||
set tabpagemax=500
|
set tabpagemax=500
|
||||||
let g:airline#extensions#tabline#enabled = 1
|
|
||||||
let g:airline#extensions#tabline#show_buffers = 0
|
|
||||||
let g:airline#extensions#tabline#show_splits = 0
|
|
||||||
let g:airline#extensions#tabline#show_close_button = 0
|
|
||||||
let g:airline#extensions#tabline#show_tab_type = 0
|
|
||||||
let g:airline#extensions#tabline#tab_nr_type = 1
|
|
||||||
|
|
||||||
" Indentation
|
" Indentation
|
||||||
set smartindent
|
set smartindent
|
||||||
|
|
@ -22,6 +15,8 @@ set tabstop=4
|
||||||
set softtabstop=4
|
set softtabstop=4
|
||||||
set shiftwidth=4
|
set shiftwidth=4
|
||||||
set expandtab
|
set expandtab
|
||||||
|
set cursorcolumn
|
||||||
|
set cursorline
|
||||||
|
|
||||||
" Search
|
" Search
|
||||||
set incsearch
|
set incsearch
|
||||||
|
|
@ -36,6 +31,17 @@ set list
|
||||||
" Terminal mode
|
" Terminal mode
|
||||||
:tnoremap <Esc> <C-\><C-n>
|
:tnoremap <Esc> <C-\><C-n>
|
||||||
|
|
||||||
|
" File handling
|
||||||
|
set hidden
|
||||||
|
|
||||||
" Custom shortcuts
|
" Custom shortcuts
|
||||||
map gb :bn<cr>
|
map gb :bn<cr>
|
||||||
map gB :bp<cr>
|
map gB :bp<cr>
|
||||||
|
|
||||||
|
" Close the completion preview window (docstring) automatically
|
||||||
|
autocmd CompleteDone * pclose
|
||||||
|
|
||||||
|
" LSP config
|
||||||
|
lua <<EOF
|
||||||
|
require("config.lazy")
|
||||||
|
EOF
|
||||||
35
nvim/lua/config/lazy.lua
Normal file
35
nvim/lua/config/lazy.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||||
|
-- loading lazy.nvim so that mappings are correct.
|
||||||
|
-- This is also a good place to setup other settings (vim.opt)
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = "\\"
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup({
|
||||||
|
spec = {
|
||||||
|
-- import your plugins
|
||||||
|
{ import = "plugins" },
|
||||||
|
},
|
||||||
|
-- Configure any other settings here. See the documentation for more details.
|
||||||
|
-- colorscheme that will be used when installing plugins.
|
||||||
|
install = { colorscheme = { "habamax" } },
|
||||||
|
-- automatically check for plugin updates
|
||||||
|
checker = { enabled = false },
|
||||||
|
})
|
||||||
34
nvim/lua/plugins/cmp.lua
Normal file
34
nvim/lua/plugins/cmp.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
return {
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
event = "InsertEnter",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
|
["<C-e>"] = cmp.mapping.close(),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = true,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd([[
|
||||||
|
set completeopt=menuone,noinsert,noselect
|
||||||
|
highlight! default link CmpItemKind CmpItemMenuDefault
|
||||||
|
]])
|
||||||
|
end,
|
||||||
|
}
|
||||||
14
nvim/lua/plugins/colorscheme.lua
Normal file
14
nvim/lua/plugins/colorscheme.lua
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"ellisonleao/gruvbox.nvim",
|
||||||
|
priority = 1000 ,
|
||||||
|
config = true,
|
||||||
|
init = function()
|
||||||
|
require("gruvbox").setup({
|
||||||
|
contrast = "hard",
|
||||||
|
hls_cursor = "red",
|
||||||
|
})
|
||||||
|
vim.cmd("colorscheme gruvbox")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
9
nvim/lua/plugins/dap-go.lua
Normal file
9
nvim/lua/plugins/dap-go.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"leoluz/nvim-dap-go",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('dap-go').setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
9
nvim/lua/plugins/dap-python.lua
Normal file
9
nvim/lua/plugins/dap-python.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-dap-python",
|
||||||
|
dependencies = {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('dap-python').setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
29
nvim/lua/plugins/dap-ui.lua
Normal file
29
nvim/lua/plugins/dap-ui.lua
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
return {
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-neotest/nvim-nio",
|
||||||
|
{
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
|
||||||
|
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
|
||||||
|
},
|
||||||
|
opts = {},
|
||||||
|
config = function(_, opts)
|
||||||
|
local dap = require("dap")
|
||||||
|
local dapui = require("dapui")
|
||||||
|
dapui.setup(opts)
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||||
|
dapui.open({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
|
dapui.close({})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
35
nvim/lua/plugins/dap.lua
Normal file
35
nvim/lua/plugins/dap.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
dependencies = {
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
{
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<F11>", function() require("dap").continue() end, desc = "Continue" },
|
||||||
|
{ "<F6>", function() require("dap").step_over() end, desc = "Step over" },
|
||||||
|
{ "<F5>", function() require("dap").step_into() end, desc = "Step into" },
|
||||||
|
{ "<F12>", function() require("dap").step_out() end, desc = "Step out" },
|
||||||
|
{ "<space>b", function() require("dap").toggle_breakpoint() end, desc = "Toggle " },
|
||||||
|
{ "<leader>d", "", desc = "+debug", mode = {"n", "v"} },
|
||||||
|
{ "<leader>dB", function() require("dap").set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Breakpoint Condition" },
|
||||||
|
{ "<leader>db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" },
|
||||||
|
{ "<leader>dc", function() require("dap").continue() end, desc = "Continue" },
|
||||||
|
{ "<leader>da", function() require("dap").continue({ before = get_args }) end, desc = "Run with Args" },
|
||||||
|
{ "<leader>dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" },
|
||||||
|
{ "<leader>dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" },
|
||||||
|
{ "<leader>di", function() require("dap").step_into() end, desc = "Step Into" },
|
||||||
|
{ "<leader>dj", function() require("dap").down() end, desc = "Down" },
|
||||||
|
{ "<leader>dk", function() require("dap").up() end, desc = "Up" },
|
||||||
|
{ "<leader>dl", function() require("dap").run_last() end, desc = "Run Last" },
|
||||||
|
{ "<leader>do", function() require("dap").step_out() end, desc = "Step Out" },
|
||||||
|
{ "<leader>dO", function() require("dap").step_over() end, desc = "Step Over" },
|
||||||
|
{ "<leader>dp", function() require("dap").pause() end, desc = "Pause" },
|
||||||
|
{ "<leader>dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" },
|
||||||
|
{ "<leader>ds", function() require("dap").session() end, desc = "Session" },
|
||||||
|
{ "<leader>dt", function() require("dap").terminate() end, desc = "Terminate" },
|
||||||
|
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
|
||||||
|
},
|
||||||
|
}
|
||||||
6
nvim/lua/plugins/gitsigns.lua
Normal file
6
nvim/lua/plugins/gitsigns.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
config = function()
|
||||||
|
require("gitsigns").setup()
|
||||||
|
end
|
||||||
|
}
|
||||||
83
nvim/lua/plugins/jdtls.lua
Normal file
83
nvim/lua/plugins/jdtls.lua
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
return {
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
ft = "java",
|
||||||
|
config = function()
|
||||||
|
local jdtlsConfig = {
|
||||||
|
cmd = {'jdtls'},
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
require('jdtls').setup_dap({hotcodereplace = 'auto'})
|
||||||
|
require('jdtls.dap').setup_dap_main_class_configs()
|
||||||
|
end,
|
||||||
|
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
|
||||||
|
init_options = {
|
||||||
|
bundles = {
|
||||||
|
vim.fn.expand("$MASON/share/java-debug-adapter/com.microsoft.java.debug.core.jar"),
|
||||||
|
vim.fn.expand("$MASON/share/java-debug-adapter/com.microsoft.java.debug.plugin.jar"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
java = {
|
||||||
|
autobuild = {
|
||||||
|
enabled = true
|
||||||
|
},
|
||||||
|
debug = {
|
||||||
|
settings = {
|
||||||
|
hotCodeReplace = 'auto'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
autobuild = {
|
||||||
|
enabled = true
|
||||||
|
},
|
||||||
|
debug = {
|
||||||
|
settings = {
|
||||||
|
hotCodeReplace = 'auto'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
saveActions = {
|
||||||
|
organizeImports = true
|
||||||
|
},
|
||||||
|
signatureHelp = {
|
||||||
|
enabled = false,
|
||||||
|
description = {
|
||||||
|
enabled = false
|
||||||
|
},
|
||||||
|
},
|
||||||
|
format = {
|
||||||
|
enable = true,
|
||||||
|
settings = {
|
||||||
|
url = "/home/oliver/Dokumente/Gallery Systems/Products/GS Eclipse Formatter Java.xml"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local dap = require('dap')
|
||||||
|
dap.configurations.java = {{
|
||||||
|
type = 'java',
|
||||||
|
request = 'attach',
|
||||||
|
name = 'Debug (Attach) port 5005',
|
||||||
|
hostName = '127.0.0.1',
|
||||||
|
port = 5005,
|
||||||
|
},{
|
||||||
|
type = 'java',
|
||||||
|
request = 'attach',
|
||||||
|
name = 'Debug (Attach) port 5006',
|
||||||
|
hostName = '127.0.0.1',
|
||||||
|
port = 5006,
|
||||||
|
},{
|
||||||
|
type = 'java',
|
||||||
|
request = 'attach',
|
||||||
|
name = 'Debug (Attach) port 5105',
|
||||||
|
hostName = '127.0.0.1',
|
||||||
|
port = 5105,
|
||||||
|
}}
|
||||||
|
|
||||||
|
require('jdtls').start_or_attach(jdtlsConfig)
|
||||||
|
end,
|
||||||
|
}
|
||||||
46
nvim/lua/plugins/lspconfig.lua
Normal file
46
nvim/lua/plugins/lspconfig.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
return {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{ "<space>e", vim.diagnostic.open_float },
|
||||||
|
{ "[d", vim.diagnostic.goto_prev },
|
||||||
|
{ "]d", vim.diagnostic.goto_next },
|
||||||
|
{ "<space>q", vim.diagnostic.setloclist },
|
||||||
|
{ "gD", vim.lsp.buf.declaration },
|
||||||
|
{ "gd", vim.lsp.buf.definition },
|
||||||
|
{ "K", vim.lsp.buf.hover },
|
||||||
|
{ "gi", vim.lsp.buf.implementation },
|
||||||
|
{ "<C-k>", vim.lsp.buf.signature_help },
|
||||||
|
{ "<space>D", vim.lsp.buf.type_definition },
|
||||||
|
{ "<space>rn", vim.lsp.buf.rename },
|
||||||
|
{ "<space>ca", vim.lsp.buf.code_action },
|
||||||
|
{ "gr", vim.lsp.buf.references },
|
||||||
|
{
|
||||||
|
"<space>f",
|
||||||
|
function()
|
||||||
|
vim.lsp.buf.format { async = true }
|
||||||
|
end
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local nvim_lsp = require("lspconfig")
|
||||||
|
|
||||||
|
local protocol = require("vim.lsp.protocol")
|
||||||
|
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
-- Format on save
|
||||||
|
if client.server_capabilities.documentFormattingProvider then
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
group = vim.api.nvim_create_augroup("Format", { clear = true }),
|
||||||
|
buffer = bufnr,
|
||||||
|
callback = function()
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
7
nvim/lua/plugins/lualine.lua
Normal file
7
nvim/lua/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
|
config = function()
|
||||||
|
require("lualine").setup()
|
||||||
|
end,
|
||||||
|
}
|
||||||
129
nvim/lua/plugins/mason.lua
Normal file
129
nvim/lua/plugins/mason.lua
Normal file
|
|
@ -0,0 +1,129 @@
|
||||||
|
return {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
enabled = true,
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
ensure_installed = {
|
||||||
|
"jdtls",
|
||||||
|
"java-debug-adapter",
|
||||||
|
"sonarlint-language-server",
|
||||||
|
"gradle-language-server",
|
||||||
|
"html-lsp",
|
||||||
|
"json-lsp",
|
||||||
|
"typos-lsp"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup()
|
||||||
|
|
||||||
|
lspconfig = require "lspconfig"
|
||||||
|
|
||||||
|
-- Gradle
|
||||||
|
lspconfig.gradle_ls.setup{}
|
||||||
|
|
||||||
|
-- HTML
|
||||||
|
lspconfig.html.setup{}
|
||||||
|
|
||||||
|
-- JSON
|
||||||
|
lspconfig.jsonls.setup{}
|
||||||
|
|
||||||
|
-- Go
|
||||||
|
lspconfig.gopls.setup{
|
||||||
|
settings = {
|
||||||
|
gopls = {
|
||||||
|
gofumpt = true,
|
||||||
|
staticcheck = true,
|
||||||
|
analyses = {
|
||||||
|
unusedparams = true,
|
||||||
|
unusedresult = true,
|
||||||
|
unusedwrite = true,
|
||||||
|
unusedvariable = true,
|
||||||
|
useany = true,
|
||||||
|
fieldalignment = false,
|
||||||
|
nilness = true,
|
||||||
|
shadow = true,
|
||||||
|
},
|
||||||
|
hints = {
|
||||||
|
assignVariableTypes = true,
|
||||||
|
compositeLiteralFields = true,
|
||||||
|
compositeLiteralTypes = true,
|
||||||
|
constantValues = true,
|
||||||
|
functionTypeParameters = true,
|
||||||
|
parameterNames = true,
|
||||||
|
rangeVariableTypes = true,
|
||||||
|
},
|
||||||
|
codelenses = {
|
||||||
|
gc_details = true,
|
||||||
|
generate = true,
|
||||||
|
regenerate_cgo = true,
|
||||||
|
tidy = true,
|
||||||
|
upgrade_dependency = true,
|
||||||
|
vendor = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
-- Organize imports and format code on save
|
||||||
|
vim.api.nvim_create_autocmd({"BufWritePre"}, {
|
||||||
|
pattern = "*.go",
|
||||||
|
callback = function()
|
||||||
|
local params = vim.lsp.util.make_range_params()
|
||||||
|
params.context = {only = {"source.organizeImports"}}
|
||||||
|
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params)
|
||||||
|
for cid, res in pairs(result or {}) do
|
||||||
|
for _, r in pairs(res.result or {}) do
|
||||||
|
if r.edit then
|
||||||
|
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||||
|
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.lsp.buf.format({async = false})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Python
|
||||||
|
lspconfig.pylsp.setup{
|
||||||
|
settings = {
|
||||||
|
pylsp = {
|
||||||
|
plugins = {
|
||||||
|
autopep8 = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
yapf = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
pylint = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
pyflakes = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
pycodestyle = {
|
||||||
|
enabled = true,
|
||||||
|
ignore = {
|
||||||
|
'E402',
|
||||||
|
'W503',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
lspconfig.typos_lsp.setup({
|
||||||
|
settings = {
|
||||||
|
filetypes = {
|
||||||
|
'java',
|
||||||
|
'go'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
init_options = {
|
||||||
|
diagnosticSeverity = "Info",
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
17
nvim/lua/plugins/neo-tree.lua
Normal file
17
nvim/lua/plugins/neo-tree.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
return {
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v3.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("neo-tree").setup({
|
||||||
|
window = {
|
||||||
|
position = "left",
|
||||||
|
width = 50,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
44
nvim/lua/plugins/sonarlint.lua
Normal file
44
nvim/lua/plugins/sonarlint.lua
Normal file
|
|
@ -0,0 +1,44 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
url = "https://gitlab.com/schrieveslaach/sonarlint.nvim",
|
||||||
|
lazy = true,
|
||||||
|
ft = {"java", "go", "html", "python"},
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('sonarlint').setup({
|
||||||
|
server = {
|
||||||
|
cmd = {
|
||||||
|
'sonarlint-language-server',
|
||||||
|
'-stdio',
|
||||||
|
'-analyzers',
|
||||||
|
vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarjava.jar"),
|
||||||
|
vim.fn.expand("$MASON/share/sonarlint-analyzers/sonargo.jar"),
|
||||||
|
vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarhtml.jar"),
|
||||||
|
vim.fn.expand("$MASON/share/sonarlint-analyzers/sonarpython.jar"),
|
||||||
|
},
|
||||||
|
settings = {
|
||||||
|
sonarlint = {
|
||||||
|
test = "test",
|
||||||
|
disableTelemetry = true,
|
||||||
|
focusOnNewCode = true,
|
||||||
|
showAnalyzerLogs = true,
|
||||||
|
rules = {
|
||||||
|
['java:S1192'] = { level = 'off' },
|
||||||
|
['go:S1192'] = { level = 'off' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = {
|
||||||
|
'java',
|
||||||
|
'go',
|
||||||
|
'html',
|
||||||
|
'python',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
25
nvim/lua/plugins/telescope.lua
Normal file
25
nvim/lua/plugins/telescope.lua
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
return {
|
||||||
|
'nvim-telescope/telescope.nvim',
|
||||||
|
branch = '0.1.x',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim', "nvim-telescope/telescope-ui-select.nvim" },
|
||||||
|
keys = {
|
||||||
|
{ "<C-p>", "<cmd>Telescope<cr>" },
|
||||||
|
{ "<C-b>", "<cmd>Telescope buffers<cr>", desc = "Find luffers" },
|
||||||
|
{ "<A-r>", "<cmd>Telescope git_files<CR>", desc = "Find files" },
|
||||||
|
{ "<C-l>", "<cmd>Telescope lsp_document_symbols<CR>", desc = "Find symbols" },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local t = require("telescope")
|
||||||
|
t.load_extension("ui-select")
|
||||||
|
t.setup({
|
||||||
|
defaults = {
|
||||||
|
preview = false,
|
||||||
|
layout_config = {
|
||||||
|
vertical = {
|
||||||
|
width = 0.5,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
||||||
57
nvim/lua/plugins/treesitter.lua
Normal file
57
nvim/lua/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
event = {
|
||||||
|
"BufReadPre",
|
||||||
|
"BufNewFile",
|
||||||
|
},
|
||||||
|
build = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
local treesitter = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
|
treesitter.setup({
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true
|
||||||
|
},
|
||||||
|
autotag = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
ensure_installed = {
|
||||||
|
"json",
|
||||||
|
"javascript",
|
||||||
|
"yaml",
|
||||||
|
"html",
|
||||||
|
"css",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"bash",
|
||||||
|
"lua",
|
||||||
|
"vim",
|
||||||
|
"gitignore",
|
||||||
|
"rust",
|
||||||
|
},
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>",
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = false,
|
||||||
|
node_decremental = "<bs>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
disable = { "html" },
|
||||||
|
extended_mode = false,
|
||||||
|
max_file_lines = nil,
|
||||||
|
},
|
||||||
|
context_commentstring = {
|
||||||
|
enable = true,
|
||||||
|
enable_autocmd = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
52
nvim/lua/plugins/trouble.lua
Normal file
52
nvim/lua/plugins/trouble.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||||
|
cmd = "Trouble",
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>xx",
|
||||||
|
"<cmd>Trouble diagnostics toggle<cr>",
|
||||||
|
desc = "Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xX",
|
||||||
|
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||||
|
desc = "Buffer Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cs",
|
||||||
|
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||||
|
desc = "Symbols (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>cl",
|
||||||
|
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||||
|
desc = "LSP Definitions / references / ... (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xL",
|
||||||
|
"<cmd>Trouble loclist toggle<cr>",
|
||||||
|
desc = "Location List (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xQ",
|
||||||
|
"<cmd>Trouble qflist toggle<cr>",
|
||||||
|
desc = "Quickfix List (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xe",
|
||||||
|
"<cmd>Trouble diagnostics filter.severity=vim.diagnostic.severity.ERROR<cr>",
|
||||||
|
desc = "Error Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xw",
|
||||||
|
"<cmd>Trouble diagnostics filter.severity=vim.diagnostic.severity.WARN<cr>",
|
||||||
|
desc = "Warning Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"<leader>xi",
|
||||||
|
"<cmd>Trouble diagnostics filter.severity=vim.diagnostic.severity.INFO<cr>",
|
||||||
|
desc = "Info Diagnostics (Trouble)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
augroup filetypedetect
|
|
||||||
" Mail
|
|
||||||
autocmd BufRead,BufNewFile /tmp/evo* setfiletype mail
|
|
||||||
autocmd FileType mail setlocal colorcolumn=72
|
|
||||||
autocmd FileType mail setlocal formatoptions+=aw
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
|
|
||||||
" Break lines for tex-files
|
|
||||||
augroup WrapLineInTeXFile
|
|
||||||
autocmd!
|
|
||||||
autocmd FileType tex setlocal wrap
|
|
||||||
autocmd FileType tex setlocal linebreak
|
|
||||||
autocmd FileType tex setlocal nonumber
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup SpellCheck
|
|
||||||
autocmd!
|
|
||||||
autocmd FileType go setlocal spell spelllang=en_us
|
|
||||||
autocmd FileType java setlocal spell spelllang=en_us
|
|
||||||
autocmd FileType markdown setlocal spell spelllang=en_us
|
|
||||||
augroup END
|
|
||||||
|
|
||||||
augroup ColorColumn
|
|
||||||
autocmd!
|
|
||||||
autocmd FileType go setlocal colorcolumn=120
|
|
||||||
autocmd FileType java setlocal colorcolumn=120
|
|
||||||
autocmd FileType markdown setlocal colorcolumn=80
|
|
||||||
augroup END
|
|
||||||
30
vim/vimrc
30
vim/vimrc
|
|
@ -1,30 +0,0 @@
|
||||||
filetype plugin on
|
|
||||||
syntax on
|
|
||||||
set number
|
|
||||||
set nowrap
|
|
||||||
set wildmode=longest,list
|
|
||||||
set colorcolumn=80
|
|
||||||
let g:airline#extensions#tabline#enabled = 1
|
|
||||||
let g:airline#extensions#tabline#show_buffers = 0
|
|
||||||
let g:airline#extensions#tabline#show_splits = 0
|
|
||||||
let g:airline#extensions#tabline#show_close_button = 0
|
|
||||||
let g:airline#extensions#tabline#show_tab_type = 0
|
|
||||||
let g:airline#extensions#tabline#tab_nr_type = 1
|
|
||||||
|
|
||||||
" Indentation
|
|
||||||
set smartindent
|
|
||||||
set tabstop=4
|
|
||||||
set softtabstop=4
|
|
||||||
set shiftwidth=4
|
|
||||||
set expandtab
|
|
||||||
|
|
||||||
" Search
|
|
||||||
set incsearch
|
|
||||||
set hlsearch
|
|
||||||
set ignorecase
|
|
||||||
set smartcase
|
|
||||||
|
|
||||||
" Whitespaces
|
|
||||||
set listchars=tab:>-,trail:·
|
|
||||||
set list
|
|
||||||
:nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue