feat(nvim): added python, lua and markdown snippets

This commit is contained in:
Sergio Laín 2024-01-05 10:55:47 +01:00
parent f2bda644b3
commit 457f985e47
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
4 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,50 @@
{
"@class (LuaDoc)": {
"body": [
"---@class (exact) ${1:class_name}",
"---@field ${2:field_name} string",
"---@field ${3:field_name} string"
],
"description": "https://github.com/LuaLS/lua-language-server/wiki/Annotations#class",
"prefix": "@class (LuaDoc)"
},
"@type (LuaDoc)": {
"body": "---@type ${1:string}",
"prefix": "@type (LuaDoc)"
},
"export module": {
"body": [
"local M = {}",
"--------------------------------------------------------------------------------",
"",
"$0--------------------------------------------------------------------------------",
"return M"
],
"prefix": "export module"
},
"find all in string": {
"body": [
"local ${1:matches} = {}",
"for match in ${2:str}:gmatch(${3:pattern}) do",
"\ttable.insert(${1:matches}, match)",
"end"
],
"prefix": "find all in string"
},
"home": {
"body": "os.getenv(\"HOME\")",
"prefix": "home"
},
"ignore (stylua)": {
"body": "-- stylua: ignore",
"prefix": "ignore (stylua)"
},
"ignore start/end (stylua)": {
"body": ["-- stylua: ignore start", "-- stylua: ignore end"],
"prefix": "ignore start/end (stylua)"
},
"import module": {
"body": "local ${1:name} = require(\"${2:module}.${1:name}\")",
"prefix": "import module"
}
}

View file

@ -3,5 +3,35 @@
"body": "<img src=\"${1:image_path}\" alt=\"${2:alt text}\" width=\"${3:50%}\">", "body": "<img src=\"${1:image_path}\" alt=\"${2:alt text}\" width=\"${3:50%}\">",
"description": "HTML syntax for images used to display images with reduced size", "description": "HTML syntax for images used to display images with reduced size",
"prefix": "image" "prefix": "image"
},
"details & summary": {
"body": ["<details>", "<summary>${1:Text}</summary>", "$0", "</details>"],
"description": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details",
"prefix": ["toggle / fold", "details & summary"]
},
"caution (callout)": {
"body": ["> [!CAUTION]", "> $0"],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "caution (callout)"
},
"important (callout)": {
"body": ["> [!IMPORTANT]", "> $0"],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "important (callout)"
},
"note (callout)": {
"body": ["> [!NOTE]", "> $0"],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": ["info (callout)", "note (callout)"]
},
"tip (callout)": {
"body": ["> [!TIP]", "> $0"],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "tip (callout)"
},
"warning (callout)": {
"body": ["> [!WARNING]", "> $0"],
"description": "https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts",
"prefix": "warning (callout)"
} }
} }

View file

@ -0,0 +1,19 @@
{
"list comprehension": {
"body": "list(${1:value} for ${2:value} in ${3:iterable})$0",
"description": "List comprehension for creating a list based on existing lists.",
"prefix": "list comprehension"
},
"replace (regex)": {
"body": "re.sub(r\"${1:regex}\", r\"${2:replace}\", ${3:str})$0",
"prefix": "replace (regex)"
},
"ternary": {
"body": "${1:value1} if ${2:condition} else ${3:value2}",
"prefix": "ternary"
},
"while": {
"body": "while ${1:condition}:\n\t${2:pass}$0",
"prefix": "while"
}
}

View file

@ -30,6 +30,14 @@
"stylus" "stylus"
], ],
"path": "./languages/css.json" "path": "./languages/css.json"
},
{
"language": "python",
"path": "./languages/python/python.json"
},
{
"language": "lua",
"path": "./languages/lua.json"
} }
] ]
} }