From 485eefc0176688574df58ce740b415c3782337db Mon Sep 17 00:00:00 2001 From: rayelliott Date: Sat, 9 May 2020 15:26:33 +0000 Subject: [PATCH 1/8] add wh - width, height to css --- UltiSnips/css.snippets | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UltiSnips/css.snippets b/UltiSnips/css.snippets index 8307065..e26e679 100644 --- a/UltiSnips/css.snippets +++ b/UltiSnips/css.snippets @@ -39,6 +39,11 @@ snippet h "height: ;" height: ${1:100%}; endsnippet +snippet wh "width: ; height: ;" +width: ${1:100%}; +height: $1; +endsnippet + snippet mxw "max-width: ;" max-width: ${1:100%}; endsnippet From ae2608cd18f980770c12de326bcc13f713412976 Mon Sep 17 00:00:00 2001 From: dots Date: Sat, 9 May 2020 22:58:29 +0300 Subject: [PATCH 2/8] update mappings add jj; and jj, --- init.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init.vim b/init.vim index 3df16ce..d472fed 100644 --- a/init.vim +++ b/init.vim @@ -390,7 +390,9 @@ nnoremap qn :cnewer "}}} " insert mode mappings {{{ -inoremap jkrg :reg +inoremap jj; A; +inoremap jj, A, +inoremap jjrg :reg inoremap :w :w inoremap [:w :w inoremap {:w :w From 0d94085c262394169d759cfc495190fcfafe4334 Mon Sep 17 00:00:00 2001 From: dots Date: Sun, 10 May 2020 14:46:27 +0300 Subject: [PATCH 3/8] update set tags --- init.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.vim b/init.vim index d472fed..a9d9496 100644 --- a/init.vim +++ b/init.vim @@ -205,8 +205,8 @@ set lazyredraw set title -" the ;/home/ray tells vim to stop searching at /home/ray -set tags+=./.tags,.tags,./tags-py,.tags-py;/home/ray/ +" the ;/home/* tells vim to stop searching at /home/* (I hope!) +set tags=./.tags,.tags,./tags-external,.tags-external;/home/* " persisitent undo file set undofile From fb3a829d3d2db5e6fdf78b53878a9b586a149e42 Mon Sep 17 00:00:00 2001 From: rayelliott Date: Sun, 10 May 2020 13:15:31 +0000 Subject: [PATCH 4/8] fix merge conflict --- UltiSnips/php.snippets | 22 +++++++++++++++++++++- coc-settings.json | 5 ++--- init.plugins.vim | 4 ++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 748d6b4..6746b42 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -1,5 +1,25 @@ snippet pf "public function ..." public function $1($2) { - $0 + $0 } endsnippet + +snippet wpregblock "function register_block() { ..." +function ${1:plugin_name}_register_block() { + + // automatically load dependencies and version + $asset_file = include( plugin_dir_path( __FILE__ ) . '$2/build/index.asset.php'); + + wp_register_script( + '${1/_/-/g}-${2:block-name}', + plugins_url( '$2/build/block.js', __FILE__ ), + $asset_file['dependencies'], + $asset_file['version'] + ); + + register_block_type( '${3:namespace}/${1/_/-/g}-$2', + array( 'editor_script' => '${1/_/-/g}-$2',) ); + +} +add_action( 'init', '$1_register_block' ); +endsnippet diff --git a/coc-settings.json b/coc-settings.json index 0e34b9f..b5fa2b7 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -22,13 +22,12 @@ "python.linting.lintOnSave": true, "python.formatting.provider": "black", "python.formatting.blackPath": "/home/ray/.local/bin/black", - "coc.preferences.formatOnSaveFiletypes": ["python", "scss", "css", "vue"], + "coc.preferences.formatOnSaveFiletypes": ["python", "vue"], "eslint.enable": true, "eslint.autoFixOnSave": true, "eslint.filetypes": [ "javascript", "vue" - ], - "prettier.eslintIntegration": true + ] } diff --git a/init.plugins.vim b/init.plugins.vim index 7e6aa16..39be4f5 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -25,8 +25,8 @@ call plug#begin('~/.config/nvim/bundle') let g:ale_fix_on_save = 1 let g:ale_fix_on_save_ignore = { 'vue': ['eslint'] } - let g:ale_linters = {'scss': [], 'javascript': [], 'json': [], 'php':['php'], 'python': [], 'html':['htmlhint'], 'vue': []} - let g:ale_fixers = {'scss': ['prettier'], 'javascript': [], 'json': ['jq'], 'python': [], 'vue': []} + let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'json': [], 'php':['php'], 'python': [], 'html':['htmlhint'], 'vue': []} + let g:ale_fixers = {'scss': ['stylelint'], 'javascript': [], 'json': ['jq'], 'python': [], 'vue': []} let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' From 744744ba71993ff4a5ecf774df940986ec214e3f Mon Sep 17 00:00:00 2001 From: rayelliott Date: Sun, 10 May 2020 13:18:31 +0000 Subject: [PATCH 5/8] rename snippet --- UltiSnips/php.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 6746b42..61e6824 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -4,7 +4,7 @@ public function $1($2) { } endsnippet -snippet wpregblock "function register_block() { ..." +snippet wprb "function register_block() { ..." function ${1:plugin_name}_register_block() { // automatically load dependencies and version From f75529402dc970c76e812eb1a10d052ab9b21506 Mon Sep 17 00:00:00 2001 From: rayelliott Date: Sun, 10 May 2020 15:28:18 +0000 Subject: [PATCH 6/8] update snippets --- UltiSnips/javascript.snippets | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index a725c45..324a597 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -116,3 +116,25 @@ endsnippet snippet tb "this ... = ... .bind(this);" this.$1 = this.$1.bind(this); endsnippet + +snippet wprb +import { registerBlockType } from '@wordpress/blocks'; + +const blockStyle = { + color: red, + backgroundColor: pink, +}; + +registerBlockType( '${1:namespace}/${2:block-name}', { + title: '$3', + icon: '${4:universal-access-alt}', + category: '${5:layout}', + example: {}, + edit() { + return
Hello World, step 1 (from the editor).
; + }, + save() { + return
Hello World, step 1 (from the frontend).
; + }, +} ); +endsnippet From 112c528ff571d4396b6f5ba1c7c4e770bcc45ad3 Mon Sep 17 00:00:00 2001 From: rayelliott Date: Sun, 10 May 2020 15:36:13 +0000 Subject: [PATCH 7/8] use index.js, not block.js --- UltiSnips/php.snippets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 61e6824..1efa075 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -12,7 +12,7 @@ function ${1:plugin_name}_register_block() { wp_register_script( '${1/_/-/g}-${2:block-name}', - plugins_url( '$2/build/block.js', __FILE__ ), + plugins_url( '$2/build/index.js', __FILE__ ), $asset_file['dependencies'], $asset_file['version'] ); From 14a25c725c71431e7ac64cda72d84668e94e5086 Mon Sep 17 00:00:00 2001 From: rayelliott Date: Sun, 10 May 2020 21:23:19 +0000 Subject: [PATCH 8/8] update snippets --- UltiSnips/javascript.snippets | 4 ++-- UltiSnips/php.snippets | 34 +++++++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/UltiSnips/javascript.snippets b/UltiSnips/javascript.snippets index 324a597..3302bfe 100644 --- a/UltiSnips/javascript.snippets +++ b/UltiSnips/javascript.snippets @@ -130,8 +130,8 @@ registerBlockType( '${1:namespace}/${2:block-name}', { icon: '${4:universal-access-alt}', category: '${5:layout}', example: {}, - edit() { - return
Hello World, step 1 (from the editor).
; + edit( { className } ) { + return
Hello World, step 1 (from the editor).
; }, save() { return
Hello World, step 1 (from the frontend).
; diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index 1efa075..a32a09b 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -5,21 +5,37 @@ public function $1($2) { endsnippet snippet wprb "function register_block() { ..." -function ${1:plugin_name}_register_block() { +function ${1/-/_/g}_${2/-/_/g}_register_block() { // automatically load dependencies and version $asset_file = include( plugin_dir_path( __FILE__ ) . '$2/build/index.asset.php'); wp_register_script( - '${1/_/-/g}-${2:block-name}', - plugins_url( '$2/build/index.js', __FILE__ ), - $asset_file['dependencies'], - $asset_file['version'] - ); + '${1:plugin-name}-${2:block-name}', + plugins_url( '$2/build/index.js', __FILE__ ), + $asset_file['dependencies'], + $asset_file['version'] + ); - register_block_type( '${3:namespace}/${1/_/-/g}-$2', - array( 'editor_script' => '${1/_/-/g}-$2',) ); + wp_register_style( + '$1-$2-style', + plugins_url( '$2/build/style.css', __FILE__ ), + array(), + filemtime ( plugin_dir_path( __FILE__ ) . '$2/build/style.css' ) + ); + wp_register_style( + '$1-$2-editor', + plugins_url( '$2/build/editor.css', __FILE__ ), + array(), + filemtime ( plugin_dir_path( __FILE__ ) . '$2/build/editor.css' ) + ); + + register_block_type( 'myguten/$1-$2', array( + 'style' => '$1-$2-style', + 'editor_style' => '$1-$2-editor', + 'editor_script' => '$1-$2', + ) ); } -add_action( 'init', '$1_register_block' ); +add_action( 'init', '${1/-/_/g}_${2/-/_/g}_register_block' ); endsnippet