wip
This commit is contained in:
parent
bcdd3cdbd7
commit
ac80409bb9
10 changed files with 292 additions and 138 deletions
8
init.lua
8
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
|
||||
|
|
|
@ -9,6 +9,8 @@ nomap("n", "<C-k>", "")
|
|||
nomap("n", "q", "")
|
||||
nomap("v", "q", "")
|
||||
nomap("v", "<leader>S", "")
|
||||
-- nomap("n", "<C-A-Tab", "")
|
||||
-- nomap("n", "<C-A-S-Tab", "")
|
||||
|
||||
-- INFO: vim.keymap.set with map()
|
||||
local map = vim.keymap.set
|
||||
|
@ -66,13 +68,14 @@ map("n", "<leader>sh", "<C-w>s", { desc = "Split window horizontally" }) -- spli
|
|||
map("t", "<C-x>", "<C-\\><C-N>", { desc = "terminal escape terminal mode" })
|
||||
|
||||
-- ──────────────────────────────< rename word under cursor >──────────────────────────────
|
||||
-- map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
map("n", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
map("v", "<leader>R", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
-- ───────────────< Enhanced word under cursor renaming in current buffer >────────────
|
||||
map({ "n", "x" }, "<leader>R", function()
|
||||
local text = vim.fn.mode() == "n" and vim.fn.expand("<cword>") 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" }, "<leader>R", function()
|
||||
-- local text = vim.fn.mode() == "n" and vim.fn.expand("<cword>") 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" })
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -29,14 +29,14 @@ return {
|
|||
-- },
|
||||
{
|
||||
-- Open in the current working directory
|
||||
"<leader>tLf",
|
||||
"<leader>tlf",
|
||||
"<cmd>Yazi cwd<cr>",
|
||||
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
|
||||
"<leader>tlf",
|
||||
"<leader>tLf",
|
||||
"<cmd>Yazi toggle<cr>",
|
||||
desc = "Terminal - Resume the last yazi session",
|
||||
},
|
||||
|
|
|
@ -42,12 +42,11 @@ return {
|
|||
|
||||
["<C-k>"] = { "select_prev", "fallback" },
|
||||
["<C-j>"] = { "select_next", "fallback" },
|
||||
["<C-q>"] = { "hide", "fallback" },
|
||||
["<C-n>"] = { "hide", "fallback" },
|
||||
|
||||
-- disable a keymap from the preset
|
||||
["<C-e>"] = {},
|
||||
["<C-p>"] = {},
|
||||
["<C-n>"] = {},
|
||||
|
||||
-- show with a list of providers
|
||||
-- ["<C-space>"] = {
|
||||
|
@ -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 <C-e>) 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 <C-e>) 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,61 +527,10 @@ 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()
|
||||
opts = {
|
||||
servers = {
|
||||
lua_ls = {
|
||||
function()
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
|
@ -565,26 +545,156 @@ return {
|
|||
},
|
||||
})
|
||||
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({
|
||||
},
|
||||
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,
|
||||
-- filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" },
|
||||
-- })
|
||||
-- end,
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
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,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,9 +1,20 @@
|
|||
return {
|
||||
{
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
"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", "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" },
|
||||
},
|
||||
}
|
||||
|
|
|
@ -278,4 +278,9 @@ return {
|
|||
vim.keymap.set("n", "<leader>sm", "<CMD>:ScissorsEditSnippet<cr>"),
|
||||
vim.keymap.set("v", "<leader>sa", "<CMD>:ScissorsAddNewSnippet<cr>"),
|
||||
},
|
||||
|
||||
{
|
||||
"gbprod/substitute.nvim",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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<string, snacks.dashboard.Text|fun(item:snacks.dashboard.Item, ctx:snacks.dashboard.Format.ctx):snacks.dashboard.Text>
|
||||
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",
|
||||
|
|
2
snippets
2
snippets
|
@ -1 +1 @@
|
|||
Subproject commit 4af57355e220288c7e5eac5a4f3a95951c212d66
|
||||
Subproject commit a0c3c9af7cbe51960ddb5ed6513a9618284f8a76
|
Loading…
Add table
Add a link
Reference in a new issue