Agregué los snippets 'untinf', 'enumerate', 'item', 'begin', 'figure' para los archivos .tex

This commit is contained in:
Ricman 2025-04-16 01:47:53 -03:00
parent a935d163f6
commit 5bc15398d6
4 changed files with 209 additions and 3 deletions

View File

@ -802,7 +802,7 @@ require('lazy').setup({
-- }, -- },
}, },
config = function() config = function()
require('luasnip.loaders.from_lua').load { paths = 'C:/Users/ricar/AppData/Local/nvim/lua/snippets/' } require 'luaconfig.luasnip'
end, end,
opts = {}, opts = {},
}, },

31
lua/luaconfig/luasnip.lua Normal file
View File

@ -0,0 +1,31 @@
local ls = require 'luasnip'
-- TODO LO DE ABAJO QUEDA COMENTADO Y POR AHORA VOY A USAR LAS TECLAS POR DEFECTO YA QUE NO ESTOY PUDIENDO
-- CAMBIAR LOS KEYMAPS
-- Mis keymaps
-- "Este es para expandir el snippet o saltar al siguiente item del snippet
-- vim.keymap.set({ 'i', 's' }, '<C-k>', function()
-- if ls.expand_or_jumpable() then
-- ls.expand_or_jump()
-- end
-- end, { silent = true })
--
-- -- Este es para moverte al item anterior del snippet
-- vim.keymap.set({ 'i', 's' }, '<C-j>', function()
-- if ls.jumpable(-1) then
-- ls.jump(-1)
-- end
-- end, { silent = true })
--
-- -- Este es para poder elegir los choice nodes
-- vim.keymap.set('i', '<C-l>', function()
-- if ls.choince_active() then
-- ls.change_choice(1)
-- end
-- end)
--
-- -- Este shorcut es para recargar los snippets para que no tenga que cerrar nvim
-- -- y volverlo a abir cada vez que hago un cambio
vim.keymap.set('n', '<leader><localleader>s', '<cmd>source C:/Users/ricar/AppData/Local/nvim/lua/luaconfig/luasnip.lua<CR>')
require('luasnip.loaders.from_lua').load { paths = 'C:/Users/ricar/AppData/Local/nvim/lua/snippets/' }

7
lua/snippets/luasnip.lua Normal file
View File

@ -0,0 +1,7 @@
local ls = require 'luasnip'
ls.setup {
update_events = { 'TextChanged', 'TextChangedI' },
enable_autosnippets = true,
-- NOTE: Falta agregar las crazy highlights del video 3 de TJDeVries
}

View File

@ -1,4 +1,172 @@
-- Estos son los snippets que se van a cargar para todos los documentos de latex -- Estos son los snippets que se van a cargar para todos los documentos de latex
vim.keymap.set({ 'i', 's' }, '<C-l>', function()
if require('luasnip').choice_active() then
require('luasnip').change_choice(1)
end
end)
vim.keymap.set({ 'i', 's' }, '<C-h>', function()
if require('luasnip').choice_active() then
require('luasnip').change_choice(-1)
end
end)
return { return {
s('hello', t 'hello world'), s(
'utninf',
fmt(
[[
\documentclass[12pt a4paper]{{article}}
\usepackage[spanish]{{babel}}
\usepackage[utf8]{{inputenc}}
% Interlineado 1.5
\usepackage{{setspace}}
\onehalfspacing
% Fuente Times New Roman
\usepackage{{mathptmx}}
% Acomodar margenes del documento
\usepackage[margin=2cm]{{geometry}}
% Paquetes comunes
\usepackage{{graphicx, float}}
\usepackage{{amsfonts, amssymb, amsmath}}
\usepackage{{enumerate}}
\usepackage[colorlinks=true, citecolor=blue]{{hyperref}}
% Para bibliografía
%\usepackage[backend=biber, style=apa]{{biblatex}}
%\addbibresource{{bibliografia.bib}}
\begin{{document}}
\begin{{titlepage}}
\centering
\includegraphics[width=\linewidth]{{C:/Users/ricar/OneDrive/Escritorio/Ingerniería en Sistemas/logo_utn.jpg}}\\[1cm]
\textsc{{
\LARGE Universidad Tecnológica Nacional\\
\Large Facultad Regional Córdoba - Extensión Áulica Bariloche\\
\large Ingeniería en Sistemas de Información\\
Año lectivo {}\\[0.5cm]
}}
\rule{{\linewidth}}{{1.0mm}}\\[0.4cm]
\Huge
\textbf{{{}}}\\
{}\\[0.2cm]
\LARGE
{}
\rule{{\linewidth}}{{1.0mm}}\\
\Large
\begin{{flushleft}}
Profesor: {}
Ayudante: {}
\end{{flushleft}}
\vfill
\begin{{flushright}}
Alumno: Ricardo Nicolás Freccero
Número de legajo: 415753
\end{{flushright}}
\end{{titlepage}}
\tableofcontents
\newpage
\section{{Enunciado}}
{}
\section{{Introducción}}
\section{{Desarrollo}}
\section{{Conclusión}}
%\printbibliography
\end{{document}}
]],
{
i(1),
i(2, 'Materia'),
i(3, 'Número del TP'),
i(4, 'Nombre del TP'),
i(5),
i(6),
i(0),
}
)
),
s(
'enumerate',
fmt(
[[
\begin{{enumerate}}{}
\item {}
\end{{enumerate}}
]],
{
c(1, {
t '',
fmt('[A{}]', { i(1, '.') }),
fmt('[a{}]', { i(1, '.') }),
fmt('[i{}]', { i(1, '.') }),
}),
i(0),
}
)
),
s('item', t '\\item '),
s(
'begin',
fmt(
[[
\begin{{{}}}{}
{}
\end{{{}}}
]],
{
i(1, 'environment'),
c(2, {
t '',
fmt('[{}]', { i(1, 'opcional') }),
}),
i(0),
rep(1),
}
)
),
s(
'figure',
fmt(
[[
\begin{{figure}}{}
\centering
\includegraphics[width={}\linewidth{{{}}}
\caption{{{}}}
\label{{fig:{}}}
\end{{figure}}
{}
]],
{
c(1, {
fmt('[{}]', { i(1, 'H') }),
t '',
}),
i(2),
i(3),
i(4),
i(5),
i(0),
}
)
),
} }