n-p-e / autocmd-lua Goto Github PK
View Code? Open in Web Editor NEWDefine Neovim autocommands without pain
License: MIT License
Define Neovim autocommands without pain
License: MIT License
local _, jdtls = lsp_installer.get_server("jdtls")
-- selene: allow(unused_variable)
---@diagnostic disable-next-line: unused-local
--local config = {
-- cmd = jdtls:get_default_options().cmd,
-- root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }),
-- capabilities = default_capabilities,
-- on_attach = default_on_attach,
-- }
-- cmd([[autocmd FileType java lua require('jdtls').start_or_attach(config)]])
require("autocmd-lua").augroup({
group = "nvim-jdtls",
autocmds = {
{
"FileType",
"java",
function()
require("jdtls").start_or_attach({
cmd = jdtls:get_default_options().cmd,
root_dir = require("jdtls.setup").find_root({ ".git", "mvnw", "gradlew" }),
capabilities = default_capabilities,
on_attach = default_on_attach,
})
end,
},
},
})
Hello. Since config
doesn't get valued inside cmd([[autocmd FileType java lua require('jdtls').start_or_attach(config)]])
I'm trying to find an alternative. While searching I came upon this repository which I think could solve my problem ( starting nvim-jdtls only for java files ). Could you please point out what exactly I'm doing wrong ?
Here is also the whole file for reference: https://0x0.st/orHv.lua
EDIT: and also the init.vim which sources this lua: https://0x0.st/or8S.vim
I was eventually able to solve this using a simple if vim.bo.filetype == "java" then
, I'm still curious about this but please feel free to close it if needed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.