diff --git a/init.lua b/init.lua index 68f2a4d..78be682 100644 --- a/init.lua +++ b/init.lua @@ -6,7 +6,7 @@ require("pika.lazy") -- │ themes are under ./lua/pika/plugins/colorschemes.lua │ -- ╰──────────────────────────────────────────────────────╯ -vim.cmd.colorscheme("oldschool") +vim.cmd.colorscheme("monet") -- Keybind for saving clipboard screenshot and inserting a Markdown link vim.api.nvim_set_keymap("n", "ps", ":lua SaveScreenshotAndInsertLink()", { noremap = true, silent = true }) diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index 69fc905..c794327 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -7,6 +7,7 @@ nomap("n", "", "") nomap("n", "q", "") nomap("v", "q", "") nomap("v", "S", "") +nomap({ "i", "v", "n" }, "", "") local map = vim.keymap.set diff --git a/lua/pika/plugins/colorschemes.lua b/lua/pika/plugins/colorschemes.lua index d977b29..d18bdd8 100644 --- a/lua/pika/plugins/colorschemes.lua +++ b/lua/pika/plugins/colorschemes.lua @@ -49,7 +49,7 @@ return { name = "cyberdream", lazy = false, opts = { - transparent = true, + transparent = false, hide_fillchars = true, terminal_colors = true, }, diff --git a/lua/pika/plugins/lsp/blink-cmp.lua b/lua/pika/plugins/lsp/blink-cmp.lua index ff271f6..4f0e900 100644 --- a/lua/pika/plugins/lsp/blink-cmp.lua +++ b/lua/pika/plugins/lsp/blink-cmp.lua @@ -26,16 +26,116 @@ return { -- C-k: Toggle signature help (if signature.enabled = true) -- -- See :h blink-cmp-config-keymap for defining your own keymap - keymap = { preset = "super-tab" }, + keymap = { + -- set to 'none' to disable the 'default' preset + preset = "super-tab", + + [""] = { "select_prev", "fallback" }, + [""] = { "select_next", "fallback" }, + [""] = { "hide", "fallback" }, + + -- disable a keymap from the preset + [""] = {}, + [""] = {}, + [""] = {}, + + -- show with a list of providers + -- [""] = { + -- function(cmp) + -- cmp.show({ providers = { "snippets" } }) + -- end, + -- }, + + -- control whether the next command will be run when using a function + -- [""] = { + -- function(cmp) + -- if some_condition then + -- return + -- end -- runs the next command + -- return true -- doesn't run the next command + -- end, + -- "select_next", + -- }, + }, appearance = { -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = "Nerd Font Mono", + nerd_font_variant = "mono", + + highlight_ns = vim.api.nvim_create_namespace("blink_cmp"), + -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- Useful for when your theme doesn't support blink.cmp + -- Will be removed in a future release + + use_nvim_cmp_as_default = true, }, -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = false } }, + completion = { + documentation = { + auto_show = false, + auto_show_delay_ms = 230, + update_delay_ms = 50, + treesitter_highlighting = false, + draw = function(opts) + opts.default_implementation() + end, + window = { + min_width = 16, + max_width = 80, + max_height = 24, + border = "padded", -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10 + winblend = 0, + winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc", + -- Note that the gutter will be disabled when border ~= 'none' + scrollbar = true, + }, + }, + ghost_text = { + enabled = true, + show_with_selection = true, + show_without_selection = true, + show_with_menu = true, + show_without_menu = true, + }, + + -- ─────────────────────────────────< mini-icons config >────────────────────────────── + menu = { + draw = { + 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, + }, + kind_icon = { + text = function(ctx) + local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) + return kind_icon + end, + -- (optional) use highlights from mini.icons + highlight = function(ctx) + local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + return hl + end, + }, + + -- kind = { + -- -- (optional) use highlights from mini.icons + -- highlight = function(ctx) + -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + -- return hl + -- end, + -- }, + }, + }, + }, + }, -- Default list of enabled providers defined so that you can extend it -- elsewhere in your config, without redefining it, due to `opts_extend` @@ -52,4 +152,184 @@ return { }, opts_extend = { "sources.default" }, }, + + -- ─────────────────────────────────< colorful menu.nvim >───────────────────────────────── + { + "xzbdmw/colorful-menu.nvim", + opts = { + { + ls = { + lua_ls = { + -- Maybe you want to dim arguments a bit. + arguments_hl = "@comment", + }, + gopls = { + -- By default, we render variable/function's type in the right most side, + -- to make them not to crowd together with the original label. + + -- when true: + -- foo *Foo + -- ast "go/ast" + + -- when false: + -- foo *Foo + -- ast "go/ast" + align_type_to_right = true, + -- When true, label for field and variable will format like "foo: Foo" + -- instead of go's original syntax "foo Foo". If align_type_to_right is + -- true, this option has no effect. + add_colon_before_type = false, + -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + preserve_type_when_truncate = true, + }, + -- for lsp_config or typescript-tools + ts_ls = { + -- false means do not include any extra info, + -- see https://github.com/xzbdmw/colorful-menu.nvim/issues/42 + extra_info_hl = "@comment", + }, + vtsls = { + -- false means do not include any extra info, + -- see https://github.com/xzbdmw/colorful-menu.nvim/issues/42 + extra_info_hl = "@comment", + }, + ["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, + }, + zls = { + -- Similar to the same setting of gopls. + align_type_to_right = true, + }, + roslyn = { + extra_info_hl = "@comment", + }, + dartls = { + extra_info_hl = "@comment", + }, + -- The same applies to pyright/pylance + basedpyright = { + -- It is usually import path such as "os" + extra_info_hl = "@comment", + }, + -- 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, + }, + }, + -- config = function() + -- -- You don't need to set these options. + -- require("colorful-menu").setup({ + -- ls = { + -- lua_ls = { + -- -- Maybe you want to dim arguments a bit. + -- arguments_hl = "@comment", + -- }, + -- gopls = { + -- -- By default, we render variable/function's type in the right most side, + -- -- to make them not to crowd together with the original label. + -- + -- -- when true: + -- -- foo *Foo + -- -- ast "go/ast" + -- + -- -- when false: + -- -- foo *Foo + -- -- ast "go/ast" + -- align_type_to_right = true, + -- -- When true, label for field and variable will format like "foo: Foo" + -- -- instead of go's original syntax "foo Foo". If align_type_to_right is + -- -- true, this option has no effect. + -- add_colon_before_type = false, + -- -- See https://github.com/xzbdmw/colorful-menu.nvim/pull/36 + -- preserve_type_when_truncate = true, + -- }, + -- -- for lsp_config or typescript-tools + -- ts_ls = { + -- -- false means do not include any extra info, + -- -- see https://github.com/xzbdmw/colorful-menu.nvim/issues/42 + -- extra_info_hl = "@comment", + -- }, + -- vtsls = { + -- -- false means do not include any extra info, + -- -- see https://github.com/xzbdmw/colorful-menu.nvim/issues/42 + -- extra_info_hl = "@comment", + -- }, + -- ["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, + -- }, + -- zls = { + -- -- Similar to the same setting of gopls. + -- align_type_to_right = true, + -- }, + -- roslyn = { + -- extra_info_hl = "@comment", + -- }, + -- dartls = { + -- extra_info_hl = "@comment", + -- }, + -- -- The same applies to pyright/pylance + -- basedpyright = { + -- -- It is usually import path such as "os" + -- extra_info_hl = "@comment", + -- }, + -- -- 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, + -- }) + -- end, + }, } diff --git a/lua/pika/plugins/lsp/nvim-treesitter-text-objects.lua b/lua/pika/plugins/lsp/nvim-treesitter-text-objects.lua deleted file mode 100644 index 68d5164..0000000 --- a/lua/pika/plugins/lsp/nvim-treesitter-text-objects.lua +++ /dev/null @@ -1,110 +0,0 @@ -return { - "nvim-treesitter/nvim-treesitter-textobjects", - lazy = true, - config = function() - require("nvim-treesitter.configs").setup({ - textobjects = { - select = { - enable = true, - - -- Automatically jump forward to textobj, similar to targets.vim - lookahead = true, - - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ["a="] = { query = "@assignment.outer", desc = "Select outer part of an assignment" }, - ["i="] = { query = "@assignment.inner", desc = "Select inner part of an assignment" }, - ["l="] = { query = "@assignment.lhs", desc = "Select left hand side of an assignment" }, - ["r="] = { query = "@assignment.rhs", desc = "Select right hand side of an assignment" }, - - -- works for javascript/typescript files (custom capture I created in after/queries/ecma/textobjects.scm) - ["a:"] = { query = "@property.outer", desc = "Select outer part of an object property" }, - ["i:"] = { query = "@property.inner", desc = "Select inner part of an object property" }, - ["l:"] = { query = "@property.lhs", desc = "Select left part of an object property" }, - ["r:"] = { query = "@property.rhs", desc = "Select right part of an object property" }, - - ["aa"] = { query = "@parameter.outer", desc = "Select outer part of a parameter/argument" }, - ["ia"] = { query = "@parameter.inner", desc = "Select inner part of a parameter/argument" }, - - ["ai"] = { query = "@conditional.outer", desc = "Select outer part of a conditional" }, - ["ii"] = { query = "@conditional.inner", desc = "Select inner part of a conditional" }, - - ["al"] = { query = "@loop.outer", desc = "Select outer part of a loop" }, - ["il"] = { query = "@loop.inner", desc = "Select inner part of a loop" }, - - ["af"] = { query = "@call.outer", desc = "Select outer part of a function call" }, - ["if"] = { query = "@call.inner", desc = "Select inner part of a function call" }, - - ["am"] = { query = "@function.outer", desc = "Select outer part of a method/function definition" }, - ["im"] = { query = "@function.inner", desc = "Select inner part of a method/function definition" }, - - ["ac"] = { query = "@class.outer", desc = "Select outer part of a class" }, - ["ic"] = { query = "@class.inner", desc = "Select inner part of a class" }, - }, - }, - swap = { - enable = true, - swap_next = { - ["na"] = "@parameter.inner", -- swap parameters/argument with next - ["n:"] = "@property.outer", -- swap object property with next - ["nm"] = "@function.outer", -- swap function with next - }, - swap_previous = { - ["pa"] = "@parameter.inner", -- swap parameters/argument with prev - ["p:"] = "@property.outer", -- swap object property with prev - ["pm"] = "@function.outer", -- swap function with previous - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - ["]f"] = { query = "@call.outer", desc = "Next function call start" }, - ["]m"] = { query = "@function.outer", desc = "Next method/function def start" }, - ["]c"] = { query = "@class.outer", desc = "Next class start" }, - ["]i"] = { query = "@conditional.outer", desc = "Next conditional start" }, - ["]l"] = { query = "@loop.outer", desc = "Next loop start" }, - - -- You can pass a query group to use query from `queries//.scm file in your runtime path. - -- Below example nvim-treesitter's `locals.scm` and `folds.scm`. They also provide highlights.scm and indent.scm. - ["]s"] = { query = "@scope", query_group = "locals", desc = "Next scope" }, - ["]z"] = { query = "@fold", query_group = "folds", desc = "Next fold" }, - }, - goto_next_end = { - ["]F"] = { query = "@call.outer", desc = "Next function call end" }, - ["]M"] = { query = "@function.outer", desc = "Next method/function def end" }, - ["]C"] = { query = "@class.outer", desc = "Next class end" }, - ["]I"] = { query = "@conditional.outer", desc = "Next conditional end" }, - ["]L"] = { query = "@loop.outer", desc = "Next loop end" }, - }, - goto_previous_start = { - ["[f"] = { query = "@call.outer", desc = "Prev function call start" }, - ["[m"] = { query = "@function.outer", desc = "Prev method/function def start" }, - ["[c"] = { query = "@class.outer", desc = "Prev class start" }, - ["[i"] = { query = "@conditional.outer", desc = "Prev conditional start" }, - ["[l"] = { query = "@loop.outer", desc = "Prev loop start" }, - }, - goto_previous_end = { - ["[F"] = { query = "@call.outer", desc = "Prev function call end" }, - ["[M"] = { query = "@function.outer", desc = "Prev method/function def end" }, - ["[C"] = { query = "@class.outer", desc = "Prev class end" }, - ["[I"] = { query = "@conditional.outer", desc = "Prev conditional end" }, - ["[L"] = { query = "@loop.outer", desc = "Prev loop end" }, - }, - }, - }, - }) - - local ts_repeat_move = require("nvim-treesitter.textobjects.repeatable_move") - - -- vim way: ; goes to the direction you were moving. - vim.keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move) - vim.keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite) - - -- Optionally, make builtin f, F, t, T also repeatable with ; and , - vim.keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f) - vim.keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F) - vim.keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t) - vim.keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T) - end, -} diff --git a/lua/pika/plugins/lsp/treesitter.lua b/lua/pika/plugins/lsp/treesitter.lua index 470acc7..017a48d 100644 --- a/lua/pika/plugins/lsp/treesitter.lua +++ b/lua/pika/plugins/lsp/treesitter.lua @@ -7,13 +7,22 @@ return { }, config = function() require("nvim-treesitter.configs").setup({ - highlight = { enable = true }, - indent = { enable = true }, - autotag = { enable = true }, + sync_install = false, + highlight = { + enable = true, + }, + indent = { + enable = true, + }, + autotag = { + enable = true, + }, ensure_installed = { "bash", + "caddy", "gitignore", "git_config", + "git_rebase", "markdown", "markdown_inline", "yaml", @@ -25,12 +34,6 @@ return { }, incremental_selection = { enable = true, - keymaps = { - init_selection = "", - node_incremental = "", - scope_incremental = false, - node_decremental = "", - }, }, }) end,