Updated vimtex and snippets
This commit is contained in:
parent
84a6b218fe
commit
10bf23a6ec
44 changed files with 4209 additions and 69 deletions
141
LuaSnip/markdown/code-blocks.lua
Normal file
141
LuaSnip/markdown/code-blocks.lua
Normal file
|
|
@ -0,0 +1,141 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
-- Return snippet tables
|
||||
return
|
||||
{
|
||||
-- Fenced block of code
|
||||
s({trig="cc", snippetType = "autosnippet"},
|
||||
fmta(
|
||||
[[
|
||||
```<>
|
||||
<>
|
||||
```
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual),
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- HTML CODE BLOCK
|
||||
s({trig="html"},
|
||||
fmta(
|
||||
[[
|
||||
```html
|
||||
<>
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- PHP CODE BLOCK
|
||||
s({trig="phpp", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[
|
||||
```php
|
||||
<?php
|
||||
{}
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- PYTHON CODE BLOCK
|
||||
s({trig="pyy", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[
|
||||
```python
|
||||
{}
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- BEANCOUNT CODE BLOCK
|
||||
s({trig="bc"},
|
||||
fmt(
|
||||
[[
|
||||
```beancount
|
||||
{}
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- BASH CODE BLOCK
|
||||
s({trig="shh", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[
|
||||
```bash
|
||||
{}
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- SQL CODE BLOCK
|
||||
s({trig="qq", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[
|
||||
```sql
|
||||
{}
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- JAVASCRIPT CODE BLOCK
|
||||
s({trig="jss", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[
|
||||
```javascript
|
||||
{}
|
||||
```
|
||||
]],
|
||||
{
|
||||
d(1, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
-- VUE CODE BLOCK
|
||||
s({trig="vuu", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[
|
||||
```vue
|
||||
{}<script setup>
|
||||
{}
|
||||
</script>
|
||||
```
|
||||
]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual)
|
||||
}
|
||||
),
|
||||
{condition = line_begin}
|
||||
),
|
||||
}
|
||||
|
||||
68
LuaSnip/markdown/markdown.lua
Normal file
68
LuaSnip/markdown/markdown.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
local helpers = require('personal.luasnip-helper-funcs')
|
||||
local get_visual = helpers.get_visual
|
||||
|
||||
local line_begin = require("luasnip.extras.expand_conditions").line_begin
|
||||
|
||||
-- Return snippet tables
|
||||
return
|
||||
{
|
||||
-- TODO NOTE
|
||||
s({trig="TODOO", snippetType="autosnippet"},
|
||||
{
|
||||
t("**TODO:** "),
|
||||
}
|
||||
),
|
||||
-- LINK; CAPTURE TEXT IN VISUAL
|
||||
s({trig="LL", wordTrig=true, snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[[<>](<>)]],
|
||||
{
|
||||
d(1, get_visual),
|
||||
i(2),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- LINK; CAPTURE URL IN VISUAL
|
||||
s({trig="LU", wordTrig=true, snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[[<>](<>)]],
|
||||
{
|
||||
i(1),
|
||||
d(2, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- BOLDFACE TEXT
|
||||
s({trig="tbb", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[**<>**]],
|
||||
{
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- ITALIC TEXT
|
||||
s({trig="tii", snippetType="autosnippet"},
|
||||
fmta(
|
||||
[[*<>*]],
|
||||
{
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- UNDERLINED TEXT
|
||||
s({trig="uu", snippetType="autosnippet"},
|
||||
fmt(
|
||||
[[<u>{}</u>]],
|
||||
{
|
||||
d(1, get_visual),
|
||||
}
|
||||
)
|
||||
),
|
||||
-- Hack to remove indentation in bulleted lists
|
||||
s({trig=" --", snippetType="autosnippet"},
|
||||
{t("- ")},
|
||||
{condition = line_begin}
|
||||
),
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue