From 13e4207ef55b4536c51b8aa08c0b982629afcd2e Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 24 Mar 2024 17:44:01 +0100 Subject: [PATCH] touched the nvim, alot. --- nvim/.luarc.json | 5 ++ nvim/lazy-lock.json | 42 +++++++------- nvim/lua/config/commands.lua | 13 +++++ nvim/lua/config/filetype.lua | 1 + nvim/lua/config/icons.lua | 42 +++++++------- nvim/lua/config/init.lua | 1 + nvim/lua/config/mappings.lua | 6 +- nvim/lua/config/{ => plugins}/catppuccin.lua | 32 +++++++--- nvim/lua/config/plugins/conform.lua | 18 ++++++ nvim/lua/config/plugins/laravel.lua | 7 +++ nvim/lua/config/plugins/telescope.lua | 45 +++++++++++++++ nvim/lua/config/telescope.lua | 13 ----- nvim/lua/plugins/editor/autopairs.lua | 2 +- nvim/lua/plugins/editor/indent.lua | 16 ++++- nvim/lua/plugins/editor/telescope.lua | 61 +++++++------------- nvim/lua/plugins/ide/conform.lua | 38 ++++++++++++ nvim/lua/plugins/ide/dap.lua | 8 +-- nvim/lua/plugins/ide/laravel.lua | 17 ------ nvim/lua/plugins/ide/lsp.lua | 1 + nvim/lua/plugins/init.lua | 15 +++-- nvim/lua/plugins/{ => lang}/go.lua | 0 nvim/lua/plugins/lang/laravel.lua | 26 +++++++++ nvim/lua/plugins/nvim-test.lua | 3 - nvim/lua/plugins/ui/barbar.lua | 9 ++- nvim/lua/plugins/ui/catppuccin.lua | 2 +- nvim/lua/plugins/ui/neo-tree.lua | 8 ++- nvim/lua/plugins/ui/which-key.lua | 1 + nvim/queries/php_only/indents.scm | 1 + 28 files changed, 288 insertions(+), 145 deletions(-) create mode 100644 nvim/.luarc.json create mode 100644 nvim/lua/config/commands.lua rename nvim/lua/config/{ => plugins}/catppuccin.lua (64%) create mode 100644 nvim/lua/config/plugins/conform.lua create mode 100644 nvim/lua/config/plugins/laravel.lua create mode 100644 nvim/lua/config/plugins/telescope.lua delete mode 100644 nvim/lua/config/telescope.lua create mode 100644 nvim/lua/plugins/ide/conform.lua delete mode 100644 nvim/lua/plugins/ide/laravel.lua rename nvim/lua/plugins/{ => lang}/go.lua (100%) create mode 100644 nvim/lua/plugins/lang/laravel.lua delete mode 100644 nvim/lua/plugins/nvim-test.lua diff --git a/nvim/.luarc.json b/nvim/.luarc.json new file mode 100644 index 0000000..7768e26 --- /dev/null +++ b/nvim/.luarc.json @@ -0,0 +1,5 @@ +{ + "diagnostics.disable": [ + "different-requires" + ] +} \ No newline at end of file diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index c1ee18d..c979538 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -3,42 +3,44 @@ "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, "barbar.nvim": { "branch": "master", "commit": "3c48b5edf61dda21ad41c514e53448fee366a824" }, "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, + "catppuccin": { "branch": "main", "commit": "56fb98218d22d5c326387bf9e4076227e7372e6b" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "dashboard": { "branch": "master", "commit": "413442b12d85315fc626c44a0ce4929b213ef604" }, + "conform.nvim": { "branch": "master", "commit": "bf109f061fc3cd75394b7823923187ae045cbf22" }, + "dashboard": { "branch": "master", "commit": "92c94c8c3c92ddd29e1181a0aebcc22f2fe96f71" }, "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, "fd": { "branch": "master", "commit": "68fe31da3f5da5d8d5b997d8919dc97e6eafead5" }, - "gitsigns.nvim": { "branch": "main", "commit": "4e348641b8206c3b8d23080999e3ddbe4ca90efc" }, + "gitsigns.nvim": { "branch": "main", "commit": "078041e9d060a386b0c9d3a8c7a7b019a35d3fb0" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "laravel.nvim": { "branch": "main", "commit": "ef57e6a138270374412553e769a3d38538d43abc" }, + "laravel.nvim": { "branch": "main", "commit": "baafe3c0072ecb7c8f1efc9ed5e3c96ff4fbf056" }, "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, - "lualine.nvim": { "branch": "master", "commit": "26dac2fcadb6e622790ab08e36d0dba3d3765398" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "55716a879568a498fa236593c8119789054a3b8e" }, - "mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" }, + "lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, + "mason-conform.nvim": { "branch": "main", "commit": "c41b19222db71b016e55c64454b5e03441f56859" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "2ba17cecfde8b8c7c7c287909a1e4de895223df6" }, + "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, - "neo-tree.nvim": { "branch": "main", "commit": "742db4e60c74e5fbcc596aaf9e7575e1342dfd09" }, - "neotest": { "branch": "master", "commit": "4440cc2227894c2ae9b0673a30e6cc6f1836e8c2" }, + "neo-tree.nvim": { "branch": "main", "commit": "16d1b194376bf1fc2acd89ccb3c29ba8315bfcea" }, + "neotest": { "branch": "master", "commit": "e07fe8241112274aae9947b98d255763738a1d52" }, "neotest-go": { "branch": "main", "commit": "6a2f996d89fe4631942e035b1c114544ee045043" }, - "neotest-phpunit": { "branch": "main", "commit": "d5e920ab861d175080524b9a3caa5ab8c372def0" }, + "neotest-phpunit": { "branch": "main", "commit": "5799a4ea84450af14461d24edbde43913f9b3008" }, "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, - "none-ls.nvim": { "branch": "main", "commit": "e25d2fcb24364b9cdb1e6b24a2399dfda5dbdf0c" }, - "nui.nvim": { "branch": "main", "commit": "3dc46d725f7b94bee5117c0a699b57b1902b5d65" }, - "nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" }, - "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, - "nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" }, - "nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" }, - "nvim-lspconfig": { "branch": "master", "commit": "4bdd3800b4148f670c6cf55ef65f490148eeb550" }, + "none-ls.nvim": { "branch": "main", "commit": "18910d09d21d7df339805343bfe4a2b2e41c057b" }, + "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" }, + "nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" }, + "nvim-cmp": { "branch": "main", "commit": "43b460a2bd02fd898e67f5f1f65dfd1cce26203a" }, + "nvim-dap": { "branch": "master", "commit": "c1695e500c7d552a0a19953a9aefcc89178fb1af" }, + "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, + "nvim-lspconfig": { "branch": "master", "commit": "d67715d3b746a19e951b6b0a99663fa909bb9e64" }, "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, - "nvim-treesitter": { "branch": "master", "commit": "3ae78f376c2e721ce4feb23e9a5e8bc6062a2657" }, + "nvim-treesitter": { "branch": "master", "commit": "722617e6726c1508adadf83d531f54987c703be0" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" }, - "nvim-web-devicons": { "branch": "master", "commit": "75df79feb02d5e0ec114e447453775d4d291ea03" }, - "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, + "nvim-web-devicons": { "branch": "master", "commit": "cb0c967c9723a76ccb1be0cc3a9a10e577d2f6ec" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, - "telescope.nvim": { "branch": "master", "commit": "67c598fdd4fca113224281c85721c4d8a6df055e" }, + "telescope.nvim": { "branch": "master", "commit": "221778e93bfaa58bce4be4e055ed2edecc26f799" }, "vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/nvim/lua/config/commands.lua b/nvim/lua/config/commands.lua new file mode 100644 index 0000000..8ad8080 --- /dev/null +++ b/nvim/lua/config/commands.lua @@ -0,0 +1,13 @@ + +-- Nice command that creates all directores in the path +-- then creates the file and opens it. +vim.api.nvim_create_user_command('CreateFile', + function(opts) + local dir = vim.fs.dirname(opts.fargs[1]) + vim.cmd(string.format("!mkdir -p %s\n !touch %s", dir, opts.fargs[1])) + vim.cmd.e(opts.fargs) + end, + { nargs = 1, complete = "file" } +) + +vim.cmd("ca cf CreateFile") diff --git a/nvim/lua/config/filetype.lua b/nvim/lua/config/filetype.lua index cd97afb..440df57 100644 --- a/nvim/lua/config/filetype.lua +++ b/nvim/lua/config/filetype.lua @@ -32,3 +32,4 @@ autocmd('Filetype', { pattern = 'php', command = 'setlocal commentstring=//\\%s' }) + diff --git a/nvim/lua/config/icons.lua b/nvim/lua/config/icons.lua index d4f27b3..e8aab37 100644 --- a/nvim/lua/config/icons.lua +++ b/nvim/lua/config/icons.lua @@ -4,37 +4,35 @@ return { selected = '', close = '✖', pinned = '', + folder = { + closed = "", + open = "", + empty = "󰜌", + }, diff = { added = '', modified = '', removed = '', }, - filetree = { - basic = { - folder_closed = "", - folder_open = "", - folder_empty = "󰜌", - }, - git = { - -- Change type - added = "", - modified = "", - deleted = "✖", - renamed = "󰁕", - -- Status type - untracked = "", - ignored = "", - unstaged = "", - staged = "", - conflict = "", - }, - }, diff_gutter = { - add = '▌', - change = '▌', + add = '▍', + change = '▍', delete = '', untracked = '+' }, + gitsigns = { + -- Change type + added = "", + modified = "", + deleted = "✖", + renamed = "󰁕", + -- Status type + untracked = "", + ignored = "", + unstaged = "", + staged = "", + conflict = "", + }, diagnostics = { error = '', warn = '', diff --git a/nvim/lua/config/init.lua b/nvim/lua/config/init.lua index 808df6f..6ad3f15 100644 --- a/nvim/lua/config/init.lua +++ b/nvim/lua/config/init.lua @@ -1,3 +1,4 @@ require("config.settings") require("config.mappings") require("config.filetype") +require("config.commands") diff --git a/nvim/lua/config/mappings.lua b/nvim/lua/config/mappings.lua index d9364a4..748fd92 100644 --- a/nvim/lua/config/mappings.lua +++ b/nvim/lua/config/mappings.lua @@ -53,6 +53,6 @@ map("n", "rw", [[:%s/\<\>//gI]], { map("n", "Q", "") -- diagnostics -map("n", "DD", vim.diagnostic.open_float, { desc = "Open"}) -map("n", "Dn", vim.diagnostic.get_next, { desc = "Open"}) -map("n", "Dp", vim.diagnostic.get_prev, { desc = "Open"}) +map("n", "do", vim.diagnostic.open_float, { desc = "Open diagnostics"}) +map("n", "dn", vim.diagnostic.get_next, { desc = "Goto next"}) +map("n", "dp", vim.diagnostic.get_prev, { desc = "Goto previous"}) diff --git a/nvim/lua/config/catppuccin.lua b/nvim/lua/config/plugins/catppuccin.lua similarity index 64% rename from nvim/lua/config/catppuccin.lua rename to nvim/lua/config/plugins/catppuccin.lua index d901d79..7acba81 100644 --- a/nvim/lua/config/catppuccin.lua +++ b/nvim/lua/config/plugins/catppuccin.lua @@ -2,11 +2,13 @@ return { flavour = "mocha", color_overrides = { mocha = { - base = '#0E1019', + base = '#0e1019', mantle = '#131521', - text = '#ECEEF4', + text = '#eceef4', } }, + no_italic = true, + no_bold = true, highlight_overrides = { mocha = function(colors) return { @@ -16,34 +18,46 @@ return { IblScope = { fg = colors.overlay2 }, BufferCurrent = { fg = colors.text, bg = colors.base }, - -- BufferInactive = { bg=colors.base}, - -- BufferOffset = { bg = colors.mantle }, - -- BufferTabpageFill = {bg=colors.base}, - -- Bufferbar + BufferCurrentMod = { fg = colors.yellow, bg = colors.base }, + BufferCurrentADDED = { fg = colors.green, bg = colors.base }, + BufferCurrentCHANGED = { fg = colors.yellow, bg = colors.base }, + BufferCurrentDELETED = { fg = colors.red, bg = colors.base }, + + -- LSP + LspReferenceText = { bg = colors.surface0 }, + LspReferenceRead = { link = "LspReferenceText" }, + LspReferenceWrite = { link = "LspReferenceText" }, -- Syntax - Operator = { link = "@text" }, + PreProc = { link = "Include" }, + Operator = { fg = colors.rosewater }, Function = { link = "@text" }, Delimiter = { link = "@text" }, - Include = { fg = colors.yellow }, + Include = { fg = colors.mauve }, Keyword = { fg = colors.yellow }, Repeat = { link = "Keyword" }, Conditional = { link = "Keyword" }, Type = { fg = colors.blue }, String = { fg = colors.lavender }, + Exception = { link = "Keyword" }, ["@constructor"] = { link = "Function" }, ["@variable"] = { fg = colors.green }, ["@variable.builtin"] = { link = "@variable" }, - ["@variable.parameter"] = { link = "@variable" }, + ["@variable.parameter"] = { link = "@parameter" }, ["@variable.member"] = { link = "@variable" }, + ["@parameter"] = { link = "@variable" }, ["@keyword.function"] = { link = "Keyword" }, ["@keyword.return"] = { link = "Keyword" }, + ["@keyword.operator"] = { link = "Keyword" }, ["@property"] = { link = "@variable" }, ["@tag"] = { link = "Keyword" }, ["@tag.delimiter"] = { link = "@text" }, ["@punctuation"] = { link = "@text" }, + ["@module"] = { link = "@text" }, ["@punctuation.bracket"] = { link = "@punctuation" }, ["@lsp.type.property"] = { link = "@variable" }, + + -- PHP specific ["@class_name.php"] = { link = "@text" }, ["@extend_name.php"] = { link = "@text" }, ["@implements_name.php"] = { link = "@text" }, diff --git a/nvim/lua/config/plugins/conform.lua b/nvim/lua/config/plugins/conform.lua new file mode 100644 index 0000000..127500e --- /dev/null +++ b/nvim/lua/config/plugins/conform.lua @@ -0,0 +1,18 @@ +return { + keys = { + { 'ff', "Format", desc = 'Format file' }, + { 'ff', "Format", mode = 'x', desc = 'Format selection' }, + }, + opts = { + format_options = { + async = true, + lsp_fallback = true, + }, + notify_on_error = true, + formatters_by_ft = { + blade = { "blade-formatter" }, + lua = { "stylua" }, + ["_"] = { "prettier" } + } + } +} diff --git a/nvim/lua/config/plugins/laravel.lua b/nvim/lua/config/plugins/laravel.lua new file mode 100644 index 0000000..7c1138d --- /dev/null +++ b/nvim/lua/config/plugins/laravel.lua @@ -0,0 +1,7 @@ +return { + keys = { + ["la"] = { ":Laravel artisan", "Run artisan" }, + ["lr"] = { ":Laravel routes", "Search routes" }, + ["lm"] = { ":Laravel related", "Related" }, + }, +} diff --git a/nvim/lua/config/plugins/telescope.lua b/nvim/lua/config/plugins/telescope.lua new file mode 100644 index 0000000..50337d2 --- /dev/null +++ b/nvim/lua/config/plugins/telescope.lua @@ -0,0 +1,45 @@ +local icons = require('config.icons') + +return { + key_groups = { + ["s"] = { name = "+search" }, + }, + keys = { + { 'sf', 'Telescope find_files', desc = 'Search files' }, + { 'sa', 'Telescope live_grep', desc = 'Search in files' }, + { 'sg', 'Telescope git_files', desc = 'Search Git files' }, + { 'so', 'Telescope oldfiles', desc = 'Search Old files' }, + { 'sw', 'Telescope grep_string', desc = 'Search for word under cursor' }, + -- LSP + { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, + { 'ss', 'Telescope lsp_document_symbols', desc = 'Search document symbols' }, + { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, + { 'gd', 'Telescope lsp_definitions', desc = 'Goto definition' }, + }, + opts = function() + local actions = require("telescope.actions") + return { + defaults = { + path_display = { truncate = 1 }, + prompt_prefix = ' ', + selection_caret = icons.current .. ' ', + multi_icon = icons.selected .. ' ', + file_ignore_patterns = { + ".git/", + "node_modules/" + }, + mappings = { + i = { + [""] = actions.close + } + } + }, + pickers = { + find_files = { + hidden = true + } + } + } + end, +} + diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua deleted file mode 100644 index 5af1cda..0000000 --- a/nvim/lua/config/telescope.lua +++ /dev/null @@ -1,13 +0,0 @@ -return { - { 'sf', 'Telescope find_files', desc = 'Search files' }, - { 'sa', 'Telescope live_grep', desc = 'Search in files' }, - { 'sg', 'Telescope git_files', desc = 'Search Git files' }, - { 'so', 'Telescope oldfiles', desc = 'Search Old files' }, - { 'sw', 'Telescope grep_string', desc = 'Search for word under cursor' }, - -- LSP - { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, - { 'ss', 'Telescope lsp_document_symbols', desc = 'Search document symbols' }, - { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, - { 'gd', 'Telescope lsp_definitions', desc = 'Goto definition' }, -} - diff --git a/nvim/lua/plugins/editor/autopairs.lua b/nvim/lua/plugins/editor/autopairs.lua index 3a794db..5698563 100644 --- a/nvim/lua/plugins/editor/autopairs.lua +++ b/nvim/lua/plugins/editor/autopairs.lua @@ -1,5 +1,5 @@ return { 'windwp/nvim-autopairs', event = "InsertEnter", - opts = {} -- this is equalent to setup({}) function + config = true } diff --git a/nvim/lua/plugins/editor/indent.lua b/nvim/lua/plugins/editor/indent.lua index 30de37e..c073e73 100644 --- a/nvim/lua/plugins/editor/indent.lua +++ b/nvim/lua/plugins/editor/indent.lua @@ -1,7 +1,11 @@ -return{ +return { "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = { + debounce = 10, + indent = { + char = '▏', + }, scope = { enabled = true, show_start = false, @@ -13,5 +17,13 @@ return{ 'dashboard' } } - } + }, + config = function (_, opts) + + require 'ibl'.setup(opts) + + local hooks = require 'ibl.hooks' + hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_tab_indent_level) + hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level) + end } diff --git a/nvim/lua/plugins/editor/telescope.lua b/nvim/lua/plugins/editor/telescope.lua index b6c1acc..7ca4a3b 100644 --- a/nvim/lua/plugins/editor/telescope.lua +++ b/nvim/lua/plugins/editor/telescope.lua @@ -1,4 +1,4 @@ -local icons = require('config.icons') +local config = require('config.plugins.telescope') return { 'nvim-telescope/telescope.nvim', @@ -9,49 +9,30 @@ return { 'sharkdp/fd', { "folke/which-key.nvim", - -- optional = true, + optional = true, opts = { - defaults = { - ["s"] = { name = "+search" }, - }, + defaults = config.key_groups or {}, }, }, }, - keys = require('config.telescope'), - opts = function() - local actions = require("telescope.actions") - return { - defaults = { - path_display = { truncate = 1 }, - -- borderchars = { "─", "│", "─", "│", "┌", "┐", "┘", "└" }, - border = { - prompt = { 1, 1, 1, 1 }, - results = { 1, 1, 1, 1 }, - preview = { 1, 1, 1, 1 }, - }, - borderchars = { - prompt = { "─", "│", "─", "│", "├", "┤", "┴", "└" }, - results = { "─", "│", " ", "│", "┌", "┬", "│", "│" }, - preview = { "─", "│", "─", " ", "─", "┐", "┘", "─" }, - }, - prompt_prefix = ' ' .. icons.prompt .. ' ', - selection_caret = icons.current .. ' ', - multi_icon = icons.selected .. ' ', - file_ignore_patterns = { - ".git/", - "node_modules/" - }, - mappings = { - i = { - [""] = actions.close - } - } + keys = config.keys or {}, + opts = config.opts or {}, + config = function (_, opts) + local override = { + border = { + prompt = { 1, 1, 1, 1 }, + results = { 1, 1, 1, 1 }, + preview = { 1, 1, 1, 1 }, + }, + borderchars = { + prompt = { "─", "│", "─", "│", "├", "┤", "┴", "└" }, + results = { "─", "│", " ", "│", "┌", "┬", "│", "│" }, + preview = { "─", "│", "─", " ", "─", "┐", "┘", "─" }, }, - pickers = { - find_files = { - hidden = true - } - } } - end, + + opts.defaults = vim.tbl_deep_extend("force", opts.defaults, override) + + require('telescope').setup(opts) + end } diff --git a/nvim/lua/plugins/ide/conform.lua b/nvim/lua/plugins/ide/conform.lua new file mode 100644 index 0000000..92606fe --- /dev/null +++ b/nvim/lua/plugins/ide/conform.lua @@ -0,0 +1,38 @@ +local config = require('config.plugins.conform') + +return { + 'stevearc/conform.nvim', + dependencies = { + "williamboman/mason.nvim", + "zapling/mason-conform.nvim" + }, + cmd = { "ConformInfo", "Format" }, + keys = config.keys or {}, + opts = config.opts or {}, + config = function (_, opts) + + -- Create command to format a buffer or range. + vim.api.nvim_create_user_command("Format", function(args) + local range = nil + if args.count ~= -1 then + local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] + range = { + start = { args.line1, 0 }, + ["end"] = { args.line2, end_line:len() }, + } + end + + local opt = opts.format_options + if range ~= nil then + opt = vim.tbl_deep_extend("force", opt, { range = range }) + end + + require("conform").format(opt) + end, { range = true }) + + require('conform').setup(opts) + + -- setup mason-conform to autmagically install formatters. + require('mason-conform').setup() + end +} diff --git a/nvim/lua/plugins/ide/dap.lua b/nvim/lua/plugins/ide/dap.lua index 04cc9e8..a12c02d 100644 --- a/nvim/lua/plugins/ide/dap.lua +++ b/nvim/lua/plugins/ide/dap.lua @@ -6,7 +6,7 @@ return { -- optional = true, opts = { defaults = { - ["d"] = { name = "+debug" }, + ["D"] = { name = "+debug" }, }, }, }, @@ -14,8 +14,8 @@ return { "rcarriga/nvim-dap-ui", -- stylua: ignore keys = { - { "du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, - { "de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, + { "Du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, + { "De", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, }, opts = {}, config = function(_, opts) @@ -37,7 +37,7 @@ return { }, }, keys = { - { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + { "Dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, }, config = function() -- local Config = require("lazyvim.config") diff --git a/nvim/lua/plugins/ide/laravel.lua b/nvim/lua/plugins/ide/laravel.lua deleted file mode 100644 index 5d15a6b..0000000 --- a/nvim/lua/plugins/ide/laravel.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - "adalessa/laravel.nvim", - dependencies = { - "nvim-telescope/telescope.nvim", - "tpope/vim-dotenv", - "MunifTanjim/nui.nvim", - "nvimtools/none-ls.nvim", - }, - cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" }, - keys = { - { "la", ":Laravel artisan" }, - { "lr", ":Laravel routes" }, - { "lm", ":Laravel related" }, - }, - event = { "VeryLazy" }, - config = true, -} diff --git a/nvim/lua/plugins/ide/lsp.lua b/nvim/lua/plugins/ide/lsp.lua index c7d65e5..61bcbe6 100644 --- a/nvim/lua/plugins/ide/lsp.lua +++ b/nvim/lua/plugins/ide/lsp.lua @@ -9,6 +9,7 @@ return { mappings = { ["rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }}, ["ca"] = { vim.lsp.buf.code_action, { desc = "Code action" }}, + ["ff"] = { vim.lsp.buf.format, { desc = "Format file" }}, gd = { vim.lsp.buf.definition, { desc = "Goto definition" }}, gi = { vim.lsp.buf.implementation, { desc = "Goto implementation"}}, gr = { vim.lsp.buf.references, { desc = "Goto references"}}, diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index fba0f4e..8426025 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -20,14 +20,14 @@ local opts = { require("lazy").setup({ -- Editor - -------------------- + ----------------------------- { import = "plugins.editor.indent" }, { import = "plugins.editor.autopairs" }, { import = "plugins.editor.mini-comment" }, { import = "plugins.editor.telescope" }, -- UI - -------------------- + ----------------------------- { import = "plugins.ui.dressing" }, { import = "plugins.ui.noice" }, { import = "plugins.ui.dashboard" }, @@ -40,15 +40,18 @@ require("lazy").setup({ { import = "plugins.ui.which-key" }, -- IDE - -------------------- + ----------------------------- { import = "plugins.ide.treesitter" }, + { import = "plugins.ide.conform" }, { import = "plugins.ide.cmp" }, { import = "plugins.ide.lsp" }, { import = "plugins.ide.dap" }, { import = "plugins.ide.neotest" }, - { import = "plugins.ide.laravel" }, - -- { import = "plugins.nvim-test" }, - --{ import = "plugins.go" }, + -- Language specific + ----------------------------- + { import = "plugins.lang.laravel" }, + --{ import = "plugins.lang.go" }, + }, opts) diff --git a/nvim/lua/plugins/go.lua b/nvim/lua/plugins/lang/go.lua similarity index 100% rename from nvim/lua/plugins/go.lua rename to nvim/lua/plugins/lang/go.lua diff --git a/nvim/lua/plugins/lang/laravel.lua b/nvim/lua/plugins/lang/laravel.lua new file mode 100644 index 0000000..f669d1e --- /dev/null +++ b/nvim/lua/plugins/lang/laravel.lua @@ -0,0 +1,26 @@ +return { + "adalessa/laravel.nvim", + dependencies = { + "nvim-telescope/telescope.nvim", + "tpope/vim-dotenv", + "MunifTanjim/nui.nvim", + "nvimtools/none-ls.nvim", + }, + ft = "php", + cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" }, + config = function (_, _) + local opts = require('config.plugins.laravel') + + local haswk, wk = pcall(require, "which-key") + + if haswk then + wk.register({l = {name = "laravel" }}, { prefix = "" }) + end + + for key, value in pairs(opts.keys) do + vim.keymap.set("n", key, value[1], { desc = value[2] or ''}) + end + + require('laravel').setup(opts) + end +} diff --git a/nvim/lua/plugins/nvim-test.lua b/nvim/lua/plugins/nvim-test.lua deleted file mode 100644 index 6ad147d..0000000 --- a/nvim/lua/plugins/nvim-test.lua +++ /dev/null @@ -1,3 +0,0 @@ -return { - "klen/nvim-test", -} diff --git a/nvim/lua/plugins/ui/barbar.lua b/nvim/lua/plugins/ui/barbar.lua index a9f89c7..24e1191 100644 --- a/nvim/lua/plugins/ui/barbar.lua +++ b/nvim/lua/plugins/ui/barbar.lua @@ -17,8 +17,13 @@ return { separator = {left = '', right = ''}, separator_at_end = false, inactive = { button = '', separator = { left = '', right = ''} }, - modified = {button = icons.filetree.git.modified }, - pinned = {button = '', filename = true}, + modified = {button = icons.gitsigns.modified }, + pinned = {button = icons.pinned, filename = true}, + gitsigns = { + added = { enabled = false }, + changed = { enabled = false }, + deleted = { enabled = false }, + } }, maximum_padding = 2, minimum_padding = 1, diff --git a/nvim/lua/plugins/ui/catppuccin.lua b/nvim/lua/plugins/ui/catppuccin.lua index 1d161ac..c8fcf91 100644 --- a/nvim/lua/plugins/ui/catppuccin.lua +++ b/nvim/lua/plugins/ui/catppuccin.lua @@ -2,7 +2,7 @@ return { "catppuccin/nvim", name = "catppuccin", priority = 1000, - opts = require('config.catppuccin'), + opts = require('config.plugins.catppuccin'), config = function (_, opts) require("catppuccin").setup(opts) vim.cmd.colorscheme("catppuccin") diff --git a/nvim/lua/plugins/ui/neo-tree.lua b/nvim/lua/plugins/ui/neo-tree.lua index 2d31ccc..c048dac 100644 --- a/nvim/lua/plugins/ui/neo-tree.lua +++ b/nvim/lua/plugins/ui/neo-tree.lua @@ -23,12 +23,16 @@ return { indent_marker = "│", last_indent_marker = "└", }, - icon = icons.filetree.basic, + icon = { + folder_open = icons.folder.open, + folder_close = icons.folder.close, + folder_empty = icons.folder.empty, + }, name = { use_git_status_colors = false, }, git_status = { - symbols = icons.filetree.git + symbols = icons.gitsigns }, }, event_handlers = { diff --git a/nvim/lua/plugins/ui/which-key.lua b/nvim/lua/plugins/ui/which-key.lua index 77302af..7eaaa0b 100644 --- a/nvim/lua/plugins/ui/which-key.lua +++ b/nvim/lua/plugins/ui/which-key.lua @@ -11,6 +11,7 @@ return { ["r"] = { name = "+rename" }, ["b"] = { name = "+buffers" }, ["f"] = { name = "+files" }, + ["d"] = { name = "+diagnostics" } } }, config = function(_, opts) diff --git a/nvim/queries/php_only/indents.scm b/nvim/queries/php_only/indents.scm index d09df03..eea446d 100644 --- a/nvim/queries/php_only/indents.scm +++ b/nvim/queries/php_only/indents.scm @@ -7,3 +7,4 @@ "/" "**" @indent.align) +