2022-06-14 09:07:55 -05:00
|
|
|
local lsp = require('lspconfig')
|
|
|
|
local util = lsp.util
|
|
|
|
|
|
|
|
local lspcap = require('cmp_nvim_lsp')
|
2022-10-21 09:14:17 -05:00
|
|
|
.default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
2022-06-14 09:07:55 -05:00
|
|
|
local lspatt = function(_, bufnr)
|
|
|
|
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
|
|
end
|
2022-04-03 21:05:52 -05:00
|
|
|
|
2022-08-03 15:22:00 -05:00
|
|
|
-- color scheme setup
|
|
|
|
vim.g.catppuccin_flavour = 'mocha'
|
|
|
|
require('catppuccin').setup()
|
|
|
|
vim.cmd [[colorscheme catppuccin]]
|
|
|
|
|
2023-01-14 07:51:16 -06:00
|
|
|
-- load snippets
|
|
|
|
require('luasnip.loaders.from_snipmate').lazy_load({
|
|
|
|
paths = "~/.config/nvim/snippets"
|
|
|
|
})
|
|
|
|
|
2022-06-09 18:00:28 -05:00
|
|
|
-- replace built in selector with telescope
|
|
|
|
require('telescope').setup {
|
|
|
|
extensions = {
|
|
|
|
["ui-select"] = {
|
|
|
|
require("telescope.themes").get_dropdown {
|
|
|
|
-- even more opts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
require('telescope').load_extension('ui-select')
|
2022-06-09 18:00:28 -05:00
|
|
|
|
2022-04-03 21:05:52 -05:00
|
|
|
-- autocomplete config
|
|
|
|
local cmp = require 'cmp'
|
|
|
|
cmp.setup {
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
2023-01-14 07:51:16 -06:00
|
|
|
require'luasnip'.lsp_expand(args.body)
|
2022-04-03 21:05:52 -05:00
|
|
|
end,
|
|
|
|
},
|
|
|
|
mapping = {
|
|
|
|
['<Tab>'] = cmp.mapping.select_next_item(),
|
|
|
|
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
|
|
|
['<CR>'] = cmp.mapping.confirm({
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
select = false,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
preselect = cmp.PreselectMode.None,
|
|
|
|
confirmation = { get_commit_characters = function(_) return {} end },
|
|
|
|
sources = {
|
2023-01-14 07:51:16 -06:00
|
|
|
{ name = 'nvim_lsp' },
|
2023-01-27 09:19:49 -06:00
|
|
|
{ name = 'luasnip' },
|
2022-04-03 21:05:52 -05:00
|
|
|
{ name = 'buffer' },
|
|
|
|
{ name = 'path' },
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
-- gitsigns
|
|
|
|
require('gitsigns').setup()
|
|
|
|
|
|
|
|
-- lsp configs
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.openscad_ls.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
2022-12-20 07:28:06 -06:00
|
|
|
local pid = vim.fn.getpid()
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.omnisharp.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
root_dir = function(file, _)
|
|
|
|
if file:sub(-#".csx") == ".csx" then
|
|
|
|
return util.path.dirname(file)
|
|
|
|
end
|
2023-02-10 17:06:22 -06:00
|
|
|
return util.root_pattern("*.sln")(file) or util.root_pattern("*.csproj")(file) or util.root_pattern("omnisharp.json")(file)
|
2022-04-03 21:05:52 -05:00
|
|
|
end,
|
2023-02-10 17:06:22 -06:00
|
|
|
cmd = { "/home/rudism/.local/share/omnisharp/OmniSharp" }, --"--languageserver" , "--hostPID", tostring(pid) },
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.tsserver.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.yamlls.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.ccls.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
|
|
|
local runtime_path = vim.split(package.path, ';')
|
|
|
|
table.insert(runtime_path, "lua/?.lua")
|
|
|
|
table.insert(runtime_path, "lua/?/init.lua")
|
2023-02-16 16:08:23 -06:00
|
|
|
lsp.lua_ls.setup {
|
2022-06-14 09:07:55 -05:00
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
cmd = { "lua-language-server", "-E" },
|
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
runtime = {
|
|
|
|
version = 'LuaJIT',
|
|
|
|
path = runtime_path,
|
|
|
|
},
|
|
|
|
diagnostics = {
|
|
|
|
globals = {'vim', 'use'},
|
|
|
|
},
|
|
|
|
workspace = {
|
|
|
|
library = vim.api.nvim_get_runtime_file("", true),
|
|
|
|
},
|
|
|
|
telemetry = {
|
|
|
|
enable = false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.perlpls.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
settings = {
|
|
|
|
perl = {
|
|
|
|
perlcritic = {
|
|
|
|
enabled = false
|
|
|
|
},
|
|
|
|
syntax = {
|
|
|
|
enabled = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.efm.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
2022-04-03 21:05:52 -05:00
|
|
|
filetypes = {"sh", "markdown"},
|
|
|
|
settings = {
|
|
|
|
languages = {
|
|
|
|
sh = {{
|
|
|
|
lintCommand = "shellcheck -f gcc -x",
|
|
|
|
lintSource = "shellcheck",
|
|
|
|
lintFormats = { "%f:%l:%c: %trror: %m", "%f:%l:%c: %tarning: %m", "%f:%l:%c: %tote: %m" },
|
|
|
|
lintIgnoreExitCode = true
|
|
|
|
}},
|
|
|
|
markdown = {{
|
|
|
|
lintCommand = "write-good --parse",
|
|
|
|
lintSource = "write-good",
|
|
|
|
lintFormats = { "%f:%l:%c:%m" },
|
|
|
|
}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-14 09:07:55 -05:00
|
|
|
lsp.pyright.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
|
|
|
}
|
|
|
|
-- setup for Arduboy dev
|
|
|
|
lsp.arduino_language_server.setup {
|
|
|
|
capabilities = lspcap,
|
|
|
|
on_attach = lspatt,
|
|
|
|
cmd = {
|
|
|
|
"arduino-language-server",
|
|
|
|
"-cli-config", "~/.arduino15/arduino-cli.yaml",
|
|
|
|
"-cli", "/bin/arduino-cli",
|
|
|
|
"-clangd", "/usr/bin/clangd",
|
|
|
|
"-fqbn", "arduino:avr:leonardo"
|
|
|
|
},
|
2022-04-23 08:29:32 -05:00
|
|
|
}
|
2022-04-03 21:05:52 -05:00
|
|
|
|
|
|
|
-- status line setup
|
|
|
|
require'lualine'.setup {
|
|
|
|
options = {
|
2022-08-03 15:22:00 -05:00
|
|
|
theme = 'catppuccin',
|
2022-04-03 21:05:52 -05:00
|
|
|
component_separators = { left = '', right = '' },
|
|
|
|
section_separators = { left = '', right = '' },
|
|
|
|
},
|
|
|
|
sections = {
|
|
|
|
lualine_a = {'mode'},
|
|
|
|
lualine_b = {'branch'},
|
|
|
|
lualine_c = {{
|
|
|
|
'filename',
|
|
|
|
symbols = {
|
|
|
|
modified = '✎ ',
|
|
|
|
readonly = '🔒 ',
|
|
|
|
unnamed = '[No Name]'
|
|
|
|
}
|
|
|
|
}},
|
|
|
|
lualine_x = {{
|
|
|
|
"diagnostics",
|
|
|
|
sources = {"nvim_lsp"},
|
|
|
|
icons_enabled = false
|
|
|
|
}},
|
|
|
|
lualine_y = {'progress'},
|
|
|
|
lualine_z = {'location'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-20 21:06:18 -05:00
|
|
|
-- zen mode config
|
|
|
|
require('true-zen').setup {
|
2022-08-29 21:51:59 -05:00
|
|
|
modes = {
|
|
|
|
ataraxis = {
|
|
|
|
callbacks = {
|
|
|
|
open_pre = function()
|
|
|
|
vim.opt.linebreak = true
|
2022-09-06 20:48:42 -05:00
|
|
|
vim.opt.spell = true
|
2022-08-29 21:51:59 -05:00
|
|
|
end,
|
|
|
|
close_post = function()
|
|
|
|
vim.opt.linebreak = false
|
2022-09-06 20:48:42 -05:00
|
|
|
vim.opt.spell = false
|
2022-08-29 21:51:59 -05:00
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2022-04-03 21:05:52 -05:00
|
|
|
integrations = {
|
|
|
|
tmux = true,
|
2022-08-20 21:06:18 -05:00
|
|
|
lualine = true
|
|
|
|
}
|
2022-04-03 21:05:52 -05:00
|
|
|
}
|
2022-08-29 21:51:59 -05:00
|
|
|
|
2023-03-21 12:23:27 -05:00
|
|
|
-- debug adapter protocol for .net core
|
|
|
|
local dap = require('dap')
|
|
|
|
dap.adapters.coreclr = {
|
|
|
|
type = 'executable',
|
|
|
|
command = '/home/rudism/.local/bin/netcoredbg',
|
|
|
|
args = {'--interpreter=vscode'},
|
|
|
|
}
|
|
|
|
dap.configurations.cs = {{
|
|
|
|
type = "coreclr",
|
|
|
|
name = "launch - netcoredbg",
|
|
|
|
request = "launch",
|
|
|
|
program = function()
|
|
|
|
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
|
|
|
|
end,
|
|
|
|
}}
|