Migrate Neovim snippets to inline configuration

Same as with configuration.
No need for extra repository.
This commit is contained in:
Daniel Siepmann 2022-03-15 08:16:18 +01:00
parent 2a55b8e6fd
commit 9e5a77f592
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
15 changed files with 630 additions and 10 deletions

View file

@ -16,15 +16,6 @@ let
};
};
snippets = pkgs.vimUtils.buildVimPlugin {
name = "snippets";
src = pkgs.fetchgit {
url = "https://gitea.daniel-siepmann.de/danielsiepmann/vim-snippets.git";
rev = "v1.0.0";
sha256 = "23XR2YysdgUW+xKS79tAYP+Hjka0YolLaHlYiD0Hyx8=";
};
};
neotags = pkgs.vimUtils.buildVimPlugin {
name = "neotags";
src = pkgs.fetchgit {
@ -180,7 +171,6 @@ in {
colorscheme-smyckblue
neotags
configuration
snippets
syntax-typoscript
# More UI related

View file

@ -0,0 +1,2 @@
snippet bde Blade dump
{{ dd(${1:get_defined_vars()}) }}

View file

@ -0,0 +1,4 @@
snippet entry
`system('date +%Y-%m-%d')` `system('git config --get user.name')` <`system('git config --get user.email')`>
* ${0}

View file

@ -0,0 +1,8 @@
snippet prt
<%= ${1} %>
snippet link_to
<%= link_to '${1}', ${2}_path %>
snippet if
<% if ${1} %>
${2}
<% end %>

View file

@ -0,0 +1,56 @@
snippet file Insert Fluid Template File with Namespace
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true">
${0}
</html>
snippet falias
<f:alias map="${1}">
${0}
</f:alias>
snippet ftrans
{f:translate(id: '${1}')}
snippet fdebug
<f:debug>${1:{_all}}</f:debug>${2}
snippet fcomment
<f:comment>
${0}
</f:comment>
snippet finput
<f:form.${1:textfield} property="${2}" />
snippet fselect
<f:form.select name="${1:name}" options="${2:{variable}}" />${3}
snippet furiresource
{f:uri.resource(path: '${1}')}
snippet fsubmit
<f:form.submit value="${1:value}" />${3}
snippet fform
<f:form action="${1}">
${2}
</f:form>
snippet fif
<f:if condition="${1}">
<f:then>
${2}
</f:then>
<f:else>
${3}
</f:else>
</f:if>
snippet ffor
<f:for each="${1}" as="${2}">
${3}
</f:for>
snippet flayout
{f:layout(name: '${0}')}
snippet frender
{f:render(${1:section}: '${0}', arguments: _all)}
snippet fcobject
{f:cObject(typoscriptObjectPath: '${0}', ${1:data: ''})}
snippet fsection
<f:section name="${1}">
${2}
</f:section>
snippet import
{namespace ${1}=${2:TYPO3\Fluid}\ViewHelpers}
snippet cdata
<![CDATA[$0]]>

View file

@ -0,0 +1,17 @@
snippet file Insert full html base document #2
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>${1}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
${2}
</body>
</html>
snippet script
<script type="text/javascript">
${0}
</script>

View file

@ -0,0 +1,43 @@
snippet file JavaScript FileTemplate
/**
* @param {object} window The window object of the browser.
* @param {object} document The document object of the browser.
* @param {function} $ jQuery
* @param {undefined} undefined Just undefined
*
* @author `system('git config --get user.name')` <`system('git config --get user.email')`>
*/
;(function(window, document, $, undefined) {
${1}
})(window, document, jQuery);
snippet log
console.log(${1});${0}
snippet license
/*
* ${1}
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
snippet cdata
<![CDATA[
${0}
]]>
snippet if
if (${1}) {
${0}
}

View file

@ -0,0 +1,309 @@
snippet t3de Insert TYPO3 Extbase var_dump
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump(${1:debug_backtrace()}, '$1', 8, ${2:true});${3:die;}${4}
snippet additionalconf
if (getenv('TYPO3_ADDITIONAL_CONFIGURATION')) {
require_once getenv('TYPO3_ADDITIONAL_CONFIGURATION');
}
snippet xdebug
\xdebug_break();
snippet t3sqlde
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class)
->getConnectionByName('Default')
->getConfiguration()
->setSQLLogger(new class implements \Doctrine\DBAL\Logging\SQLLogger {
public function startQuery($sql, ?array $params = null, ?array $types = null) {
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($sql, 'sql', 8, false);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($params, 'params', 8, false);
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($types, 'types', 8, false);
}
public function stopQuery() { }
});
snippet declare_strict
declare(strict_types=1);
snippet t3log
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class)
->getLogger('das')
->debug('DAS', [${1}]);
snippet t3mem
\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Log\LogManager')
->getLogger('das')
->debug('memory stats ${1}', [
'memory_get_usage' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(memory_get_usage()),
'memory_get_peak_usage' => \TYPO3\CMS\Core\Utility\GeneralUtility::formatSize(memory_get_peak_usage()),
]);
snippet throw
throw new \Exception('${1:message}', `system('date +%s')`);
snippet t3devlog
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('${1:message}', '${2:ds}', ${3:0}, ${4:[]});
snippet construct
public function __construct(
${0}
) {
}
snippet sfile
<?php
declare(strict_types=1);
namespace `expand('%:h:gs?src/??:gs?/?\\\?')`;
/**
* Class `expand('%:t:s?.php??')`
* @package `expand('%:h:gs?src/??:gs?/?\\\?')`
*/
class `expand('%:t:s?.php??')`
{
${0}
}
snippet lfile
<?php
namespace `expand('%:h:gs?/?\\?:s?.?\u&?')`;
/**
*
*/
class ${1:`expand('%:t:s?.php??')`}
{
${2}
}
snippet lseedfile
<?php
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\\`expand('%:t:r:s?Seeder??')`;
class `expand('%:t:r')` extends Seeder
{
public function run(Factory $factory)
{
$factory->create(`expand('%:t:r:s?Seeder??')`::class, 50)->each(function ($`expand('%:t:r:s?Seeder??:s?.?\l&?')`) use ($factory) {
// $`expand('%:t:r:s?Seeder??:s?.?\l&?')`->posts()->save($factory->make(\App\Post::class));
});
}
}
snippet t3file
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?.*ext/??:s?Classes/??:s?local_packages/??:s?localPackages/??:s?packages/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
class ${1:`expand('%:t:s?.php??')`}
{
${2}
}
snippet localconf
<?php
(function ($extensionKey) {
${0}
})('${1:}');
snippet file
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?Classes/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
class ${1:`expand('%:t:s?.php??')`} extends ${2} implements ${3}
{
${4}
}
snippet stestfile
<?php
declare(strict_types=1);
namespace `expand('%:h:gs?src/??:gs?/?\\\?')`;
use PHPUnit\Framework\TestCase;
/**
* Tests `expand('%:t:s?.php??')`
* @package `expand('%:h:gs?src/??:gs?/?\\\?')`
*/
class `expand('%:t:s?.php??')` extends TestCase
{
/**
* @test
*/
public function ${0}()
{
}
}
snippet ltestfile
<?php
namespace `expand('%:h:gs?/?\\?:s?.?\u&?')`;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ${1:`expand('%:t:s?.php??')`} extends TestCase
{
use RefreshDatabase;
/**
* @var
*/
protected $subject;
public function setUp()
{
parent::setUp();
$this->subject = $this->app->make(::class);
}
${4}
}
snippet testfile
<?php
declare(strict_types=1);
/*
* Copyright (C) `system('date +%Y')` `system('git config --get user.name')` <`system('git config --get user.email')`>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace DanielSiepmann`expand('%:h:s?.*ext/??:s?local_packages/??:s?Classes/??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use DanielSiepmann`expand('%:r:s?.*ext/??:s?local_packages/??:s?Classes/??:s?Tests/Unit/??:s?Tests/Functional/??:s?Test??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`;
use PHPUnit\Framework\TestCase;
/**
* @covers \DanielSiepmann`expand('%:r:s?.*ext/??:s?local_packages/??:s?Classes/??:s?Tests/Unit/??:s?Tests/Functional/??:s?Test??:s?.*_?\u&?:gs?_.?\U&?:gs?_??:gs?/?\\\?:s??\\\?')`
*/
class ${1:`expand('%:t:s?.php??')`} extends TestCase
{
/**
* @test
*/
public function canBeCreated(): void
{
$subject = new `expand('%:r:s?Test$??:s?.*/??')`();
self::assertInstanceOf(
`expand('%:r:s?Test$??:s?.*/??')`::class,
$subject
);
}
}
snippet Exception
throw new \Exception('${1}', `strftime('%s')`);
snippet if
if (${1:/* condition */}) {
${0}
}
snippet foreach
foreach ($${1:variable} as $${2:value}) {
${0}
}
snippet foreachk
foreach ($${1:variable} as $${2:key} => $${3:value}) {
${0}
}
snippet fun
${1:private} function ${2:name}(${3})${4}
{
${0}
}
snippet closure
(function () {
${0}
})();
snippet test
/**
* @test
*/
public function ${1:name}(): void
{
${0}
}
snippet dump
var_dump(${1});${2}
snippet die
throw new \Exception('debugging end: ' . var_export(${1}, true));${2}

View file

@ -0,0 +1,4 @@
snippet file
@startuml
${0}
@enduml

View file

@ -0,0 +1,108 @@
snippet post
.. post:: `strftime("%b %d, %Y")`
:tags: ${2}
:excerpt: 2
${1:Title}
=========
Further reading
---------------
snippet filetoc
.. raw:: pdf
PageBreak oneColumn
.. contents::
.. raw:: pdf
PageBreak oneColumn
snippet filefooter
.. Some meta configuration for the document
.. |date| date:: %d.%m.%Y
.. |time| date:: %H:%M
.. section-numbering::
.. footer::
###Page### / ###Total###
.. vi: spelllang=de
snippet contents
.. contents::
:local:
snippet toc
.. toctree::
Subfolder/index
snippet label
.. _${0}:
snippet note
.. note::
${0}
snippet see
.. seealso::
${0}
snippet admo
.. ${1:attention, caution, danger, error, hint, important, note, tip, warning, admonition, title}::
${0}
snippet todo
.. todo:: ${0}
snippet include
.. literalinclude:: /Includes.txt${0}
snippet sidebar
.. sidebar:: ${0}
snippet figure
.. figure:: /Images/${1:1-Installation/figure-1-2.png}
:align: center
${2:Figure 1-2: The autocompletion feature will show you possible class names}
snippet file
.. _${1:refLabel}:
${2:heading}
=====
$0
snippet codeinclude
.. literalinclude:: ${1:filename}
:language: ${2:php}
:emphasize-lines: 12,15-18
:linenos:
snippet code
.. code-block:: ${1:php}
:linenos:
${0}
snippet youtube
.. youtube:: ${1:videoHash}
snippet index
.. index::
single: ${1:indexWord}
snippet option
.. option:: ${1:optionName}
$0

View file

@ -0,0 +1,4 @@
snippet test
test "${1}" do
end

View file

@ -0,0 +1,8 @@
snippet dump
{{ dump(${0}) }}
snippet include
{{ include('${0}.html.twig') }}
snippet path
{{ path('${1:route_name}') }}

View file

@ -0,0 +1,2 @@
snippet include
@import 'EXT:${1:ext_key}/${2:Path}/${3:FileName}.typoscript'

View file

@ -0,0 +1,48 @@
snippet xml
<?xml version="1.0"?>
snippet xlifft3
<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="messages" date="`strftime('%Y-%m-%dT%H:%M:%SZ')`" product-name="`expand('%:h:s?.*ext/??:s?/.*??')`">
<header/>
<body>
<trans-unit id="$0" xml:space="preserve">
<source></source>
</trans-unit>
</body>
</file>
</xliff>
snippet flexform
<?xml version="1.0" encoding="utf-8"?>
<T3DataStructure>
<ROOT>
<type>array</type>
<el>
<property>
<TCEforms>
<label>LLL:EXT:sitepackage/Resources/Private/Language/locallang_be.xlf:configuration.flexForm.</label>
<config>
<type>input</type>
</config>
</TCEforms>
</property>
</el>
</ROOT>
</T3DataStructure>
snippet trans
<trans-unit id="$0">
<source></source>
</trans-unit>
snippet cdata
<![CDATA[$0]]>
snippet phpunitsql
<env name="typo3DatabaseDriver" value="pdo_mysql"/>
<env name="typo3DatabaseName" value="testing"/>
<env name="typo3DatabaseHost" value="127.0.0.1"/>
<env name="typo3DatabaseUsername" value="testing"/>
<env name="typo3DatabasePassword" value="testing"/>

View file

@ -0,0 +1,17 @@
snippet file
services:
_defaults:
autowire: true
autoconfigure: true
public: false
DanielSiepmann\DsSite\:
resource: '../Classes/*'
DanielSiepmann\DsSite\Frontend\DataProcessing\:
resource: '../Classes/Frontend/DataProcessing/*'
snippet basevariant
-
base: '%env("TYPO3_BASE")%'
condition: 'getenv("TYPO3_BASE")'