many snippets
This commit is contained in:
		
							parent
							
								
									ca932c83df
								
							
						
					
					
						commit
						4fab2f7425
					
				
							
								
								
									
										2
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										2
									
								
								init.lua
								
								
								
								
							|  | @ -959,3 +959,5 @@ ls.add_snippets('tcl', snippets.tcl) | |||
| ls.add_snippets('typst', snippets.typst) | ||||
| ls.add_snippets('c', snippets.c) | ||||
| ls.add_snippets('cpp', snippets.c_header) | ||||
| ls.add_snippets('bib', snippets.bib) | ||||
| ls.add_snippets('javascript', snippets.js) | ||||
|  |  | |||
|  | @ -11,5 +11,19 @@ return { | |||
|     vim.o.tabstop = 4 | ||||
|     vim.o.shiftwidth = 4 | ||||
|     vim.o.expandtab = true | ||||
| 
 | ||||
|     vim.keymap.set('', '<up>', '<nop>', { noremap = true }) | ||||
|     vim.keymap.set('', '<down>', '<nop>', { noremap = true }) | ||||
|     vim.keymap.set('i', '<up>', '<nop>', { noremap = true }) | ||||
|     vim.keymap.set('i', '<down>', '<nop>', { noremap = true }) | ||||
|     vim.keymap.set('i', '<left>', '<nop>', { noremap = true }) | ||||
|     vim.keymap.set('i', '<right>', '<nop>', { noremap = true }) | ||||
| 
 | ||||
|     vim.opt.mouse = '' | ||||
|     vim.opt.mousescroll = 'ver:0,hor:0' | ||||
| 
 | ||||
|     vim.api.nvim_create_user_command('ConfEdit', function() | ||||
|       vim.cmd 'edit ~/.config/nvim/lua/custom/plugins/' | ||||
|     end, { desc = 'Ouvrir le dossier des plugins personnalisés' }) | ||||
|   end, | ||||
| } | ||||
|  |  | |||
|  | @ -3,6 +3,7 @@ local s = ls.snippet | |||
| local t = ls.text_node | ||||
| local i = ls.insert_node | ||||
| local rep = require('luasnip.extras').rep | ||||
| local fmt = require('luasnip.extras.fmt').fmt | ||||
| 
 | ||||
| return { | ||||
|   -- Snippet pour la déclaration de fonction Tcl | ||||
|  | @ -57,7 +58,7 @@ return { | |||
|   }, | ||||
|   -- Déclaration de snippet typst | ||||
|   typst = { | ||||
|     s('images', { | ||||
|     s('image', { | ||||
|       t { '#figure(caption: "' }, | ||||
|       i(1, 'caption'), | ||||
|       t { '")[', '' }, | ||||
|  | @ -66,6 +67,20 @@ return { | |||
|       t { '")', '' }, | ||||
|       t { ']' }, | ||||
|     }), | ||||
|     s('image_paysage', { | ||||
|       t { '#page(flipped:true)[', '  #figure(caption: "' }, | ||||
|       i(1, ''), | ||||
|       t { '")[', '    #align(center + horizon)[#image("' }, | ||||
|       i(2, ''), | ||||
|       t { '")]', '  ]', ']' }, | ||||
|     }), | ||||
|     s('code_fig', { | ||||
|       t { '#figure(caption:"' }, | ||||
|       i(1, 'Légende'), | ||||
|       t { '")[```', '' }, | ||||
|       i(2, 'Contenu'), | ||||
|       t { '', '```]' }, | ||||
|     }), | ||||
|   }, | ||||
|   c = { | ||||
|     s('main', { | ||||
|  | @ -119,4 +134,92 @@ return { | |||
|       t { '', 'int foo(int x);  /* An example function declaration */', '', '#endif' }, | ||||
|     }), | ||||
|   }, | ||||
|   bib = { | ||||
|     s('online', { | ||||
|       t { '@online{' }, | ||||
|       i(1, 'citekey'), | ||||
|       t { ',', '\tauthor = {' }, | ||||
|       i(2, 'Author Name'), | ||||
|       t { '},' }, | ||||
|       t { '', '\ttitle = {' }, | ||||
|       i(3, 'Title of Webpage'), | ||||
|       t { '},' }, | ||||
|       t { '', '\turl = {' }, | ||||
|       i(4, 'https://example.com'), | ||||
|       t { '},' }, | ||||
|       t { '', '\turldate = {' }, | ||||
|       i(5, '2025-01-08'), | ||||
|       t { '}', '}' }, | ||||
|     }), | ||||
|   }, | ||||
|   js = { | ||||
|     s('func', { | ||||
|       t { 'function ' }, | ||||
|       i(1, 'functionName'), | ||||
|       t '() {', | ||||
|       t { '', '  ' }, | ||||
|       i(2, '// code'), | ||||
|       t { '', '}' }, | ||||
|     }), | ||||
| 
 | ||||
|     -- If statement snippet | ||||
|     s('if', { | ||||
|       t { 'if (' }, | ||||
|       i(1, 'condition'), | ||||
|       t ') {', | ||||
|       t { '', '  ' }, | ||||
|       i(2, '// code'), | ||||
|       t { '', '}' }, | ||||
|     }), | ||||
| 
 | ||||
|     -- For loop snippet | ||||
|     s('for', { | ||||
|       t { 'for (let ' }, | ||||
|       i(1, 'i'), | ||||
|       t ' = ', | ||||
|       i(2, '0'), | ||||
|       t '; ', | ||||
|       i(3, 'i'), | ||||
|       t ' < ', | ||||
|       i(4, '10'), | ||||
|       t '; ', | ||||
|       i(5, 'i'), | ||||
|       t '++) {', | ||||
|       t { '', '  ' }, | ||||
|       i(6, '// code'), | ||||
|       t { '', '}' }, | ||||
|     }), | ||||
| 
 | ||||
|     -- While loop snippet | ||||
|     s('while', { | ||||
|       t { 'while (' }, | ||||
|       i(1, 'condition'), | ||||
|       t ') {', | ||||
|       t { '', '  ' }, | ||||
|       i(2, '// code'), | ||||
|       t { '', '}' }, | ||||
|     }), | ||||
| 
 | ||||
|     -- Foreach snippet | ||||
|     s('foreach', { | ||||
|       i(1, 'array'), | ||||
|       t '.forEach(', | ||||
|       i(2, 'element'), | ||||
|       t ' => {', | ||||
|       t { '', '  ' }, | ||||
|       i(3, '// code'), | ||||
|       t { '', '});' }, | ||||
|     }), | ||||
|     s('javadoc', { | ||||
|       t { '/**', ' * ' }, | ||||
|       i(1, 'Description...'), | ||||
|       t { '', ' * ', ' * @param ' }, | ||||
|       i(2, 'paramName'), | ||||
|       t ' ', | ||||
|       i(3, 'description of parameter'), | ||||
|       t { '', ' * @return ' }, | ||||
|       i(4, 'description of return value'), | ||||
|       t { '', ' */' }, | ||||
|     }), | ||||
|   }, | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue