From 741556792bd684f00112fa5b546278f1e282ce28 Mon Sep 17 00:00:00 2001 From: pika Date: Sat, 5 Apr 2025 10:51:29 +0200 Subject: [PATCH] some plugin changes and visual optimisations --- lua/pika/core/keymaps.lua | 29 ++++++++++++-------- lua/pika/core/options.lua | 5 ++-- lua/pika/lazy.lua | 41 ++++++++++++++-------------- lua/pika/plugins/dashboard.lua | 14 +++++----- lua/pika/plugins/lsp/mason.lua | 6 ++++ lua/pika/plugins/mini.lua | 36 ++++++++++++++++++++++-- lua/pika/plugins/qol.lua | 39 +++++++++++++------------- lua/pika/plugins/ui.lua | 50 +++++++++++++++++++++++++--------- 8 files changed, 143 insertions(+), 77 deletions(-) diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index 1ecd19c..c48cd1b 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -1,5 +1,7 @@ +-- INFO: Maps leader to 'space' vim.g.mapleader = " " +-- TIP: Unmap keymaps -- ─< lua/keymaps.lua >───────────────────────────────────────────────────────────────── local nomap = vim.keymap.set nomap("i", "", "") @@ -8,17 +10,16 @@ nomap("n", "q", "") nomap("v", "q", "") nomap("v", "S", "") +-- INFO: vim.keymap.set with map() local map = vim.keymap.set map("n", "", "nohlsearch") -- ─< Comment >───────────────────────────────────────────────────────────────────────── +-- INFO: makes instant comments, no plugin needet map("n", "", "gcc", { desc = "comment toggle", remap = true }) map("v", "", "gc", { desc = "comment toggle", remap = true }) --- ─< Terminal >──────────────────────────────────────────────────────────────────────── -map("t", "", "", { desc = "terminal escape terminal mode" }) - -- ─< Movement while in "insert"-mode >───────────────────────────────────────────────── map("i", "", "^i", { desc = "move beginning of line" }) map("i", "", "", { desc = "move end of line" }) @@ -28,10 +29,9 @@ map("i", "", "", { desc = "move down" }) map("i", "", "", { desc = "move up" }) map("n", ";", ":", { desc = "CMD enter command mode" }) -map("i", "jk", "") -map("i", "", "") -map("n", "", "") -map("v", "", "") + +-- CTRL-C for escape +map({ "i", "n", "v" }, "", "") map("n", "x", "bd!") @@ -48,22 +48,27 @@ map("n", "k", "", { desc = "Move focus to the upper window" }) -- map("n", "p", vim.cmd.Ex) map("n", "q", vim.cmd.q) +map("n", "Q", "q!") map("n", "s", vim.cmd.w) map("n", "", vim.cmd.w) -- Visual mode: Indent selected lines -map("v", "", ">gv", { desc = "Indent and keep selection" }) -map("v", "", "", ">gv", { desc = "Indent and keep selection" }) +-- map("v", "", "sv", "v", { desc = "Split window vertically" }) -- split window vertically map("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally +-- ─< Terminal >──────────────────────────────────────────────────────────────────────── +-- NOTE: This is only for terminal mode +map("t", "", "", { desc = "terminal escape terminal mode" }) + -- ──────────────────────────────< rename word under cursor >────────────────────────────── -- map("n", "R", [[:%s/\<\>//gI]]) --- ──────────────────────< Enhanced word renaming in current buffer >────────────────────── --- -- Minimal working version -vim.keymap.set({ "n", "x" }, "R", function() +-- ───────────────< Enhanced word under cursor renaming in current buffer >──────────── +map({ "n", "x" }, "R", function() local text = vim.fn.mode() == "n" and vim.fn.expand("") or vim.fn.trim(vim.fn.getreg('"')) vim.ui.input({ prompt = "Replace: ", default = text }, function(input) if input and input ~= text then diff --git a/lua/pika/core/options.lua b/lua/pika/core/options.lua index fa3fc11..47fe86c 100644 --- a/lua/pika/core/options.lua +++ b/lua/pika/core/options.lua @@ -53,7 +53,8 @@ o.laststatus = 3 o.swapfile = false -- Disable the tilde on empty lines -o.fillchars = { eob = " " } +-- enable slimline bubble chain ( )----( ) +o.fillchars = { eob = " ", stl = "─" } -- SudaRead automatic if file is inaccessible vim.g.suda_smart_edit = 1 @@ -77,7 +78,7 @@ vim.cmd([[ if vim.g.neovide then -- vim.g.neovide_transparency = 0.35 - vim.g.neovide_transparency = 1 + vim.g.neovide_opacity = 1 vim.g.neovide_theme = "dark" vim.g.neovide_refresh_rate = 90 vim.g.neovide_cursor_vfx_mode = "torpedo" diff --git a/lua/pika/lazy.lua b/lua/pika/lazy.lua index d56a156..dae8236 100644 --- a/lua/pika/lazy.lua +++ b/lua/pika/lazy.lua @@ -1,17 +1,17 @@ -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) @@ -23,14 +23,13 @@ vim.g.maplocalleader = "\\" -- Setup lazy.nvim require("lazy").setup({ - spec = { - -- import your plugins - { import = "pika.plugins" }, - { import = "pika.plugins.lsp" }, - }, - -- Configure any other settings here. See the documentation for more details. - -- colorscheme that will be used when installing plugins. - install = { colorscheme = { "nord" } }, - -- automatically check for plugin updates - checker = { enabled = true }, + spec = { + -- import your plugins + { import = "pika.plugins" }, + { import = "pika.plugins.lsp" }, + }, + -- Configure any other settings here. See the documentation for more details. + ui = { backdrop = 100 }, + -- automatically check for plugin updates + checker = { enabled = true }, }) diff --git a/lua/pika/plugins/dashboard.lua b/lua/pika/plugins/dashboard.lua index 1646807..96e3de6 100644 --- a/lua/pika/plugins/dashboard.lua +++ b/lua/pika/plugins/dashboard.lua @@ -116,13 +116,13 @@ return { "folke/persistence.nvim", event = "BufReadPre", opts = {}, - -- stylua: ignore - keys = { - { "qs", function() require("persistence").load() end, desc = "Restore Session" }, - { "ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, - { "qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" }, - { "db", ":Dashboard", desc = "Dashboard"} - }, + -- stylua: ignore + keys = { + -- { "qs", function() require("persistence").load() end, desc = "Restore Session" }, + -- { "ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, + -- { "qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" }, + { "db", ":Dashboard", desc = "Dashboard"} + }, }, }, } diff --git a/lua/pika/plugins/lsp/mason.lua b/lua/pika/plugins/lsp/mason.lua index d5fcf86..1fec2fe 100644 --- a/lua/pika/plugins/lsp/mason.lua +++ b/lua/pika/plugins/lsp/mason.lua @@ -4,6 +4,9 @@ return { "williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", }, + -- opts = { + -- + -- } config = function() -- import mason local mason = require("mason") @@ -46,6 +49,9 @@ return { }) mason_tool_installer.setup({ + function(server_name) -- default handler (optional) + require("lspconfig")[server_name].setup({}) + end, ensure_installed = { "shfmt", "prettier", diff --git a/lua/pika/plugins/mini.lua b/lua/pika/plugins/mini.lua index e3bca6d..59d6091 100644 --- a/lua/pika/plugins/mini.lua +++ b/lua/pika/plugins/mini.lua @@ -1,22 +1,52 @@ return { + -- INFO: -- mini-ai for a and i selections or other --> vin" for visual in next "" { "echasnovski/mini.ai", - version = "false", + version = "*", opts = {}, }, + -- TIP: -- ─< mini-surround for surrounding words or lines with "" or () or '' etc.. >────────── { "echasnovski/mini.surround", - version = "false", + version = "*", opts = {}, }, + -- Move any selection in any direction + { + "echasnovski/mini.move", + version = "*", + opts = { + -- Module mappings. Use `''` (empty string) to disable one. + mappings = { + -- Move visual selection in Visual mode. Defaults are Alt (Meta) + hjkl. + left = "", + right = "", + down = "", + up = "", + + line_left = "", + line_right = "", + line_down = "", + line_up = "", + -- Move current line in Normal mode + }, + + -- Options which control moving behavior + options = { + -- Automatically reindent selection during linewise vertical move + reindent_linewise = true, + }, + }, + }, + -- ─< miniIcons >─────────────────────────────────────────────────────────────────────── { "echasnovski/mini.icons", - version = "false", + version = "*", opts = {}, lazy = true, specs = { diff --git a/lua/pika/plugins/qol.lua b/lua/pika/plugins/qol.lua index 2e39595..558aad0 100644 --- a/lua/pika/plugins/qol.lua +++ b/lua/pika/plugins/qol.lua @@ -138,7 +138,7 @@ return { ), }, - -- ─< INFO: Those comments are really great! >────────────────────────────────────────── + -- ─< ERROR: Those comments are really great! >────────────────────────────────────────── -- ─────────────────────< NOTE: And they can be pretty satisfying... >───────────────────── -- ╭──────────────────────────────────────╮ -- │ WARN: Also they can change in color! │ @@ -148,8 +148,9 @@ return { dependencies = { "nvim-lua/plenary.nvim" }, opts = { keywords = { - NOTE = { icon = " ", color = "hint" }, - INFO = { icon = " ", color = "info" }, + NOTE = { icon = " ", color = "hint", alt = { "TIP" } }, + INFO = { icon = " ", color = "info", alt = { "INFORMATION" } }, + ERROR = { icon = " ", color = "error", alt = { "ERR" } }, WARNING = { icon = " ", color = "warning", alt = { "WARN" } }, }, }, @@ -200,7 +201,7 @@ return { enable_named_colors = true, ---Highlight tailwind colors, e.g. 'bg-blue-500' - enable_tailwind = false, + enable_tailwind = true, ---Set custom colors ---Label must be properly escaped with '%' to adhere to `string.gmatch` @@ -219,21 +220,21 @@ return { -- ╭──────────────────────────────────────╮ -- │ flash - to navigate more efficiently │ -- ╰──────────────────────────────────────╯ - { - "folke/flash.nvim", - event = "VeryLazy", - vscode = true, - -- @type Flash.Config - opts = {}, - -- stylua: ignore - keys = { - { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, - { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, - { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, - { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, - { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, - }, - }, + -- { + -- "folke/flash.nvim", + -- event = "VeryLazy", + -- vscode = true, + -- -- @type Flash.Config + -- -- opts = {}, + -- -- stylua: ignore + -- keys = { + -- { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + -- { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + -- { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + -- { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + -- { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + -- }, + -- }, -- ╭──────────────────────────────╮ -- │ renaming (also project wide) │ diff --git a/lua/pika/plugins/ui.lua b/lua/pika/plugins/ui.lua index 5236ba4..385326d 100644 --- a/lua/pika/plugins/ui.lua +++ b/lua/pika/plugins/ui.lua @@ -23,19 +23,19 @@ return { move_wraps_at_ends = true, -- whether or not the move command "wraps" at the first or last position separator_style = "slope", -- ─< icons >─────────────────────────────────────────────────────────────────────────── - modified_icon = "󱞇", - left_trunc_marker = "󰬩", - right_trunc_marker = "󰬫", + modified_icon = "󱞇 ", + left_trunc_marker = "󰬩 ", + right_trunc_marker = "󰬫 ", themable = true, -- allows highlight groups to be overriden i.e. sets highlights as default - close_icon = "󱄊", - buffer_close_icon = "󱄊", + close_icon = "󱄊 ", + buffer_close_icon = "󱄊 ", show_buffer_icons = true, -- disable filetype icons for buffers show_buffer_close_icons = true, show_close_icon = true, show_tab_indicators = true, hover = { enabled = true, - delay = 80, + delay = 30, reveal = { "close" }, hide = { "nvim_lsp" }, }, @@ -217,6 +217,7 @@ return { }) vim.notify = require("notify") end, + vim.keymap.set("n", "tn", "Telescope notify", { desc = "Telescope show Notifications" }), }, -- ╭──────────────────────────────╮ -- │ slimline - nice bar for nvim │ @@ -229,9 +230,37 @@ return { verbose_mode = false, -- Mode as single letter or as a word style = "bg", -- or "fg". Whether highlights should be applied to bg or fg of components mode_follow_style = true, -- Whether the mode color components should follow the style option + spaces = { + components = "─", + left = "─", + right = "─", + }, + configs = { + path = { + hl = { + primary = "Define", + }, + }, + git = { + hl = { + primary = "Function", + }, + }, + diagnostics = { + hl = { + primary = "Statement", + }, + }, + filetype_lsp = { + hl = { + primary = "String", + }, + }, + }, components = { -- Choose components and their location left = { "mode", + "progress", -- "path", -- "git", }, @@ -245,11 +274,6 @@ return { "progress", }, }, - spaces = { - components = " ", -- string between components - left = " ", -- string at the start of the line - right = " ", -- string at the end of the line - }, sep = { hide = { first = false, -- hides the first separator @@ -293,8 +317,8 @@ return { "folke/which-key.nvim", event = "VeryLazy", init = function() - vim.o.timeout = true - vim.o.timeoutlen = 350 + vim.o.timeout = false + vim.o.timeoutlen = 0 end, opts = { -- your configuration comes here