From 19fc44af8021e00af835347d3097ef37132fb47a Mon Sep 17 00:00:00 2001 From: pika Date: Wed, 2 Apr 2025 20:05:03 +0200 Subject: [PATCH] some nice changes --- init.lua | 2 +- lua/pika/core/keymaps.lua | 31 --------------------- lua/pika/plugins/colorschemes.lua | 16 ++++------- lua/pika/plugins/explorer.lua | 4 +-- lua/pika/plugins/lsp/blink-cmp.lua | 40 ++++++++++++++++++++------- lua/pika/plugins/telescope.lua | 44 +++++++++++++----------------- 6 files changed, 58 insertions(+), 79 deletions(-) diff --git a/init.lua b/init.lua index c2da3d1..b057c40 100644 --- a/init.lua +++ b/init.lua @@ -9,5 +9,5 @@ else -- │ themes are under ./lua/pika/plugins/colorschemes.lua │ -- ╰──────────────────────────────────────────────────────╯ - vim.cmd.colorscheme("cyberdream") + vim.cmd.colorscheme("rose-pine-moon") end diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index c794327..57203c8 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -7,7 +7,6 @@ nomap("n", "", "") nomap("n", "q", "") nomap("v", "q", "") nomap("v", "S", "") -nomap({ "i", "v", "n" }, "", "") local map = vim.keymap.set @@ -58,33 +57,3 @@ map("n", "R", [[:%s/\<\>//gI]]) -- window management map("n", "sv", "v", { desc = "Split window vertically" }) -- split window vertically map("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally - -vim.keymap.set({ "n", "i" }, "tt", function() - -- Frage den Shell-Command ab - vim.ui.input({ prompt = "Shell Command: " }, function(cmd) - if cmd == nil or cmd == "" then - return - end - - local result = vim.fn.system(cmd) - local exit_code = vim.v.shell_error - - if exit_code ~= 0 then - vim.notify("Shell Error:\n" .. result, vim.log.levels.ERROR, { title = "Shell Command Failed" }) - return - end - - local lines = vim.split(result, "\n", { trimempty = true }) - - -- Insert at cursor position - local row, col = unpack(vim.api.nvim_win_get_cursor(0)) - if #lines == 1 then - -- Insert inline if the result is a single line - local current_line = vim.api.nvim_get_current_line() - local new_line = current_line:sub(1, col) .. lines[1] .. current_line:sub(col + 1) - vim.api.nvim_set_current_line(new_line) - else - vim.api.nvim_buf_set_lines(0, row, row, false, lines) - end - end) -end, { desc = "Insert Shell Output at Cursor" }) diff --git a/lua/pika/plugins/colorschemes.lua b/lua/pika/plugins/colorschemes.lua index d18bdd8..80ffdd1 100644 --- a/lua/pika/plugins/colorschemes.lua +++ b/lua/pika/plugins/colorschemes.lua @@ -1,19 +1,15 @@ return { - { "folke/tokyonight.nvim" }, - { "fynnfluegge/monet.nvim", name = "monet" }, + { "rose-pine/neovim", name = "rose-pine" }, { "L-Colombo/oldschool.nvim", config = "true" }, + { "ptdewey/darkearth-nvim" }, -- { "catppuccin/nvim", name = "catppuccin" }, + -- { "folke/tokyonight.nvim" }, + -- { "fynnfluegge/monet.nvim", name = "monet" }, + -- { "AlexvZyl/nordic.nvim" }, + -- { "eldritch-theme/eldritch.nvim" }, -- { "EdenEast/nightfox.nvim" }, -- { "DanWlker/primeppuccin", name = "primeppuccin" }, - -- { "rose-pine/neovim", name = "rose-pine" }, - { "AlexvZyl/nordic.nvim" }, - { "eldritch-theme/eldritch.nvim" }, -- { "sainnhe/sonokai" }, - { "samharju/synthweave.nvim" }, - { "sainnhe/gruvbox-material" }, - { "pauchiner/pastelnight.nvim" }, - { "ptdewey/darkearth-nvim" }, - { "marko-cerovac/material.nvim" }, -- { -- "ferdinandrau/lavish.nvim", -- opts = { diff --git a/lua/pika/plugins/explorer.lua b/lua/pika/plugins/explorer.lua index 6791427..c9c16b3 100644 --- a/lua/pika/plugins/explorer.lua +++ b/lua/pika/plugins/explorer.lua @@ -29,14 +29,14 @@ return { -- }, { -- Open in the current working directory - "Lf", + "tLf", "Yazi cwd", desc = "Open the file manager in nvim's working directory", }, { -- NOTE: this requires a version of yazi that includes -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18 - "lf", + "tlf", "Yazi toggle", desc = "Resume the last yazi session", }, diff --git a/lua/pika/plugins/lsp/blink-cmp.lua b/lua/pika/plugins/lsp/blink-cmp.lua index 4f0e900..5964d3c 100644 --- a/lua/pika/plugins/lsp/blink-cmp.lua +++ b/lua/pika/plugins/lsp/blink-cmp.lua @@ -71,13 +71,12 @@ return { use_nvim_cmp_as_default = true, }, - -- (Default) Only show the documentation popup when manually triggered completion = { documentation = { auto_show = false, auto_show_delay_ms = 230, update_delay_ms = 50, - treesitter_highlighting = false, + treesitter_highlighting = true, draw = function(opts) opts.default_implementation() end, @@ -125,13 +124,13 @@ return { end, }, - -- kind = { - -- -- (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, + }, }, }, }, @@ -140,7 +139,15 @@ return { -- 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 = { "lazydev", "lsp", "path", "snippets", "buffer" }, + providers = { + lazydev = { + name = "LazyDev", + module = "lazydev.integrations.blink", + -- make lazydev completions top priority (see `:h blink.cmp`) + score_offset = 100, + }, + }, }, -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance @@ -332,4 +339,17 @@ return { -- }) -- end, }, + + -- ───────────────────────────────────────< extras >─────────────────────────────────────── + { + "folke/lazydev.nvim", + ft = "lua", -- only load on lua files + opts = { + library = { + -- See the configuration section for more details + -- Load luvit types when the `vim.uv` word is found + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, + }, + }, + }, } diff --git a/lua/pika/plugins/telescope.lua b/lua/pika/plugins/telescope.lua index 0656a2b..c6c80d1 100644 --- a/lua/pika/plugins/telescope.lua +++ b/lua/pika/plugins/telescope.lua @@ -25,38 +25,32 @@ return { telescope.load_extension("fzf") - -- set keymaps + -- ─< set keymaps >───────────────────────────────────────────────────────────────────── local map = vim.keymap.set -- for conciseness - - -- Telescope mappings - map("n", "sf", "Telescope find_files", { noremap = true, silent = true, desc = "Find Files" }) - map("n", "sw", "Telescope live_grep", { noremap = true, silent = true, desc = "Search Word" }) - map("n", "", "Telescope buffers", { noremap = true, silent = true, desc = "Buffers" }) local builtin = require("telescope.builtin") - - map("n", "sn", function() - builtin.find_files({ cwd = vim.fn.stdpath("config") }) - end, { desc = "[S]earch [N]eovim files" }) - map("n", "ff", builtin.find_files, { desc = "[S]earch [F]iles" }) - map("n", "sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) - map("n", "sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) - map("n", "sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) - map("n", "sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) - -- map("n", "sr", builtin.resume, { desc = "[S]earch [R]esume" }) - map("n", "s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - map("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) - map("n", "sR", function() - require("telescope.builtin").oldfiles() - end) + -- ─────────────────────────────────< Telescope mappings >───────────────────────────────── map("n", "T", "Telescope colorscheme") - map("n", "q", vim.cmd.q) + + map("n", "ff", "Telescope find_files", { noremap = true, silent = true, desc = "Find Files" }) + -- map("n", "ff", builtin.find_files, { desc = "Find Files" }) + map("n", "fw", "Telescope live_grep", { noremap = true, silent = true, desc = "Find Word" }) + -- map("n", "fw", builtin.live_grep, { desc = "Find word" }) + -- map("n", "fb", "Telescope buffers", { noremap = true, silent = true, desc = "Find Buffers" }) + map("n", "", builtin.buffers, { desc = "[ ] Find existing buffers" }) + map("n", "fn", function() + builtin.find_files({ cwd = vim.fn.stdpath("config") }) + end, { desc = "Find Neovim files" }) + map("n", "fh", builtin.help_tags, { desc = "Find Help" }) + map("n", "fk", builtin.keymaps, { desc = "Find Keymaps" }) + map("n", "fd", builtin.diagnostics, { desc = "Find Diagnostics" }) + map("n", "fo", builtin.oldfiles, { desc = "Find old/Recent Files" }) -- Additional custom mappings map("n", "/", function() builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown()) - end, { desc = "[/] Fuzzily search in current buffer" }) - map("n", "s/", function() + end, { desc = "Search in current buffer" }) + map("n", "f/", function() builtin.live_grep({ grep_open_files = true, prompt_title = "Live Grep in Open Files" }) - end, { desc = "[S]earch [/] in Open Files" }) + end, { desc = "Search in Open Files" }) end, }