feat: amélioration des autocmds pour groovy

This commit is contained in:
Xavier Logerais 2023-11-28 15:25:28 +01:00
parent adf023f322
commit a5935068ab
2 changed files with 25 additions and 50 deletions

View File

@ -6,15 +6,6 @@ vim.api.nvim_create_autocmd(
local utils = require("astronvim.utils") local utils = require("astronvim.utils")
utils.notify("Loading autocmd customizations for groovy files") utils.notify("Loading autocmd customizations for groovy files")
-- Vim settings
vim.opt_local.signcolumn = '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
-- Define prefered options for the terminal -- Define prefered options for the terminal
@ -40,14 +31,6 @@ vim.api.nvim_create_autocmd(
-- Spawn in background so it will be ready to execute code -- Spawn in background so it will be ready to execute code
groovy:spawn() groovy:spawn()
-- Add to toggleterm list
-- groovy:__add() -- TODO: This is not working
-- Define a function to toggle the terminal
function _Groovy_terminal_toggle()
groovy:toggle(size, direction)
end
-- -- 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
@ -63,44 +46,27 @@ vim.api.nvim_create_autocmd(
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
-- <F22> corresponds to Shift + F10 on my keyboard
-- <F34> corresponds to Ctrl + F10 on my keyboard
vim.keymap.set({ 'n', 'i', 'v', 't' }, '<F10>', function() groovy:toggle(size, direction) end, vim.keymap.set({ 'n', 'i', 'v', 't' }, '<F10>', function() groovy:toggle(size, direction) end,
{ noremap = true, silent = true }) { noremap = true, silent = true })
vim.api.nvim_set_keymap("v", "<F22>", "<cmd>lua _Groovy_visual_exec()<cr>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", toggle_key, -- Vim settings
-- "<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.opt_local.signcolumn = 'auto'
-- '<cmd>lua _Groovy_visual_exec()<cr>', vim.opt_local.foldcolumn = 'auto'
-- { noremap = true, silent = true }) vim.opt_local.makeprg = 'groovy %'
-- vim.api.nvim_set_keymap("i", "<F22>", vim.keymap.set({ 'n', 'i', 'v' }, '<F5>', ':make<CR>', { buffer = true })
-- '<cmd>lua _Groovy_visual_exec()<cr>',
-- { noremap = true, silent = true })
vim.api.nvim_set_keymap("v", "<F22>",
"<cmd>lua _Groovy_visual_exec()<cr>",
{ noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<F34>", -- vim.keymap.nnoremap { '<leader>²x', ':make<CR>' }
-- '<cmd>lua _Groovy_buffer_exec()<cr>', -- vim.keymap.inoremap { '<leader>²x', '<ESC>:make<CR>' }
-- { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("i", "<F34>", -- DevDocs
-- '<cmd>lua _Groovy_buffer_exec()<cr>', require('nvim-devdocs').setup({
-- { noremap = true, silent = true }) -- your configuration comes here
-- vim.api.nvim_set_keymap("t", "<F34>", -- or leave it empty to use the default settings
-- '<cmd>lua _Groovy_buffer_exec()<cr>', -- refer to the configuration section below
-- { noremap = true, silent = true }) })
vim.keymap.set({ 'n', 'i', 'v' }, '<F1>', ':DevdocsOpen groovy-2.4<CR>', { buffer = true })
end, end,
} }
) )

View File

@ -0,0 +1,9 @@
return {
"luckasRanarison/nvim-devdocs",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-treesitter/nvim-treesitter",
},
-- opts = {}
}