feat: amélioration des autocmds
This commit is contained in:
parent
3583d1df2b
commit
adf023f322
@ -8,8 +8,12 @@ vim.api.nvim_create_autocmd(
|
|||||||
|
|
||||||
-- Vim settings
|
-- Vim settings
|
||||||
|
|
||||||
vim.opt.signcolumn = "auto"
|
vim.opt_local.signcolumn = 'auto'
|
||||||
vim.opt.foldcolumn = "auto"
|
vim.opt_local.foldcolumn = 'auto'
|
||||||
|
vim.opt_local.makeprg = 'groovy %'
|
||||||
|
vim.keymap.set({ 'n', 'i', 'v' }, '<F5>', ':make<CR>', { buffer = true })
|
||||||
|
-- vim.keymap.nnoremap { '<leader>²x', ':make<CR>' }
|
||||||
|
-- vim.keymap.inoremap { '<leader>²x', '<ESC>:make<CR>' }
|
||||||
|
|
||||||
-- Terminal settings
|
-- Terminal settings
|
||||||
|
|
||||||
@ -19,6 +23,7 @@ vim.api.nvim_create_autocmd(
|
|||||||
local command = " groovysh"
|
local command = " groovysh"
|
||||||
local direction = "horizontal"
|
local direction = "horizontal"
|
||||||
local size = 25
|
local size = 25
|
||||||
|
local toggle_key = "<F10>"
|
||||||
|
|
||||||
-- Define a new terminal dedicated to groovy
|
-- Define a new terminal dedicated to groovy
|
||||||
local toggleterm = require('toggleterm')
|
local toggleterm = require('toggleterm')
|
||||||
@ -46,44 +51,46 @@ vim.api.nvim_create_autocmd(
|
|||||||
-- -- Define a function to run code from current buffer in the terminal
|
-- -- Define a function to run code from current buffer in the terminal
|
||||||
-- function _Groovy_buffer_exec()
|
-- function _Groovy_buffer_exec()
|
||||||
-- if not groovy:is_open() then groovy:open(size, direction) end
|
-- if not groovy:is_open() then groovy:open(size, direction) end
|
||||||
-- groovy:open(size, direction)
|
|
||||||
-- groovy:send(' clear', true)
|
-- groovy:send(' clear', true)
|
||||||
-- groovy:send(command, true)
|
-- groovy:send(command, true)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Define a function to run code from visual selection in the terminal
|
-- Define a function to run code from visual selection in the terminal
|
||||||
-- function _Groovy_visual_exec(args)
|
function _Groovy_visual_exec()
|
||||||
-- groovy:open(size, direction)
|
if not groovy:is_open() then groovy:open(size, direction) end
|
||||||
-- toggleterm.send_lines_to_terminal("visual_lines", true, { groovy.id })
|
toggleterm.send_lines_to_terminal("visual_lines", true, { groovy.id })
|
||||||
-- end
|
end
|
||||||
|
|
||||||
-- Define a keymap to run the current buffer in the terminal
|
-- Define a keymap to run the current buffer in the terminal
|
||||||
-- <F10> corresponds to F10 on my keyboard
|
-- <F10> corresponds to F10 on my keyboard
|
||||||
-- <F22> corresponds to Shift + F10 on my keyboard
|
-- <F22> corresponds to Shift + F10 on my keyboard
|
||||||
-- <F34> corresponds to Ctrl + F10 on my keyboard
|
-- <F34> corresponds to Ctrl + F10 on my keyboard
|
||||||
vim.api.nvim_set_keymap("n", "<F10>",
|
vim.keymap.set({ 'n', 'i', 'v', 't' }, '<F10>', function() groovy:toggle(size, direction) end,
|
||||||
"<cmd>lua _Groovy_terminal_toggle()<cr>",
|
|
||||||
{ noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("i", "<F10>",
|
|
||||||
"<cmd>lua _Groovy_terminal_toggle()<cr>",
|
|
||||||
{ noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("v", "<F10>",
|
|
||||||
"<cmd>lua _Groovy_terminal_toggle()<cr>",
|
|
||||||
{ noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("t", "<F10>",
|
|
||||||
"<cmd>lua _Groovy_terminal_toggle()<cr>",
|
|
||||||
{ noremap = true, silent = true })
|
{ noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- vim.api.nvim_set_keymap("n", toggle_key,
|
||||||
|
-- "<cmd>lua _Groovy_terminal_toggle()<cr>",
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_set_keymap("i", toggle_key,
|
||||||
|
-- "<cmd>lua _Groovy_terminal_toggle()<cr>",
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_set_keymap("v", toggle_key,
|
||||||
|
-- "<cmd>lua _Groovy_terminal_toggle()<cr>",
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_set_keymap("t", toggle_key,
|
||||||
|
-- "<cmd>lua _Groovy_terminal_toggle()<cr>",
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<F22>",
|
-- vim.api.nvim_set_keymap("n", "<F22>",
|
||||||
-- '<cmd>lua _Groovy_visual_exec()<cr>',
|
-- '<cmd>lua _Groovy_visual_exec()<cr>',
|
||||||
-- { noremap = true, silent = true })
|
-- { noremap = true, silent = true })
|
||||||
-- vim.api.nvim_set_keymap("i", "<F22>",
|
-- vim.api.nvim_set_keymap("i", "<F22>",
|
||||||
-- '<cmd>lua _Groovy_visual_exec()<cr>',
|
-- '<cmd>lua _Groovy_visual_exec()<cr>',
|
||||||
-- { noremap = true, silent = true })
|
-- { noremap = true, silent = true })
|
||||||
-- vim.api.nvim_set_keymap("v", "<F22>",
|
vim.api.nvim_set_keymap("v", "<F22>",
|
||||||
-- "<cmd>lua _Groovy_visual_exec()<cr>",
|
"<cmd>lua _Groovy_visual_exec()<cr>",
|
||||||
-- { noremap = true, silent = true })
|
{ noremap = true, silent = true })
|
||||||
|
|
||||||
-- vim.api.nvim_set_keymap("n", "<F34>",
|
-- vim.api.nvim_set_keymap("n", "<F34>",
|
||||||
-- '<cmd>lua _Groovy_buffer_exec()<cr>',
|
-- '<cmd>lua _Groovy_buffer_exec()<cr>',
|
||||||
|
@ -8,9 +8,8 @@ vim.api.nvim_create_autocmd(
|
|||||||
|
|
||||||
-- Vim settings
|
-- Vim settings
|
||||||
|
|
||||||
vim.opt.signcolumn = "auto"
|
vim.opt_local.signcolumn = "auto"
|
||||||
vim.opt.foldcolumn = "auto"
|
vim.opt_local.foldcolumn = "auto"
|
||||||
|
|
||||||
|
|
||||||
-- Terminal settings
|
-- Terminal settings
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user