From 798b75923aceb7844e13cd798105bdd7d37a0882 Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Mon, 27 Nov 2023 14:02:51 -0700 Subject: [PATCH] Add neovim apex support --- .config/nvim/lua/config/autocmds.lua | 14 ++++++++++++++ .config/nvim/lua/plugins/apex.lua | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .config/nvim/lua/plugins/apex.lua diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 27e9e06..cdd9edf 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,3 +1,17 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here + +local function augroup(name) + return vim.api.nvim_create_augroup("kevin_" .. name, { clear = true }) +end + +vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + group = augroup("filetypes"), + pattern = { "*.cls" }, + callback = function(event) + vim.bo[event.buf].filetype = "apex" + vim.bo[event.buf].shiftwidth = 4 + vim.bo[event.buf].tabstop = 4 + end, +}) diff --git a/.config/nvim/lua/plugins/apex.lua b/.config/nvim/lua/plugins/apex.lua new file mode 100644 index 0000000..1486cb9 --- /dev/null +++ b/.config/nvim/lua/plugins/apex.lua @@ -0,0 +1,28 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { + "apex", + }) + end, + }, + { + "williamboman/mason.nvim", + opts = function(_, opts) + vim.list_extend(opts.ensure_installed, { + "apex-language-server", + }) + end, + }, + { + "neovim/nvim-lspconfig", + opts = { + servers = { + apex_ls = { + filetypes = { "apex", "apexcode" }, + }, + }, + }, + }, +}