Add Rust hello world, remove weird python based print snippet
Test Neovim config on push / build (ubuntu-20.04) (push) Failing after 33s
Details
Test Neovim config on push / build (ubuntu-20.04) (push) Failing after 33s
Details
This commit is contained in:
parent
3348f2e49b
commit
8233320d90
|
@ -1,3 +1,14 @@
|
|||
snippet helloworld "Hello world example" b
|
||||
// @name main
|
||||
// @return
|
||||
// @brief Hello world example.
|
||||
// @param
|
||||
fn main() {
|
||||
println!("Hello World!");
|
||||
}
|
||||
$0
|
||||
endsnippet
|
||||
|
||||
snippet fn "function declaration" i
|
||||
// @name $1
|
||||
// @return $3
|
||||
|
@ -13,13 +24,6 @@ else:
|
|||
$0
|
||||
endsnippet
|
||||
|
||||
snippet doxygen "Doxygen comment" b
|
||||
// @name ${1:name}
|
||||
// @return ${2:Return type}
|
||||
// @param ${3:Parameter}
|
||||
// @brief ${4:Description}
|
||||
endsnippet
|
||||
|
||||
snippet struct "struct declaration"
|
||||
// $1
|
||||
// ${2:Description}
|
||||
|
@ -50,39 +54,6 @@ while $1 {
|
|||
} $0
|
||||
endsnippet
|
||||
|
||||
global !p
|
||||
import re
|
||||
def create_parameter_placeholders(snip):
|
||||
placeholders_amount = int(snip.buffer[snip.line].strip())
|
||||
|
||||
snip.buffer[snip.line] = ''
|
||||
|
||||
anon_snippet_body = 'println!("' + '{}'.join(['$' + str(i+1) for i in range(placeholders_amount)]) + f"${placeholders_amount}" + '"'
|
||||
|
||||
if placeholders_amount > 0:
|
||||
anon_snippet_body = anon_snippet_body + ', '
|
||||
|
||||
anon_snippet_body = anon_snippet_body + ', '.join(['$' + str(i+1) for i in range(placeholders_amount, 2*placeholders_amount)]) + ");"
|
||||
|
||||
snip.expand_anon(anon_snippet_body)
|
||||
endglobal
|
||||
|
||||
post_jump "create_parameter_placeholders(snip)"
|
||||
snippet "print\d+" "println" rA
|
||||
`!p snip.rv = match.group(1)`
|
||||
endsnippet
|
||||
|
||||
snippet println "println" A
|
||||
println!("$1");$0
|
||||
endsnippet
|
||||
|
||||
snippet docstring "Document head" b
|
||||
/*
|
||||
* Filename: `!p snip.rv = fn`
|
||||
* Author: ${1:Yannick Reiss}
|
||||
* Project: ${2:Project Name}
|
||||
* Copyright: ${3:None} => You • 9 months ago • Move of Snippets into repository
|
||||
* Description: ${4:Funny module}
|
||||
*
|
||||
*/$0
|
||||
endsnippet
|
||||
|
|
Loading…
Reference in New Issue