diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json index 65cb71d..dcb9bb4 100644 --- a/nvim/lazy-lock.json +++ b/nvim/lazy-lock.json @@ -1,33 +1,34 @@ { "LuaSnip": { "branch": "master", "commit": "50fcf17db7c75af80e6b6109acfbfb4504768780" }, - "catppuccin": { "branch": "main", "commit": "5215ea59df6d0a7e27da9a5cd1165e06d1b04cbe" }, + "catppuccin": { "branch": "main", "commit": "67565cd353fa543fa30cb738570c2e4c87da3e9c" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, - "conform.nvim": { "branch": "master", "commit": "069e971295a34a810484b7b2ef54b3c735214181" }, - "fd": { "branch": "master", "commit": "be815c261ace9cd0026cff5c8a579cda094e10fd" }, - "gitsigns.nvim": { "branch": "main", "commit": "4a143f13e122ab91abdc88f89eefbe70a4858a56" }, + "conform.nvim": { "branch": "master", "commit": "9a06e83527407a7600a2fe4e0d10adf432b6215e" }, + "fd": { "branch": "master", "commit": "f8270a6a447648a087c968552aa80325277a5588" }, + "friendly-snippets": { "branch": "main", "commit": "682157939e57bd6a2c86277dfd4d6fbfce63dbac" }, + "gitsigns.nvim": { "branch": "main", "commit": "0dc886637f9686b7cfd245a4726f93abeab19d4a" }, "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, - "lazy.nvim": { "branch": "main", "commit": "eb4957442e3182f051b0ae11da32e06d22c190e3" }, + "lazy.nvim": { "branch": "main", "commit": "bc620783663ab09d16bff9fdecc07da65b2a1528" }, "lsp-zero.nvim": { "branch": "v3.x", "commit": "16de3b18c5f7b6230d89b8e64ce9a4801b6f8d08" }, "lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" }, - "mini.nvim": { "branch": "main", "commit": "cc2f5b542c38b2af234b62196fa5a8621119fb0c" }, - "none-ls.nvim": { "branch": "main", "commit": "8691504118b252d64fc5023a104aedd100ab754a" }, + "mini.nvim": { "branch": "main", "commit": "a3f274633a57c713160baf51724ecfc051117877" }, + "none-ls.nvim": { "branch": "main", "commit": "cc0a3c45047e3daf85d07c1571d65476cfce6480" }, "nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" }, - "nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" }, - "nvim-lspconfig": { "branch": "master", "commit": "92166b89ab4b3d60f24e58170cac53b7141fd032" }, - "nvim-treesitter": { "branch": "master", "commit": "c5cbd3ec74f6f5ddbac939e6f24b99fe78262b4c" }, + "nvim-cmp": { "branch": "main", "commit": "a110e12d0b58eefcf5b771f533fc2cf3050680ac" }, + "nvim-lspconfig": { "branch": "master", "commit": "6806370929cf6a35be6e5e0e74588515a4356e4d" }, + "nvim-treesitter": { "branch": "master", "commit": "7b04b398f868563cac37ae90baffd7c3dca513fe" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "34867c69838078df7d6919b130c0541c0b400c47" }, - "nvim-ts-autotag": { "branch": "main", "commit": "6eb4120a1aadef07ac312f1c4bc6456712220007" }, - "nvim-web-devicons": { "branch": "master", "commit": "b4b302d6ae229f67df7a87ef69fa79473fe788a9" }, - "oil.nvim": { "branch": "master", "commit": "e5312c3a801e7274fa14e6a56aa10a618fed80c3" }, + "nvim-ts-autotag": { "branch": "main", "commit": "06fe07d7523ba8c755fac7c913fceba43b1720ee" }, + "nvim-web-devicons": { "branch": "master", "commit": "c0cfc1738361b5da1cd0a962dd6f774cc444f856" }, + "oil.nvim": { "branch": "master", "commit": "4c574cf4a2de736d2662d52ce086d8bdf87c49df" }, "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "dfa230be84a044e7f546a6c2b0a403c739732b86" }, - "trouble.nvim": { "branch": "main", "commit": "38915023a777b7f2422e503dc603f6a64b465bf5" }, - "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" }, + "telescope.nvim": { "branch": "master", "commit": "c392f1b78eaaf870ca584bd698e78076ed301b26" }, + "trouble.nvim": { "branch": "main", "commit": "2d8610a07033f2b367e71230ab128f8b89c2639d" }, + "vim-fugitive": { "branch": "master", "commit": "64d6cafb9dcbacce18c26d7daf617ebb96b273f3" }, "which-key.nvim": { "branch": "main", "commit": "0099511294f16b81c696004fa6a403b0ae61f7a0" } } \ No newline at end of file diff --git a/nvim/lua/config/cmp.lua b/nvim/lua/config/cmp.lua index 4a038ca..d71556c 100644 --- a/nvim/lua/config/cmp.lua +++ b/nvim/lua/config/cmp.lua @@ -33,7 +33,7 @@ return function() [""] = selectNext, [""] = selectNext, [""] = cmp.mapping.abort(), - [""] = utils.confirm({ select = true }), + [""] = utils.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), }, snippet = { expand = function(args) @@ -52,7 +52,7 @@ return function() }, sources = { { name = "nvim_lsp" }, - -- { name = "luasnip" }, + { name = "luasnip" }, { name = "buffer" }, { name = "path" }, { @@ -66,10 +66,10 @@ return function() }, }, }, - experimental = { - ghost_text = { - hl_group = "NonText", - }, - }, + -- experimental = { + -- ghost_text = { + -- hl_group = "NonText", + -- }, + -- }, } end diff --git a/nvim/lua/config/gitsigns.lua b/nvim/lua/config/gitsigns.lua index 7ba90e5..8d92ce6 100644 --- a/nvim/lua/config/gitsigns.lua +++ b/nvim/lua/config/gitsigns.lua @@ -9,4 +9,14 @@ return { topdelete = { text = icons.delete }, changedelete = { text = icons.change }, }, + signs_staged = { + add = { text = icons.add }, + delete = { text = icons.delete }, + change = { text = icons.change }, + topdelete = { text = icons.delete }, + changedelete = { text = icons.change }, + }, + diff_opts = { + internal = true + } } diff --git a/nvim/lua/config/lsp.lua b/nvim/lua/config/lsp.lua index 64af92c..a723a1f 100644 --- a/nvim/lua/config/lsp.lua +++ b/nvim/lua/config/lsp.lua @@ -14,6 +14,8 @@ return { servers = { -- Bash bashls = {}, + -- C/C++ + ccls = {}, -- PHP -- intelephense = {}, phpactor = { diff --git a/nvim/lua/config/lualine.lua b/nvim/lua/config/lualine.lua index fe71d83..00d29e4 100644 --- a/nvim/lua/config/lualine.lua +++ b/nvim/lua/config/lualine.lua @@ -1,15 +1,15 @@ -local icons = require('config.icons') -local separator = { "'" .. icons.separator .. "'", color = 'StatusLineSeparator' } +local icons = require("config.icons") +local separator = { "'" .. icons.separator .. "'", color = "StatusLineSeparator" } return { options = { globalstatus = true, - component_separators = '', - section_separators = '', + component_separators = "", + section_separators = "", disabled_filetypes = { statusline = { - 'dashboard', - } + "dashboard", + }, }, theme = { normal = { @@ -32,11 +32,11 @@ return { a = "StatusLineVisual", z = "StatusLine", }, - replace = { + replace = { a = "StatusLineReplace", z = "StatusLine", - } - } + }, + }, }, sections = { lualine_a = { @@ -45,49 +45,70 @@ return { 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" }, - }, + 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 .. ' ', + 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 .. ' ' - } + added = icons.diff.added .. " ", + modified = icons.diff.modified .. " ", + removed = icons.diff.removed .. " ", + }, }, - separator, + separator, }, lualine_c = { - 'filename' + { + "filename", + path = 1, + symbols = { + modified = "+", + readonly = "[R]", + unnamed = "-", + newfile = "[New]", + }, + }, }, lualine_x = { - 'filetype', - 'fileformat', + "filetype", + "fileformat", '(vim.bo.expandtab and "SPC" or "TAB") .. " " .. vim.bo.shiftwidth', }, lualine_y = { separator, - 'location', - 'progress' + "location", + "progress", + }, + lualine_z = {}, + }, + winbar = { + lualine_c = { + { "filetype", icon_only = true }, + "filename", + }, + }, + inactive_winbar = { + lualine_c = { + { "filetype", icon_only = true }, + "filename", }, - lualine_z = {} }, extensions = { - 'lazy', - 'neo-tree' - } + "lazy", + "neo-tree", + }, } diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/config/telescope.lua index abd43fe..220d1d8 100644 --- a/nvim/lua/config/telescope.lua +++ b/nvim/lua/config/telescope.lua @@ -1,14 +1,17 @@ -local icons = require("config.icons") - return function() + local icons = require("config.icons") local actions = require("telescope.actions") + + local dropdown_opts = { + previewer = false, + prompt_title = false, + layout_strategy = "horizontal", + layout_config = { + prompt_position = "top", + }, + } 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 .. " ", @@ -27,19 +30,18 @@ return function() find_files = { hidden = true, }, - buffers = { - theme = "dropdown", - previewer = false, + buffers = vim.tbl_deep_extend("force", dropdown_opts, { + theme = "dropdown", mappings = { i = { [""] = actions.delete_buffer + actions.move_to_top, }, }, - }, + }), }, extensions = { ["ui-select"] = { - require("telescope.themes").get_dropdown(), + require("telescope.themes").get_dropdown(dropdown_opts), }, }, } diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/config/treesitter.lua index 779c9dc..53fbd43 100644 --- a/nvim/lua/config/treesitter.lua +++ b/nvim/lua/config/treesitter.lua @@ -16,6 +16,7 @@ return { "phpdoc", "blade", "go", + "gotmpl", "gomod", "gosum", "javascript", diff --git a/nvim/lua/plugins/core.lua b/nvim/lua/plugins/core.lua index b449cd3..595a235 100644 --- a/nvim/lua/plugins/core.lua +++ b/nvim/lua/plugins/core.lua @@ -161,7 +161,7 @@ return { local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1] range = { start = { args.line1, 0 }, - ---@diagnostic disable-next-line: undefined-field + ---@diagnostic disable-next-line: undefined-field ["end"] = { args.line2, end_line:len() }, } end @@ -177,20 +177,28 @@ return { opts = require("config.oil"), dependencies = { "nvim-tree/nvim-web-devicons" }, config = function(_, opts) - require('oil').setup(opts) + require("oil").setup(opts) - -- Don't touch my CWD! - require('utils.oil').RegisterCWDHackHook() + -- Don't touch my CWD! + require("utils.oil").RegisterCWDHackHook() end, }, { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" }, keys = keys.trouble or {}, - opts = {}, + opts = {}, }, { "L3MON4D3/LuaSnip", + dependencies = { + { + "rafamadriz/friendly-snippets", + config = function() + require("luasnip.loaders.from_vscode").lazy_load() + end, + }, + }, opts = {}, config = function(_, opts) require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" }) diff --git a/nvim/lua/plugins/lsp.lua b/nvim/lua/plugins/lsp.lua index 5933dab..eb0bcf0 100644 --- a/nvim/lua/plugins/lsp.lua +++ b/nvim/lua/plugins/lsp.lua @@ -20,8 +20,8 @@ return { "hrsh7th/cmp-buffer", -- autocomplete from buffer "hrsh7th/cmp-path", -- autocomplete from filesystem "hrsh7th/cmp-nvim-lsp", -- autocomplete from lsp - -- "saadparwaiz1/cmp_luasnip", -- autocomplete from snippet engine - -- "L3MON4D3/LuaSnip", -- snippet engine + "saadparwaiz1/cmp_luasnip", -- autocomplete from snippet engine + "L3MON4D3/LuaSnip", -- snippet engine "onsails/lspkind-nvim", -- icons for kind }, opts = require("config.cmp"), @@ -39,6 +39,7 @@ return { local lsp_zero = require("lsp-zero") local lsp_config = require("lspconfig") local augroup = vim.api.nvim_create_augroup("Lsp", {}) + local utils = require("utils.lsp") local map = require("utils.keys") lsp_zero.on_attach(function(_, bufnr) @@ -60,8 +61,12 @@ return { }) end - if (opts.document_hightlight or server_opt.document_highlight or false) and client.supports_method('textDocument/documentHighlight')then - require("utils.lsp").document_highlight(bufnr) + if client.supports_method('textDocument/hover') then + --utils.signature_help_on_hover(bufnr) + end + + if (opts.document_hightlight or server_opt.document_highlight or false) and client.supports_method('textDocument/documentHighlight') then + utils.document_highlight(bufnr) end end diff --git a/nvim/lua/utils/buffers.lua b/nvim/lua/utils/buffers.lua index 950f105..ae997f4 100644 --- a/nvim/lua/utils/buffers.lua +++ b/nvim/lua/utils/buffers.lua @@ -17,4 +17,14 @@ function M.CloseAll() end end +function M.GetLoaded() + local loaded = {} + for i, hnd in ipairs(vim.api.nvim_list_bufs()) do + if vim.api.nvim_buf_is_loaded(hnd) then + loaded[i] = hnd + end + end + return loaded +end + return M diff --git a/nvim/lua/utils/cmd.lua b/nvim/lua/utils/cmd.lua index 0e5cd0a..153e2a0 100644 --- a/nvim/lua/utils/cmd.lua +++ b/nvim/lua/utils/cmd.lua @@ -1,45 +1,44 @@ - -local luasnip = require('luasnip') -local cmp = require('cmp') +local luasnip = require("luasnip") +local cmp = require("cmp") local M = {} function M.selectNext(opts) - return cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item(opts or {}) - elseif luasnip.locally_jumpable(1) then - luasnip.jump(1) - else - fallback() - end - end, {"i", "s"}) + return cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item(opts or {}) + elseif luasnip.locally_jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, { "i", "s" }) end function M.selectPrev(opts) - return cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item(opts or {}) - elseif luasnip.locally_jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, {"i", "s"}) + return cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item(opts or {}) + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { "i", "s" }) end function M.confirm(opts) - return cmp.mapping(function(fallback) - if cmp.visible() then - if luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - cmp.confirm(opts or {}) - end - else - fallback() - end - end) + return cmp.mapping(function(fallback) + if cmp.visible() then + -- if luasnip.expand_or_jumpable() then + -- luasnip.expand_or_jump() + -- else + cmp.confirm(opts or {}) + -- end + else + fallback() + end + end) end return M diff --git a/nvim/lua/utils/lsp.lua b/nvim/lua/utils/lsp.lua index 0d91a39..f5cf897 100644 --- a/nvim/lua/utils/lsp.lua +++ b/nvim/lua/utils/lsp.lua @@ -19,4 +19,14 @@ function M.document_highlight(bufnr) }) end +function M.signature_help_on_hover(bufnr) + local group = vim.api.nvim_create_augroup('lsp_hover', { clear = false }) + + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + group = group, + buffer = bufnr, + callback = vim.lsp.buf.hover, + }) +end + return M diff --git a/nvim/queries/gotmpl/highlights.scm b/nvim/queries/gotmpl/highlights.scm new file mode 100644 index 0000000..1b5b21a --- /dev/null +++ b/nvim/queries/gotmpl/highlights.scm @@ -0,0 +1,84 @@ +; extends: html + +[ + (field) + (field_identifier) +] @property + +(variable) @variable + +; Function calls + +(function_call + function: (identifier) @function) + +(method_call + method: (selector_expression + field: (field_identifier) @method)) + +; Operators + +"|" @operator +":=" @operator + +; Builtin functions + +((identifier) @function.builtin + (#match? @function.builtin "^(and|call|html|index|slice|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|ge|gt|ge)$")) + +; Delimiters + +"." @punctuation.delimiter +"," @punctuation.delimiter + +"{{" @punctuation.bracket +"}}" @punctuation.bracket +"{{-" @punctuation.bracket +"-}}" @punctuation.bracket +")" @punctuation.bracket +"(" @punctuation.bracket + +; Keywords + +[ + "else" + "else if" + "if" + "with" +] @conditional + +[ + "range" + "end" + "template" + "define" + "block" +] @keyword + +; Literals + +[ + (interpreted_string_literal) + (raw_string_literal) + (rune_literal) +] @string + +(escape_sequence) @string.special + +[ + (int_literal) + (float_literal) + (imaginary_literal) +] @number + +[ + (true) + (false) +] @boolean + +[ + (nil) +] @constant.builtin + +(comment) @comment +(ERROR) @error diff --git a/nvim/queries/gotmpl/injections.scm b/nvim/queries/gotmpl/injections.scm new file mode 100644 index 0000000..c620397 --- /dev/null +++ b/nvim/queries/gotmpl/injections.scm @@ -0,0 +1 @@ +(text) @html