[neovim] Port snipmate snippets for Python over to Ultisnips
This commit is contained in:
		
							parent
							
								
									e779607c5f
								
							
						
					
					
						commit
						a4e272bd6b
					
				
					 1 changed files with 45 additions and 0 deletions
				
			
		
							
								
								
									
										45
									
								
								config/nvim/UltiSnips/python.snippets
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								config/nvim/UltiSnips/python.snippets
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,45 @@
 | 
			
		|||
# python.snippets
 | 
			
		||||
# vim: set ts=8 sw=8 sts=8 noet list:
 | 
			
		||||
# Eryn Wells <eryn@erynwells.me>
 | 
			
		||||
 | 
			
		||||
snippet parse_args
 | 
			
		||||
def parse_args():
 | 
			
		||||
	parser = argparse.ArgumentParser()
 | 
			
		||||
	# TODO: Configure arguments here.
 | 
			
		||||
	args = parser.parse_args()
 | 
			
		||||
	return args
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet ifmain
 | 
			
		||||
def main():
 | 
			
		||||
	${1:pass}
 | 
			
		||||
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
	main()
 | 
			
		||||
endsnippet
 | 
			
		||||
 | 
			
		||||
snippet script
 | 
			
		||||
	#!/usr/bin/env python3
 | 
			
		||||
	# Eryn Wells <eryn@erynwells.me>
 | 
			
		||||
 | 
			
		||||
	'''
 | 
			
		||||
	New script.
 | 
			
		||||
	'''
 | 
			
		||||
 | 
			
		||||
	import argparse
 | 
			
		||||
 | 
			
		||||
	def parse_args(argv, *a, **kw):
 | 
			
		||||
		parser = argparse.ArgumentParser(*a, **kw)
 | 
			
		||||
		# TODO: Configure arguments here.
 | 
			
		||||
		args = parser.parse_args(argv)
 | 
			
		||||
		return args
 | 
			
		||||
	
 | 
			
		||||
	def main(argv):
 | 
			
		||||
		args = parse_args(argv[1:], prog=argv[0])
 | 
			
		||||
		${1:# TODO}
 | 
			
		||||
	
 | 
			
		||||
	if __name__ == '__main__':
 | 
			
		||||
		import sys
 | 
			
		||||
		result = main(sys.argv)
 | 
			
		||||
		sys.exit(0 if not result else result)
 | 
			
		||||
endsnippet
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue