Add laravel maps
This commit is contained in:
@@ -11,6 +11,23 @@ local function project_name_from_cwd(cwd)
|
||||
return vim.fn.fnamemodify(cwd, ':t')
|
||||
end
|
||||
|
||||
local function command_with_dir(dir, cmd)
|
||||
if dir then
|
||||
return '!cd ' .. dir .. ' && ' .. cmd
|
||||
end
|
||||
return '!' .. cmd
|
||||
end
|
||||
|
||||
local function laravel_keymaps(dir)
|
||||
map('sl ', command_with_dir(dir, 'vendor/bin/sail '), { desc = 'Run sail command' }, 'c')
|
||||
map('art ', command_with_dir(dir, 'php artisan '), { desc = 'Run artisan command' }, 'c')
|
||||
map('sart ', command_with_dir(dir, 'vendor/bin/sail artisan '), { desc = 'Run artisan command with sail' }, 'c')
|
||||
map('cmp ', command_with_dir(dir, 'composer '), { desc = 'Run composer script' }, 'c')
|
||||
map('<Leader>pm', ':'..command_with_dir(dir, 'vendor/bin/sail artisan migrate<CR>'))
|
||||
map('<Leader>pr', ':'..command_with_dir(dir, 'vendor/bin/sail artisan migrate:rollback<CR>'))
|
||||
map('<Leader>pM', ':'..command_with_dir(dir, 'vendor/bin/sail artisan make:'))
|
||||
end
|
||||
|
||||
-- Define per-project configuration here.
|
||||
-- Keys are folder names (last segment of your cwd).
|
||||
local PROJECTS = {
|
||||
@@ -51,10 +68,7 @@ local PROJECTS = {
|
||||
map('<leader>E', ':e .env<CR>', { desc = 'Edit .env file' })
|
||||
map('s ', '!cd server && ', { desc = 'Run command in server directory' }, 'c')
|
||||
map('c ', '!cd client && ', { desc = 'Run command in client directory' }, 'c')
|
||||
map('sl ', '!cd server && vendor/bin/sail ', { desc = 'Run sail command' }, 'c')
|
||||
map('art ', '!cd server && php artisan ', { desc = 'Run artisan command' }, 'c')
|
||||
map('sart ', '!cd server && vendor/bin/sail artisan ', { desc = 'Run artisan command with sail' }, 'c')
|
||||
map('cmp ', '!cd server && composer ', { desc = 'Run composer script' }, 'c')
|
||||
laravel_keymaps('server')
|
||||
map('yrn ', '!cd client && yarn ', { desc = 'Run yarn script' }, 'c')
|
||||
map('ts ', '!cd server && php artisan typescript:transform --format', { desc = 'Compile typescript' }, 'c')
|
||||
require('conform').formatters.pint = {
|
||||
@@ -70,10 +84,7 @@ local PROJECTS = {
|
||||
helpers.open_term { cmd = 'lazysql pgsql://homestead:password@localhost:5432/homestead' }
|
||||
end, { desc = 'Open database manager' })
|
||||
map('<leader>E', ':e .env', { desc = 'Edit .env file' })
|
||||
map('s ', '!vendor/bin/sail ', { desc = 'Run sail command' }, 'c')
|
||||
map('art ', '!php artisan ', { desc = 'Run artisan command' }, 'c')
|
||||
map('sart ', '!vendor/bin/sail artisan ', { desc = 'Run artisan command with sail' }, 'c')
|
||||
map('cmp ', '!composer ', { desc = 'Run composer script' }, 'c')
|
||||
laravel_keymaps()
|
||||
map('yrn ', '!cd frontend && yarn ', { desc = 'Run yarn script' }, 'c')
|
||||
end,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user