move java mappings to java.lua

This commit is contained in:
fiplox 2023-01-03 15:10:19 +01:00
parent 8393fc12ae
commit fb47b1f896
2 changed files with 49 additions and 48 deletions

View File

@ -251,3 +251,46 @@ keymap('n', '<leader>ju', '<Cmd>JdtUpdateConfig<CR>', opts)
keymap('v', '<leader>jv', "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", opts)
keymap('v', '<leader>jc', "<Esc><Cmd>lua require('jdtls').extract_constant(true)<CR>", opts)
keymap('v', '<leader>jm', "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", opts)
local wk = require 'which-key'
local optsj = {
mode = 'n', -- NORMAL mode
prefix = '<leader>',
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local vopts = {
mode = 'v', -- VISUAL mode
prefix = '<leader>',
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local mappingsj = {
L = {
name = 'Java',
o = { "<Cmd>lua require'jdtls'.organize_imports()<CR>", 'Organize Imports' },
v = { "<Cmd>lua require('jdtls').extract_variable()<CR>", 'Extract Variable' },
c = { "<Cmd>lua require('jdtls').extract_constant()<CR>", 'Extract Constant' },
t = { "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", 'Test Method' },
T = { "<Cmd>lua require'jdtls'.test_class()<CR>", 'Test Class' },
u = { '<Cmd>JdtUpdateConfig<CR>', 'Update Config' },
},
}
local vmappings = {
L = {
name = 'Java',
v = { "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", 'Extract Variable' },
c = { "<Esc><Cmd>lua require('jdtls').extract_constant(true)<CR>", 'Extract Constant' },
m = { "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", 'Extract Method' },
},
}
wk.register(mappingsj, optsj)
wk.register(vmappings, vopts)

View File

@ -86,13 +86,13 @@ function UnMapDHM()
vim.api.nvim_del_keymap('n', 'N')
end
-- local handle = io.popen 'lsusb | grep -c Sofle'
-- local automap = handle:read '*n'
-- handle:close()
local handle = io.popen 'lsusb | grep -c Sofle'
local automap = handle:read '*n'
handle:close()
-- if automap or os.getenv("SSH_TTY") then
MapDHM()
-- end
if not automap or os.getenv 'SSH_TTY' then
MapDHM()
end
local wk = require 'which-key'
@ -220,45 +220,3 @@ local mappings = {
}
-- }}}
wk.register(mappings, opts)
local optsj = {
mode = "n", -- NORMAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local vopts = {
mode = "v", -- VISUAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local mappingsj = {
L = {
name = "Java",
o = { "<Cmd>lua require'jdtls'.organize_imports()<CR>", "Organize Imports" },
v = { "<Cmd>lua require('jdtls').extract_variable()<CR>", "Extract Variable" },
c = { "<Cmd>lua require('jdtls').extract_constant()<CR>", "Extract Constant" },
t = { "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", "Test Method" },
T = { "<Cmd>lua require'jdtls'.test_class()<CR>", "Test Class" },
u = { "<Cmd>JdtUpdateConfig<CR>", "Update Config" },
},
}
local vmappings = {
L = {
name = "Java",
v = { "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", "Extract Variable" },
c = { "<Esc><Cmd>lua require('jdtls').extract_constant(true)<CR>", "Extract Constant" },
m = { "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", "Extract Method" },
},
}
wk.register(mappingsj, optsj)
wk.register(vmappings, vopts)