Update init.lua
This commit is contained in:
+1
-15
@@ -8,7 +8,6 @@ M.config = {
|
|||||||
["<leader>jr"] = "JavaRun",
|
["<leader>jr"] = "JavaRun",
|
||||||
["<leader>nf"] = "NewJavaFile",
|
["<leader>nf"] = "NewJavaFile",
|
||||||
["<leader>np"] = "NewJavaProject",
|
["<leader>np"] = "NewJavaProject",
|
||||||
["<Esc>"] = "CloseTerminal",
|
|
||||||
},
|
},
|
||||||
terminal = {
|
terminal = {
|
||||||
width_pad = 10,
|
width_pad = 10,
|
||||||
@@ -62,24 +61,11 @@ local function open_float_terminal(cmd)
|
|||||||
end
|
end
|
||||||
vim.api.nvim_win_set_option(win, "scrolloff", 5)
|
vim.api.nvim_win_set_option(win, "scrolloff", 5)
|
||||||
vim.api.nvim_win_set_option(win, "cursorline", true)
|
vim.api.nvim_win_set_option(win, "cursorline", true)
|
||||||
vim.api.nvim_buf_set_keymap(buf, "t", "<Esc>", "<Esc>", { noremap = true, silent = true })
|
|
||||||
|
|
||||||
vim.fn.termopen(cmd)
|
vim.fn.termopen(cmd)
|
||||||
vim.cmd("startinsert")
|
vim.cmd("startinsert")
|
||||||
|
|
||||||
-- vim.api.nvim_buf_set_keymap(buf, "t", "<Esc>", "<C-\\><C-n>:q<CR>", { noremap = true, silent = true })
|
vim.api.nvim_buf_set_keymap(buf, "t", "<Esc>", "<C-\\><C-n>:q<CR>", { noremap = true, silent = true })
|
||||||
local close_key = nil -- Default
|
|
||||||
for key, action in pairs(M.config.keybinds) do
|
|
||||||
if action == "CloseTerminal" then
|
|
||||||
close_key = key
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set keybinding for closing the terminal
|
|
||||||
if close_key then
|
|
||||||
vim.api.nvim_buf_set_keymap(buf, "t", close_key, "<C-\\><C-n>:q<CR>", { noremap = true, silent = true })
|
|
||||||
end
|
|
||||||
return buf, win
|
return buf, win
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user