Merge branch 'master' of ssh://git.rayelliott.dev:3222/dots/nvim

This commit is contained in:
Ray Elliott 2020-05-16 13:35:28 +01:00
commit e96ae73fd8
5 changed files with 68 additions and 9 deletions

View File

@ -116,3 +116,25 @@ endsnippet
snippet tb "this ... = ... .bind(this);" snippet tb "this ... = ... .bind(this);"
this.$1 = this.$1.bind(this); this.$1 = this.$1.bind(this);
endsnippet 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( { className } ) {
return <div className={ className }>Hello World, step 1 (from the editor).</div>;
},
save() {
return <div style={ blockStyle }>Hello World, step 1 (from the frontend).</div>;
},
} );
endsnippet

View File

@ -1,5 +1,41 @@
snippet pf "public function ..." snippet pf "public function ..."
public function $1($2) { public function $1($2) {
$0 $0
} }
endsnippet endsnippet
snippet wprb "function 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:plugin-name}-${2:block-name}',
plugins_url( '$2/build/index.js', __FILE__ ),
$asset_file['dependencies'],
$asset_file['version']
);
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/-/_/g}_${2/-/_/g}_register_block' );
endsnippet

View File

@ -22,13 +22,12 @@
"python.linting.lintOnSave": true, "python.linting.lintOnSave": true,
"python.formatting.provider": "black", "python.formatting.provider": "black",
"python.formatting.blackPath": "/home/ray/.local/bin/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.enable": true,
"eslint.autoFixOnSave": true, "eslint.autoFixOnSave": true,
"eslint.filetypes": [ "eslint.filetypes": [
"javascript", "javascript",
"vue" "vue"
], ]
"prettier.eslintIntegration": true
} }

View File

@ -25,8 +25,8 @@ call plug#begin('~/.config/nvim/bundle')
let g:ale_fix_on_save = 1 let g:ale_fix_on_save = 1
let g:ale_fix_on_save_ignore = { 'vue': ['eslint'] } 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_linters = {'scss': ['stylelint'], 'javascript': [], 'json': [], 'php':['php'], 'python': [], 'html':['htmlhint'], 'vue': []}
let g:ale_fixers = {'scss': ['prettier'], 'javascript': [], 'json': ['jq'], 'python': [], 'vue': []} let g:ale_fixers = {'scss': ['stylelint'], 'javascript': [], 'json': ['jq'], 'python': [], 'vue': []}
let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix'

View File

@ -205,8 +205,8 @@ set lazyredraw
set title set title
" the ;/home/ray tells vim to stop searching at /home/ray " the ;/home/* tells vim to stop searching at /home/* (I hope!)
set tags+=./.tags,.tags,./tags-py,.tags-py;/home/ray/ set tags=./.tags,.tags,./tags-external,.tags-external;/home/*
" persisitent undo file " persisitent undo file
set undofile set undofile
@ -390,7 +390,9 @@ nnoremap <space>qn :cnewer<CR>
"}}} "}}}
" insert mode mappings {{{ " insert mode mappings {{{
inoremap jkrg <c-o>:reg<cr> inoremap jj; <Esc>A;<Esc>
inoremap jj, <Esc>A,<Esc>
inoremap jjrg <c-o>:reg<cr>
inoremap :w<cr> :w<cr> inoremap :w<cr> :w<cr>
inoremap [:w<cr> :w<cr> inoremap [:w<cr> :w<cr>
inoremap {:w<cr> :w<cr> inoremap {:w<cr> :w<cr>