Compare commits

..

3 Commits

Author SHA1 Message Date
Xavier Logerais
adf023f322 feat: amélioration des autocmds 2023-11-24 19:02:55 +01:00
Xavier Logerais
3583d1df2b feat: amélioration des options 2023-11-24 19:02:27 +01:00
Xavier Logerais
b3a4fe9053 feat: amélioration des mappings 2023-11-24 19:02:27 +01:00
4 changed files with 51 additions and 37 deletions

View File

@ -8,8 +8,12 @@ vim.api.nvim_create_autocmd(
-- Vim settings
vim.opt.signcolumn = "auto"
vim.opt.foldcolumn = "auto"
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
@ -19,6 +23,7 @@ vim.api.nvim_create_autocmd(
local command = " groovysh"
local direction = "horizontal"
local size = 25
local toggle_key = "<F10>"
-- Define a new terminal dedicated to groovy
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
-- function _Groovy_buffer_exec()
-- if not groovy:is_open() then groovy:open(size, direction) end
-- groovy:open(size, direction)
-- groovy:send(' clear', true)
-- groovy:send(command, true)
-- 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
function _Groovy_visual_exec()
if not groovy:is_open() then groovy:open(size, direction) end
toggleterm.send_lines_to_terminal("visual_lines", true, { groovy.id })
end
-- 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.api.nvim_set_keymap("n", "<F10>",
"<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>",
vim.keymap.set({ 'n', 'i', 'v', 't' }, '<F10>', function() groovy:toggle(size, direction) end,
{ 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>",
-- '<cmd>lua _Groovy_visual_exec()<cr>',
-- { noremap = true, silent = true })
-- vim.api.nvim_set_keymap("i", "<F22>",
-- '<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("v", "<F22>",
"<cmd>lua _Groovy_visual_exec()<cr>",
{ noremap = true, silent = true })
-- vim.api.nvim_set_keymap("n", "<F34>",
-- '<cmd>lua _Groovy_buffer_exec()<cr>',

View File

@ -8,9 +8,8 @@ vim.api.nvim_create_autocmd(
-- Vim settings
vim.opt.signcolumn = "auto"
vim.opt.foldcolumn = "auto"
vim.opt_local.signcolumn = "auto"
vim.opt_local.foldcolumn = "auto"
-- Terminal settings

View File

@ -14,6 +14,7 @@ return {
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
-- My telescope keybindings
["<F1>"] = { "<cmd>Telescope help_tags<cr>", desc = "Find help with Telescope" },
["<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>fs"] = { "<cmd>Telescope spell_suggest<cr>", desc = "Find spell suggestions with Telescope" },
@ -29,17 +30,17 @@ return {
["<leader>²nb"] = { "<cmd>Neotree toggle buffers left<cr>", desc = "Open Neotree Buffers" },
["<leader>²ng"] = { "<cmd>Neotree toggle git_status left<cr>", desc = "Open Neotree Git status" },
["<F26>"] = { '<cmd>Neotree toggle<cr>', desc = "File Explorer" }, -- F26 corresponds to <Ctrl+F2> on my keyboard
["<F27>"] = { function() require("astronvim.utils").toggle_term_cmd "lazygit" end, desc = "Lazygit" }, -- F27 corresponds to <Ctrl+F3> on my keyboard
["<F28>"] = { function() require("astronvim.utils").toggle_term_cmd "tig" end, desc = "Tig" }, -- F28 corresponds to <Ctrl+F4> on my keyboard
["<F2>"] = { '<cmd>Neotree toggle<cr>', desc = "File Explorer" }, -- F26 corresponds to <Ctrl+F2> on my keyboard
["<F3>"] = { function() require("astronvim.utils").toggle_term_cmd "lazygit" end, desc = "Lazygit terminal" }, -- F27 corresponds to <Ctrl+F3> on my keyboard
["<F4>"] = { function() require("astronvim.utils").toggle_term_cmd "tig" end, desc = "Tig terminal" }, -- F28 corresponds to <Ctrl+F4> on my keyboard
},
-- Insert mode
i = {
["<F26>"] = { '<cmd>Neotree toggle<cr>', desc = "File Explorer" }, -- F26 corresponds to <Ctrl+F2> on my keyboard
["<F27>"] = { function() require("astronvim.utils").toggle_term_cmd "lazygit" end, desc = "Lazygit" }, -- F27 corresponds to <Ctrl+F3> on my keyboard
["<F28>"] = { function() require("astronvim.utils").toggle_term_cmd "tig" end, desc = "Tig" }, -- F28 corresponds to <Ctrl+F4> on my keyboard
["<F2>"] = { '<cmd>Neotree toggle<cr>', desc = "File Explorer" }, -- F26 corresponds to <Ctrl+F2> on my keyboard
["<F3>"] = { function() require("astronvim.utils").toggle_term_cmd "lazygit" end, desc = "Lazygit terminal" }, -- F27 corresponds to <Ctrl+F3> on my keyboard
["<F4>"] = { function() require("astronvim.utils").toggle_term_cmd "tig" end, desc = "Tig terminal" }, -- F28 corresponds to <Ctrl+F4> on my keyboard
},
-- Terminal mode
@ -54,7 +55,8 @@ return {
-- Clear Ctrl-J and Ctrl-K so that we can use them to navigate the terminal (for lazygit)
["<C-j>"] = false,
["<C-k>"] = false,
["<F27>"] = { function() require("astronvim.utils").toggle_term_cmd "lazygit" end, desc = "Lazygit" }, -- F27 corresponds to <Ctrl+F3> on my keyboard
["<F28>"] = { function() require("astronvim.utils").toggle_term_cmd "tig" end, desc = "Tig" }, -- F28 corresponds to <Ctrl+F4> on my keyboard
-- My terms
["<F3>"] = { function() require("astronvim.utils").toggle_term_cmd "lazygit" end, desc = "Lazygit terminal" }, -- F27 corresponds to <Ctrl+F3> on my keyboard
["<F4>"] = { function() require("astronvim.utils").toggle_term_cmd "tig" end, desc = "Tig terminal" }, -- F28 corresponds to <Ctrl+F4> on my keyboard
},
}

View File

@ -1,13 +1,19 @@
-- set vim options here (vim.<first_key>.<second_key> = value)
return {
opt = {
relativenumber = false, -- sets vim.opt.relativenumber
cmdheight = 1,
scrolloff = 0, -- Set scroll offset to zero so that zt and zb work as expected
-- spell = false, -- sets vim.opt.spell
number = true, -- sets vim.opt.number
relativenumber = false, -- sets vim.opt.relativenumber
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
foldcolumn = "auto", -- sets vim.opt.foldcolumn to auto
spelllang = "fr", -- Set spell language to french
-- number = true, -- sets vim.opt.number
-- signcolumn = "auto", -- sets vim.opt.signcolumn to auto
-- spell = false, -- sets vim.opt.spell
-- wrap = false, -- sets vim.opt.wrap
},