Coder Social home page Coder Social logo

autocmd-lua's People

Contributors

n-p-e avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

autocmd-lua's Issues

Requesting help regarding a java filetype autocmd

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.