diff --git a/nvim/.luarc.json b/nvim-old/.luarc.json similarity index 100% rename from nvim/.luarc.json rename to nvim-old/.luarc.json diff --git a/nvim/README.md b/nvim-old/README.md similarity index 100% rename from nvim/README.md rename to nvim-old/README.md diff --git a/nvim-old/init.lua b/nvim-old/init.lua new file mode 100644 index 0000000..a75bc2d --- /dev/null +++ b/nvim-old/init.lua @@ -0,0 +1,2 @@ +require("config") +require("plugins") diff --git a/nvim-old/lazy-lock.json b/nvim-old/lazy-lock.json new file mode 100644 index 0000000..fde0f75 --- /dev/null +++ b/nvim-old/lazy-lock.json @@ -0,0 +1,53 @@ +{ + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, + "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" }, + "bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" }, + "catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, + "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, + "dashboard": { "branch": "master", "commit": "681300934baf36f6184ca41f0b26aed22056d4ee" }, + "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, + "edgy.nvim": { "branch": "main", "commit": "de79b7d92a5979cd71a9a1d8b6282515345e5055" }, + "fd": { "branch": "master", "commit": "11069e284a61afef8becdd4e189977e5621c0cf9" }, + "gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" }, + "glow.nvim": { "branch": "main", "commit": "238070a686c1da3bccccf1079700eb4b5e19aea4" }, + "go.nvim": { "branch": "master", "commit": "39c245285483f7b587d827b3ff3eaa7e9ed00510" }, + "guihua.lua": { "branch": "master", "commit": "3b3126ae87c254f6849e708549ba76c39e3f42f8" }, + "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, + "laravel.nvim": { "branch": "main", "commit": "baafe3c0072ecb7c8f1efc9ed5e3c96ff4fbf056" }, + "lazy.nvim": { "branch": "main", "commit": "bef521ac89c8d423f9d092e37b58e8af0c099309" }, + "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, + "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, + "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, + "mason-conform.nvim": { "branch": "main", "commit": "c41b19222db71b016e55c64454b5e03441f56859" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" }, + "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, + "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, + "neo-tree.nvim": { "branch": "main", "commit": "c61074acb19102dfc6f21738dcae4d9a494a8959" }, + "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, + "neotest": { "branch": "master", "commit": "f03a78cef74db5638e4312e18b767294a90de8da" }, + "neotest-go": { "branch": "main", "commit": "6a2f996d89fe4631942e035b1c114544ee045043" }, + "neotest-phpunit": { "branch": "main", "commit": "5799a4ea84450af14461d24edbde43913f9b3008" }, + "none-ls.nvim": { "branch": "main", "commit": "dca7ddec321a102ec9e792b1b29193702aff5fbb" }, + "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" }, + "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, + "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, + "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, + "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, + "nvim-lspconfig": { "branch": "master", "commit": "b3014f2209503944f2714cf27c95591433a0c7d8" }, + "nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" }, + "nvim-treesitter": { "branch": "master", "commit": "b0ac1135fe304edd34e18204304906744db0fe63" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "67ac27f859ee3f7584f3edef81d0942bb61d5344" }, + "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, + "nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" }, + "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, + "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, + "telescope.nvim": { "branch": "master", "commit": "5a701e99906961218b55d7ad6c2a998f066c6fe0" }, + "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, + "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, + "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-old/lua/config/commands.lua similarity index 100% rename from nvim/lua/config/commands.lua rename to nvim-old/lua/config/commands.lua diff --git a/nvim/lua/config/filetype.lua b/nvim-old/lua/config/filetype.lua similarity index 100% rename from nvim/lua/config/filetype.lua rename to nvim-old/lua/config/filetype.lua diff --git a/nvim-old/lua/config/icons.lua b/nvim-old/lua/config/icons.lua new file mode 100644 index 0000000..50326a3 --- /dev/null +++ b/nvim-old/lua/config/icons.lua @@ -0,0 +1,90 @@ +return { + prompt = '', + current = ' ', + selected = '', + close = '󰅖', + modified = '', + pinned = '', + separator = '│', + tree = { + node = '│', + nodelast = '└', + }, + files = { + text = "", + symlink = "", + }, + folder = { + closed = "", + open = "", + empty = "", + empty_open = "", + symlink = "", + symlink_open = "", + }, + diff = { + added = '', + modified = '', + removed = '', + }, + diff_gutter = { + add = '▍', + change = '▍', + delete = '', + untracked = '+' + }, + gitsigns = { + -- Change type + added = "", + modified = "", + deleted = "", + renamed = "➜", + -- Status type + untracked = "★", + ignored = "◌", + unstaged = "", + staged = "✓", + conflict = "", + }, + diagnostics = { + error = '', + warn = '', + info = '', + hint = '' + }, + test = { + ok = '', + failed = '', + running = '', + skipped = '', + watch = '', + unknown = '', + }, + symbols = { + Text = "", + Method = "", + Function = "󰊕", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "󰑭", + Value = "", + Enum = "", + Keyword = "", + Snippet = "󰘦", + Color = "", + File = "󰈙", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "", + }, +} diff --git a/nvim/lua/config/init.lua b/nvim-old/lua/config/init.lua similarity index 100% rename from nvim/lua/config/init.lua rename to nvim-old/lua/config/init.lua diff --git a/nvim/lua/config/mappings.lua b/nvim-old/lua/config/mappings.lua similarity index 100% rename from nvim/lua/config/mappings.lua rename to nvim-old/lua/config/mappings.lua diff --git a/nvim/lua/config/plugins/bufferline.lua b/nvim-old/lua/config/plugins/bufferline.lua similarity index 100% rename from nvim/lua/config/plugins/bufferline.lua rename to nvim-old/lua/config/plugins/bufferline.lua diff --git a/nvim/lua/config/plugins/catppuccin.lua b/nvim-old/lua/config/plugins/catppuccin.lua similarity index 100% rename from nvim/lua/config/plugins/catppuccin.lua rename to nvim-old/lua/config/plugins/catppuccin.lua diff --git a/nvim/lua/config/plugins/cmp.lua b/nvim-old/lua/config/plugins/cmp.lua similarity index 100% rename from nvim/lua/config/plugins/cmp.lua rename to nvim-old/lua/config/plugins/cmp.lua diff --git a/nvim/lua/config/plugins/comment.lua b/nvim-old/lua/config/plugins/comment.lua similarity index 100% rename from nvim/lua/config/plugins/comment.lua rename to nvim-old/lua/config/plugins/comment.lua diff --git a/nvim/lua/config/plugins/conform.lua b/nvim-old/lua/config/plugins/conform.lua similarity index 100% rename from nvim/lua/config/plugins/conform.lua rename to nvim-old/lua/config/plugins/conform.lua diff --git a/nvim/lua/config/plugins/laravel.lua b/nvim-old/lua/config/plugins/laravel.lua similarity index 100% rename from nvim/lua/config/plugins/laravel.lua rename to nvim-old/lua/config/plugins/laravel.lua diff --git a/nvim/lua/config/plugins/lsp.lua b/nvim-old/lua/config/plugins/lsp.lua similarity index 100% rename from nvim/lua/config/plugins/lsp.lua rename to nvim-old/lua/config/plugins/lsp.lua diff --git a/nvim/lua/config/plugins/lualine.lua b/nvim-old/lua/config/plugins/lualine.lua similarity index 100% rename from nvim/lua/config/plugins/lualine.lua rename to nvim-old/lua/config/plugins/lualine.lua diff --git a/nvim/lua/config/plugins/neo-tree.lua b/nvim-old/lua/config/plugins/neo-tree.lua similarity index 100% rename from nvim/lua/config/plugins/neo-tree.lua rename to nvim-old/lua/config/plugins/neo-tree.lua diff --git a/nvim/lua/config/plugins/telescope.lua b/nvim-old/lua/config/plugins/telescope.lua similarity index 100% rename from nvim/lua/config/plugins/telescope.lua rename to nvim-old/lua/config/plugins/telescope.lua diff --git a/nvim/lua/config/plugins/treesitter.lua b/nvim-old/lua/config/plugins/treesitter.lua similarity index 100% rename from nvim/lua/config/plugins/treesitter.lua rename to nvim-old/lua/config/plugins/treesitter.lua diff --git a/nvim/lua/config/plugins/trouble.lua b/nvim-old/lua/config/plugins/trouble.lua similarity index 100% rename from nvim/lua/config/plugins/trouble.lua rename to nvim-old/lua/config/plugins/trouble.lua diff --git a/nvim/lua/config/plugins/which-key.lua b/nvim-old/lua/config/plugins/which-key.lua similarity index 100% rename from nvim/lua/config/plugins/which-key.lua rename to nvim-old/lua/config/plugins/which-key.lua diff --git a/nvim/lua/config/settings.lua b/nvim-old/lua/config/settings.lua similarity index 100% rename from nvim/lua/config/settings.lua rename to nvim-old/lua/config/settings.lua diff --git a/nvim/lua/plugins/core/autopairs.lua b/nvim-old/lua/plugins/core/autopairs.lua similarity index 100% rename from nvim/lua/plugins/core/autopairs.lua rename to nvim-old/lua/plugins/core/autopairs.lua diff --git a/nvim/lua/plugins/core/autotag.lua b/nvim-old/lua/plugins/core/autotag.lua similarity index 100% rename from nvim/lua/plugins/core/autotag.lua rename to nvim-old/lua/plugins/core/autotag.lua diff --git a/nvim/lua/plugins/core/indent-blankline.lua b/nvim-old/lua/plugins/core/indent-blankline.lua similarity index 100% rename from nvim/lua/plugins/core/indent-blankline.lua rename to nvim-old/lua/plugins/core/indent-blankline.lua diff --git a/nvim/lua/plugins/core/treesitter.lua b/nvim-old/lua/plugins/core/treesitter.lua similarity index 100% rename from nvim/lua/plugins/core/treesitter.lua rename to nvim-old/lua/plugins/core/treesitter.lua diff --git a/nvim/lua/plugins/editor/mini-comment.lua b/nvim-old/lua/plugins/editor/mini-comment.lua similarity index 100% rename from nvim/lua/plugins/editor/mini-comment.lua rename to nvim-old/lua/plugins/editor/mini-comment.lua diff --git a/nvim/lua/plugins/editor/telescope.lua b/nvim-old/lua/plugins/editor/telescope.lua similarity index 100% rename from nvim/lua/plugins/editor/telescope.lua rename to nvim-old/lua/plugins/editor/telescope.lua diff --git a/nvim/lua/plugins/ide/cmp.lua b/nvim-old/lua/plugins/ide/cmp.lua similarity index 100% rename from nvim/lua/plugins/ide/cmp.lua rename to nvim-old/lua/plugins/ide/cmp.lua diff --git a/nvim/lua/plugins/ide/conform.lua b/nvim-old/lua/plugins/ide/conform.lua similarity index 100% rename from nvim/lua/plugins/ide/conform.lua rename to nvim-old/lua/plugins/ide/conform.lua diff --git a/nvim/lua/plugins/ide/copilot.lua b/nvim-old/lua/plugins/ide/copilot.lua similarity index 100% rename from nvim/lua/plugins/ide/copilot.lua rename to nvim-old/lua/plugins/ide/copilot.lua diff --git a/nvim/lua/plugins/ide/dap.lua b/nvim-old/lua/plugins/ide/dap.lua similarity index 95% rename from nvim/lua/plugins/ide/dap.lua rename to nvim-old/lua/plugins/ide/dap.lua index 9cdafc9..0dd14b2 100644 --- a/nvim/lua/plugins/ide/dap.lua +++ b/nvim-old/lua/plugins/ide/dap.lua @@ -14,6 +14,7 @@ return { "rcarriga/nvim-dap-ui", -- stylua: ignore keys = { + { "Dr", function() require("dap").continue({ }) end, desc = "Dap Run/Continue" }, { "Du", function() require("dapui").toggle({ }) end, desc = "Dap UI" }, { "De", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} }, }, diff --git a/nvim-old/lua/plugins/ide/glow.lua b/nvim-old/lua/plugins/ide/glow.lua new file mode 100644 index 0000000..0e2c41f --- /dev/null +++ b/nvim-old/lua/plugins/ide/glow.lua @@ -0,0 +1 @@ +return {"ellisonleao/glow.nvim", config = true, cmd = "Glow"} diff --git a/nvim/lua/plugins/ide/lsp.lua b/nvim-old/lua/plugins/ide/lsp.lua similarity index 100% rename from nvim/lua/plugins/ide/lsp.lua rename to nvim-old/lua/plugins/ide/lsp.lua diff --git a/nvim/lua/plugins/ide/neodev.lua b/nvim-old/lua/plugins/ide/neodev.lua similarity index 100% rename from nvim/lua/plugins/ide/neodev.lua rename to nvim-old/lua/plugins/ide/neodev.lua diff --git a/nvim/lua/plugins/ide/neotest.lua b/nvim-old/lua/plugins/ide/neotest.lua similarity index 100% rename from nvim/lua/plugins/ide/neotest.lua rename to nvim-old/lua/plugins/ide/neotest.lua diff --git a/nvim/lua/plugins/ide/trouble.lua b/nvim-old/lua/plugins/ide/trouble.lua similarity index 100% rename from nvim/lua/plugins/ide/trouble.lua rename to nvim-old/lua/plugins/ide/trouble.lua diff --git a/nvim/lua/plugins/ide/undotree.lua b/nvim-old/lua/plugins/ide/undotree.lua similarity index 100% rename from nvim/lua/plugins/ide/undotree.lua rename to nvim-old/lua/plugins/ide/undotree.lua diff --git a/nvim/lua/plugins/init.lua b/nvim-old/lua/plugins/init.lua similarity index 97% rename from nvim/lua/plugins/init.lua rename to nvim-old/lua/plugins/init.lua index a24d0cd..5369a58 100644 --- a/nvim/lua/plugins/init.lua +++ b/nvim-old/lua/plugins/init.lua @@ -54,6 +54,7 @@ require("lazy").setup({ { import = "plugins.ide.neotest" }, { import = "plugins.ide.neodev" }, { import = "plugins.ide.copilot" }, + { import = "plugins.ide.glow" }, -- Language specific ----------------------------- diff --git a/nvim/lua/plugins/lang/go.lua b/nvim-old/lua/plugins/lang/go.lua similarity index 100% rename from nvim/lua/plugins/lang/go.lua rename to nvim-old/lua/plugins/lang/go.lua diff --git a/nvim/lua/plugins/lang/laravel.lua b/nvim-old/lua/plugins/lang/laravel.lua similarity index 100% rename from nvim/lua/plugins/lang/laravel.lua rename to nvim-old/lua/plugins/lang/laravel.lua diff --git a/nvim/lua/plugins/ui/barbar.lua b/nvim-old/lua/plugins/ui/barbar.lua similarity index 100% rename from nvim/lua/plugins/ui/barbar.lua rename to nvim-old/lua/plugins/ui/barbar.lua diff --git a/nvim/lua/plugins/ui/bufferline.lua b/nvim-old/lua/plugins/ui/bufferline.lua similarity index 100% rename from nvim/lua/plugins/ui/bufferline.lua rename to nvim-old/lua/plugins/ui/bufferline.lua diff --git a/nvim/lua/plugins/ui/catppuccin.lua b/nvim-old/lua/plugins/ui/catppuccin.lua similarity index 100% rename from nvim/lua/plugins/ui/catppuccin.lua rename to nvim-old/lua/plugins/ui/catppuccin.lua diff --git a/nvim/lua/plugins/ui/colorscheme.lua b/nvim-old/lua/plugins/ui/colorscheme.lua similarity index 100% rename from nvim/lua/plugins/ui/colorscheme.lua rename to nvim-old/lua/plugins/ui/colorscheme.lua diff --git a/nvim/lua/plugins/ui/dashboard.lua b/nvim-old/lua/plugins/ui/dashboard.lua similarity index 100% rename from nvim/lua/plugins/ui/dashboard.lua rename to nvim-old/lua/plugins/ui/dashboard.lua diff --git a/nvim/lua/plugins/ui/dressing.lua b/nvim-old/lua/plugins/ui/dressing.lua similarity index 100% rename from nvim/lua/plugins/ui/dressing.lua rename to nvim-old/lua/plugins/ui/dressing.lua diff --git a/nvim/lua/plugins/ui/edgy.lua b/nvim-old/lua/plugins/ui/edgy.lua similarity index 100% rename from nvim/lua/plugins/ui/edgy.lua rename to nvim-old/lua/plugins/ui/edgy.lua diff --git a/nvim/lua/plugins/ui/gitsigns.lua b/nvim-old/lua/plugins/ui/gitsigns.lua similarity index 100% rename from nvim/lua/plugins/ui/gitsigns.lua rename to nvim-old/lua/plugins/ui/gitsigns.lua diff --git a/nvim/lua/plugins/ui/lualine.lua b/nvim-old/lua/plugins/ui/lualine.lua similarity index 100% rename from nvim/lua/plugins/ui/lualine.lua rename to nvim-old/lua/plugins/ui/lualine.lua diff --git a/nvim/lua/plugins/ui/neo-tree.lua b/nvim-old/lua/plugins/ui/neo-tree.lua similarity index 100% rename from nvim/lua/plugins/ui/neo-tree.lua rename to nvim-old/lua/plugins/ui/neo-tree.lua diff --git a/nvim/lua/plugins/ui/which-key.lua b/nvim-old/lua/plugins/ui/which-key.lua similarity index 100% rename from nvim/lua/plugins/ui/which-key.lua rename to nvim-old/lua/plugins/ui/which-key.lua diff --git a/nvim-old/lua/utils/lspkind.lua b/nvim-old/lua/utils/lspkind.lua new file mode 100644 index 0000000..aee80bb --- /dev/null +++ b/nvim-old/lua/utils/lspkind.lua @@ -0,0 +1,21 @@ + +local M = {} + +-- Create format function. +function M.format(config) + return function(entry, vim_item) + -- Devicons for files + if vim.tbl_contains({ 'path' }, entry.source.name) then + local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label) + if icon then + vim_item.kind = icon + vim_item.kind_hl_group = hl_group + return vim_item + end + end + + return require('lspkind').cmp_format(config)(entry, vim_item) + end +end + +return M diff --git a/nvim-old/queries/blade/highlights.scm b/nvim-old/queries/blade/highlights.scm new file mode 100644 index 0000000..5c206f5 --- /dev/null +++ b/nvim-old/queries/blade/highlights.scm @@ -0,0 +1,6 @@ +(comment) @comment +((parameter) @string (#set! "priority" 110)) +((php_only) @include (#set! "priority" 110)) +((bracket_start) @function (#set! "priority" 120)) +((bracket_end) @function (#set! "priority" 120)) +((keyword) @keyword (#set! "priority" 110)) diff --git a/nvim-old/queries/blade/injections.scm b/nvim-old/queries/blade/injections.scm new file mode 100644 index 0000000..b7066e5 --- /dev/null +++ b/nvim-old/queries/blade/injections.scm @@ -0,0 +1,15 @@ +((text) @injection.content + (#not-has-ancestor? @injection.content "envoy") + (#set! injection.combined) + (#set! injection.language php)) + +; could be bash or zsh +; or whatever tree-sitter grammar you have. +((text) @injection.content + (#has-ancestor? @injection.content "envoy") + (#set! injection.combined) + (#set! injection.language bash)) + + +((php_only) @injection.content (#set! injection.language php)) +((parameter) @injection.content (#set! injection.language php)) diff --git a/nvim-old/queries/php_only/highlights.scm b/nvim-old/queries/php_only/highlights.scm new file mode 100644 index 0000000..c7c4539 --- /dev/null +++ b/nvim-old/queries/php_only/highlights.scm @@ -0,0 +1,23 @@ +; inherits: php_only + +; php tags should be tagged as preprocessor tokens +(php_tag) @preproc + +; Tag names in class definition as regular text. +(class_declaration [ + name: (name) @class_name + (base_clause (name) @extend_name) + (class_interface_clause (name) @implement_name) +]) + +; tag "use" traits as text +(use_declaration (name) @text) + +; tag namespace classes in "use" as text +(namespace_use_declaration (namespace_use_clause [ + (qualified_name [ + (name) @namespace_name + (namespace_name_as_prefix (namespace_name (name) @namespace_name)) + ]) + (namespace_aliasing_clause (name) @namespace_alias) +])) diff --git a/nvim-old/queries/php_only/indents.scm b/nvim-old/queries/php_only/indents.scm new file mode 100644 index 0000000..eea446d --- /dev/null +++ b/nvim-old/queries/php_only/indents.scm @@ -0,0 +1,10 @@ +; extends + +; Fix for phpdoc comments that don't align * properly. +; This is black magic. I came up with it myself but +; i don't know why it works. +(ERROR + "/" + "**" + @indent.align) + diff --git a/nvim/init.lua b/nvim/init.lua index a75bc2d..57f342d 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,2 +1,27 @@ -require("config") -require("plugins") +local setup = require('setup') + +-- config +require("config.options") +require("config.filetypes") +setup.keymaps('config.keymaps') +require('config.autocmd') + +-- plugins +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup('plugins', { + dev = { + path = "~/code/nvim_plugins", + } +}) diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 9389f36..23ed47c 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,53 +1,29 @@ { - "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, - "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" }, - "bufferline.nvim": { "branch": "main", "commit": "64e2c5def50dfd6b6f14d96a45fa3d815a4a1eef" }, - "catppuccin": { "branch": "main", "commit": "02bdd749931a5d739063562e57531c118e081882" }, + "LuaSnip": { "branch": "master", "commit": "b152822e1a4bafb6bdf11a16cc26525cbd95ee00" }, + "catppuccin": { "branch": "main", "commit": "6af91673ceccbd6e073b66c439e7fce239f72d24" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" }, - "copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" }, - "dashboard": { "branch": "master", "commit": "681300934baf36f6184ca41f0b26aed22056d4ee" }, - "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, - "edgy.nvim": { "branch": "main", "commit": "de79b7d92a5979cd71a9a1d8b6282515345e5055" }, - "fd": { "branch": "master", "commit": "11069e284a61afef8becdd4e189977e5621c0cf9" }, - "gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" }, - "go.nvim": { "branch": "master", "commit": "39c245285483f7b587d827b3ff3eaa7e9ed00510" }, - "guihua.lua": { "branch": "master", "commit": "3b3126ae87c254f6849e708549ba76c39e3f42f8" }, + "conform.nvim": { "branch": "master", "commit": "12b3995537f52ba2810a9857e8ca256881febbda" }, + "fd": { "branch": "master", "commit": "8acd7722f09ff45ef51335751160e0a8dcc096dc" }, + "gitsigns.nvim": { "branch": "main", "commit": "bc933d24a669608968ff4791b14d2d9554813a65" }, "indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" }, - "laravel.nvim": { "branch": "main", "commit": "baafe3c0072ecb7c8f1efc9ed5e3c96ff4fbf056" }, - "lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" }, + "lazy.nvim": { "branch": "main", "commit": "d3974346b6cef2116c8e7b08423256a834cb7cbc" }, + "lsp-zero.nvim": { "branch": "v3.x", "commit": "e00dcf8a6019a88139626c1668dccdc295abd324" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "mason-conform.nvim": { "branch": "main", "commit": "c41b19222db71b016e55c64454b5e03441f56859" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" }, - "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, - "mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" }, - "neo-tree.nvim": { "branch": "main", "commit": "c61074acb19102dfc6f21738dcae4d9a494a8959" }, - "neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" }, - "neotest": { "branch": "master", "commit": "f03a78cef74db5638e4312e18b767294a90de8da" }, - "neotest-go": { "branch": "main", "commit": "6a2f996d89fe4631942e035b1c114544ee045043" }, - "neotest-phpunit": { "branch": "main", "commit": "5799a4ea84450af14461d24edbde43913f9b3008" }, - "none-ls.nvim": { "branch": "main", "commit": "dca7ddec321a102ec9e792b1b29193702aff5fbb" }, - "nui.nvim": { "branch": "main", "commit": "cbd2668414331c10039278f558630ed19b93e69b" }, - "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, - "nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" }, - "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, - "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, - "nvim-lspconfig": { "branch": "master", "commit": "b3014f2209503944f2714cf27c95591433a0c7d8" }, - "nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" }, - "nvim-treesitter": { "branch": "master", "commit": "b0ac1135fe304edd34e18204304906744db0fe63" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "67ac27f859ee3f7584f3edef81d0942bb61d5344" }, + "nvim-autopairs": { "branch": "master", "commit": "14e97371b2aab6ee70054c1070a123dfaa3e217e" }, + "nvim-cmp": { "branch": "main", "commit": "8f3c541407e691af6163e2447f3af1bd6e17f9a3" }, + "nvim-lspconfig": { "branch": "master", "commit": "97762065bf7e1ac617d0a8710eb7ec2d656287a9" }, + "nvim-treesitter": { "branch": "master", "commit": "268611e3ece8463bfb5b09044dcd1b76a28ffbb6" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" }, "nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" }, - "nvim-web-devicons": { "branch": "master", "commit": "6e355632387a085f15a66ad68cf681c1d7374a04" }, - "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, + "nvim-web-devicons": { "branch": "master", "commit": "475fbcfcb6ee7c35aa33a6b6207ebd4032791d87" }, + "oil.nvim": { "branch": "master", "commit": "bcfc0a2e01def5019aa14fac2fc6de20dedb6d3d" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, - "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, - "telescope.nvim": { "branch": "master", "commit": "5a701e99906961218b55d7ad6c2a998f066c6fe0" }, - "trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" }, - "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, - "vim-dotenv": { "branch": "master", "commit": "5c51cfcf8d87280d6414e03cd6b253eb70ecb800" }, + "plenary.nvim": { "branch": "master", "commit": "08e301982b9a057110ede7a735dd1b5285eb341f" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "fac83a556e7b710dc31433dec727361ca062dbe9" }, "which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" } } \ No newline at end of file diff --git a/nvim/lua/config/autocmd.lua b/nvim/lua/config/autocmd.lua new file mode 100644 index 0000000..01f049c --- /dev/null +++ b/nvim/lua/config/autocmd.lua @@ -0,0 +1,6 @@ +local autocmd = vim.api.nvim_create_autocmd + +-- Remove all trailing whitespaces on save +autocmd('BufWritePre', { + command = [[:exe 'norm m`' | %s/\s\+$//eg | norm ``]] +}) diff --git a/nvim/lua/config/cmp.lua b/nvim/lua/config/cmp.lua new file mode 100644 index 0000000..791e465 --- /dev/null +++ b/nvim/lua/config/cmp.lua @@ -0,0 +1,61 @@ +return function() + local cmp = require('cmp') + local lspkind = require('utils.lspkind') + local icons = require('config.icons') + + local selectPrev = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) + local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }) + + local windowstyle = { + border = "none", + winhighlight = 'Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None', + } + + return { + preselect = false, + completion = { + completeopt = "menuone,longest,noinsert,preview" + }, + view = { + entries = { name = 'custom', selection_order = 'near_cursor' }, + }, + window = { + documentation = windowstyle, + completion = windowstyle + }, + mapping = { + [""] = selectPrev, + [""] = selectPrev, + [""] = selectNext, + [""] = selectNext, + [""] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), + }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + formatting = { + fields = { "abbr", "kind", "menu" }, + format = lspkind.format({ + mode = 'symbol', + preset = 'codicons', + symbol_map = icons.symbols, + maxwidth = 40, + ellipsis_char = "...", + }), + }, + sources = { + { name = 'nvim_lsp' }, + { name = 'buffer' }, + { name = 'path' }, + { name = 'luasnip' } + }, + experimental = { + ghost_text = { + hl_group = "NonText", + }, + }, + } +end diff --git a/nvim/lua/config/colorscheme.lua b/nvim/lua/config/colorscheme.lua new file mode 100644 index 0000000..6846540 --- /dev/null +++ b/nvim/lua/config/colorscheme.lua @@ -0,0 +1,115 @@ +return { + flavour = "mocha", + color_overrides = { + mocha = { + base = '#0E1019', + mantle = '#0D0F17', + crust = '#0C0D14', + surface0 = '#131521', + surface1 = '#343959', + surface2 = '#41476F', + overlay0 = '#3F4256', + overlay1 = '#5B5F7C', + overlay2 = '#767BA0', + text = '#eceef4', + } + }, + no_italic = true, + no_bold = true, + highlight_overrides = { + mocha = function(colors) + return { + -- Normal = { fg = colors.text }, + -- NormalNC = { fg = colors.text }, + + -- Floating windows + NormalFloat = { fg = colors.text, bg = colors.mantle }, + FloatTitle = { fg = colors.base, bg = colors.blue }, + FloatBorder = { fg = colors.blue, bg = colors.mantle }, + + -- Window separator + WinSeparator = { fg = colors.surface0 }, + NeoTreeWinSeparator = { link = "WinSeparator" }, + + -- Menus + Pmenu = { fg = colors.text, bg = colors.mantle }, + + -- NoiceMini = { link = "NormalFloat" }, + WhichKeyFloat = { link = "Pmenu" }, + + -- indent lines + IblScope = { fg = colors.overlay1 }, + + -- LSP + -- 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 }, + TelescopeSelection = { fg = colors.text, bg = colors.surface0 }, + + -- Statusline + StatusLine = { fg = colors.text, bg = colors.mantle }, + StatusLineNormal = { fg = colors.text, bg = colors.mantle }, + StatusLineSeparator = { fg = colors.surface0, bg = colors.mantle }, + StatusLineInsert = { fg = colors.base, bg = colors.blue }, + StatusLineVisual = { fg = colors.base, bg = colors.mauve }, + StatusLineCommand = { fg = colors.base, bg = colors.yellow }, + StatusLineReplace = { fg = colors.base, bg = colors.maroon }, + + -- Syntax + PreProc = { link = "Include" }, + Operator = { fg = colors.rosewater }, + Function = { link = "@text" }, + Delimiter = { link = "@text" }, + 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 = "@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" }, + ["@namespace_name.php"] = { link = "@text" }, + ["@namespace_alias.php"] = { link = "@text" }, + } + end + }, + integrations = { + cmp = true, + treesitter = true, + barbar = true, + neotree = true, + noice = true, + telescope = { + enabled = true, + } + } +} diff --git a/nvim/lua/config/conform.lua b/nvim/lua/config/conform.lua new file mode 100644 index 0000000..235dab9 --- /dev/null +++ b/nvim/lua/config/conform.lua @@ -0,0 +1,12 @@ +return { + 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/filetypes.lua b/nvim/lua/config/filetypes.lua new file mode 100644 index 0000000..f365e0f --- /dev/null +++ b/nvim/lua/config/filetypes.lua @@ -0,0 +1,48 @@ +-- +-- Filetype settings +-- +local autocmd = vim.api.nvim_create_autocmd +local augroup = vim.api.nvim_create_augroup + + +-- Add blade filetype for .blade.php files +vim.filetype.add({ + pattern = { + ['.*%.blade%.php'] = 'blade', + }, +}) + +-- Fix autocomment plugins to use line comments for php. +autocmd('Filetype', { + pattern = 'php', + command = 'setlocal commentstring=//\\%s' +}) + + +-- +-- Indent +-- + + +augroup('indent', { clear = true }) + +-- Hardtabs for make +autocmd('Filetype', { + group = 'indent', + pattern = { 'make' }, + command = 'setlocal ts=4 sts=0 sw=4 noexpandtab' +}) + +-- Softtab (2) for yaml +autocmd('Filetype', { + group = 'indent', + pattern = { 'yaml' }, + command = 'setlocal ts=2 sts=2 sw=2 expandtab' +}) + +-- Hardtabs for c/cpp +autocmd('Filetype', { + group = 'indent', + pattern = { 'c', 'cpp' }, + command = 'setlocal ts=8 sts=0 sw=8 noexpandtab' +}) diff --git a/nvim/lua/config/gitsigns.lua b/nvim/lua/config/gitsigns.lua new file mode 100644 index 0000000..7ba90e5 --- /dev/null +++ b/nvim/lua/config/gitsigns.lua @@ -0,0 +1,12 @@ +local icons = require('config.icons').diff_gutter + +return { + signs = { + add = { text = icons.add }, + delete = { text = icons.delete }, + change = { text = icons.change }, + untracked = { text = icons.untracked }, + topdelete = { text = icons.delete }, + changedelete = { text = icons.change }, + }, +} diff --git a/nvim/lua/config/icons.lua b/nvim/lua/config/icons.lua index 50326a3..2083cf5 100644 --- a/nvim/lua/config/icons.lua +++ b/nvim/lua/config/icons.lua @@ -6,6 +6,11 @@ return { modified = '', pinned = '', separator = '│', + fold = { + open = '', + close = '', + sep = ' ', + }, tree = { node = '│', nodelast = '└', diff --git a/nvim/lua/config/keymaps.lua b/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..41bfe1e --- /dev/null +++ b/nvim/lua/config/keymaps.lua @@ -0,0 +1,135 @@ +local cmd = vim.cmd + +return { + leader = " ", + + -- + -- Global keymaps! Alot of stuff "borrowed" from thePrimeagen + -- + global = { + + -- + -- Navigation + -- + + -- Make half page jumps stay in the center of screen + { "n", "", "zz", { silent = true, desc = "jump half a page up" } }, + { "n", "", "zz", { silent = true, desc = "jump half a page down" } }, + { "n", "", "zz", { silent = true, desc = "jump half a page up" } }, + { "n", "", "zz", { silent = true, desc = "jump half a page down" } }, + + -- Split windows + { "n", "", "h", { silent = true, desc = "Goto left split" } }, + { "n", "", "j", { silent = true, desc = "Goto down split" } }, + { "n", "", "k", { silent = true, desc = "Goto up split" } }, + { "n", "", "l", { silent = true, desc = "Goto right split" } }, + + -- Make jump to next search item stay in the center of screen. + { "n", "n", "nzzzv", { silent = true, desc = "jump to next search match" } }, + { "n", "N", "Nzzzv", { silent = true, desc = "jump to previous search match" } }, + + -- Ctrl+s saves the current buffer in normal/insert mode. + { { "n", "i" }, "", cmd.w, { desc = "save current buffer" } }, + + -- Move text + { "n", "", ":m -2v=", { silent = true, desc = "move current line one line up" } }, + { "n", "", ":m +1v=", { silent = true, desc = "move current line one line down" } }, + { "v", "", ":m '<-2gv=gv", { silent = true, desc = "move current selection one line up" } }, + { "v", "", ":m '>+1gv=gv", { silent = true, desc = "move current selection one line down" } }, + + -- copy/paste + { "x", "p", [["_dP]], + { silent = true, desc = "Paste over selected text without losing content in \"-register" } }, + { { "n", "v" }, "y", [["+y]], { desc = "Yank to system clipboard register" } }, + { { "n", "v" }, "p", [["+p]], { desc = "Paste from system clipboard register" } }, + + -- File operations + { "n", "Fe", "Ex", { silent = true, desc = "Open Netrw" } }, + { "n", "Fc", ":CreateFile ", { silent = true, desc = "Create new file" } }, + { "n", "Fx", "!chmod +x %", { silent = true, desc = "Set execute flag on current file" } }, + + -- buffers + { "n", "bn", cmd.bn, { silent = true, desc = "Move to next buffer" } }, + { "n", "bb", cmd.bp, { silent = true, desc = "Move to previous buffer" } }, + { "n", "bd", cmd.bd, { silent = true, desc = "Close current buffer" } }, + { "n", "bc", "BufferLineCloseOthers", { silent = true, desc = "Close all other buffers" } }, + { "n", "bD", "%bd", { silent = true, desc = "Close all buffers" } }, + + -- Indent + { 'n', "", "^=$" }, + { 'x', "", "=", { desc = "auto indent selection" } }, + { "i", "", "", { desc = "delete indent" } }, + + { 'n', "fs", [[:%s/\s\+$//g`']], desc = "Remove trailing spaces" }, + + -- fix paste + -- {'n', "p", "p=$"}, + + -- Crazy search+replace + { "n", "rw", [[:%s/\<\>//gI]], + { desc = "search+replace word under cursor" } }, + + { { "x" }, "fhx", [[:s/\(\x\{2\}\)/0x\1, /g]], { desc = "Format hex" } }, + { { "x" }, "fha", [[:s/0x\(\x\{1\}\X\)/0x0\1/g]], { desc = "Format each hex number to be 2 characters long" } }, + { { "x" }, "fhn", [[:s/\(\(0x\x\{1,2\}, \)\{8\}\)/\1\r/g]], { desc = "Format hex with 8 bytes per row" } }, + -- {{"x"}, "hb", [[:'<,'>s/\(\x\{2\}\)/0x\1, /g]], { desc = "Format a hex string to byte array"}}, + + -- diagnostics + { "n", "do", vim.diagnostic.open_float, { desc = "Open diagnostics" } }, + { "n", "dn", vim.diagnostic.get_next, { desc = "Goto next" } }, + { "n", "dp", vim.diagnostic.get_prev, { desc = "Goto previous" } }, + + -- TMux + { "n", "m", ":terminal tmuxsi", { desc = "Open tmux manager" } }, + + + { "n", "Q", "" }, + + }, + whichkey = { + mode = { "n", "v" }, + ["r"] = { name = "+Rename" }, + ["b"] = { name = "+Buffers" }, + ["f"] = { name = "+Format" }, + ["F"] = { name = "+Files" }, + ["d"] = { name = "+Diagnostics" }, + ["s"] = { name = "+Search" }, + ["g"] = { name = "+Git" }, + }, + oil = { + { '.', function() require('oil').open_float() end, { desc = "Open parent directory" } } + }, + conform = { + { 'ff', "Format", desc = 'Format file' }, + { 'ff', "Format", mode = 'x', desc = 'Format selection' }, + }, + gitsigns = { + { 'gp', 'Gitsigns preview_hunk', desc = 'Git preview diff' }, + { 'gb', 'Gitsigns blame_line', desc = 'Git blame' } + }, + -- Keybinds for buffers with an LSP client attached + lsp = { + { 'K', function() vim.lsp.buf.hover() end, desc = '' }, + { 'ca', function() vim.lsp.buf.code_action() end, desc = 'Code action' }, + { 'rs', function() vim.lsp.buf.rename() end, desc = 'Rename symbol' }, + { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, + { 'ss', 'Telescope lsp_document_symbols', desc = 'Search document symbols' }, + { 'sr', 'Telescope lsp_references', desc = 'Search Reference' }, + { 'si', 'Telescope lsp_implementations', desc = 'Search Inplementations' }, + { 'sp', 'Telescope lsp_workspace_symbols', desc = 'Search Workspace symbols' }, + { 'go', 'Telescope lsp_type_definitions', desc = "Goto type definition" }, + { 'gd', 'Telescope lsp_definitions', desc = 'Goto definition' }, + }, + telescope = { + { 'sf', 'Telescope find_files', desc = 'Search files' }, + { 'sF', 'lua require("telescope.builtin").find_files({no_ignore=true})', desc = 'Search all files' }, + { 'sb', 'Telescope buffers', desc = 'Search buffers' }, + { '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' }, + { 'sd', 'Telescope diagnostics', desc = 'Search Diagnostics' }, + { 'sq', 'Telescope quickfix', desc = 'Search Quickfix' }, + { 'sh', 'Telescope help', desc = 'Search Neovim help' }, + }, +} diff --git a/nvim/lua/config/lsp.lua b/nvim/lua/config/lsp.lua new file mode 100644 index 0000000..8c4d0bd --- /dev/null +++ b/nvim/lua/config/lsp.lua @@ -0,0 +1,65 @@ +return { + servers = { + -- PHP + phpactor = { + settings = { + init_options = { + ["language_server_phpstan.enabled"] = true, + ["language_server_psalm.enabled"] = false, + } + } + }, + -- + -- + -- JS,TS,VUE + volar = { + filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json' } + }, + -- TailwindCSS + tailwindcss = {}, + -- GO + gopls = { + on_save = function() + local params = vim.lsp.util.make_range_params() + params.context = { only = { "source.organizeImports" } } + local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000) + for cid, res in pairs(result or {}) do + for _, r in pairs(res.result or {}) do + if r.edit then + local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16" + vim.lsp.util.apply_workspace_edit(r.edit, enc) + end + end + end + vim.lsp.buf.format({ async = false }) + end, + settings = { + gopls = { + analyses = { + unusedvariable = true, + unusedwrite = true, + useany = true + }, + gofumpt = true, + }, + }, + }, + -- Lua + lua_ls = { + cmd = {"/opt/luals/bin/lua-language-server", "--logpath=~/.local/luals/logs"}, + settings = { + Lua = { + runtime = { + version = 'LuaJIT' + }, + workspace = { + checkThirdParty = false, + library = { + vim.env.VIMRUNTIME + } + } + }, + }, + }, + }, +} diff --git a/nvim/lua/config/lualine.lua b/nvim/lua/config/lualine.lua new file mode 100644 index 0000000..fe71d83 --- /dev/null +++ b/nvim/lua/config/lualine.lua @@ -0,0 +1,93 @@ +local icons = require('config.icons') +local separator = { "'" .. icons.separator .. "'", color = 'StatusLineSeparator' } + +return { + options = { + globalstatus = true, + component_separators = '', + section_separators = '', + disabled_filetypes = { + statusline = { + 'dashboard', + } + }, + theme = { + normal = { + a = "StatusLineNormal", + b = "StatusLine", + c = "StatusLine", + x = "StatusLine", + y = "StatusLine", + z = "StatusLine", + }, + command = { + a = "StatusLineCommand", + z = "StatusLine", + }, + insert = { + a = "StatusLineInsert", + z = "StatusLine", + }, + visual = { + a = "StatusLineVisual", + z = "StatusLine", + }, + replace = { + a = "StatusLineReplace", + z = "StatusLine", + } + } + }, + sections = { + lualine_a = { + "mode", + }, + lualine_b = { + separator, + "branch", + separator, + '" " .. tostring(#vim.tbl_keys(vim.lsp.buf_get_clients()))', + { + require("lazy.status").updates, + cond = require("lazy.status").has_updates, + color = { fg = "#ff9e64" }, + }, + { + "diagnostics", + symbols = { + error = icons.diagnostics.error .. ' ', + warn = icons.diagnostics.warn .. ' ', + info = icons.diagnostics.info .. ' ', + hint = icons.diagnostics.hint .. ' ', + }, + }, + { + "diff", + symbols = { + added = icons.diff.added .. ' ', + modified = icons.diff.modified .. ' ', + removed = icons.diff.removed .. ' ' + } + }, + separator, + }, + lualine_c = { + 'filename' + }, + lualine_x = { + 'filetype', + 'fileformat', + '(vim.bo.expandtab and "SPC" or "TAB") .. " " .. vim.bo.shiftwidth', + }, + lualine_y = { + separator, + 'location', + 'progress' + }, + lualine_z = {} + }, + extensions = { + 'lazy', + 'neo-tree' + } +} diff --git a/nvim/lua/config/oil.lua b/nvim/lua/config/oil.lua new file mode 100644 index 0000000..1022a9a --- /dev/null +++ b/nvim/lua/config/oil.lua @@ -0,0 +1,12 @@ +return { + float = { + -- Padding around the floating window + padding = 2, + max_width = 200, + max_height = 30, + border = "single", + win_options = { + winblend = 0, + }, + }, +} diff --git a/nvim/lua/config/options.lua b/nvim/lua/config/options.lua new file mode 100644 index 0000000..5cebe32 --- /dev/null +++ b/nvim/lua/config/options.lua @@ -0,0 +1,96 @@ +local set = vim.opt +local icons = require('config.icons') + +-- +-- General Settings +-- + +set.termguicolors = true +set.updatetime = 50 +set.showmode = false -- disable mode in the command line, because i use lualine + + +-- +-- Editor settings +-- + +set.wrap = false -- Disable line wrap +set.pumheight = 20 +set.laststatus = 3 +set.splitkeep = "screen" +set.scrolloff = 20 + +set.fillchars = { + foldopen = icons.fold.open, + foldclose = icons.fold.close, + fold = " ", + foldsep = icons.fold.sep, + diff = " ", + eob = " ", +} + +-- mouse and cursor +set.cursorline = true +set.mousemoveevent = true + +-- search +set.hlsearch = false +set.incsearch = true +set.ignorecase = true +set.smartcase = true + +-- line numbers +set.number = true +set.relativenumber = true +set.numberwidth = 5 + +-- sign column to the left +set.statuscolumn = '%s %=%{v:relnum?v:relnum:v:lnum} │ ' + +-- indent +set.expandtab = true +set.tabstop = 4 +set.softtabstop = 4 +set.shiftwidth = 4 +set.autoindent = true +set.smartindent = true + +-- Completion +-- set.completeopt = "menuone,longest,preview" + +-- folds +set.foldenable = true +set.foldlevel = 99 +set.foldmethod = "expr" +set.foldexpr = "nvim_treesitter#foldexpr()" +set.foldcolumn = "auto" + +-- +-- Diagnostics +-- + + + +vim.fn.sign_define('DiagnosticSignError', { text = icons.diagnostics.error, texthl = 'DiagnosticSignError' }) +vim.fn.sign_define('DiagnosticSignWarn', { text = icons.diagnostics.warn, texthl = 'DiagnosticSignWarn' }) +vim.fn.sign_define('DiagnosticSignInfo', { text = icons.diagnostics.info, texthl = 'DiagnosticSignInfo' }) +vim.fn.sign_define('DiagnosticSignHint', { text = icons.diagnostics.hint, texthl = 'DiagnosticSignHint' }) + +vim.diagnostic.config({ + virtual_text = false, + severity_sort = true, + underline = false, + float = { + -- border = 'single', + }, +}) + +-- 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 = 400 } + end, +}) diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua new file mode 100644 index 0000000..75b1929 --- /dev/null +++ b/nvim/lua/config/telescope.lua @@ -0,0 +1,37 @@ +local icons = require('config.icons') + +return function() + local actions = require("telescope.actions") + return { + defaults = { + border = { + prompt = { 1, 1, 1, 1 }, + results = { 1, 1, 1, 1 }, + preview = { 1, 1, 1, 1 }, + }, + 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 + } + }, + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown() + } + } + } +end diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua new file mode 100644 index 0000000..f725696 --- /dev/null +++ b/nvim/lua/config/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/plugins/core.lua b/nvim/lua/plugins/core.lua new file mode 100644 index 0000000..3bdec80 --- /dev/null +++ b/nvim/lua/plugins/core.lua @@ -0,0 +1,187 @@ +local keys = require('config.keymaps') + +return { + -- colorscheme + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + config = function() + require("catppuccin").setup(require('config.colorscheme')) + vim.cmd.colorscheme("catppuccin") + end + }, + { + "folke/which-key.nvim", + event = "VeryLazy", + init = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + end, + opts = function() return { + defaults = keys.whichkey + } end, + config = function(_, opts) + local wk = require("which-key") + wk.setup(opts) + wk.register(opts.defaults or {}) + end + }, + { + '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.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, + }, + { + 'windwp/nvim-autopairs', + event = "InsertEnter", + config = true + }, + { + "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', + } + } + }, + { + "lukas-reineke/indent-blankline.nvim", + main = "ibl", + opts = { + debounce = 10, + indent = { + char = '▏', + }, + scope = { + enabled = true, + show_start = false, + show_end = false + }, + exclude = { + filetypes = { + 'help', + '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 + }, + -- Git stuff + { + 'lewis6991/gitsigns.nvim', + dependencies = { + { + "folke/which-key.nvim", + optional = true, + opts = { + defaults = { + ["g"] = { name = "+git" }, + }, + }, + }, + }, + lazy = false, + keys = keys.gitsigns or {}, + opts = require('config.gitsigns') + + }, + { + 'nvim-lualine/lualine.nvim', + event = "VeryLazy", + dependencies = { + 'arkav/lualine-lsp-progress', + 'nvim-tree/nvim-web-devicons', + }, + opts = require("config.lualine") + }, + { + 'nvim-telescope/telescope.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + 'nvim-tree/nvim-web-devicons', + 'sharkdp/fd', + 'nvim-telescope/telescope-ui-select.nvim', + }, + keys = keys.telescope, + opts = require('config.telescope'), + config = function (_, opts) + local telescope = require("telescope") + + telescope.setup(opts) + for name, _ in pairs(opts.extensions or {}) do + telescope.load_extension(name) + end + end, + }, + { + 'stevearc/conform.nvim', + keys = keys.conform or {}, + opts = require('config.conform'), + config = function(_, opts) + 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 + require("conform").format({ async = true, lsp_fallback = true, range = range }) + end, { range = true }) + + require('conform').setup(opts) + end, + }, + { + 'stevearc/oil.nvim', + keys = keys.oil or {}, + opts = require('config.oil'), + dependencies = { "nvim-tree/nvim-web-devicons" }, + } +} diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua new file mode 100644 index 0000000..6ca8ca4 --- /dev/null +++ b/nvim/lua/plugins/lsp.lua @@ -0,0 +1,64 @@ +return { + 'VonHeikemen/lsp-zero.nvim', + branch = 'v3.x', + dependencies = { + 'neovim/nvim-lspconfig', + 'hrsh7th/cmp-nvim-lsp', + + -- completion + { + 'hrsh7th/nvim-cmp', + version = false, + event = "InsertEnter", + dependencies = { + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-nvim-lsp', + 'L3MON4D3/LuaSnip', + 'onsails/lspkind-nvim', + }, + opts = require('config.cmp'), + config = function(_, opts) + local cmp = require('cmp') + cmp.setup(opts) + + -- insert () on function completion using autopairs + cmp.event:on( + 'confirm_done', + require('nvim-autopairs.completion.cmp').on_confirm_done() + ) + end + }, + }, + opts = require('config.lsp'), + config = function(_, opts) + local lsp_zero = require('lsp-zero') + local lsp_config = require('lspconfig') + local augroup = vim.api.nvim_create_augroup("Lsp", {}) + local map = require('utils.keys') + + lsp_zero.on_attach(function(_, bufnr) + for _, v in ipairs(require('config.keymaps').lsp or {}) do + map(v, { buffer = bufnr }) + end + end) + + for name, server_opt in pairs(opts.servers) do + local on_attach = function(_, bufnr) + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + + if server_opt.on_save then + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = server_opt.on_save, + }) + end + end + + server_opt = vim.tbl_deep_extend("force", {on_attach = on_attach}, server_opt or {}) + + lsp_config[name].setup(server_opt) + end + end, +} diff --git a/nvim/lua/setup.lua b/nvim/lua/setup.lua new file mode 100644 index 0000000..4223cef --- /dev/null +++ b/nvim/lua/setup.lua @@ -0,0 +1,12 @@ +local M = {} + +M.keymaps = function(opts) + opts = type(opts) == 'string' and require(opts) or opts + vim.g.mapleader = opts.leader + + for _, v in ipairs(opts.global) do + vim.keymap.set(unpack(v)) + end +end + +return M diff --git a/nvim/lua/utils/keys.lua b/nvim/lua/utils/keys.lua new file mode 100644 index 0000000..f0895e8 --- /dev/null +++ b/nvim/lua/utils/keys.lua @@ -0,0 +1,7 @@ +return function(v, opts) + local c = vim.deepcopy(v) + local lhs = table.remove(c, 1) + local rhs = table.remove(c, 1) + opts = vim.tbl_deep_extend("force", c, opts or {}) + vim.keymap.set('n', lhs, rhs, opts) +end