Skip to content

Latest commit

 

History

History
74 lines (58 loc) · 1.83 KB

README.md

File metadata and controls

74 lines (58 loc) · 1.83 KB

java-test-util.nvim

Lua

stylua

Plugin to run Java tests in a toggleterm, on the background or on a floating terminal. Currently only supports Maven projects.

Warning

  • plugin is in beta stage and not stable
  • changes will happen

Installation

Lazy

  {
    "tvntvn13/java-test-util.nvim",
    ft = { "java" },
    config = function()
      require("java_test_util").setup({})
    end,
    dependencies = {
      "nvim-treesitter/nvim-treesitter",
      "akinsho/toggleterm.nvim",
    },
  },

Default config

Note

  • plugin currently only supports floating terminal
local config = {
  use_maven_wrapper = false, 
  hide_terminal = true, 
  terminal_height = 25,
  terminal_width = 90,
  terminal_border = "curved", 
  display_name = "mvn test", 
  title_pos = "center",
  direction = "float",
  auto_scroll = true,
  close_on_exit = false,
  timeout_len = 5000,
  toggle_key = "<leader>Mm",
  close_key = "q",
}

Commands

Plugin exposes 4 commands to run maven tests:

  • MvnRunMethod -- run test for current method
  • MvnRunClass -- run tests for current class
  • MvnRunPackage -- run tests for current package
  • MvnRunPrev -- re-run previous tests
  • MvnRunAll -- run all tests

Keymaps

You can set keymaps to these commands for example:

vim.api.nvim_set_keymap("n", "<leader>Mt", "<cmd>MvnRunMethod<cr>", { desc = "Run tests for current method", noremap = true, silent = true})