diff --git a/init.lua b/init.lua index 27ffd9a..92866e8 100644 --- a/init.lua +++ b/init.lua @@ -1 +1,12 @@ require("core.lazy") +vim.cmd("colorscheme catppuccin") +require("core.keymaps") +require("core.lsp-notifications") +require("utils.extensions") +require("utils.telescope_extra").setup() +require("utils.git_paste").setup({ + telescope_key = "pg", +}) +vim.filetype.add({ + pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, +}) diff --git a/lazy-lock.json b/lazy-lock.json index ff1f023..717f1ff 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -9,7 +9,7 @@ "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f94f7ba948e32cd302caba1c2ca3f7c697fb4fcf" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "codecompanion.nvim": { "branch": "main", "commit": "453fda745c673a6092c685bc0abb6918915ea532" }, + "codecompanion.nvim": { "branch": "main", "commit": "f79fd321c772c18e1520a08eea2ec06a7edb162e" }, "copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" }, "copilot-lualine": { "branch": "main", "commit": "dc4b8ed0f75bc2557b3158c526624bf04ad233ea" }, "copilot.lua": { "branch": "master", "commit": "30321e33b03cb924fdcd6a806a0dc6fa0b0eafb9" }, @@ -22,7 +22,7 @@ "image.nvim": { "branch": "master", "commit": "6ffafab2e98b5bda46bf227055aa84b90add8cdc" }, "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, "lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" }, - "lazydev.nvim": { "branch": "main", "commit": "a1b78b2ac6f978c72e76ea90ae92a94edf380cfc" }, + "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lsp_lines.nvim": { "branch": "main", "commit": "a92c755f182b89ea91bd8a6a2227208026f27b4d" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, "lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" }, @@ -40,14 +40,14 @@ "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" }, "nvim-tree.lua": { "branch": "master", "commit": "d529a99f88e0dff02e0aa275db2f595cd252a2c8" }, - "nvim-treesitter": { "branch": "master", "commit": "cb8e810a1ea3f562e95a259df3065c7c23decf7a" }, + "nvim-treesitter": { "branch": "master", "commit": "a15dd9280f369fef4640e64de794f69456ecdf7a" }, "nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, "odis": { "branch": "master", "commit": "5176a07a729860d0c0cdefe96252fc7ff9e16d43" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "011d98eaa3a73b5a51d82ce5bc6b1397dde95562" }, - "render-markdown.nvim": { "branch": "main", "commit": "6d446de33937633bc2104f45c943f4fae632b822" }, + "render-markdown.nvim": { "branch": "main", "commit": "57fa691b9e374c6539cc0340062dac8f42d4bd8b" }, "telescope-color-names.nvim": { "branch": "main", "commit": "95b372b9a8ba0fc7cf6a67be637ee37453f322da" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "626998e5c1b71c130d8bc6cf7abb6709b98287bb" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "2a5ceff981501cff8f46871d5402cd3378a8ab6a" }, diff --git a/lua/core/autocmds.lua b/lua/core/autocmds.lua index 4b1405a..974ad2e 100644 --- a/lua/core/autocmds.lua +++ b/lua/core/autocmds.lua @@ -74,3 +74,17 @@ vim.api.nvim_create_autocmd({ "User" }, { end, }) -- }}} + +-- {{{ Hyprlang LSP +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.hl", "hypr*.conf" }, + callback = function(event) + print(string.format("starting hyprls for %s", vim.inspect(event))) + vim.lsp.start({ + name = "hyprlang", + cmd = { "hyprls" }, + root_dir = vim.fn.getcwd(), + }) + end, +}) +--}}} diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua index cee9307..c0c07ff 100644 --- a/lua/core/keymaps.lua +++ b/lua/core/keymaps.lua @@ -6,6 +6,7 @@ local term_factory = term.term_factory local term_toggle = term.term_toggle local opts = { silent = true, noremap = true } +local nosilent = { noremap = true } -- Leader key vim.g.mapleader = " " @@ -204,16 +205,22 @@ local lsp_mappings = { local code_companion_mappings = { { mode = "n", key = "cp", cmd = ":vert Copilot panel", group = "Code" }, { mode = "n", key = "oc", cmd = ":CodeCompanionChat Toggle", group = "Open" }, - { mode = "n", key = "Cc", cmd = ":CodeCompanionChat Toggle", group = "CodeCompanion" }, - { mode = "n", key = "Ci", cmd = ":CodeCompanion ", group = "CodeCompanion" }, - { mode = "n", key = "CT", cmd = ":CodeCompanionChat Toggle", group = "CodeCompanion" }, - { mode = "n", key = "Ca", cmd = ":CodeCompanionActions", group = "CodeCompanion" }, - { mode = "v", key = "Cc", cmd = ":CodeCompanionChat Add", group = "CodeCompanion" }, - { mode = "v", key = "Ci", cmd = ":CodeCompanion /buffer ", group = "CodeCompanion" }, - { mode = "v", key = "Ce", cmd = ":CodeCompanion /explain", group = "CodeCompanion" }, - { mode = "v", key = "Cf", cmd = ":CodeCompanion /fix", group = "CodeCompanion" }, - { mode = "v", key = "Cl", cmd = ":CodeCompanion /lsp", group = "CodeCompanion" }, - { mode = "v", key = "Ct", cmd = ":CodeCompanion /tests", group = "CodeCompanion" }, + { mode = "n", key = "Cc", cmd = ":CodeCompanionChat Toggle", group = "CodeCompanionChat" }, + { mode = "n", key = "Ci", cmd = ":CodeCompanion ", group = "Inline CodeCompanion", opts = nosilent }, + { mode = "n", key = "CT", cmd = ":CodeCompanionChat Toggle", group = "CodeCompanion Toggle" }, + { mode = "n", key = "Ca", cmd = ":CodeCompanionActions", group = "CodeCompanion Actions" }, + { mode = "v", key = "Cc", cmd = ":CodeCompanionChat Add", group = "CodeCompanion Add" }, + { + mode = "v", + key = "Ci", + cmd = ":CodeCompanion /buffer ", + group = "CodeCompanion /buffer", + opts = nosilent, + }, + { mode = "v", key = "Ce", cmd = ":CodeCompanion /explain", group = "CodeCompanion /explain" }, + { mode = "v", key = "Cf", cmd = ":CodeCompanion /fix", group = "CodeCompanion /fix" }, + { mode = "v", key = "Cl", cmd = ":CodeCompanion /lsp", group = "CodeCompanion /lsp" }, + { mode = "v", key = "Ct", cmd = ":CodeCompanion /tests", group = "CodeCompanion /tests" }, } -- }}} @@ -391,12 +398,16 @@ local noice_mappings = { -- {{{ ODIS Mappings local odis_mappings = { - { mode = "n", key = "dv", cmd = ':lua require("odis").show_documentation("vsplit")', group = "ODIS" }, - { mode = "n", key = "dh", cmd = ':lua require("odis").show_documentation("vsplit")', group = "ODIS" }, - { mode = "n", key = "db", cmd = ':lua require("odis").show_documentation("vsplit")', group = "ODIS" }, - { mode = "n", key = "dt", cmd = ':lua require("odis").show_documentation("vsplit")', group = "ODIS" }, - { mode = "n", key = "dt", cmd = ':lua require("odis").show_documentation("vsplit")', group = "ODIS" }, - -- { mode = "n", key = "dc", cmd = 'require("odis").close_float()' }, + { + mode = "n", + key = "dv", + cmd = ':lua require("odis").show_documentation("vsplit")', + group = "Vertical split", + }, + { mode = "n", key = "dh", cmd = ':lua require("odis").show_documentation("split")', group = "Split" }, + { mode = "n", key = "db", cmd = ':lua require("odis").show_documentation("buffer")', group = "Buffer" }, + { mode = "n", key = "dt", cmd = ':lua require("odis").show_documentation("tab")', group = "Tab" }, + { mode = "n", key = "df", cmd = ':lua require("odis").show_documentation("float")', group = "Float" }, } -- }}} @@ -407,7 +418,7 @@ local diffview_mappings = { mode = "n", key = "gdo", cmd = ":DiffviewOpen", - group = "Git", + group = "DiffviewOpen", }, { @@ -537,4 +548,5 @@ add_to_whichkey(map_from_table(workspace_management_mappings)) add_to_whichkey(map_from_table(noice_mappings)) add_to_whichkey(map_from_table(odis_mappings)) add_to_whichkey(map_from_table(diffview_mappings)) +add_to_whichkey(nil, { key = "dc", group = "Close" }) --}}} diff --git a/lua/core/lazy.lua b/lua/core/lazy.lua index 0605a15..c0c7643 100644 --- a/lua/core/lazy.lua +++ b/lua/core/lazy.lua @@ -60,12 +60,3 @@ require("lazy").setup({ require = false, }, }) - -vim.cmd("colorscheme catppuccin") -require("core.keymaps") -require("core.lsp-notifications") -require("utils.extensions") -require("utils.telescope_extra").setup() -require("utils.git_paste").setup({ - telescope_key = "pg", -}) diff --git a/lua/core/options.lua b/lua/core/options.lua index 0b1e66b..583fdea 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -52,6 +52,9 @@ g.db_ui_use_nerd_fonts = 1 -- vim.cmd.colorscheme = 'catppuccin-macchiato' vim.cmd.colorscheme = "catppuccin" +-- Define the highlight color for float border +vim.api.nvim_set_hl(0, "FloatBorder", { fg = "#89b4fa", bold = true }) + local border = { { "╭", "FloatBorder" }, { "─", "FloatBorder" }, diff --git a/lua/plugins/noice.lua b/lua/plugins/noice.lua index 74b8f7b..01f8300 100644 --- a/lua/plugins/noice.lua +++ b/lua/plugins/noice.lua @@ -3,19 +3,49 @@ return { event = "VeryLazy", opts = { lsp = { + progress = { + enabled = true, + -- Lsp Progress is formatted using the builtins for lsp_progress. See config.format.builtin + -- See the section on formatting for more details on how to customize. + --- @type NoiceFormat|string + format = "lsp_progress", + --- @type NoiceFormat|string + format_done = "lsp_progress_done", + throttle = 1000 / 30, -- frequency to update lsp progress message + view = "mini", + }, -- override markdown rendering so that **cmp** and other plugins use **Treesitter** override = { ["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.stylize_markdown"] = true, ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp }, + hover = { + enabled = false, + silent = false, -- set to true to not show a message if hover is not available + view = "split", -- when nil, use defaults from documentation + ---@type NoiceViewOptions + opts = {}, -- merged with defaults from documentation + }, + signature = { + enabled = true, + auto_open = { + enabled = false, + trigger = true, -- Automatically show signature help when typing a trigger character from the LSP + luasnip = true, -- Will open signature help when jumping to Luasnip insert nodes + throttle = 50, -- Debounce lsp signature help request by 50ms + }, + view = nil, -- when nil, use defaults from documentation + ---@type NoiceViewOptions + opts = {}, -- merged with defaults from documentation + }, }, -- you can enable a preset for easier configuration presets = { bottom_search = true, -- use a classic bottom cmdline for search command_palette = true, -- position the cmdline and popupmenu together long_message_to_split = true, -- long messages will be sent to a split - inc_rename = false, -- enables an input dialog for inc-rename.nvim + inc_rename = false, -- enables an input dialog for inc-rename.nvim lsp_doc_border = true, -- add a border to hover docs and signature help }, }, @@ -26,5 +56,5 @@ return { -- `nvim-notify` is only needed, if you want to use the notification view. -- If not available, we use `mini` as the fallback "rcarriga/nvim-notify", - } + }, } diff --git a/lua/utils/treeister/parsers/hyprlang.lua b/lua/utils/treeister/parsers/hyprlang.lua new file mode 100644 index 0000000..76b3aba --- /dev/null +++ b/lua/utils/treeister/parsers/hyprlang.lua @@ -0,0 +1,12 @@ +local parser_config = require("nvim-treesitter.parsers").get_parser_configs() +parser_config.hyprlang = { + install_info = { + url = "~/github/tree-sitter-hyprlang", -- local path or git repo + files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc + -- optional entries: + branch = "main", -- default branch in case of git repo if different from master + generate_requires_npm = false, -- if stand-alone parser without npm dependencies + requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c + }, + filetype = "conf", -- if filetype does not match the parser name +}