4 votes

So you want to write Java in Neovim

13 comments

  1. tobii
    Link
    I have a similar Neovim config for Java as the one in the article and I have to say the experience still feels inferior to other languages. I think the problem is the Java ecosystem, not Neovim...

    I have a similar Neovim config for Java as the one in the article and I have to say the experience still feels inferior to other languages.
    I think the problem is the Java ecosystem, not Neovim though...
    I've mainly used Maven and Gradle so maybe someone with more experience isn't facing the same pain points. Everything feels slow and convoluted, especially setup and configuration for new projects. Java is the only language I still sometimes use an IDE with (IntelliJ with Vim mode). Configuring projects (with version control) is still something I never know if I'm doing it right or not...

    It would be cool if the author talked a bit more about some examples and their workflows when working on their Java projects.

    4 votes
  2. [12]
    lou
    Link
    Neovim lost me in the transition to Lua. For a non-programmer like me, simple plug-in configurations became very convoluted. I already have Emacs for the complex side of things. Neovim is for real...

    Neovim lost me in the transition to Lua. For a non-programmer like me, simple plug-in configurations became very convoluted. I already have Emacs for the complex side of things. Neovim is for real programmers now.

    1 vote
    1. [11]
      fxgn
      Link Parent
      How did plugin setup become more complicated? For most plugins, it's simply require("plugin").setup({ option1 = "foo", option2 = 123 })

      How did plugin setup become more complicated? For most plugins, it's simply

      require("plugin").setup({
        option1 = "foo",
        option2 = 123
      })
      
      2 votes
      1. [10]
        lou
        (edited )
        Link Parent
        The fact that you find this simple already kinda proves my point. That's already about 3 more lines than it would have been before. Also, I can never navigate all the parenthesis in order to...

        The fact that you find this simple already kinda proves my point.

        That's already about 3 more lines than it would have been before. Also, I can never navigate all the parenthesis in order to "extract" whatever setting I want and then make it work as a snippet without copying the whole thing. I used to be able to simply copy-pasting whatever I wanted and change the switches I wanted. It's too much syntax for me now.

        I mean... do you really think a regular user that is not a programmer can discern how to use this without simply copying the whole thing, making their init.vim a huge mess (when you add all the other plugins)?

        local cfg = {
          explorer = {
            cmd = "nnn",       -- command override (-F1 flag is implied, -a flag is invalid!)
            width = 24,        -- width of the vertical split
            side = "topleft",  -- or "botright", location of the explorer window
            session = "",      -- or "global" / "local" / "shared"
            tabs = true,       -- separate nnn instance per tab
            fullscreen = true, -- whether to fullscreen explorer window when current tab is empty
          },
          picker = {
            cmd = "nnn",       -- command override (-p flag is implied)
            style = {
              width = 0.9,     -- percentage relative to terminal size when < 1, absolute otherwise
              height = 0.8,    -- ^
              xoffset = 0.5,   -- ^
              yoffset = 0.5,   -- ^
              border = "single"-- border decoration for example "rounded"(:h nvim_open_win)
            },
            session = "",      -- or "global" / "local" / "shared"
            tabs = true,       -- separate nnn instance per tab
            fullscreen = true, -- whether to fullscreen picker window when current tab is empty
          },
          auto_open = {
            setup = nil,       -- or "explorer" / "picker", auto open on setup function
            tabpage = nil,     -- or "explorer" / "picker", auto open when opening new tabpage
            empty = false,     -- only auto open on empty buffer
            ft_ignore = {      -- dont auto open for these filetypes
              "gitcommit",
            }
          },
          auto_close = false,  -- close tabpage/nvim when nnn is last window
          replace_netrw = nil, -- or "explorer" / "picker"
          mappings = {},       -- table containing mappings, see below
          windownav = {        -- window movement mappings to navigate out of nnn
            left = "<C-w>h",
            right = "<C-w>l",
            next = "<C-w>w",
            prev = "<C-w>W",
          },
          buflisted = false,   -- whether or not nnn buffers show up in the bufferlist
          quitcd = nil,        -- or "cd" / tcd" / "lcd", command to run on quitcd file if found
          offset = false,      -- whether or not to write position offset to tmpfile(for use in preview-tui)
        }
        

        I have absolutely no idea what to do with this. And I tried. There was always something wrong. A parenthesis, a curly brace, a comma, whatever. The only thing that worked for me was asking GPT, but it didn't work every time.

        I also am entirely sure that professional programmers will find this trivial.

        I am not a programmer. Neovim is great, it's not for me anymore. It's fine. I went back to Vim.

        2 votes
        1. [2]
          Akir
          Link Parent
          I’m gonna be the guy who tells you to just learn Lua. It’s bad that you should need to learn it to use the program you like. But I’ll dare to say that I actually find Lua fun. I first got serious...

          I’m gonna be the guy who tells you to just learn Lua.

          It’s bad that you should need to learn it to use the program you like. But I’ll dare to say that I actually find Lua fun. I first got serious about it playing with the playdate SDK but now I’m actually starting another game project with it for PC using Löve and I’m having a grand time even though it’s very out of my wheelhouse.

          3 votes
          1. lou
            (edited )
            Link Parent
            No problem, but I'm not learning Lua! :P I am not a developer. That is not my job, so learning Lua will bring nothing for me. I just like to use certain tools that programmers also use. I have no...

            No problem, but I'm not learning Lua! :P

            I am not a developer. That is not my job, so learning Lua will bring nothing for me. I just like to use certain tools that programmers also use. I have no wish to be a computer programmer at all. Although being left behind did annoy me, Neovim does not exist for people like me. It worked for me but I am using Vim now. It's fine.

            3 votes
        2. [2]
          jackson
          Link Parent
          For what it's worth, someone will feel this way about basically any configuration interface. I despise YAML, some hate JSON, others find TOML confusing, and you don't care for Lua :) For basic vim...

          For what it's worth, someone will feel this way about basically any configuration interface. I despise YAML, some hate JSON, others find TOML confusing, and you don't care for Lua :)

          For basic vim settings, I believe you can configure them with the exact same markup as vim in neovim. I am by no means an expert on this though.

          3 votes
          1. lou
            Link Parent
            The real problem are the plug-ins. My view is that Vimscript was perfect for me, a dumb tool for a dumb user. Neovim/Lua is not bad, I think, I'm just not the target audience. It's annoying that I...

            The real problem are the plug-ins.

            My view is that Vimscript was perfect for me, a dumb tool for a dumb user. Neovim/Lua is not bad, I think, I'm just not the target audience. It's annoying that I can't use it anymore, but I'll live. Neovim/Lua seems ideal for their target audience: computer programmers. I just happen to not be a computer programmer.

            1 vote
        3. fxgn
          Link Parent
          I'm not sure what the benefits of vim are though. Neovim is fully backwards compatible, so you can just continue using vim plugins and writing your config in Vimscript if you like that. And you...

          I went back to Vim.

          I'm not sure what the benefits of vim are though. Neovim is fully backwards compatible, so you can just continue using vim plugins and writing your config in Vimscript if you like that. And you get some other benefits of neovim like more modern standard support and better defaults.

          3 votes
        4. [4]
          hungariantoast
          Link Parent
          Ironically, your editor should make these syntax errors trivial to spot and fix, such as how Emacs will automatically highlight unbalanced parentheses and braces. Does Neovim not do the same?

          There was always something wrong. A parenthesis, a curly brace, a comma, whatever.

          Ironically, your editor should make these syntax errors trivial to spot and fix, such as how Emacs will automatically highlight unbalanced parentheses and braces. Does Neovim not do the same?

          1 vote
          1. [3]
            lou
            Link Parent
            I generally edit vim files on Vim or Neovim. Also I had a init.vim and I don't believe Emacs would correctly flag Lua errors inside a vim file. And generally Emacs will say something is wrong, it...

            I generally edit vim files on Vim or Neovim.

            Also I had a init.vim and I don't believe Emacs would correctly flag Lua errors inside a vim file. And generally Emacs will say something is wrong, it won't fix it for me. And I can't fix most things because I don't know Lua :P

            1. [2]
              fxgn
              Link Parent
              You had lua config inside of a .vim file?.. I think that's why there was an error lol

              Also I had a init.vim and I don't believe Emacs would correctly flag Lua errors inside a vim file

              You had lua config inside of a .vim file?.. I think that's why there was an error lol

              2 votes
              1. lou
                (edited )
                Link Parent
                Oh no it did work out in the end. It was some basic settings for nnn.vim (a file manager). You just wrap the Lua with some syntax I don't remember anymore. My issue was not that I couldn't do just...

                Oh no it did work out in the end. It was some basic settings for nnn.vim (a file manager). You just wrap the Lua with some syntax I don't remember anymore. My issue was not that I couldn't do just that one thing, but rather the expectation of going through the same motions for every single add-on configuration I needed.

                Even the plug-in managers and distributions felt incredibly complex and not something I would expect from a Vim fork. It's like they're trying to create a new Emacs. With the exception that I find Elisp absolutely wonderful for the very simple configurations that I need.

                Current Neovim is trying to compete with Emacs I feel. I already have one Emacs. I don't need another. I still think Neovim is a great program, it's just not for me anymore

                1 vote