Compare commits
2 Commits
420f84f1a3
...
333ea49d45
Author | SHA1 | Date | |
---|---|---|---|
|
333ea49d45 | ||
|
b276ddc4b8 |
@ -1,18 +1,33 @@
|
|||||||
vim.api.nvim_create_autocmd(
|
vim.api.nvim_create_autocmd(
|
||||||
"FileType", {
|
"FileType", {
|
||||||
desc = "Customizations for groovy files",
|
desc = "Customizations for groovy files",
|
||||||
-- group = vim.api.nvim_create_augroup("groovy", { clear = true }),
|
|
||||||
pattern = { "groovy", "Jenkinsfile" },
|
pattern = { "groovy", "Jenkinsfile" },
|
||||||
callback = function()
|
callback = function()
|
||||||
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.signcolumn = "auto"
|
||||||
|
vim.opt.foldcolumn = "auto"
|
||||||
|
|
||||||
|
-- Terminal settings
|
||||||
|
|
||||||
|
-- Define prefered options for the terminal
|
||||||
|
-- local command = string.format(" groovy %s", vim.api.nvim_buf_get_name(0))
|
||||||
|
local name = "groovy"
|
||||||
|
local command = " groovysh"
|
||||||
|
local direction = "horizontal"
|
||||||
|
local size = 25
|
||||||
|
|
||||||
-- Define a new terminal dedicated to groovy
|
-- Define a new terminal dedicated to groovy
|
||||||
|
local toggleterm = require('toggleterm')
|
||||||
local Terminal = require('toggleterm.terminal').Terminal
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
local groovy = Terminal:new({
|
local groovy = Terminal:new({
|
||||||
name = "groovy",
|
name = name,
|
||||||
size = 50,
|
cmd = command,
|
||||||
direction = "horizontal",
|
direction = direction,
|
||||||
|
size = size,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
close_on_exit = true,
|
close_on_exit = true,
|
||||||
})
|
})
|
||||||
@ -20,48 +35,65 @@ 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
|
-- Define a function to toggle the terminal
|
||||||
function _groovy_terminal_toggle()
|
function _Groovy_terminal_toggle()
|
||||||
groovy:toggle(50, 'horizontal')
|
groovy:toggle(size, direction)
|
||||||
end
|
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()
|
||||||
local command = string.format(" groovy %s", vim.api.nvim_buf_get_name(0))
|
-- if not groovy:is_open() then groovy:open(size, direction) end
|
||||||
groovy:open(50, 'horizontal')
|
-- 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
|
||||||
|
-- function _Groovy_visual_exec(args)
|
||||||
|
-- groovy:open(size, direction)
|
||||||
|
-- toggleterm.send_lines_to_terminal("visual_lines", true, { groovy.id })
|
||||||
|
-- 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.api.nvim_set_keymap("n", "<F10>",
|
||||||
"<cmd>lua _groovy_terminal_toggle()<cr>",
|
"<cmd>lua _Groovy_terminal_toggle()<cr>",
|
||||||
{ noremap = true, silent = true })
|
{ noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("i", "<F10>",
|
vim.api.nvim_set_keymap("i", "<F10>",
|
||||||
"<cmd>lua _groovy_terminal_toggle()<cr>",
|
"<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 })
|
{ noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("t", "<F10>",
|
vim.api.nvim_set_keymap("t", "<F10>",
|
||||||
"<cmd>lua _groovy_terminal_toggle()<cr>",
|
"<cmd>lua _Groovy_terminal_toggle()<cr>",
|
||||||
{ noremap = true, silent = true })
|
{ noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("n", "<F34>",
|
|
||||||
-- "<cmd>TermExec name=groovy cmd='groovy %'<cr>",
|
-- vim.api.nvim_set_keymap("n", "<F22>",
|
||||||
'<cmd>lua _groovy_buffer_exec()<cr>',
|
-- '<cmd>lua _Groovy_visual_exec()<cr>',
|
||||||
{ noremap = true, silent = true })
|
-- { noremap = true, silent = true })
|
||||||
vim.api.nvim_set_keymap("i", "<F34>",
|
-- vim.api.nvim_set_keymap("i", "<F22>",
|
||||||
-- "<cmd>TermExec name=groovy cmd='groovy %'<cr>",
|
-- '<cmd>lua _Groovy_visual_exec()<cr>',
|
||||||
'<cmd>lua _groovy_buffer_exec()<cr>',
|
-- { noremap = true, silent = true })
|
||||||
{ noremap = true, silent = true })
|
-- vim.api.nvim_set_keymap("v", "<F22>",
|
||||||
vim.api.nvim_set_keymap("t", "<F34>",
|
-- "<cmd>lua _Groovy_visual_exec()<cr>",
|
||||||
-- "<cmd>TermExec name=groovy cmd='groovy %'<cr>",
|
-- { noremap = true, silent = true })
|
||||||
'<cmd>lua _groovy_buffer_exec()<cr>',
|
|
||||||
{ noremap = true, silent = true })
|
-- vim.api.nvim_set_keymap("n", "<F34>",
|
||||||
-- vim.api.nvim_set_keymap('n', '<F5>', ':terminal groovysh<CR>', { noremap = true, silent = true })
|
-- '<cmd>lua _Groovy_buffer_exec()<cr>',
|
||||||
-- vim.opt_local.wrap = true
|
-- { noremap = true, silent = true })
|
||||||
-- vim.opt_local.spell = true
|
-- vim.api.nvim_set_keymap("i", "<F34>",
|
||||||
|
-- '<cmd>lua _Groovy_buffer_exec()<cr>',
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
|
-- vim.api.nvim_set_keymap("t", "<F34>",
|
||||||
|
-- '<cmd>lua _Groovy_buffer_exec()<cr>',
|
||||||
|
-- { noremap = true, silent = true })
|
||||||
end,
|
end,
|
||||||
-- command = "setlocal wrap spell",
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -6,28 +6,41 @@ vim.api.nvim_create_autocmd(
|
|||||||
local utils = require("astronvim.utils")
|
local utils = require("astronvim.utils")
|
||||||
utils.notify("Loading autocmd customizations for python files")
|
utils.notify("Loading autocmd customizations for python files")
|
||||||
|
|
||||||
|
-- Vim settings
|
||||||
|
|
||||||
|
vim.opt.signcolumn = "auto"
|
||||||
|
vim.opt.foldcolumn = "auto"
|
||||||
|
|
||||||
|
|
||||||
|
-- Terminal settings
|
||||||
|
|
||||||
|
-- Define prefered options for the terminal
|
||||||
|
local name = "python"
|
||||||
|
local direction = "vertical"
|
||||||
|
local size = 100
|
||||||
|
|
||||||
-- Define a new terminal dedicated to python
|
-- Define a new terminal dedicated to python
|
||||||
local Terminal = require('toggleterm.terminal').Terminal
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
local python = Terminal:new({
|
local python = Terminal:new({
|
||||||
name = "python",
|
name = name,
|
||||||
size = 100,
|
size = size,
|
||||||
direction = "vertical",
|
direction = direction,
|
||||||
hidden = true,
|
hidden = true,
|
||||||
close_on_exit = true,
|
-- close_on_exit = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Spawn in background so it will be ready to execute code
|
-- Spawn it in background so it will be ready to execute code
|
||||||
python:spawn()
|
python:spawn()
|
||||||
|
|
||||||
-- Define a function to toggle the terminal
|
-- Define a function to toggle the terminal
|
||||||
function _Python_terminal_toggle()
|
function _Python_terminal_toggle()
|
||||||
python:toggle(100, 'vertical')
|
python:toggle(size, direction)
|
||||||
end
|
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 _Python_buffer_exec()
|
function _Python_buffer_exec()
|
||||||
local command = string.format(" python %s", vim.api.nvim_buf_get_name(0))
|
local command = string.format(" python %s", vim.api.nvim_buf_get_name(0))
|
||||||
python:open(100, 'vertical')
|
if not python:is_open() then python:open(size, direction) end
|
||||||
python:send(' clear', true)
|
python:send(' clear', true)
|
||||||
python:send(command, true)
|
python:send(command, true)
|
||||||
end
|
end
|
||||||
@ -57,11 +70,6 @@ vim.api.nvim_create_autocmd(
|
|||||||
-- "<cmd>TermExec name=python cmd='python %'<cr>",
|
-- "<cmd>TermExec name=python cmd='python %'<cr>",
|
||||||
'<cmd>lua _Python_buffer_exec()<cr>',
|
'<cmd>lua _Python_buffer_exec()<cr>',
|
||||||
{ noremap = true, silent = true })
|
{ noremap = true, silent = true })
|
||||||
|
|
||||||
-- Test
|
|
||||||
-- local is_available = utils.is_available
|
|
||||||
-- if is_available "notify" then
|
|
||||||
-- notify("notify is available", "info")
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -14,6 +14,7 @@ return {
|
|||||||
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
||||||
|
|
||||||
-- My telescope keybindings
|
-- My telescope keybindings
|
||||||
|
["<leader>gf"] = { "<cmd>Telescope git_files<cr>", desc = "Find git files with Telescope" },
|
||||||
["<leader>fq"] = { "<cmd>Telescope quickfix<cr>", desc = "Find quickfixes with Telescope" },
|
["<leader>fq"] = { "<cmd>Telescope quickfix<cr>", desc = "Find quickfixes with Telescope" },
|
||||||
["<leader>fs"] = { "<cmd>Telescope spell_suggest<cr>", desc = "Find spell suggestions with Telescope" },
|
["<leader>fs"] = { "<cmd>Telescope spell_suggest<cr>", desc = "Find spell suggestions with Telescope" },
|
||||||
["<leader>fp"] = { "<cmd>Telescope projects<cr>", desc = "Find projetcs with Telescope" },
|
["<leader>fp"] = { "<cmd>Telescope projects<cr>", desc = "Find projetcs with Telescope" },
|
||||||
|
Loading…
Reference in New Issue
Block a user