init
This commit is contained in:
13
nvim/snippets/languages/css.json
Normal file
13
nvim/snippets/languages/css.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"ignore (prettier)": {
|
||||
"body": "/* prettier-ignore */",
|
||||
"prefix": "ignore (prettier)"
|
||||
},
|
||||
"ignore range (stylelint)": {
|
||||
"body": [
|
||||
"/* stylelint-disable ${1:no-duplicate-selectors} */",
|
||||
"/* stylelint-enable ${1:no-duplicate-selectors} */"
|
||||
],
|
||||
"prefix": "ignore range (stylelint)"
|
||||
}
|
||||
}
|
||||
6
nvim/snippets/languages/global.json
Normal file
6
nvim/snippets/languages/global.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"nonbreaking space": {
|
||||
"body": " ",
|
||||
"prefix": "nonbreaking space"
|
||||
}
|
||||
}
|
||||
50
nvim/snippets/languages/lua.json
Normal file
50
nvim/snippets/languages/lua.json
Normal 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"
|
||||
}
|
||||
}
|
||||
72
nvim/snippets/languages/markdown.json
Normal file
72
nvim/snippets/languages/markdown.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"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)"
|
||||
},
|
||||
"centerdiv": {
|
||||
"body": "<div style=\"text-align: center;\">$0</div>",
|
||||
"prefix": "centerdiv"
|
||||
},
|
||||
"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"
|
||||
]
|
||||
},
|
||||
"div": {
|
||||
"body": "<div>$0</div>",
|
||||
"description": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div",
|
||||
"prefix": "div"
|
||||
},
|
||||
"image": {
|
||||
"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",
|
||||
"prefix": "image"
|
||||
},
|
||||
"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)"
|
||||
}
|
||||
}
|
||||
19
nvim/snippets/languages/python/python.json
Normal file
19
nvim/snippets/languages/python/python.json
Normal 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"
|
||||
}
|
||||
}
|
||||
48
nvim/snippets/package.json
Normal file
48
nvim/snippets/package.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"DOCS": [
|
||||
"https://code.visualstudio.com/api/language-extensions/snippet-guide",
|
||||
"https://code.visualstudio.com/docs/editor/userdefinedsnippets",
|
||||
"https://github.com/L3MON4D3/LuaSnip/blob/master/DOC.md#vs-code"
|
||||
],
|
||||
"contributes": {
|
||||
"snippets": [
|
||||
{
|
||||
"language": [
|
||||
"plaintext",
|
||||
"markdown",
|
||||
"tex",
|
||||
"html",
|
||||
"global",
|
||||
"all"
|
||||
],
|
||||
"path": "./languages/global.json"
|
||||
},
|
||||
{
|
||||
"language": "markdown",
|
||||
"path": "./languages/markdown.json"
|
||||
},
|
||||
{
|
||||
"language": [
|
||||
"css",
|
||||
"scss",
|
||||
"sass",
|
||||
"less",
|
||||
"stylus"
|
||||
],
|
||||
"path": "./languages/css.json"
|
||||
},
|
||||
{
|
||||
"language": "python",
|
||||
"path": "./languages/python/python.json"
|
||||
},
|
||||
{
|
||||
"language": "lua",
|
||||
"path": "./languages/lua.json"
|
||||
},
|
||||
{
|
||||
"language": "lua",
|
||||
"path": "./projects/nvim.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
38
nvim/snippets/projects/nvim.json
Normal file
38
nvim/snippets/projects/nvim.json
Normal file
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"autocmd": {
|
||||
"body": [
|
||||
"vim.api.nvim_create_autocmd(\"${1:event}\", {",
|
||||
"\tcallback = function()",
|
||||
"\t\t$0",
|
||||
"\tend,",
|
||||
"})"
|
||||
],
|
||||
"prefix": "autocmd"
|
||||
},
|
||||
"autocmd (Filetype)": {
|
||||
"body": [
|
||||
"vim.api.nvim_create_autocmd(\"FileType\", {",
|
||||
"\tpattern = \"${1:ft}\",",
|
||||
"\tcallback = function()",
|
||||
"\t\t$0",
|
||||
"\tend,",
|
||||
"})"
|
||||
],
|
||||
"filetype": "lua",
|
||||
"prefix": "autocmd (Filetype)"
|
||||
},
|
||||
"check if file exists": {
|
||||
"body": "local fileExists = vim.uv.fs_stat(\"${1:filepath}\") ~= nil",
|
||||
"prefix": "check if file exists"
|
||||
},
|
||||
"keymap": {
|
||||
"body": "map(\"n\", \"${1:lhs}\", \"${2:rhs}\", { desc = \"${3:description}\" })",
|
||||
"filetype": "lua",
|
||||
"prefix": "keymap"
|
||||
},
|
||||
"notify": {
|
||||
"body": "vim.notify(${1:message}, ${2:level}, { title = \"${3:title}\" })",
|
||||
"filetype": "lua",
|
||||
"prefix": "notify"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user