Updated vimtex and snippets
This commit is contained in:
parent
84a6b218fe
commit
10bf23a6ec
44 changed files with 4209 additions and 69 deletions
91
LuaSnip/cpp/controlflow.lua
Normal file
91
LuaSnip/cpp/controlflow.lua
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
return
|
||||
{
|
||||
-- IF STATEMENT
|
||||
s({trig = "iff", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
if (<>) {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- FOR LOOP
|
||||
s({trig = "fll", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
for (<>) {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- WHILE LOOP
|
||||
s({trig = "wll", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
while (<>) {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- SWITCH STATEMENT
|
||||
s({trig = "sc", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
switch (<>) {
|
||||
case <>: {
|
||||
<>
|
||||
}<>
|
||||
default: {
|
||||
<>
|
||||
}
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(2),
|
||||
i(3),
|
||||
i(4),
|
||||
i(5),
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- SWITCH CASE
|
||||
s({trig = "cs", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
case <>: {
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual),
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
}
|
||||
88
LuaSnip/cpp/cpp.lua
Normal file
88
LuaSnip/cpp/cpp.lua
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
return
|
||||
{
|
||||
-- MAIN FUNCTION
|
||||
s({trig = "main", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
int main()
|
||||
{
|
||||
<>
|
||||
return 0;
|
||||
}
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- GENRIC FUNCTION
|
||||
s({trig = "ff", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
/*
|
||||
<>
|
||||
*/
|
||||
<>(<>)
|
||||
{
|
||||
<>
|
||||
}
|
||||
]],
|
||||
{
|
||||
i(3),
|
||||
i(1),
|
||||
i(2),
|
||||
d(4, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- BLOCK COMMENT
|
||||
s({trig = "cc", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
/*
|
||||
<>
|
||||
*/
|
||||
]],
|
||||
{ i(1) }
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- DATA STRUCTURE
|
||||
s({trig = "ss", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
struct <> {
|
||||
<>
|
||||
};
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
i(0)
|
||||
}
|
||||
)
|
||||
),
|
||||
-- -> DEREFERENCE STRUCTURE PROPERTY
|
||||
s({trig = "--", snippetType="autosnippet", wordTrig=false},
|
||||
{
|
||||
t("->")
|
||||
}
|
||||
),
|
||||
-- NULL POINTER SYMBOLIC CONSTANT
|
||||
s({trig = "00", snippetType="autosnippet", wordTrig=false},
|
||||
{
|
||||
t("NULL")
|
||||
}
|
||||
),
|
||||
-- RETURN
|
||||
s({trig = "rr", snippetType="autosnippet", wordTrig=false},
|
||||
{
|
||||
t("return")
|
||||
},
|
||||
{ condition = line_begin }
|
||||
),
|
||||
}
|
||||
33
LuaSnip/cpp/headers.lua
Normal file
33
LuaSnip/cpp/headers.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
return
|
||||
{
|
||||
-- GENERIC HEADER INCLUDE
|
||||
s({trig = "hh", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[#include <{}>]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- STDIO HEADER
|
||||
s({trig = "hio", snippetType="autosnippet"},
|
||||
{ t('#include <iostream>') },
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- MATH HEADER
|
||||
s({trig = "hmath", snippetType="autosnippet"},
|
||||
{ t('#include <cmath>') },
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- STRING HEADER
|
||||
s({trig = "hstr", snippetType="autosnippet"},
|
||||
{ t('#include <string>') },
|
||||
{condition = line_begin}
|
||||
),
|
||||
}
|
||||
33
LuaSnip/cpp/io.lua
Normal file
33
LuaSnip/cpp/io.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
return
|
||||
{
|
||||
-- PRINTF
|
||||
-- s({trig = "pp", snippetType="autosnippet"},
|
||||
-- fmta(
|
||||
-- [[printf("<>"<>);]],
|
||||
-- {
|
||||
-- i(1),
|
||||
-- i(2)
|
||||
-- }
|
||||
-- ),
|
||||
-- { condition = line_begin }
|
||||
-- ),
|
||||
-- GETLINE BOILERPLATE
|
||||
s({trig = "gll", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t nread;
|
||||
nread = getline(&line, &len, stdin);
|
||||
<>
|
||||
free(line);
|
||||
]],
|
||||
{ i(0) }
|
||||
)
|
||||
),
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue