diff --git a/init.lua b/init.lua index ca9ef11..c3d199f 100644 --- a/init.lua +++ b/init.lua @@ -10,4 +10,12 @@ else -- ╰──────────────────────────────────────────────────────╯ vim.cmd.colorscheme("tokyodark") + + vim.opt.formatoptions:append("c") -- Auto-wrap comments + vim.opt.formatoptions:append("r") -- Auto-insert comment leader on Enter + vim.opt.formatoptions:append("o") -- Auto-insert comment leader with 'o'/'O' + vim.opt.formatoptions:append("q") -- Allow formatting of comments with 'gq' + vim.opt.formatoptions:remove("t") -- Don't auto-wrap text (only comments) + + vim.opt.textwidth = 80 end diff --git a/lua/pika/core/keymaps.lua b/lua/pika/core/keymaps.lua index 1c7fcde..350391b 100644 --- a/lua/pika/core/keymaps.lua +++ b/lua/pika/core/keymaps.lua @@ -9,6 +9,8 @@ nomap("n", "", "") nomap("n", "q", "") nomap("v", "q", "") nomap("v", "S", "") +-- nomap("n", "sh", "s", { desc = "Split window horizontally" }) -- spli map("t", "", "", { desc = "terminal escape terminal mode" }) -- ──────────────────────────────< rename word under cursor >────────────────────────────── --- map("n", "R", [[:%s/\<\>//gI]]) +map("n", "R", [[:%s/\<\>//gI]]) +map("v", "R", [[:%s/\<\>//gI]]) -- ───────────────< 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 - vim.cmd(("keeppatterns %%s/%s/%s/g"):format(vim.pesc(text), vim.pesc(input))) - end - end) -end, { desc = "Rename in 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 +-- vim.cmd(("keeppatterns %%s/%s/%s/g"):format(vim.pesc(text), vim.pesc(input))) +-- end +-- end) +-- end, { desc = "Rename in buffer" }) diff --git a/lua/pika/plugins/colorschemes.lua b/lua/pika/plugins/colorschemes.lua index afbab25..1db882b 100644 --- a/lua/pika/plugins/colorschemes.lua +++ b/lua/pika/plugins/colorschemes.lua @@ -16,7 +16,7 @@ return { comments = { italic = false }, -- style for comments keywords = { italic = true }, -- style for keywords identifiers = { italic = true }, -- style for identifiers - variables = { bold = true }, -- style for variables + variables = { bold = true, underline = false }, -- style for variables functions = {}, -- style for functions }, custom_highlights = {} or function(highlights, palette) diff --git a/lua/pika/plugins/explorer.lua b/lua/pika/plugins/explorer.lua index 25d33c4..16f06f9 100644 --- a/lua/pika/plugins/explorer.lua +++ b/lua/pika/plugins/explorer.lua @@ -29,14 +29,14 @@ return { -- }, { -- Open in the current working directory - "tLf", + "tlf", "Yazi cwd", desc = "Terminal - Open yazi 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 - "tlf", + "tLf", "Yazi toggle", desc = "Terminal - Resume the last yazi session", }, diff --git a/lua/pika/plugins/lsp/blink-cmp.lua b/lua/pika/plugins/lsp/blink-cmp.lua index 495ac0f..b5e5dd1 100644 --- a/lua/pika/plugins/lsp/blink-cmp.lua +++ b/lua/pika/plugins/lsp/blink-cmp.lua @@ -42,12 +42,11 @@ return { [""] = { "select_prev", "fallback" }, [""] = { "select_next", "fallback" }, - [""] = { "hide", "fallback" }, + [""] = { "hide", "fallback" }, -- disable a keymap from the preset [""] = {}, [""] = {}, - [""] = {}, -- show with a list of providers -- [""] = { @@ -79,6 +78,38 @@ return { -- Will be removed in a future release use_nvim_cmp_as_default = true, + kind_icons = { + Text = "󰉿", + Method = "󰊕", + Function = "󰊕", + Constructor = "󰒓", + + Field = "󰜢", + Variable = "󰆦", + Property = "󰖷", + + Class = "󱡠", + Interface = "󱡠", + Struct = "󱡠", + Module = "󰅩", + + Unit = "󰪚", + Value = "󰦨", + Enum = "󰦨", + EnumMember = "󰦨", + + Keyword = "󰻾", + Constant = "󰏿", + + Snippet = "󱄽", + Color = "󰏘", + File = "󰈔", + Reference = "󰬲", + Folder = "󰉋", + Event = "󱐋", + Operator = "󰪚", + TypeParameter = "󰬛", + }, }, -- (Default) Only show the documentation popup when manually triggered @@ -127,26 +158,26 @@ return { -- Maximum number of items to display max_items = 128, - selection = { - -- When `true`, will automatically select the first item in the completion list - preselect = true, - -- preselect = function(ctx) return vim.bo.filetype ~= 'markdown' end, + -- selection = { + -- -- When `true`, will automatically select the first item in the completion list + -- preselect = true, + -- -- preselect = function(ctx) return vim.bo.filetype ~= 'markdown' end, + -- + -- -- When `true`, inserts the completion item automatically when selecting it + -- -- You may want to bind a key to the `cancel` command (default ) when using this option, + -- -- which will both undo the selection and hide the completion menu + -- auto_insert = true, + -- -- auto_insert = function(ctx) return vim.bo.filetype ~= 'markdown' end + -- }, - -- When `true`, inserts the completion item automatically when selecting it - -- You may want to bind a key to the `cancel` command (default ) when using this option, - -- which will both undo the selection and hide the completion menu - auto_insert = true, - -- auto_insert = function(ctx) return vim.bo.filetype ~= 'markdown' end - }, - - cycle = { - -- When `true`, calling `select_next` at the _bottom_ of the completion list - -- will select the _first_ completion item. - from_bottom = true, - -- When `true`, calling `select_prev` at the _top_ of the completion list - -- will select the _last_ completion item. - from_top = true, - }, + -- cycle = { + -- -- When `true`, calling `select_next` at the _bottom_ of the completion list + -- -- will select the _first_ completion item. + -- from_bottom = true, + -- -- When `true`, calling `select_prev` at the _top_ of the completion list + -- -- will select the _last_ completion item. + -- from_top = true, + -- }, }, documentation = { @@ -496,95 +527,174 @@ return { { "antosha417/nvim-lsp-file-operations", config = true }, -- { "folke/neodev.nvim", opts = {} }, }, - - config = function() - local lspconfig = require("lspconfig") - local capabilities = require("blink.cmp").get_lsp_capabilities() - local mason_lspconfig = require("mason-lspconfig") - - -- Change the Diagnostic symbols in the sign column (gutter) - -- (not in youtube nvim video) - local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } - for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) - end - - mason_lspconfig.setup_handlers({ - function(server_name) - lspconfig[server_name].setup({ - capabilities = capabilities, - }) - end, - ["svelte"] = function() - lspconfig["svelte"].setup({ - capabilities = capabilities, - on_attach = function(client, bufnr) - vim.api.nvim_create_autocmd("BufWritePost", { - pattern = { "*.js", "*.ts" }, - callback = function(ctx) - client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match }) - end, - }) - end, - }) - end, - ["graphql"] = function() - lspconfig["graphql"].setup({ - capabilities = capabilities, - filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, - }) - end, - ["emmet_ls"] = function() - lspconfig["emmet_ls"].setup({ - capabilities = capabilities, - filetypes = { - "html", - "typescriptreact", - "javascriptreact", - "css", - "sass", - "scss", - "less", - "svelte", - }, - }) - end, - ["lua_ls"] = function() - lspconfig["lua_ls"].setup({ - capabilities = capabilities, - settings = { - Lua = { - diagnostics = { - globals = { "vim" }, - }, - completion = { - callSnippet = "Replace", + opts = { + servers = { + lua_ls = { + function() + lspconfig["lua_ls"].setup({ + capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + completion = { + callSnippet = "Replace", + }, }, }, + }) + end, + }, + bashls = {}, + }, + }, + config = function(_, opts) + -- local lspconfig = require("lspconfig") + -- for server, config in pairs(opts.servers) do + -- -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- -- `opts[server].capabilities, if you've defined it + -- config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) + -- lspconfig[server].setup(config) + -- end + local servers = { + html = {}, + awk_ls = {}, + shfmt = { + filetypes = { + "ab", + }, + }, + bashls = { + filetypes = { + "bash", + "sh", + "zsh", + }, + }, + lua_ls = { + -- capabilities = capabilities, + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + completion = { + callSnippet = "Replace", + }, }, - }) - end, - ["cssls"] = function() - lspconfig["cssls"].setup({ - capabilities = capabilities, - filetypes = { "css", "scss" }, - }) - end, - ["intelephense"] = function() - lspconfig["intelephense"].setup({ - capabilities = capabilities, - filetypes = { "php", "blade.php" }, - }) - end, - -- ["tsserver"] = function() - -- -- Replace tsserver with typescript-language-server - -- lspconfig["typescript-language-server"].setup({ - -- capabilities = capabilities, - -- filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, - -- }) - -- end, - }) + }, + }, + + pyright = { + settings = { + python = { + analysis = { + autoSearchPaths = true, + typeCheckingMode = "basic", + }, + }, + }, + }, + } + + for name, opts in pairs(servers) do + vim.lsp.enable(name) -- nvim v0.11.0 or above required + vim.lsp.config(name, opts) -- nvim v0.11.0 or above required + end end, + + -- CAUTION: + -- old config + -- + -- config = function() + -- local lspconfig = require("lspconfig") + -- local capabilities = require("blink.cmp").get_lsp_capabilities() + -- local mason_lspconfig = require("mason-lspconfig") + -- + -- -- Change the Diagnostic symbols in the sign column (gutter) + -- -- (not in youtube nvim video) + -- local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } + -- for type, icon in pairs(signs) do + -- local hl = "DiagnosticSign" .. type + -- vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + -- end + -- + -- mason_lspconfig.setup_handlers({ + -- function(server_name) + -- lspconfig[server_name].setup({ + -- capabilities = capabilities, + -- }) + -- end, + -- ["svelte"] = function() + -- lspconfig["svelte"].setup({ + -- capabilities = capabilities, + -- on_attach = function(client, bufnr) + -- vim.api.nvim_create_autocmd("BufWritePost", { + -- pattern = { "*.js", "*.ts" }, + -- callback = function(ctx) + -- client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.match }) + -- end, + -- }) + -- end, + -- }) + -- end, + -- ["graphql"] = function() + -- lspconfig["graphql"].setup({ + -- capabilities = capabilities, + -- filetypes = { "graphql", "gql", "svelte", "typescriptreact", "javascriptreact" }, + -- }) + -- end, + -- ["emmet_ls"] = function() + -- lspconfig["emmet_ls"].setup({ + -- capabilities = capabilities, + -- filetypes = { + -- "html", + -- "typescriptreact", + -- "javascriptreact", + -- "css", + -- "sass", + -- "scss", + -- "less", + -- "svelte", + -- }, + -- }) + -- end, + -- ["lua_ls"] = function() + -- lspconfig["lua_ls"].setup({ + -- capabilities = capabilities, + -- settings = { + -- Lua = { + -- diagnostics = { + -- globals = { "vim" }, + -- }, + -- completion = { + -- callSnippet = "Replace", + -- }, + -- }, + -- }, + -- }) + -- end, + -- ["cssls"] = function() + -- lspconfig["cssls"].setup({ + -- capabilities = capabilities, + -- filetypes = { "css", "scss" }, + -- }) + -- end, + -- ["intelephense"] = function() + -- lspconfig["intelephense"].setup({ + -- capabilities = capabilities, + -- filetypes = { "php", "blade.php" }, + -- }) + -- end, + -- -- ["tsserver"] = function() + -- -- -- Replace tsserver with typescript-language-server + -- -- lspconfig["typescript-language-server"].setup({ + -- -- capabilities = capabilities, + -- -- filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, + -- -- }) + -- -- end, + -- }) + -- end, }, } diff --git a/lua/pika/plugins/lsp/mason.lua b/lua/pika/plugins/lsp/mason.lua index 1fec2fe..42b6964 100644 --- a/lua/pika/plugins/lsp/mason.lua +++ b/lua/pika/plugins/lsp/mason.lua @@ -4,9 +4,6 @@ return { "williamboman/mason-lspconfig.nvim", "WhoIsSethDaniel/mason-tool-installer.nvim", }, - -- opts = { - -- - -- } config = function() -- import mason local mason = require("mason") @@ -54,13 +51,14 @@ return { end, ensure_installed = { "shfmt", + "shellcheck", + "bashls", "prettier", "stylua", - "blade-formatter", "html-lsp", - "docker-compose-language-service", "pylint", - "eslint_d", + -- "eslint_d", + -- "blade-formatter", }, }) end, diff --git a/lua/pika/plugins/markdown.lua b/lua/pika/plugins/markdown.lua index bd9ae9a..5207a7b 100644 --- a/lua/pika/plugins/markdown.lua +++ b/lua/pika/plugins/markdown.lua @@ -1,9 +1,20 @@ -return{ -{ - 'MeanderingProgrammer/render-markdown.nvim', - opts = {}, - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite - dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins - -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons -}, +return { + { + "MeanderingProgrammer/render-markdown.nvim", + opts = {}, + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite + dependencies = { "nvim-treesitter/nvim-treesitter", "echasnovski/mini.icons" }, -- if you use standalone mini plugins + -- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons + }, + + -- install with yarn or npm + { + "iamcco/markdown-preview.nvim", + cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" }, + build = "cd app && yarn install", + init = function() + vim.g.mkdp_filetypes = { "markdown" } + end, + ft = { "markdown" }, + }, } diff --git a/lua/pika/plugins/qol.lua b/lua/pika/plugins/qol.lua index cc60817..4af2800 100644 --- a/lua/pika/plugins/qol.lua +++ b/lua/pika/plugins/qol.lua @@ -278,4 +278,9 @@ return { vim.keymap.set("n", "sm", ":ScissorsEditSnippet"), vim.keymap.set("v", "sa", ":ScissorsAddNewSnippet"), }, + + { + "gbprod/substitute.nvim", + opts = {}, + }, } diff --git a/lua/pika/plugins/snacks.lua b/lua/pika/plugins/snacks.lua index 90ab751..8ca0cc2 100644 --- a/lua/pika/plugins/snacks.lua +++ b/lua/pika/plugins/snacks.lua @@ -12,23 +12,26 @@ return { ---@class snacks.animate.Config ---@field easing? snacks.animate.easing|snacks.animate.easing.Fn animate = { - enabled = true, + enabled = false, ---@type snacks.animate.Duration|number duration = 4, -- ms per step easing = "linear", - fps = 60, -- frames per second. Global setting for all animations + fps = 90, -- frames per second. Global setting for all animations }, notifier = { enabled = true }, indent = { enabled = true }, toggle = { enabled = true }, scroll = { enabled = true }, + ---@class snacks.dashboard.Config + ---@field enabled? boolean + ---@field sections snacks.dashboard.Section + ---@field formats table dashboard = { row = nil, col = nil, pane_gap = 2, enabled = true, - -- example = "pokemon", sections = { { section = "header" }, { @@ -378,6 +381,22 @@ return { }) end, dependencies = { + { + "RileyGabrielson/inspire.nvim", + config = function() + require("inspire").setup({ + -- 'daily' or 'random' + mode = "daily", + + -- Override the default quotes + quotes = { + { text = "My First Custom Quote", author = "Me" }, + { text = "My Second Custom Quote", author = "Myself" }, + { text = "My Third Custom Quote", author = "and I" }, + }, + }) + end, + }, { "folke/persistence.nvim", event = "BufReadPre", @@ -388,7 +407,7 @@ return { -- { "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"}, - { "dq", function() require("inspire").show_quote() end, desc = "Show Inspire Quote"}, + { "dq", function() require("inspire").show_quote() end, desc = "Show Inspire Quote"}, }, }, }, diff --git a/snippets b/snippets index 4af5735..a0c3c9a 160000 --- a/snippets +++ b/snippets @@ -1 +1 @@ -Subproject commit 4af57355e220288c7e5eac5a4f3a95951c212d66 +Subproject commit a0c3c9af7cbe51960ddb5ed6513a9618284f8a76