diff --git a/lua/config/set.lua b/lua/config/set.lua index 5f38dfd..249b18a 100644 --- a/lua/config/set.lua +++ b/lua/config/set.lua @@ -49,3 +49,9 @@ vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { vim.bo.filetype = "c" end, }) +vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { + pattern = "*.pl", + callback = function() + vim.bo.filetype = "prolog" + end, +}) diff --git a/lua/plugins/cmp.lua b/lua/plugins/cmp.lua index 2a6ac57..f9d5c79 100644 --- a/lua/plugins/cmp.lua +++ b/lua/plugins/cmp.lua @@ -1,3 +1,125 @@ +return { + { + "xzbdmw/colorful-menu.nvim", + config = function() + -- You don't need to set these options. + require("colorful-menu").setup({ + ls = { + ["rust-analyzer"] = { + -- Such as (as Iterator), (use std::io). + extra_info_hl = "@comment", + -- Similar to the same setting of gopls. + align_type_to_right = true, + -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + preserve_type_when_truncate = true, + }, + clangd = { + -- Such as "From ". + extra_info_hl = "@comment", + -- Similar to the same setting of gopls. + align_type_to_right = true, + -- the hl group of leading dot of "•std::filesystem::permissions(..)" + import_dot_hl = "@comment", + -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + preserve_type_when_truncate = true, + }, + -- If true, try to highlight "not supported" languages. + fallback = true, + -- this will be applied to label description for unsupport languages + fallback_extra_info_hl = "@comment", + }, + -- If the built-in logic fails to find a suitable highlight group for a label, + -- this highlight is applied to the label. + fallback_highlight = "@variable", + -- If provided, the plugin truncates the final displayed text to + -- this width (measured in display cells). Any highlights that extend + -- beyond the truncation point are ignored. When set to a float + -- between 0 and 1, it'll be treated as percentage of the width of + -- the window: math.floor(max_width * vim.api.nvim_win_get_width(0)) + -- Default 60. + max_width = 60, + }) + + vim.api.nvim_set_hl(0, "BlinkCmpMenu", { link = "NormalFloat" }) + vim.api.nvim_set_hl(0, "BlinkCmpMenuBorder", { link = "FloatBorder" }) + vim.api.nvim_set_hl(0, "BlinkCmpDoc", { link = "NormalFloat" }) + vim.api.nvim_set_hl(0, "BlinkCmpDocBorder", { link = "FloatBorder" }) + end, + }, + { + "saghen/blink.cmp", + config = function() + require("blink.cmp").setup({ + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = "super-tab" }, + signature = { enabled = true }, + + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, + + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, + + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + + -- (Default) Only show the documentation popup when manually triggered + completion = { + documentation = { auto_show = false }, + menu = { + -- border = "single", + draw = { + -- We don't need label_description now because label and label_description are already + -- combined together in label by colorful-menu.nvim. + columns = { { "kind_icon" }, { "label", gap = 1 } }, + components = { + label = { + text = function(ctx) + return require("colorful-menu").blink_components_text(ctx) + end, + highlight = function(ctx) + return require("colorful-menu").blink_components_highlight(ctx) + end, + }, + }, + }, + }, + }, + }) + end, + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', + + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts_extend = { "sources.default" }, + }, +} +--[[ return { "hrsh7th/nvim-cmp", dependencies = { @@ -58,3 +180,5 @@ return { }) end, } +]] +-- diff --git a/lua/plugins/colors.lua b/lua/plugins/colors.lua index 7b1b12f..d0e4347 100644 --- a/lua/plugins/colors.lua +++ b/lua/plugins/colors.lua @@ -1,17 +1,38 @@ return { - "sainnhe/gruvbox-material", + "savq/melange-nvim", + dependencies = { "rktjmp/lush.nvim" }, lazy = false, priority = 1000, config = function() - vim.g.gruvbox_material_enable_italic = true - --vim.g.gruvbox_material_background = "medium" - vim.g.gruvbox_material_background = "medium" - vim.g.gruvbox_material_better_performance = 1 - - vim.cmd.colorscheme("gruvbox-material") + vim.g.melange_enable_font_variants = 0 -- disable font variants + require("lush") -- make sure Lush is installed + require("melange.build").build() -- Compile to vimscript + vim.cmd.colorscheme("melange") end, } -- return { +-- "ptdewey/darkearth-nvim", +-- lazy = false, +-- priority = 1000, +-- config = function() +-- vim.cmd.colorscheme("darkearth") +-- end, +-- } + +-- return { +-- "sainnhe/gruvbox-material", +-- lazy = false, +-- priority = 1000, +-- config = function() +-- vim.g.gruvbox_material_enable_italic = true +-- --vim.g.gruvbox_material_background = "medium" +-- vim.g.gruvbox_material_background = "medium" +-- vim.g.gruvbox_material_better_performance = 1 +-- +-- vim.cmd.colorscheme("gruvbox-material") +-- end, +-- } +-- return { -- { -- "ellisonleao/gruvbox.nvim", -- priority = 1000, diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 5df35e3..655ca1c 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -1,17 +1,13 @@ return { { "neovim/nvim-lspconfig", - dependencies = { - "hrsh7th/cmp-nvim-lsp", - }, config = function() - local capabilities = require("cmp_nvim_lsp").default_capabilities() + --local capabilities = require("cmp_nvim_lsp").default_capabilities() -- local nvim_lsp = require("lspconfig") vim.lsp.log.set_level(vim.log.levels.OFF) -- LUA vim.lsp.config("lua_ls", { - capabilities = capabilities, settings = { Lua = { diagnostics = { @@ -36,7 +32,7 @@ return { -- vim.lsp.config("ts_ls", { capabilities = capabilities }) -- CLANGD - vim.lsp.config("clangd", { capabilities = capabilities }) + --vim.lsp.config("clangd", { capabilities = capabilities }) vim.lsp.enable("clangd") -- vim.lsp.config("ocamllsp", { capabilities = capabilities }) @@ -51,18 +47,20 @@ return { -- }) -- vim.lsp.enable("metals") - vim.lsp.config("asm_lsp", { capabilities = capabilities }) + --vim.lsp.config("asm_lsp", { capabilities = capabilities }) vim.lsp.enable("asm_lsp") - vim.lsp.config("slangd", { capabilities = capabilities, flags = { allow_incremental_sync = true } }) + vim.lsp.config("slangd", { flags = { allow_incremental_sync = true } }) vim.lsp.enable("slangd") - vim.lsp.config("tinymist", { capabilities = capabilities }) + --vim.lsp.config("tinymist", { capabilities = capabilities }) vim.lsp.enable("tinymist") - vim.lsp.config("wgsl_analyzer", { capabilities = capabilities }) + --vim.lsp.config("wgsl_analyzer", { capabilities = capabilities }) vim.lsp.enable("wgsl_analyzer") + vim.lsp.enable("prolog_ls") + vim.lsp.config("hls", { filetypes = { "haskell", "lhaskell", "cabal" }, }) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index f680e2b..ecae361 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -1,13 +1,26 @@ return { + { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, { "nvim-telescope/telescope.nvim", tag = "0.1.6", dependencies = { "nvim-lua/plenary.nvim" }, - init = function () - local builtin = require('telescope.builtin') - vim.keymap.set('n', 'pf', builtin.find_files, {}) - vim.keymap.set('n', 'pb', builtin.buffers, {}) - end + init = function() + local builtin = require("telescope.builtin") + vim.keymap.set("n", "pf", builtin.find_files, {}) + vim.keymap.set("n", "pb", builtin.buffers, {}) + vim.keymap.set("n", "ps", builtin.live_grep, {}) + require("telescope").load_extension("fzf") + require("telescope").setup({ + extensions = { + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + }, + }, + }) + end, }, } -