summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/custom/config
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/custom/config')
-rw-r--r--.config/nvim/lua/custom/config/language-servers.lua47
-rw-r--r--.config/nvim/lua/custom/config/lsp.lua8
-rw-r--r--.config/nvim/lua/custom/config/options.lua3
-rw-r--r--.config/nvim/lua/custom/config/rustaceanvim.lua32
4 files changed, 64 insertions, 26 deletions
diff --git a/.config/nvim/lua/custom/config/language-servers.lua b/.config/nvim/lua/custom/config/language-servers.lua
index 1165994..2d824d0 100644
--- a/.config/nvim/lua/custom/config/language-servers.lua
+++ b/.config/nvim/lua/custom/config/language-servers.lua
@@ -1,29 +1,28 @@
-- NOTE: A list of language servers (and potentially their config)
-- Accepts either true to enable, false to disable or a table with settings
return {
- -- lua_ls = {
- -- settings = {
- -- diagnostics = {
- -- globals = { 'vim' },
- -- },
- -- workspace = {
- -- library = {
- -- [vim.fn.expand('$VIMRUNTIME/lua')] = true,
- -- [vim.fn.stdpath('config') .. '/lua'] = true,
- -- },
- -- },
- -- },
- -- }, -- lua
- lua_ls = true, -- lua
- clangd = true, -- C/C++
- gradle_ls = true, -- java package manager
- jdtls = true, -- java eclipse lsp
+ lua_ls = {
+ settings = {
+ diagnostics = {
+ globals = { 'vim' },
+ },
+ workspace = {
+ library = {
+ [vim.fn.expand('$VIMRUNTIME/lua')] = true,
+ [vim.fn.stdpath('config') .. '/lua'] = true,
+ },
+ },
+ },
+ }, -- lua
+ clangd = true, -- C/C++
+ gradle_ls = true, -- java package manager
+ jdtls = true, -- java eclipse lsp
kotlin_language_server = true, -- kotlin
- pyright = true, -- python
- rust_analyzer = true, -- rust
- bashls = true, -- bash
- taplo = true, -- toml
- lemminx = true, -- xml
- yamlls = true, -- yaml
- jsonls = true, -- json
+ pyright = true, -- python
+ rust_analyzer = false, -- NOTE: using rustaceanvim
+ bashls = true, -- bash
+ taplo = true, -- toml
+ lemminx = true, -- xml
+ yamlls = true, -- yaml
+ jsonls = true, -- json
}
diff --git a/.config/nvim/lua/custom/config/lsp.lua b/.config/nvim/lua/custom/config/lsp.lua
index c99c4e5..3e43452 100644
--- a/.config/nvim/lua/custom/config/lsp.lua
+++ b/.config/nvim/lua/custom/config/lsp.lua
@@ -1,8 +1,11 @@
+local lspconfig = require('lspconfig')
local capabilities = require('cmp_nvim_lsp').default_capabilities()
-local servers = require('custom.config.language-servers')
-local lspconfig = require('lspconfig')
+local servers = require('custom.config.language-servers')
for name, config in pairs(servers) do
+ if config == false then
+ goto continue
+ end
if config == true then
---@diagnostic disable-next-line: cast-local-type
config = {}
@@ -13,6 +16,7 @@ for name, config in pairs(servers) do
}, config)
lspconfig[name].setup(config)
+ ::continue::
end
vim.api.nvim_create_autocmd('LspAttach', {
diff --git a/.config/nvim/lua/custom/config/options.lua b/.config/nvim/lua/custom/config/options.lua
index 9ee0fd0..b96d19b 100644
--- a/.config/nvim/lua/custom/config/options.lua
+++ b/.config/nvim/lua/custom/config/options.lua
@@ -44,3 +44,6 @@ vim.g.loaded_node_provider = 0
vim.g.loaded_perl_provider = 0
vim.g.loaded_ruby_provider = 0
vim.g.loaded_python3_provider = 0
+
+-- LSP
+vim.lsp.inlay_hint.enable()
diff --git a/.config/nvim/lua/custom/config/rustaceanvim.lua b/.config/nvim/lua/custom/config/rustaceanvim.lua
new file mode 100644
index 0000000..b8c2c1b
--- /dev/null
+++ b/.config/nvim/lua/custom/config/rustaceanvim.lua
@@ -0,0 +1,32 @@
+---@type RustaceanOpts
+vim.g.rustaceanvim = {
+ ---@type RustaceanToolsOpts
+ tools = {
+ float_win_config = {
+ border = 'rounded',
+ },
+ },
+ ---@type RustaceanLspClientOpts
+ server = {
+ on_attach = function(_, bufnr)
+ local keymaps = {
+ { { 'n', 'i' }, '<M-Enter>', '<cmd>RustLsp codeAction<cr>', { desc = 'Code Action' } },
+ }
+
+ for _, keymap in ipairs(keymaps) do
+ local modes = keymap[1]
+ local lhs = keymap[2]
+ local rhs = keymap[3]
+ local opts = keymap[4]
+ opts.buffer = bufnr
+
+ vim.keymap.set(modes, lhs, rhs, opts)
+ end
+ end,
+ default_settings = {
+ ['rust-analyzer'] = {},
+ },
+ },
+ ---@type RustaceanDapOpts
+ dap = {},
+}