From a21a1a33864027e119f322d2580362b250543bc8 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 9 Nov 2025 23:03:51 +0000 Subject: [PATCH] More changes --- lua/keymap.lua | 2 +- lua/plugins/conform.lua | 54 ++++++++++++++++++++++------------------- lua/projects.lua | 42 ++++++++++++++++++++++++++++---- lua/snippets/php.lua | 10 +++++++- 4 files changed, 76 insertions(+), 32 deletions(-) diff --git a/lua/keymap.lua b/lua/keymap.lua index 3555471..816199d 100644 --- a/lua/keymap.lua +++ b/lua/keymap.lua @@ -62,7 +62,7 @@ vim.keymap.set({ 'n', 'v', 'c', 'i' }, '', function() hidden = true, } end, { desc = 'Find all files' }) -vim.keymap.set({ 'n', 'v', 'c', 'i' }, '', function() +vim.keymap.set({ 'n', 'v', 'c', 'i' }, '', function() require('telescope.builtin').live_grep { hidden = true, } diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index fae1b44..2c35b5e 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -12,29 +12,33 @@ return { -- Autoformat desc = '[F]ormat buffer', }, }, - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true, vue = true, js = true } - if disable_filetypes[vim.bo[bufnr].filetype] then - return nil - else - return { - timeout_ms = 500, - lsp_format = 'fallback', - } - end - end, - formatters_by_ft = { - lua = { 'stylua' }, - -- Conform can also run multiple formatters sequentially - -- python = { "isort", "black" }, - -- - -- You can use 'stop_after_first' to run the first available formatter from the list - -- javascript = { "prettierd", "prettier", stop_after_first = true }, - }, - }, + config = function() + require('conform').setup({ + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable "format_on_save lsp_fallback" for languages that don't + -- have a well standardized coding style. You can add additional + -- languages here or re-enable it for the disabled ones. + local disable_filetypes = { c = true, cpp = true, vue = true, js = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + else + return { + timeout_ms = 500, + lsp_format = 'fallback', + } + end + end, + formatters_by_ft = { + lua = { 'stylua' }, + php = { 'pint' }, + -- Conform can also run multiple formatters sequentially + -- python = { "isort", "black" }, + -- + -- You can use 'stop_after_first' to run the first available formatter from the list + -- javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + log_level = vim.log.levels.DEBUG + }) + end } diff --git a/lua/projects.lua b/lua/projects.lua index 12e7a08..dbe3909 100644 --- a/lua/projects.lua +++ b/lua/projects.lua @@ -15,23 +15,55 @@ end -- Keys are folder names (last segment of your cwd). local PROJECTS = { -- Example: a repo folder - ['runcats'] = function() + ['runcats'] = function(dir) + -- local dump_buf = vim.api.nvim_create_buf(false, true) + -- vim.api.nvim_set_option_value('bufhidden', 'hide', { buf = dump_buf }) + -- vim.api.nvim_set_option_value('modifiable', false, { buf = dump_buf }) + -- + -- vim.fn.jobstart('cd server && sail artisan dump-server', { + -- term = true, + -- }) + + -- map('dd', function() + -- local height = math.ceil(vim.o.lines * 0.8) + -- local width = math.ceil(vim.o.columns * 0.8) + -- vim.api.nvim_open_win(dump_buf, true, { + -- style = 'minimal', + -- relative = 'editor', + -- width = width, + -- height = height, + -- row = math.ceil((vim.o.lines - height) / 2), + -- col = math.ceil((vim.o.columns - width) / 2), + -- border = 'single', + -- }) + -- + -- vim.cmd.startinsert() + -- end, { desc = 'Open the dump-server window' }) + map( - 'pl', + 'psl', ':cexpr system("cd server && vendor/bin/phpstan analyse --no-progress --error-format=raw --memory-limit=2G -vv") ', { desc = 'Run lint' } ) + map('pcl', ':cexpr system("cd client && tsc --allowJs --removeComments --noEmit") ', { desc = 'Run lint' }) map('db', function() helpers.open_term { cmd = 'lazysql mysql://root@localhost:3306/runcats' } end, { desc = 'Open database manager' }) + map('E', ':e .env', { 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 && sail ', { desc = 'Run sail command' }, '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 && sail artisan ', { desc = 'Run artisan command with sail' }, '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') map('yrn ', '!cd client && yarn ', { desc = 'Run yarn script' }, 'c') map('ts ', '!cd server && php artisan typescript:transform --format', { desc = 'Compile typescript' }, 'c') + map('