From f910f441916128d2c312a1da7141c80e169817da Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 3 Apr 2024 21:02:20 +0200 Subject: [PATCH] some nvim touching --- nvim/lazy-lock.json | 45 +++++----- nvim/lua/config/icons.lua | 31 ++++--- nvim/lua/config/mappings.lua | 5 ++ nvim/lua/config/plugins/bufferline.lua | 36 ++++++++ nvim/lua/config/plugins/catppuccin.lua | 37 ++++++--- nvim/lua/config/plugins/comment.lua | 20 +++++ nvim/lua/config/plugins/neo-tree.lua | 69 +++++++++++++++ nvim/lua/config/plugins/treesitter.lua | 57 +++++++++++++ nvim/lua/config/plugins/which-key.lua | 9 ++ nvim/lua/config/settings.lua | 12 +++ .../plugins/{editor => core}/autopairs.lua | 0 nvim/lua/plugins/core/autotag.lua | 24 ++++++ .../indent.lua => core/indent-blankline.lua} | 0 nvim/lua/plugins/core/treesitter.lua | 27 ++++++ nvim/lua/plugins/editor/mini-comment.lua | 6 +- nvim/lua/plugins/editor/telescope.lua | 10 +-- nvim/lua/plugins/ide/cmp.lua | 4 +- nvim/lua/plugins/ide/dap.lua | 38 ++++++++- nvim/lua/plugins/ide/neotest.lua | 6 +- nvim/lua/plugins/ide/treesitter.lua | 83 ------------------- nvim/lua/plugins/init.lua | 16 ++-- nvim/lua/plugins/ui/barbar.lua | 2 +- nvim/lua/plugins/ui/barbecue.lua | 12 --- nvim/lua/plugins/ui/bufferline.lua | 6 ++ nvim/lua/plugins/ui/edgy.lua | 33 ++++++++ nvim/lua/plugins/ui/lualine.lua | 22 +++-- nvim/lua/plugins/ui/neo-tree.lua | 53 +----------- nvim/lua/plugins/ui/noice.lua | 25 +++++- nvim/lua/plugins/ui/which-key.lua | 12 +-- 29 files changed, 467 insertions(+), 233 deletions(-) create mode 100644 nvim/lua/config/plugins/bufferline.lua create mode 100644 nvim/lua/config/plugins/comment.lua create mode 100644 nvim/lua/config/plugins/neo-tree.lua create mode 100644 nvim/lua/config/plugins/treesitter.lua create mode 100644 nvim/lua/config/plugins/which-key.lua rename nvim/lua/plugins/{editor => core}/autopairs.lua (100%) create mode 100644 nvim/lua/plugins/core/autotag.lua rename nvim/lua/plugins/{editor/indent.lua => core/indent-blankline.lua} (100%) create mode 100644 nvim/lua/plugins/core/treesitter.lua delete mode 100644 nvim/lua/plugins/ide/treesitter.lua delete mode 100644 nvim/lua/plugins/ui/barbecue.lua create mode 100644 nvim/lua/plugins/ui/bufferline.lua create mode 100644 nvim/lua/plugins/ui/edgy.lua diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index c979538..1c4f9f2 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,46 +1,49 @@ { "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, - "barbar.nvim": { "branch": "master", "commit": "3c48b5edf61dda21ad41c514e53448fee366a824" }, - "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, - "catppuccin": { "branch": "main", "commit": "56fb98218d22d5c326387bf9e4076227e7372e6b" }, + "LuaSnip": { "branch": "master", "commit": "825a61bad1d60d917a7962d73cf3c683f4e0407e" }, + "bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" }, + "catppuccin": { "branch": "main", "commit": "aebe43db9cb26e1c70fc5b2fd4158169c405e720" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "conform.nvim": { "branch": "master", "commit": "bf109f061fc3cd75394b7823923187ae045cbf22" }, - "dashboard": { "branch": "master", "commit": "92c94c8c3c92ddd29e1181a0aebcc22f2fe96f71" }, + "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, + "dashboard": { "branch": "master", "commit": "7c0c09d55118a2afeb8874e885f87ae80d8ff452" }, "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, - "fd": { "branch": "master", "commit": "68fe31da3f5da5d8d5b997d8919dc97e6eafead5" }, - "gitsigns.nvim": { "branch": "main", "commit": "078041e9d060a386b0c9d3a8c7a7b019a35d3fb0" }, + "edgy.nvim": { "branch": "main", "commit": "de79b7d92a5979cd71a9a1d8b6282515345e5055" }, + "fd": { "branch": "master", "commit": "11069e284a61afef8becdd4e189977e5621c0cf9" }, + "gitsigns.nvim": { "branch": "main", "commit": "b45ff86f5618d1421a88c12d4feb286b80a1e2d3" }, + "go.nvim": { "branch": "master", "commit": "abd282564a31c5dec14e2038ebf04fdac9ea3278" }, + "guihua.lua": { "branch": "master", "commit": "3b3126ae87c254f6849e708549ba76c39e3f42f8" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, "laravel.nvim": { "branch": "main", "commit": "baafe3c0072ecb7c8f1efc9ed5e3c96ff4fbf056" }, - "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, + "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, "mason-conform.nvim": { "branch": "main", "commit": "c41b19222db71b016e55c64454b5e03441f56859" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "2ba17cecfde8b8c7c7c287909a1e4de895223df6" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, "neo-tree.nvim": { "branch": "main", "commit": "16d1b194376bf1fc2acd89ccb3c29ba8315bfcea" }, "neotest": { "branch": "master", "commit": "e07fe8241112274aae9947b98d255763738a1d52" }, "neotest-go": { "branch": "main", "commit": "6a2f996d89fe4631942e035b1c114544ee045043" }, "neotest-phpunit": { "branch": "main", "commit": "5799a4ea84450af14461d24edbde43913f9b3008" }, - "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, - "none-ls.nvim": { "branch": "main", "commit": "18910d09d21d7df339805343bfe4a2b2e41c057b" }, + "noice.nvim": { "branch": "main", "commit": "0cbe3f88d038320bdbda3c4c5c95f43a13c3aa12" }, + "none-ls.nvim": { "branch": "main", "commit": "fff481b65d88415933b9574dc0e1947724bcf64a" }, "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-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, + "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, - "nvim-lspconfig": { "branch": "master", "commit": "d67715d3b746a19e951b6b0a99663fa909bb9e64" }, - "nvim-navic": { "branch": "master", "commit": "8649f694d3e76ee10c19255dece6411c29206a54" }, - "nvim-treesitter": { "branch": "master", "commit": "722617e6726c1508adadf83d531f54987c703be0" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "d2a4ffc22d9d38d44edb73da007b3cf43451e9b4" }, - "nvim-web-devicons": { "branch": "master", "commit": "cb0c967c9723a76ccb1be0cc3a9a10e577d2f6ec" }, + "nvim-lspconfig": { "branch": "master", "commit": "96e5711040df23583591391ce49e556b8cd248d8" }, + "nvim-nio": { "branch": "master", "commit": "173f285eebb410199273fa178aa517fd2d7edd80" }, + "nvim-treesitter": { "branch": "master", "commit": "cc0e29727a9651e27869b7444e835c44fb1e7b4c" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "acffd3476eb340faef0ec07e48060b817386b973" }, + "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, + "nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, - "plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" }, - "telescope.nvim": { "branch": "master", "commit": "221778e93bfaa58bce4be4e055ed2edecc26f799" }, + "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, + "telescope.nvim": { "branch": "master", "commit": "4626aaa2bcfdacf55fd6d44b430e2df81b2403ff" }, "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/icons.lua b/nvim/lua/config/icons.lua index e8aab37..07ef0d3 100644 --- a/nvim/lua/config/icons.lua +++ b/nvim/lua/config/icons.lua @@ -2,12 +2,23 @@ return { prompt = '', current = ' ', selected = '', - close = '✖', + close = '󰅖', pinned = '', + tree = { + node = '│', + nodelast = '└', + }, + files = { + text = "", + symlink = "", + }, folder = { closed = "", open = "", - empty = "󰜌", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", }, diff = { added = '', @@ -15,8 +26,8 @@ return { removed = '', }, diff_gutter = { - add = '▍', - change = '▍', + add = '▏', + change = '▏', delete = '', untracked = '+' }, @@ -24,14 +35,14 @@ return { -- Change type added = "", modified = "", - deleted = "✖", - renamed = "󰁕", + deleted = "", + renamed = "➜", -- Status type - untracked = "", - ignored = "", + untracked = "★", + ignored = "◌", unstaged = "", - staged = "", - conflict = "", + staged = "✓", + conflict = "", }, diagnostics = { error = '', diff --git a/nvim/lua/config/mappings.lua b/nvim/lua/config/mappings.lua index 748fd92..6d5b1a0 100644 --- a/nvim/lua/config/mappings.lua +++ b/nvim/lua/config/mappings.lua @@ -50,6 +50,11 @@ map("n", "rw", [[:%s/\<\>//gI]], { desc = "search+replace word under cursor" }) +map({"x"}, "hx", [[:s/\(\x\{2\}\)/0x\1,/g]], { desc = "Format hex"}) +map({"x"}, "ha", [[:s/0x\(\x\{1\}\X\)/0x0\1/g]], { desc = "Format hex more"}) +map({"x"}, "hn", [[:s/\(\(0x\x\{1,2\}, \)\{8\}\)/\1\r/g]], { desc = "Format hex with 8 bytes per row"}) + + map("n", "Q", "") -- diagnostics diff --git a/nvim/lua/config/plugins/bufferline.lua b/nvim/lua/config/plugins/bufferline.lua new file mode 100644 index 0000000..e3edd9d --- /dev/null +++ b/nvim/lua/config/plugins/bufferline.lua @@ -0,0 +1,36 @@ +local icons = require('config.icons') + +return function () + local highlightfunc = require("catppuccin.groups.integrations.bufferline") + return { + highlights = highlightfunc.get(), + options = { + mode = "buffers", + themable = true, + buffer_close_icon = icons.close, + close_icon = icons.close, + modified_icon = icons.modified_icon, + diagnostics = false, + enforce_regular_tabs = true, + indicator = { + style = 'underline', + }, + close_command = function (bufnum) + vim.cmd("bprev") + vim.api.nvim_buf_delete(bufnum, {}) + end, + hover = { + enabled = true, + delay = 200, + reveal = {'close'} + }, + offsets = { + { + filetype = "neo-tree", + text = "File Explorer", + text_align = "left" + } + }, + } + } +end diff --git a/nvim/lua/config/plugins/catppuccin.lua b/nvim/lua/config/plugins/catppuccin.lua index 7acba81..554a75a 100644 --- a/nvim/lua/config/plugins/catppuccin.lua +++ b/nvim/lua/config/plugins/catppuccin.lua @@ -3,7 +3,14 @@ return { color_overrides = { mocha = { base = '#0e1019', - mantle = '#131521', + mantle = '#0D0F17', + crust = '#0C0D14', + surface0 = '#131521', + surface1 = '#343959', + surface2 = '#41476F', + overlay0 = '#3F4256', + overlay1 = '#5B5F7C', + overlay2 = '#767BA0', text = '#eceef4', } }, @@ -12,21 +19,29 @@ return { highlight_overrides = { mocha = function(colors) return { - CursorLine = { bg = colors.mantle }, + NormalFloat = { bg = colors.crust }, + FloatBorder = { fg = colors.crust, bg = colors.crust }, + WinSeparator = { fg = colors.surface0 }, + + NoiceMini = { bg = colors.crust }, -- indent lines - IblScope = { fg = colors.overlay2 }, + IblScope = { fg = colors.overlay1 }, - BufferCurrent = { fg = colors.text, bg = colors.base }, - 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" }, + -- LspReferenceText = { bg = colors.surface0 }, + -- LspReferenceRead = { link = "LspReferenceText" }, + -- LspReferenceWrite = { link = "LspReferenceText" }, + -- + -- -- telescope + TelescopeNormal = { bg = colors.crust }, + TelescopeBorder = { fg = colors.crust, bg = colors.crust }, + TelescopePromptNormal = { bg = colors.mantle }, + TelescopePromptPrefix = { fg = colors.mauve }, + TelescopePromptBorder = { fg = colors.mantle, bg = colors.mantle }, + TelescopePromptTitle = { fg = colors.crust, bg = colors.blue }, + TelescopePreviewTitle = { fg = colors.crust, bg = colors.mauve }, -- Syntax PreProc = { link = "Include" }, diff --git a/nvim/lua/config/plugins/comment.lua b/nvim/lua/config/plugins/comment.lua new file mode 100644 index 0000000..e882df2 --- /dev/null +++ b/nvim/lua/config/plugins/comment.lua @@ -0,0 +1,20 @@ +return { + options = { + custom_commentstring = function() return vim.bo.commentstring end + }, + mappings = { + -- Toggle comment (like `gcip` - comment inner paragraph) for both + -- Normal and Visual modes + comment = '/', + + -- Toggle comment on current line + comment_line = '//', + + -- Toggle comment on visual selection + comment_visual = '/', + + -- Define 'comment' textobject (like `dgc` - delete whole comment block) + -- Works also in Visual mode if mapping differs from `comment_visual` + textobject = 'gc', + } +} diff --git a/nvim/lua/config/plugins/neo-tree.lua b/nvim/lua/config/plugins/neo-tree.lua new file mode 100644 index 0000000..6842b1f --- /dev/null +++ b/nvim/lua/config/plugins/neo-tree.lua @@ -0,0 +1,69 @@ +local icons = require('config.icons') + +return { + close_if_last_window = false, + hide_root_node = true, + default_component_configs = { + indent = { + indent_size = 2, + padding = 1, + -- indent guides + with_markers = true, + indent_marker = icons.tree.node, + last_indent_marker = icons.tree.nodelast, + }, + icon = { + folder_open = icons.folder.open, + folder_close = icons.folder.close, + folder_empty = icons.folder.empty, + default = icons.files.text, + }, + name = { + use_git_status_colors = false, + }, + git_status = { + symbols = icons.gitsigns + }, + file_size = { + enabled = false, + }, + type = { + enabled = false, + }, + last_modified = { + enabled = false, + }, + created = { + enabled = false, + }, + symlink_target = { + enabled = true, + }, + }, + event_handlers = { + { + event = "neo_tree_buffer_enter", + handler = function() + if vim.bo.filetype == "neo-tree" then + vim.cmd("setlocal statuscolumn=") + end + end, + } + }, + filesystem = { + filtered_items = { + visible = true, -- when true, they will just be displayed differently than normal items + hide_dotfiles = true, + hide_gitignored = true, + hide_hidden = true, -- only works on Windows for hidden files/directories + hide_by_name = { + "node_modules", + "vendor", + }, + }, + follow_current_file = { + enabled = true, + }, + use_libuv_file_watcher = true, + } +} diff --git a/nvim/lua/config/plugins/treesitter.lua b/nvim/lua/config/plugins/treesitter.lua new file mode 100644 index 0000000..f725696 --- /dev/null +++ b/nvim/lua/config/plugins/treesitter.lua @@ -0,0 +1,57 @@ +return { + -- A list of parser names + ensure_installed = { + "bash", + "c", + "cpp", + "ninja", + "cmake", + "dockerfile", + "make", + "lua", + "vim", + "vimdoc", + "query", + "php", + "phpdoc", + "blade", + "go", + "gomod", + "gosum", + "javascript", + "typescript", + "css", + "scss", + "html", + "vue", + "json", + "jsonc", + "yaml", + "toml", + "xml", + "glsl", + "hlsl", + "markdown" + }, + + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = true, + + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = false, + + highlight = { + enable = true, + + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, + + indent = { + enable = true + } +} diff --git a/nvim/lua/config/plugins/which-key.lua b/nvim/lua/config/plugins/which-key.lua new file mode 100644 index 0000000..b291d53 --- /dev/null +++ b/nvim/lua/config/plugins/which-key.lua @@ -0,0 +1,9 @@ +return { + defaults = { + mode = { "n", "v" }, + ["r"] = { name = "+rename" }, + ["b"] = { name = "+buffers" }, + ["f"] = { name = "+files" }, + ["d"] = { name = "+diagnostics" } + } +} diff --git a/nvim/lua/config/settings.lua b/nvim/lua/config/settings.lua index 325edf0..ef2374e 100644 --- a/nvim/lua/config/settings.lua +++ b/nvim/lua/config/settings.lua @@ -6,6 +6,7 @@ local set = vim.opt set.termguicolors = true set.updatetime = 50 set.showmode = false -- disable mode in the command line, because i use lualine +set.mousemoveevent = true -- -- Editor settings @@ -14,6 +15,7 @@ set.pumheight = 20 set.hlsearch = false set.incsearch = true set.laststatus = 3 +set.splitkeep = "screen" set.scrolloff=20 --vim.opt.sidescrolloff = 8 set.cursorline = true @@ -60,3 +62,13 @@ vim.diagnostic.config({ source = 'always', }, }) + +-- Highlight on yank +vim.api.nvim_create_autocmd('TextYankPost', { + group = vim.api.nvim_create_augroup('highlight_yank', {}), + desc = 'Hightlight selection on yank', + pattern = '*', + callback = function() + vim.highlight.on_yank { higroup = 'IncSearch', timeout = 200 } + end, +}) diff --git a/nvim/lua/plugins/editor/autopairs.lua b/nvim/lua/plugins/core/autopairs.lua similarity index 100% rename from nvim/lua/plugins/editor/autopairs.lua rename to nvim/lua/plugins/core/autopairs.lua diff --git a/nvim/lua/plugins/core/autotag.lua b/nvim/lua/plugins/core/autotag.lua new file mode 100644 index 0000000..426c352 --- /dev/null +++ b/nvim/lua/plugins/core/autotag.lua @@ -0,0 +1,24 @@ +return { + "windwp/nvim-ts-autotag", + dependencies = { + 'nvim-treesitter/nvim-treesitter' + }, + opts = { + filetypes = { + 'html', + 'javascript', + 'typescript', + 'javascriptreact', + 'typescriptreact', + 'svelte', + 'vue', + 'tsx', + 'jsx', + 'rescript', + 'xml', + 'php', + 'blade', + 'markdown', + } + } +} diff --git a/nvim/lua/plugins/editor/indent.lua b/nvim/lua/plugins/core/indent-blankline.lua similarity index 100% rename from nvim/lua/plugins/editor/indent.lua rename to nvim/lua/plugins/core/indent-blankline.lua diff --git a/nvim/lua/plugins/core/treesitter.lua b/nvim/lua/plugins/core/treesitter.lua new file mode 100644 index 0000000..4cba713 --- /dev/null +++ b/nvim/lua/plugins/core/treesitter.lua @@ -0,0 +1,27 @@ +return { + 'nvim-treesitter/nvim-treesitter', + build = function() + require('nvim-treesitter.install').update({ with_sync = true }) + end, + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + 'nvim-treesitter/playground' + }, + opts = require('config.plugins.treesitter'), + config = function(_, opts) + local parser_config = require('nvim-treesitter.parsers').get_parser_configs() + + parser_config.blade = { + install_info = { + url = 'https://github.com/EmranMR/tree-sitter-blade', + branch = "main", + files = { 'src/parser.c' }, + generate_requires_npm = true, + requires_generate_from_grammar = true, + }, + filetype = 'blade', + } + + require("nvim-treesitter.configs").setup(opts) + end, +} diff --git a/nvim/lua/plugins/editor/mini-comment.lua b/nvim/lua/plugins/editor/mini-comment.lua index de19c9b..255cddb 100644 --- a/nvim/lua/plugins/editor/mini-comment.lua +++ b/nvim/lua/plugins/editor/mini-comment.lua @@ -1,9 +1,5 @@ return { 'echasnovski/mini.comment', version = '*', - opts = { - options = { - custom_commentstring = function() return vim.bo.commentstring end - } - } + opts = require('config.plugins.comment') } diff --git a/nvim/lua/plugins/editor/telescope.lua b/nvim/lua/plugins/editor/telescope.lua index 7ca4a3b..fec4f13 100644 --- a/nvim/lua/plugins/editor/telescope.lua +++ b/nvim/lua/plugins/editor/telescope.lua @@ -24,11 +24,11 @@ return { results = { 1, 1, 1, 1 }, preview = { 1, 1, 1, 1 }, }, - borderchars = { - prompt = { "─", "│", "─", "│", "├", "┤", "┴", "└" }, - results = { "─", "│", " ", "│", "┌", "┬", "│", "│" }, - preview = { "─", "│", "─", " ", "─", "┐", "┘", "─" }, - }, + -- borderchars = { + -- prompt = { "─", "│", "─", "│", "├", "┤", "┴", "└" }, + -- results = { "─", "│", " ", "│", "┌", "┬", "│", "│" }, + -- preview = { "─", "│", "─", " ", "─", "┐", "┘", "─" }, + -- }, } opts.defaults = vim.tbl_deep_extend("force", opts.defaults, override) diff --git a/nvim/lua/plugins/ide/cmp.lua b/nvim/lua/plugins/ide/cmp.lua index 4d0487a..ed3f294 100644 --- a/nvim/lua/plugins/ide/cmp.lua +++ b/nvim/lua/plugins/ide/cmp.lua @@ -17,8 +17,8 @@ return { local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) local border = cmp.config.window.bordered({ - border = {'┌', '─', '┐', '│', '┘', '─', '└', '│'}, - winhighlight = 'Normal:None,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None' + -- border = {'┌', '─', '┐', '│', '┘', '─', '└', '│'}, + winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None' }) return { diff --git a/nvim/lua/plugins/ide/dap.lua b/nvim/lua/plugins/ide/dap.lua index a12c02d..9cdafc9 100644 --- a/nvim/lua/plugins/ide/dap.lua +++ b/nvim/lua/plugins/ide/dap.lua @@ -38,11 +38,47 @@ return { }, keys = { { "Dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + { "Db", function() require'dap'.toggle_breakpoint() end, desc = "Toggle breakpoint" }, }, config = function() - -- local Config = require("lazyvim.config") vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" }) + local dap = require "dap" + dap.adapters.delve = { + type = 'server', + port = '${port}', + executable = { + command = 'dlv', + args = {'dap', '-l', '127.0.0.1:${port}'}, + } + } + + dap.configurations.go = { + { + type = "delve", + name = "Debug", + request = "launch", + program = "${file}" + }, + { + type = "delve", + name = "Debug test", -- configuration for debugging test files + request = "launch", + mode = "test", + program = "${file}" + }, + -- works with go.mod packages and sub packages + { + type = "delve", + name = "Debug test (go.mod)", + request = "launch", + mode = "test", + program = "./${relativeFileDirname}" + } + } + -- local Config = require("lazyvim.config") + + -- for name, sign in pairs(Config.icons.dap) do -- sign = type(sign) == "table" and sign or { sign } -- vim.fn.sign_define( diff --git a/nvim/lua/plugins/ide/neotest.lua b/nvim/lua/plugins/ide/neotest.lua index c3909dd..aec2d8c 100644 --- a/nvim/lua/plugins/ide/neotest.lua +++ b/nvim/lua/plugins/ide/neotest.lua @@ -1,6 +1,7 @@ return { "nvim-neotest/neotest", dependencies = { + "nvim-neotest/nvim-nio", "nvim-lua/plenary.nvim", "antoinemadec/FixCursorHold.nvim", "nvim-treesitter/nvim-treesitter", @@ -22,7 +23,7 @@ return { {"ta", ":lua require('neotest').output_panel.open():lua require('neotest').run.run({suite = true})", desc = "test all"}, {"ts", ":lua require('neotest').run.stop()", desc = "stop test"}, {"tq", ":lua require('neotest').output_panel.close()", desc = "close output window"}, - {"te", ":lua require('neotest').summary()"} + {"te", ":Neotest summary", desc = "Open test explorer"} }, opts = function() local icons = require('config.icons').test @@ -48,6 +49,9 @@ return { skipped = icons.skipped, unknown = icons.unknown, watching = icons.watch + }, + summery = { + open = "botleft vsplit" } } end diff --git a/nvim/lua/plugins/ide/treesitter.lua b/nvim/lua/plugins/ide/treesitter.lua deleted file mode 100644 index f4d4825..0000000 --- a/nvim/lua/plugins/ide/treesitter.lua +++ /dev/null @@ -1,83 +0,0 @@ -return { - 'nvim-treesitter/nvim-treesitter', - build = function() - require('nvim-treesitter.install').update({ with_sync = true }) - end, - dependencies = { - 'nvim-treesitter/nvim-treesitter-textobjects', - 'nvim-treesitter/playground' - }, - opts = { - -- A list of parser names - ensure_installed = { - "bash", - "c", - "cpp", - "ninja", - "cmake", - "dockerfile", - "make", - "lua", - "vim", - "vimdoc", - "query", - "php", - "phpdoc", - "blade", - "go", - "gomod", - "gosum", - "javascript", - "typescript", - "css", - "scss", - "html", - "vue", - "json", - "jsonc", - "yaml", - "toml", - "xml", - "glsl", - "hlsl", - "markdown" - }, - - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = true, - - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = false, - - highlight = { - enable = true, - - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, - - indent = { - enable = true - } - }, - config = function(_, opts) - local parser_config = require('nvim-treesitter.parsers').get_parser_configs() - - parser_config.blade = { - install_info = { - url = 'https://github.com/EmranMR/tree-sitter-blade', - branch = "main", - files = { 'src/parser.c' }, - generate_requires_npm = true, - requires_generate_from_grammar = true, - }, - filetype = 'blade', - } - - require("nvim-treesitter.configs").setup(opts) - end, -} diff --git a/nvim/lua/plugins/init.lua b/nvim/lua/plugins/init.lua index 8426025..13c696f 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim/lua/plugins/init.lua @@ -19,29 +19,33 @@ local opts = { require("lazy").setup({ + -- Core + ----------------------------- + { import = "plugins.core.treesitter" }, + { import = "plugins.core.autopairs" }, + { import = "plugins.core.autotag" }, + { import = "plugins.core.indent-blankline" }, + -- 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.edgy" }, { import = "plugins.ui.noice" }, { import = "plugins.ui.dashboard" }, { import = "plugins.ui.catppuccin" }, { import = "plugins.ui.neo-tree" }, - { import = "plugins.ui.barbar" }, - { import = "plugins.ui.barbecue" }, + { import = "plugins.ui.bufferline" }, { import = "plugins.ui.lualine" }, { import = "plugins.ui.gitsigns" }, { import = "plugins.ui.which-key" }, -- IDE ----------------------------- - { import = "plugins.ide.treesitter" }, { import = "plugins.ide.conform" }, { import = "plugins.ide.cmp" }, { import = "plugins.ide.lsp" }, @@ -51,7 +55,7 @@ require("lazy").setup({ -- Language specific ----------------------------- { import = "plugins.lang.laravel" }, - --{ import = "plugins.lang.go" }, + { import = "plugins.lang.go" }, }, opts) diff --git a/nvim/lua/plugins/ui/barbar.lua b/nvim/lua/plugins/ui/barbar.lua index 24e1191..fe8cc75 100644 --- a/nvim/lua/plugins/ui/barbar.lua +++ b/nvim/lua/plugins/ui/barbar.lua @@ -28,7 +28,7 @@ return { maximum_padding = 2, minimum_padding = 1, sidebar_filetypes = { - ['neo-tree'] = {event = 'BufWipeout'}, + --['neo-tree'] = {event = 'BufWipeout'}, } }, } diff --git a/nvim/lua/plugins/ui/barbecue.lua b/nvim/lua/plugins/ui/barbecue.lua deleted file mode 100644 index c9ed216..0000000 --- a/nvim/lua/plugins/ui/barbecue.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - "utilyre/barbecue.nvim", - name = "barbecue", - version = "*", - dependencies = { - "SmiteshP/nvim-navic", - "nvim-tree/nvim-web-devicons", - }, - opts = { - theme = "catppuccin", - } -} diff --git a/nvim/lua/plugins/ui/bufferline.lua b/nvim/lua/plugins/ui/bufferline.lua new file mode 100644 index 0000000..b34788f --- /dev/null +++ b/nvim/lua/plugins/ui/bufferline.lua @@ -0,0 +1,6 @@ +return { + 'akinsho/bufferline.nvim', + version = "*", + dependencies = 'nvim-tree/nvim-web-devicons', + opts = require('config.plugins.bufferline') +} diff --git a/nvim/lua/plugins/ui/edgy.lua b/nvim/lua/plugins/ui/edgy.lua new file mode 100644 index 0000000..c51e1e7 --- /dev/null +++ b/nvim/lua/plugins/ui/edgy.lua @@ -0,0 +1,33 @@ +return { + "folke/edgy.nvim", + event = "VeryLazy", + keys = { + { "ue", function() require("edgy").toggle() end, desc = "Edgy Toggle" }, + -- stylua: ignore + { "uE", function() require("edgy").select() end, desc = "Edgy Select Window" }, + }, + opts = { + left = { + { + title = "Neo-Tree", + ft = "neo-tree", + filter = function(buf) + return vim.b[buf].neo_tree_source == "filesystem" + end, + size = { height = 0.5 }, + }, + { + title = "Test", + ft = "neotest-summary" + }, + "neo-tree", + }, + options = { + left = { size = 40 } + }, + animate = { + enabled = false, + }, + exit_when_last = false + } +} diff --git a/nvim/lua/plugins/ui/lualine.lua b/nvim/lua/plugins/ui/lualine.lua index 1160455..ee07779 100644 --- a/nvim/lua/plugins/ui/lualine.lua +++ b/nvim/lua/plugins/ui/lualine.lua @@ -12,6 +12,7 @@ return { theme = "catppuccin-mocha", component_separators = '', globalstatus = true, + section_separators = { left = '', right = '' }, disabled_filetypes = { statusline = { 'dashboard', @@ -22,6 +23,17 @@ return { sections = { lualine_a = { "mode" }, lualine_b = { "branch" }, + lualine_c = { + { + "diagnostics", + symbols = { + error = icons.diagnostics.error .. ' ', + warn = icons.diagnostics.warn .. ' ', + info = icons.diagnostics.info .. ' ', + hint = icons.diagnostics.hint .. ' ', + }, + } + }, lualine_x = { { require("lazy.status").updates, @@ -36,15 +48,7 @@ return { -- removed = icons.diff.removed .. ' ' -- } -- }, - { - "diagnostics", - symbols = { - error = icons.diagnostics.error .. ' ', - warn = icons.diagnostics.warn .. ' ', - info = icons.diagnostics.info .. ' ', - hint = icons.diagnostics.hint .. ' ', - }, - }, + 'filename' }, lualine_y = { 'encoding', diff --git a/nvim/lua/plugins/ui/neo-tree.lua b/nvim/lua/plugins/ui/neo-tree.lua index c048dac..bbfa169 100644 --- a/nvim/lua/plugins/ui/neo-tree.lua +++ b/nvim/lua/plugins/ui/neo-tree.lua @@ -1,5 +1,3 @@ -local icons = require('config.icons') - return { 'nvim-neo-tree/neo-tree.nvim', cmd = 'Neotree', @@ -11,54 +9,5 @@ return { "nvim-tree/nvim-web-devicons", "nvim-lua/plenary.nvim", }, - opts = { - close_if_last_window = true, - hide_root_node = true, - default_component_configs = { - indent = { - indent_size = 2, - padding = 1, - -- indent guides - with_markers = true, - indent_marker = "│", - last_indent_marker = "└", - }, - 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.gitsigns - }, - }, - event_handlers = { - { - event = "neo_tree_buffer_enter", - handler = function() - if vim.bo.filetype == "neo-tree" then - vim.cmd("setlocal statuscolumn=") - end - end, - } - }, - filesystem = { - filtered_items = { - visible = true, -- when true, they will just be displayed differently than normal items - hide_dotfiles = true, - hide_gitignored = true, - hide_hidden = true, -- only works on Windows for hidden files/directories - hide_by_name = { - "node_modules", - "vendor", - }, - }, - follow_current_file = { - enable = true - }, - }, - } + opts = require('config.plugins.neo-tree') } diff --git a/nvim/lua/plugins/ui/noice.lua b/nvim/lua/plugins/ui/noice.lua index 940f369..7ce4a39 100644 --- a/nvim/lua/plugins/ui/noice.lua +++ b/nvim/lua/plugins/ui/noice.lua @@ -1,16 +1,33 @@ return { "folke/noice.nvim", event = "VeryLazy", + dependencies = { + "MunifTanjim/nui.nvim", + }, opts = { cmdline = { + enabled = true, view = "cmdline" }, presets = { bottom_search = true, - command_palette = true + command_palette = false + }, + commands = { + history = { + view = "cmdline_output", + } + }, + views = { + mini = { + position = { + row = -2, + }, + border = { + style = 'solid', + padding = { 0, 1 }, + } + } } }, - dependencies = { - "MunifTanjim/nui.nvim", - } } diff --git a/nvim/lua/plugins/ui/which-key.lua b/nvim/lua/plugins/ui/which-key.lua index 7eaaa0b..a20e348 100644 --- a/nvim/lua/plugins/ui/which-key.lua +++ b/nvim/lua/plugins/ui/which-key.lua @@ -5,19 +5,11 @@ return { vim.o.timeout = true vim.o.timeoutlen = 300 end, - opts = { - defaults = { - mode = { "n", "v" }, - ["r"] = { name = "+rename" }, - ["b"] = { name = "+buffers" }, - ["f"] = { name = "+files" }, - ["d"] = { name = "+diagnostics" } - } - }, + opts = require('config.plugins.which-key'), config = function(_, opts) local wk = require("which-key") wk.setup(opts) - wk.register(opts.defaults) + wk.register(opts.defaults or {}) end }