From ac066bb07654ee90086fcd3ec833c61531eeab8d Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Tue, 30 Jan 2024 21:48:10 +0100 Subject: [PATCH] Add '1px border ' snippets --- .vim/snips/css.snippets | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.vim/snips/css.snippets b/.vim/snips/css.snippets index 9e5ba2b..deb9e3f 100644 --- a/.vim/snips/css.snippets +++ b/.vim/snips/css.snippets @@ -1,6 +1,20 @@ -snippet b1r "Red border (1px)" -border: 1px solid red; -$0 +snippet b1(\w+) "Border (1px)" r +`!p +import re +colors = { + 'r': 'red', + 'g': 'green', + 'b': 'blue', + 'y': 'yellow', + 'o': 'orange', + 'p': 'purple', + 'c': 'cyan', + 'm': 'magenta', + 'w': 'white', +} +color = colors.get(match.group(1), 'black') +snip.rv = f"border: 1px solid {color};" +`$0 endsnippet snippet df "Use flexbox layout"