test 0.12.1 config
This commit is contained in:
75
nvim-old/.config/nvim/snippets/python.lua
Normal file
75
nvim-old/.config/nvim/snippets/python.lua
Normal file
@@ -0,0 +1,75 @@
|
||||
-- Python snippets
|
||||
local ls = require("luasnip")
|
||||
local s = ls.snippet
|
||||
local t = ls.text_node
|
||||
local i = ls.insert_node
|
||||
local f = ls.function_node
|
||||
local c = ls.choice_node
|
||||
local d = ls.dynamic_node
|
||||
local sn = ls.snippet_node
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local rep = require("luasnip.extras").rep
|
||||
|
||||
-- Return a table of snippets for Python
|
||||
-- stylua: ignore start
|
||||
return {
|
||||
-- Print statement
|
||||
s("pr", {
|
||||
t("print("),
|
||||
i(1, "text"),
|
||||
t(")"),
|
||||
}),
|
||||
|
||||
-- Function definition
|
||||
s("def", fmt([[
|
||||
def {}({}):
|
||||
{}
|
||||
]], {
|
||||
i(1, "function_name"),
|
||||
i(2, ""),
|
||||
i(3, "pass"),
|
||||
})),
|
||||
|
||||
-- Class definition
|
||||
s("class", fmt([[
|
||||
class {}:
|
||||
def __init__(self, {}):
|
||||
{}
|
||||
]], {
|
||||
i(1, "ClassName"),
|
||||
i(2, ""),
|
||||
i(3, "pass"),
|
||||
})),
|
||||
|
||||
-- For loop
|
||||
s("for", fmt([[
|
||||
for {} in {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "item"),
|
||||
i(2, "iterable"),
|
||||
i(3, "pass"),
|
||||
})),
|
||||
|
||||
-- If statement
|
||||
s("if", fmt([[
|
||||
if {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "condition"),
|
||||
i(2, "pass"),
|
||||
})),
|
||||
|
||||
-- Try/except
|
||||
s("try", fmt([[
|
||||
try:
|
||||
{}
|
||||
except {}:
|
||||
{}
|
||||
]], {
|
||||
i(1, "# code"),
|
||||
i(2, "Exception"),
|
||||
i(3, "pass"),
|
||||
})),
|
||||
}
|
||||
-- stylua: ignore end
|
||||
Reference in New Issue
Block a user