mirror of
https://codeberg.org/leana8959/.files.git
synced 2025-12-06 14:49:14 +00:00
add(nvim): linked snippets
This commit is contained in:
parent
24cf0bcbe5
commit
da08b92ed7
8 changed files with 105 additions and 1 deletions
45
.config/nvim/snippets/python.json
Normal file
45
.config/nvim/snippets/python.json
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Map using dict comprehension": {
|
||||
"prefix": "mdd",
|
||||
"body": [
|
||||
"{",
|
||||
"\t${1:key}:${2:value}",
|
||||
"\tfor ${3:var} in ${4:iterated}",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Map using dictionary comprehension"
|
||||
},
|
||||
"Map using list comprehension": {
|
||||
"prefix": "mll",
|
||||
"body": [
|
||||
"[",
|
||||
"\t${1:var}${2:transformation}",
|
||||
"\tfor ${1:var} in ${3:iterated}",
|
||||
"]",
|
||||
""
|
||||
],
|
||||
"description": "Map using list comprehension"
|
||||
},
|
||||
"For": {
|
||||
"prefix": "for",
|
||||
"body": [
|
||||
"for ${1:var} in ${2:iterated}:",
|
||||
"\t"
|
||||
],
|
||||
"description": "Iterate over ..."
|
||||
},
|
||||
"Open, read and save file to variable": {
|
||||
"prefix": "open",
|
||||
"body": [
|
||||
"${1:var} = []",
|
||||
"with open(\"${2:file.txt}\") as f:",
|
||||
"\t${1:var} = [",
|
||||
"\t\tline.strip()",
|
||||
"\t\tfor line in f.readlines() if line != '\\n'",
|
||||
"\t]",
|
||||
""
|
||||
],
|
||||
"description": "open, read, strip, and save file to variable"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue