Compare commits

3 Commits

Author SHA1 Message Date
847c71a194 Update projects 2025-12-23 22:52:37 +00:00
Chris
78b8bf177c Merge branch 'main' of labs.scarif.space:chris/nvim 2025-12-18 09:18:41 +00:00
Chris
4f8e722f13 Snippets 2025-12-18 09:18:00 +00:00
3 changed files with 160 additions and 77 deletions

View File

@@ -92,39 +92,39 @@ end
local function laravel_bookmarks_with_dir(dir)
create_bookmark_maps {
['e'] = dir .. '/.env',
['l'] = dir .. '/storage/logs/laravel.log',
['w'] = dir .. '/routes/web.php',
['a'] = dir .. '/routes/api.php',
['m'] = dir .. '/database/migrations',
['e'] = dir .. '.env',
['l'] = dir .. 'storage/logs/laravel.log',
['w'] = dir .. 'routes/web.php',
['a'] = dir .. 'routes/api.php',
['m'] = dir .. 'database/migrations',
['dc'] = dir .. '/app/Core/',
['dd'] = dir .. '/app/Data/',
['dE'] = dir .. '/app/Enums/',
['de'] = dir .. '/app/Events/',
['dh'] = dir .. '/app/Http/',
['dj'] = dir .. '/app/Jobs/',
['dl'] = dir .. '/app/Listeners/',
['dM'] = dir .. '/app/Mail/',
['dm'] = dir .. '/app/Models/',
['dn'] = dir .. '/app/Notifications/',
['do'] = dir .. '/app/Observers/',
['dp'] = dir .. '/app/Providers/',
['dc'] = dir .. 'app/Core/',
['dd'] = dir .. 'app/Data/',
['dE'] = dir .. 'app/Enums/',
['de'] = dir .. 'app/Events/',
['dh'] = dir .. 'app/Http/',
['dj'] = dir .. 'app/Jobs/',
['dl'] = dir .. 'app/Listeners/',
['dM'] = dir .. 'app/Mail/',
['dm'] = dir .. 'app/Models/',
['dn'] = dir .. 'app/Notifications/',
['do'] = dir .. 'app/Observers/',
['dp'] = dir .. 'app/Providers/',
['pa'] = dir .. '/app/Providers/AppServiceProvider.php',
['pe'] = dir .. '/app/Providers/EventServiceProvider.php',
['pa'] = dir .. 'app/Providers/AppServiceProvider.php',
['pe'] = dir .. 'app/Providers/EventServiceProvider.php',
['cA'] = dir .. '/config/app.php',
['ca'] = dir .. '/config/auth.php',
['cb'] = dir .. '/config/broadcasting.php',
['cd'] = dir .. '/config/database.php',
['cf'] = dir .. '/config/filesystems.php',
['ch'] = dir .. '/config/filesystems.php',
['cl'] = dir .. '/config/logging.php',
['cm'] = dir .. '/config/mail.php',
['cq'] = dir .. '/config/queue.php',
['cS'] = dir .. '/config/services.php',
['cs'] = dir .. '/config/session.php',
['cA'] = dir .. 'config/app.php',
['ca'] = dir .. 'config/auth.php',
['cb'] = dir .. 'config/broadcasting.php',
['cd'] = dir .. 'config/database.php',
['cf'] = dir .. 'config/filesystems.php',
['ch'] = dir .. 'config/filesystems.php',
['cl'] = dir .. 'config/logging.php',
['cm'] = dir .. 'config/mail.php',
['cq'] = dir .. 'config/queue.php',
['cS'] = dir .. 'config/services.php',
['cs'] = dir .. 'config/session.php',
}
end
@@ -216,8 +216,8 @@ local PROJECTS = {
end, { desc = 'Open database manager' })
map('s ', '!cd server && ', { desc = 'Run command in server directory' }, 'c')
map('c ', '!cd client && ', { desc = 'Run command in client directory' }, 'c')
laravel_keymaps 'server'
laravel_makes 'server'
laravel_keymaps 'server/'
laravel_makes 'server/'
map('yrn ', '!cd client && yarn ', { desc = 'Run yarn script' }, 'c')
map('<Leader>pt', ':!cd server && php artisan typescript:transform --format<CR>', { desc = 'Compile typescript' })
require('conform').formatters.pint = {

View File

@@ -1,45 +1,128 @@
local ls = require 'luasnip'
local s = ls.snippet
local sn = ls.snippet_node
local fn = ls.function_node
local ms = ls.multi_snippet
local t = ls.text_node
local c = ls.choice_node
local i = ls.insert_node
local f = ls.function_node
local d = ls.dynamic_node
local fmt = require('luasnip.extras.fmt').fmt
local rep = require('luasnip.extras').rep
local extend_decorator = require 'luasnip.util.extend_decorator'
local fmta = extend_decorator.apply(fmt, { delimiters = '#~' })
local utils = require 'snippets.snip_utils'
local tr = utils.tr
local etr = utils.etr
local atr = utils.atr
local ctr = utils.ctr
local bs = utils.bs
return {
s('du', { t 'console.log(', i(0), t ');' }),
s(etr('du ', 'Dump a variable to the console'), fmta('console.log(#~);', { i(0) })),
s(
etr('vue', 'Vue Single File Component skeleton'),
fmta(
[[
<template>
</template>
<script setup>
#~
</script>
<style scoped>
</style>
]],
{ i(0) }
)
),
s('vue', {
t { '<template>', '' },
t { '', '</template>', '', '', '<script setup>', '' },
i(0),
t { '', '</script>', '', '', '<style scoped>', '', '.o-share-page {', '}', '', '</style>' },
bs(atr('t ', 'this'), fmta('this.#~', { i(0) })),
s(etr('return ', 'Add semicolon after return'), fmta('return #~;', { i(0) })),
s(etr('rt ', 'return alias'), fmta('return #~;', { i(0) })),
s(etr('const', 'const declaration'), {
c(1, {
sn(nil, fmta('const #~ = #~;', { i(1, 'variableName'), i(2, 'value') })),
sn(
nil,
fmta(
[[
const #~ = (#~) => {
#~
}
]],
{ i(1), i(2), i(3) }
)
),
}),
}),
s('fun', {
t 'function ',
i(1),
t '(',
i(2),
t ') {',
t { '', ' ' },
i(0),
t { '', '}' },
s(
etr('fn ', 'function block'),
fmta(
[[
function #~(#~) {
#~
}
]],
{ i(1), i(2), i(0) }
)
),
bs(atr('fn ', 'function block'), {
c(1, {
sn(
nil,
fmta(
[[
(#~) => {
#~
}
]],
{ i(1), i(2) }
)
),
sn(
nil,
fmta(
[[
function (#~) {
#~
}
]],
{ i(1), i(2) }
)
),
}),
}),
s('afun', {
t 'async function ',
i(1),
t '(',
i(2),
t ') {',
t { '', ' ' },
i(0),
t { '', '}' },
bs(atr('afn ', 'async function block'), {
c(1, {
sn(
nil,
fmta(
[[
async (#~) => {
#~
}
]],
{ i(1), i(2) }
)
),
sn(
nil,
fmta(
[[
async function (#~) {
#~
}
]],
{ i(1), i(2) }
)
),
}),
s('()', {
t '() => {',
t { '', ' ' },
i(0),
t { '', '}' },
}),
}

View File

@@ -172,7 +172,7 @@ return {
s(etr('return ', 'Add semicolon after return'), fmta('return #~;', { i(0) })),
s(atr(' use ', 'Add use to function'), fmta(' use (#~)', { i(0) })),
s(etr('rt ', 'return alias'), fmta('return #~;', { i(0) })),
bs(etr('fn ', 'Shorthand function block'), {
bs(atr('fn ', 'Shorthand function block'), {
c(1, {
sn(nil, fmta('fn (#~) => #~', { i(1), i(2) })),
sn(
@@ -188,7 +188,7 @@ return {
),
}),
}),
bs(etr('fun ', 'Shorthand function block'), {
bs(atr('fun ', 'Shorthand function block'), {
c(1, {
sn(
nil,
@@ -384,7 +384,7 @@ return {
-------------
s(
etr('bt', 'belongsTo Laravel relationship method'),
c(0, {
c(1, {
sn(
nil,
fmta(
@@ -397,7 +397,7 @@ return {
return $this->belongsTo(#~::class);
}
]],
{ rep(1), i(0), i(1) }
{ rep(1), i(2), i(1) }
)
),
sn(
@@ -412,14 +412,14 @@ return {
return $this->belongsTo(#~::class, #~);
}
]],
{ rep(1), i(2), i(1), i(0) }
{ rep(1), i(2), i(1), i(3) }
)
),
})
),
s(
etr('hm', 'hasMany Laravel relationship method'),
c(0, {
c(1, {
sn(
nil,
fmta(
@@ -432,7 +432,7 @@ return {
return $this->hasOne(#~::class);
}
]],
{ rep(1), i(0), i(1) }
{ rep(1), i(2), i(1) }
)
),
sn(
@@ -447,14 +447,14 @@ return {
return $this->hasOne(#~::class, #~);
}
]],
{ rep(1), i(2), i(1), i(0) }
{ rep(1), i(2), i(1), i(3) }
)
),
})
),
s(
etr('ho', 'hasOne Laravel relationship method'),
c(0, {
c(1, {
sn(
nil,
fmta(
@@ -467,7 +467,7 @@ return {
return $this->hasOne(#~::class);
}
]],
{ rep(1), i(0), i(1) }
{ rep(1), i(2), i(1) }
)
),
sn(
@@ -482,14 +482,14 @@ return {
return $this->hasOne(#~::class, #~);
}
]],
{ rep(1), i(2), i(1), i(0) }
{ rep(1), i(2), i(1), i(3) }
)
),
})
),
s(
etr('bm', 'belongsToMany Laravel relationship method'),
c(0, {
c(1, {
sn(
nil,
fmta(
@@ -502,7 +502,7 @@ return {
return $this->belongsToMany(#~::class, #~);
}
]],
{ rep(1), i(2), i(1), i(0) }
{ rep(1), i(2), i(1), i(3) }
)
),
sn(
@@ -517,7 +517,7 @@ return {
return $this->belongsToMany(#~::class, #~, #~);
}
]],
{ rep(1), i(2), i(1), i(3), i(0) }
{ rep(1), i(2), i(1), i(3), i(4) }
)
),
})