GithubHelp home page GithubHelp logo

java.nvim's Introduction

java.nvim

A neovim plugin to move and rename java files.

Introduction

I am a Java developer and am loving to use neovim. Nevertheless, refactoring was the thing that always brought me back to JetBrains IDEs. Although nvim-jdtls is existing, which is able to simply rename symbols, file renames were never possible with it. For instance, tsserver-LSP has this feature. Because I really wanted to use neovim as my dailydriver and file-renames are essential, I have written this plugin.

Dependencies

Function of this plugin

In current state, this plugin is a addition to nvim-jdtls. It allows you to rename .java files and looks for any reference to the name and updates the import statements and symbol usages automaticaly. This does only work due to the use of lua-patterns and regex. I hope this plugin wil help someone with this basic feature of file refactoring.

Why have I named it java.nvim?

This can be simply answered: I want to add some features besides the refactoring of files that are helping in everyday Java use. For instance, I will try to add the ability for simple LuaSnip snippets that allow you to create a default class/interface/enum by using a simple snippet without needing to write all the same stuff again and again.

Supported platforms

  • Linux
  • MacOS

Installing the plugin

The plugin can be easily installed using dusing different Plugin Managers.

Lazy

-- other lazy stuff
{
    'simaxme/java.nvim'
}
-- other lazy stuff

You will also need to setup the plugin (see Configuring the plugin)

Configuring the plugin

You can setup java.nvim with the following line:

require("java").setup()

However, there are some tweaks you can make (default configuration):

require("java").setup {
    rename = {
        enable = true, -- enable the functionality for renaming java files
        nvimtree = true, -- enable nvimtree integration
        write_and_close = false -- automatically write and close modified (previously unopened) files after refactoring a java file
    },
    snippets = {
        enable = true -- enable the functionality for java snippets
    }
}

All current functionalities

  • Detect file renames in nvim-tree and automatically update the class name and every associated files with the symbol.
  • Snippet integration with LuaSnip
    • type class, interface or enum in an empty java file to automatically create a package and class/enum/interface declaration in the file.

After configuration

Go to your nvim-tree pane and execute a simple r on a java file or a package. Magic will happen and you will not have to do anything ๐Ÿ™ƒ.

java.nvim's People

Contributors

simaxme avatar

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.