fix: correct command name casing and adjust indentation in C template

feat: add Monokai Pro and Monokai Nightasty theme configurations
This commit is contained in:
David Ponte 2025-05-04 19:12:56 +02:00
parent 5153613b3b
commit 10ccea08ec
2 changed files with 117 additions and 6 deletions

View file

@ -1,6 +1,6 @@
-- local set = vim.opt_local
-- Define a custom command ':intmain' that inserts int main() {} template
-- Define a custom command ':IntMain' that inserts int main() {} template
vim.api.nvim_create_user_command('IntMain', function()
local current_line = vim.api.nvim_win_get_cursor(0)[1]
local lines = {
@ -8,12 +8,19 @@ vim.api.nvim_create_user_command('IntMain', function()
'',
'int main ()',
'{',
' ',
' printf();',
' return 0;',
' ',
' printf();',
' return 0;',
'}',
}
vim.api.nvim_buf_set_lines(0, current_line - 1, current_line - 1, false, lines)
-- Position cursor inside the function body
vim.api.nvim_win_set_cursor(0, { current_line + 1, 4 })
end, {})
vim.api.nvim_create_user_command('Libft', function()
local current_line = vim.api.nvim_win_get_cursor(0)[1]
vim.api.nvim_buf_set_lines(0, current_line - 1, current_line - 1, false, {
'#include "libft.h"',
})
end, {})