Okay I forgot to stage lmao, now we're adding everything
This commit is contained in:
parent
d70730791f
commit
85efa7bb6c
35
after/ftplugin/markdown.lua
Normal file
35
after/ftplugin/markdown.lua
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
local set = vim.opt_local
|
||||
|
||||
set.textwidth = 80
|
||||
set.spell = true
|
||||
set.linebreak = true
|
||||
|
||||
|
||||
-- Define colors
|
||||
local color1_bg = "#ff757f"
|
||||
local color2_bg = "#4fd6be"
|
||||
local color3_bg = "#7dcfff"
|
||||
local color4_bg = "#ff9e64"
|
||||
local color5_bg = "#7aa2f7"
|
||||
local color6_bg = "#c0caf5"
|
||||
local color_fg = "#1F2335"
|
||||
|
||||
vim.cmd(
|
||||
string.format([[highlight @markup.heading.1.markdown cterm=bold gui=bold guifg=%s guibg=%s]], color_fg, color1_bg)
|
||||
)
|
||||
vim.cmd(
|
||||
string.format([[highlight @markup.heading.2.markdown cterm=bold gui=bold guifg=%s guibg=%s]], color_fg, color2_bg)
|
||||
)
|
||||
vim.cmd(
|
||||
string.format([[highlight @markup.heading.3.markdown cterm=bold gui=bold guifg=%s guibg=%s]], color_fg, color3_bg)
|
||||
)
|
||||
vim.cmd(
|
||||
string.format([[highlight @markup.heading.4.markdown cterm=bold gui=bold guifg=%s guibg=%s]], color_fg, color4_bg)
|
||||
)
|
||||
vim.cmd(
|
||||
string.format([[highlight @markup.heading.5.markdown cterm=bold gui=bold guifg=%s guibg=%s]], color_fg, color5_bg)
|
||||
)
|
||||
vim.cmd(
|
||||
string.format([[highlight @markup.heading.6.markdown cterm=bold gui=bold guifg=%s guibg=%s]], color_fg, color6_bg)
|
||||
)
|
||||
@ -1,32 +1,56 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
||||
"auto-session": { "branch": "main", "commit": "292492ab7af4bd8b9e37e28508bc8ce995722fd5" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" },
|
||||
"folkeTokyonight": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"fzy-lua-native": { "branch": "master", "commit": "9d720745d5c2fb563c0d86c17d77612a3519c506" },
|
||||
"git-worktree.nvim": { "branch": "master", "commit": "f247308e68dab9f1133759b05d944569ad054546" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "1ce96a464fdbc24208e24c117e2021794259005d" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "a472496e1a4465a2dd574389dcf6cdb29af9bf1b" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||
"img-clip.nvim": { "branch": "main", "commit": "b6ddfb97b5600d99afe3452d707444afda658aca" },
|
||||
"incline.nvim": { "branch": "main", "commit": "8b54c59bcb23366645ae10edca6edfb9d3a0853e" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lspkind.nvim": { "branch": "master", "commit": "c7274c48137396526b59d86232eabcdc7fed8a32" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "ae609525ddf01c153c39305730b1791800ffe4fe" },
|
||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "443f1ef8b5e6bf47045cb2217b6f748a223cf7dc" },
|
||||
"mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" },
|
||||
"mini.comment": { "branch": "main", "commit": "a0c721115faff8d05505c0a12dab410084d9e536" },
|
||||
"mini.files": { "branch": "main", "commit": "fafacfecdd6c5a66bb10d173a749f3c098e84498" },
|
||||
"mini.nvim": { "branch": "main", "commit": "8c40d95931cbe6138391af9180e59439ed2e69df" },
|
||||
"mini.splitjoin": { "branch": "main", "commit": "9fcd8856efb95a505090c3225726466494076127" },
|
||||
"mini.surround": { "branch": "main", "commit": "d648a5601e1c48f175b07d10eba141da338a0a2a" },
|
||||
"mini.trailspace": { "branch": "main", "commit": "f8083ca969e1b2098480c10f3c3c4d2ce3586680" },
|
||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "92c9b016d16473dabd2bf3760196cf2d928edacc" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "338409dd8a6ed74767bad3eb5269f1b903ffb3cf" },
|
||||
"nvim-emmet": { "branch": "main", "commit": "cde4fb2968704aae5c18b7f8a9bc2508767bb78d" },
|
||||
"nvim-lint": { "branch": "master", "commit": "bcd1a44edbea8cd473af7e7582d3f7ffc60d8e81" },
|
||||
"nvim-lsp-file-operations": { "branch": "master", "commit": "b9c795d3973e8eec22706af14959bc60c579e771" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "66fd02ad1c7ea31616d3ca678fa04e6d0b360824" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "45a07f869b0cffba342276f2c77ba7c116d35db8" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "ab3eb124062422d276fae49e0dd63b3ad1062cfc" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
|
||||
"oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "48b4175dbca8439d30c1f52231cbe5a712c8f9d9" },
|
||||
"rose-pine": { "branch": "main", "commit": "cf2a288696b03d0934da713d66c6d71557b5c997" },
|
||||
"showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||
"solarized-osaka.nvim": { "branch": "main", "commit": "f0c2f0ba0bd56108d53c9bfae4bb28ff6c67bbdb" },
|
||||
"tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
||||
"telescope-themes": { "branch": "main", "commit": "65721365bd7a04a6c9679e76b6387b60320fd5f3" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "ad7d9580338354ccc136e5b8f0aa4f880434dcdc" },
|
||||
|
||||
@ -1 +1 @@
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
vim.cmd("colorscheme rose-pine-moon")
|
||||
@ -9,9 +9,9 @@ local M = {}
|
||||
M.general = {
|
||||
n = {
|
||||
["<C-h>"] = { "<cmd> TmuxNavigateLeft<CR>", "window left"},
|
||||
["<C-h>"] = { "<cmd> TmuxNavigateRight<CR>", "window right"},
|
||||
["<C-h>"] = { "<md> TmuxNavigateDown<CR>", "window down"},
|
||||
["<C-h>"] = { "<cmd> TmuxNavigateUp<CR>", "window up"},
|
||||
["<C-l>"] = { "<cmd> TmuxNavigateRight<CR>", "window right"},
|
||||
["<C-j>"] = { "<md> TmuxNavigateDown<CR>", "window down"},
|
||||
["<C-k>"] = { "<cmd> TmuxNavigateUp<CR>", "window up"},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "themenacesauce.plugins" },
|
||||
{ import = "themenacesauce.plugins.lsp" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
|
||||
8
lua/themenacesauce/plugins/emmet.lua
Normal file
8
lua/themenacesauce/plugins/emmet.lua
Normal file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
-- here only for wrapping html tags
|
||||
-- emmet_ls is alread installed in mason
|
||||
"olrtg/nvim-emmet",
|
||||
config = function()
|
||||
vim.keymap.set({ "n", "v" }, '<leader>xe', require('nvim-emmet').wrap_with_abbreviation)
|
||||
end,
|
||||
}
|
||||
70
lua/themenacesauce/plugins/formatting.lua
Normal file
70
lua/themenacesauce/plugins/formatting.lua
Normal file
@ -0,0 +1,70 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function ()
|
||||
local conform = require("conform")
|
||||
|
||||
conform.setup({
|
||||
formatters = {
|
||||
["markdown-toc"] = {
|
||||
condition = function(_, ctx)
|
||||
for _, line in ipairs(vim.api.nvim_get_buf_lines(ctx.buf, 0, -1, false)) do
|
||||
if line:find("<!%-%- toc %-%->") then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
["markdownlint-cli2"] = {
|
||||
condition = function(_, ctx)
|
||||
local diag = vim.tbl_filter(function(d)
|
||||
return d.source == "markdownlint"
|
||||
end, vim.diagnostic.get(ctx.buf))
|
||||
return #diag > 0
|
||||
end,
|
||||
},
|
||||
},
|
||||
formatters_by_ft = {
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
svelte = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
-- markdown = { "prettier" },
|
||||
graphql = { "prettier" },
|
||||
liquid = { "prettier" },
|
||||
lua = { "stylus" },
|
||||
python = { "black" },
|
||||
markdown = { "prettier" },
|
||||
["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
--Configure individual formatters
|
||||
conform.formatters.prettier = {
|
||||
args = {
|
||||
"--stdin-filepath",
|
||||
"$FILENAME",
|
||||
"--tab-width",
|
||||
"4",
|
||||
"--use-tabs",
|
||||
"false",
|
||||
},
|
||||
}
|
||||
conform.formatters.shfmt = {
|
||||
prepend_args = { "-i", "4" }
|
||||
}
|
||||
vim.keymap.set({ "n", "v"}, "<leader>mp", function()
|
||||
conform.format({
|
||||
lsp_fallback = true,
|
||||
async = false,
|
||||
timeout_ms = 1000,
|
||||
})
|
||||
end, { desc = " Prettier Format whole file or range (in visual mode) with" })
|
||||
end
|
||||
}
|
||||
@ -38,7 +38,9 @@ return {
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = package.loaded.gitsigns
|
||||
local gs = package.loaded.gitsigns
|
||||
|
||||
|
||||
local function map(mode, l, r, desc)
|
||||
vim.keymap.set(mode, l, r, { buffer = bufnr, desc = desc})
|
||||
end
|
||||
@ -46,19 +48,22 @@ return {
|
||||
-- Actions
|
||||
map("n", "<leader>gs", gs.stage_hunk, "Stage hunk")
|
||||
map("n", "<leader>gr", gs.reset_hunk, "Reset hunk")
|
||||
map("v", "<leader>gs", function()
|
||||
|
||||
map("v", "<leader>gs", function() -- stage selected hunk
|
||||
gs.stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "Stage hunk")
|
||||
map("v", "<leader>gr", function()
|
||||
gs.reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||
end, "Reset hunk")
|
||||
|
||||
map("n", "<leader>gS", gs.stage_buffer, "Stage buffer") -- stage whole buffer
|
||||
map("n", "<leader>gR", gs.reset_buffer, "Reset buffer") -- unstage whole buffer
|
||||
|
||||
map("n", "<leader>gu", gs.undo_stage_hunk, "Undo stage hunk")
|
||||
map("n", "<leader<gp", gs.preview_hunk, "Preview hunk")
|
||||
|
||||
map("n", "<leader>gbl", function() gs.blame_line({ full = true }) end, "Blame line")
|
||||
map("n", "<leader>gB", gs.toggle_current_line_blame, "Toggle line blame")
|
||||
map("n", "<leader>gd", gs.diffthis, "Diff this")
|
||||
map("n", "<leader>gD", function() gs.diffthis("~") end, "Diff this ~")
|
||||
|
||||
-- Navigation
|
||||
|
||||
30
lua/themenacesauce/plugins/gitworktree.lua
Normal file
30
lua/themenacesauce/plugins/gitworktree.lua
Normal file
@ -0,0 +1,30 @@
|
||||
return {
|
||||
"ThePrimeagen/git-worktree.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
config = function()
|
||||
local gitworktree = require("git-worktree")
|
||||
|
||||
gitworktree.setup()
|
||||
|
||||
require("telescope").load_extension("git_worktree")
|
||||
|
||||
-- HACK: by default
|
||||
-- <Enter> - switches to that worktree
|
||||
-- <c-d> - deletes that worktree
|
||||
-- <c-f> - toggle forcing of the next deletion
|
||||
|
||||
-- Create new worktree
|
||||
vim.keymap.set("n", "<leader>wl", function()
|
||||
require("telescope").extensions.git_worktree.create_git_worktree()
|
||||
end, { desc = "list Git Worktree" })
|
||||
|
||||
-- Switch/list worktrees
|
||||
vim.keymap.set("n", "<leader>wc", function()
|
||||
require("telescope").extensions.git_worktree.create_git_worktree()
|
||||
end, { desc = "Create Git Worktree Branches" })
|
||||
|
||||
end
|
||||
}
|
||||
46
lua/themenacesauce/plugins/image-support.lua
Normal file
46
lua/themenacesauce/plugins/image-support.lua
Normal file
@ -0,0 +1,46 @@
|
||||
return {
|
||||
"HakonHarnes/img-clip.nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
-- suggested keymap
|
||||
{ "<leader>pi", "<cmd>PasteImage<cr>", desc = "Paste image from system clipboard" },
|
||||
},
|
||||
opts = {
|
||||
default = {
|
||||
insert_mode_after_paste = true,
|
||||
url_encode_path = true,
|
||||
template = "$FILE_PATH",
|
||||
use_cursor_in_template = true,
|
||||
|
||||
prompt_for_file_name = true,
|
||||
show_dir_path_in_prompt = true,
|
||||
|
||||
use_absolute_path = false,
|
||||
relative_to_current_file = true,
|
||||
|
||||
embed_image_as_base64 = false,
|
||||
max_base64_size = 10,
|
||||
|
||||
dir_path = function()
|
||||
local cwd = vim.fn.getcwd()
|
||||
local vault_name = "Alibaba's Vault" -- obsidian vault dir
|
||||
local vault_images_path = "/Documents/Alibaba's Vault/Images/"
|
||||
|
||||
if cwd:match(vault_name) then
|
||||
return vault_images_path
|
||||
else
|
||||
return "assets"
|
||||
end
|
||||
end,
|
||||
|
||||
drag_and_drop = {
|
||||
enabled = true,
|
||||
insert_mode = true,
|
||||
copy_images = true,
|
||||
download_images = true,
|
||||
},
|
||||
},
|
||||
-- add options here
|
||||
-- or leave it empty to use the default settings
|
||||
},
|
||||
}
|
||||
41
lua/themenacesauce/plugins/linting.lua
Normal file
41
lua/themenacesauce/plugins/linting.lua
Normal file
@ -0,0 +1,41 @@
|
||||
return {
|
||||
"mfussenegger/nvim-lint",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
config = function()
|
||||
local lint = require("lint")
|
||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||
local eslint = lint.linters.eslint_d
|
||||
|
||||
-- if Eslint error configuration not found : change MasonInstall eslint@version or npm i -g eslint at a specific version
|
||||
lint.linters_by_ft = {
|
||||
javascript = {"biomejs"},
|
||||
typescript = {"biomejs"},
|
||||
javascriptreact = {"biomejs"},
|
||||
typescriptreact = {"biomejs"},
|
||||
svelte = { "biomejs" },
|
||||
python = { "pylint" },
|
||||
}
|
||||
|
||||
eslint.args = {
|
||||
"--no-warn-ignored",
|
||||
"--format",
|
||||
"json",
|
||||
"--stdin",
|
||||
"--stdin-filename",
|
||||
function()
|
||||
return vim.fn.expand("%:p")
|
||||
end,
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>l", function()
|
||||
lint.try_lint()
|
||||
end, { desc = "Trigger linting for current file" })
|
||||
end,
|
||||
}
|
||||
204
lua/themenacesauce/plugins/lsp/lspconfig.lua
Normal file
204
lua/themenacesauce/plugins/lsp/lspconfig.lua
Normal file
@ -0,0 +1,204 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp", { "antosha417/nvim-lsp-file-operations", config = true },
|
||||
},
|
||||
config = function()
|
||||
-- NOTE: LSP Keybinds
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
-- Buffer local mappings
|
||||
local opts = { buffer = ev.buf, silent = true }
|
||||
|
||||
-- Keymaps
|
||||
opts.desc = "Show LSP references"
|
||||
vim.keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "Go to declaration"
|
||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||
|
||||
opts.desc = "Show LSP definitions"
|
||||
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "Show LSP implementations"
|
||||
vim.keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||
|
||||
opts.desc = "Show LSP type definitions"
|
||||
vim.keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "See available code actions"
|
||||
vim.keymap.set({ "n", "v" }, "<leader>vca", function()
|
||||
vim.lsp.buf.code_action()
|
||||
end, opts)
|
||||
|
||||
opts.desc = "Smart rename"
|
||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||
|
||||
opts.desc = "Show buffer diagnostics"
|
||||
vim.keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
|
||||
|
||||
opts.desc = "Show line diagnostics"
|
||||
vim.keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
|
||||
|
||||
opts.desc = "Show documentation for what is under cursor"
|
||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||
|
||||
opts.desc = "Restart LSP"
|
||||
vim.keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts)
|
||||
|
||||
vim.keymap.set("i", "<C-h>", function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
-- Define sign icons for each severity
|
||||
local signs = {
|
||||
[vim.diagnostic.severity.ERROR] = " ",
|
||||
[vim.diagnostic.severity.WARN] = " ",
|
||||
[vim.diagnostic.severity.HINT] = " ",
|
||||
[vim.diagnostic.severity.INFO] = " ",
|
||||
}
|
||||
|
||||
-- Set diagnostic config
|
||||
vim.diagnostic.config({
|
||||
signs = {
|
||||
text = signs,
|
||||
},
|
||||
virtual_text = true,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
})
|
||||
|
||||
-- Setup servers
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
-- Global LSP settings (applied to all servers)
|
||||
vim.lsp.config('*', {
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Configure and enable LSP servers
|
||||
-- lua_ls
|
||||
vim.lsp.config("lua_ls", {
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- emmet_language_server
|
||||
vim.lsp.config("emmet_language_server", {
|
||||
filetypes = {
|
||||
"css",
|
||||
"eruby",
|
||||
"html",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"less",
|
||||
"sass",
|
||||
"scss",
|
||||
"pug",
|
||||
"typescriptreact",
|
||||
},
|
||||
init_options = {
|
||||
includeLanguages = {},
|
||||
excludeLanguages = {},
|
||||
extensionsPath = {},
|
||||
preferences = {},
|
||||
showAbbreviationSuggestions = true,
|
||||
showExpandedAbbreviation = "always",
|
||||
showSuggestionsAsSnippets = false,
|
||||
syntaxProfiles = {},
|
||||
variables = {},
|
||||
},
|
||||
})
|
||||
|
||||
-- emmet_ls
|
||||
vim.lsp.config("emmet_ls", {
|
||||
filetypes = {
|
||||
"html",
|
||||
"typescriptreact",
|
||||
"javascriptreact",
|
||||
"css",
|
||||
"sass",
|
||||
"scss",
|
||||
"less",
|
||||
"svelte",
|
||||
},
|
||||
})
|
||||
|
||||
-- ts_ls (TypeScript/JavaScript)
|
||||
vim.lsp.config("ts_ls", {
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
},
|
||||
single_file_support = true,
|
||||
init_options = {
|
||||
preferences = {
|
||||
includeCompletionsForModuleExports = true,
|
||||
includeCompletionsForImportStatements = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- gopls
|
||||
vim.lsp.config("gopls", {
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- tailwind
|
||||
vim.lsp.config("tailwindcss", {
|
||||
filetypes = {
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"javascriptreact",
|
||||
"typescriptreact",
|
||||
"svelte",
|
||||
"vue",
|
||||
"astro",
|
||||
},
|
||||
init_options = {
|
||||
userLanguages = {
|
||||
astro = "html",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable("lua_ls")
|
||||
vim.lsp.enable("emmet_language_server")
|
||||
vim.lsp.enable("emmet_ls")
|
||||
vim.lsp.enable("ts_ls")
|
||||
vim.lsp.enable("gopls")
|
||||
vim.lsp.enable("astro")
|
||||
vim.lsp.enable("tailwindcss")
|
||||
end,
|
||||
}
|
||||
62
lua/themenacesauce/plugins/lsp/mason.lua
Normal file
62
lua/themenacesauce/plugins/lsp/mason.lua
Normal file
@ -0,0 +1,62 @@
|
||||
return {
|
||||
"williamboman/mason.nvim",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"neovim/nvim-lspconfig",
|
||||
-- "saghen/blink.cmp",
|
||||
},
|
||||
config = function()
|
||||
-- import mason and mason_lspconfig
|
||||
local mason = require("mason")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local mason_tool_installer = require("mason-tool-installer")
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local capabilites = cmp_nvim_lsp.default_capabilities() -- used to enable autocompletion
|
||||
|
||||
-- enable mason and configure icons
|
||||
mason.setup({
|
||||
ui = {
|
||||
icons = {
|
||||
package_installed = "✓",
|
||||
package_pending = "➜",
|
||||
package_uninstalled = "✗",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
automatic_enable = false,
|
||||
-- servers for mason to install
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
-- "ts_ls" currently us a ts plugin
|
||||
"html",
|
||||
"cssls",
|
||||
"tailwindcss",
|
||||
"gopls",
|
||||
"emmet_ls",
|
||||
"emmet_language_server",
|
||||
-- "eslint",
|
||||
"marksman",
|
||||
},
|
||||
-- auto install configured servers (with lspconfig)
|
||||
})
|
||||
|
||||
mason_tool_installer.setup({
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
"stylua", --
|
||||
"isort",
|
||||
"pylint",
|
||||
"clangd",
|
||||
"denols",
|
||||
-- { 'eslint_d', version = '13.1.2' },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@ -91,7 +91,7 @@ return {
|
||||
only_in_normal_buffers = true,
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "<leader>cw", function() minTrailspace.trim() end, { desc = "Erase Whitespace" })
|
||||
vim.keymap.set("n", "<leader>cw", function() miniTrailspace.trim() end, { desc = "Erase Whitespace" })
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
pattern = "*",
|
||||
|
||||
99
lua/themenacesauce/plugins/noice.lua
Normal file
99
lua/themenacesauce/plugins/noice.lua
Normal file
@ -0,0 +1,99 @@
|
||||
return {
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
enabled = true,
|
||||
dependencies = {
|
||||
-- if you lazy-load any plugin below, make sure to add proper `module="..."` entries
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
config = function ()
|
||||
local noice = require("noice")
|
||||
|
||||
noice.setup({
|
||||
cmdline = {
|
||||
enabled = false,
|
||||
view = "cmdline_popup",
|
||||
format = {
|
||||
cmdline = { pattern = "", icon = " :", lang = "vim" },
|
||||
help = { pattern = "^:%s*he?l?p?%s+", icon = " :" },
|
||||
search_down = { kind = "search", pattern = "^/", icon = "/", lang = "regex" },
|
||||
search_up = { kind = "search", pattern = "^%?", icon = "/", lang = "regex" },
|
||||
filter = { pattern = "^:%s*!", icon = " $ :", lang = "bash" },
|
||||
lua = {
|
||||
pattern = { "^:%s*lua%s+", "^:%s*lua%s*=%s*", "^:%s*=%s*" },
|
||||
icon = " :",
|
||||
lang = "lua",
|
||||
},
|
||||
input = { view = "cmdline_input", icon = " :" }, -- Used by input()
|
||||
},
|
||||
},
|
||||
views = {
|
||||
popupmenu = {
|
||||
relative = "editor",
|
||||
position = {
|
||||
row = 8,
|
||||
col = "50%",
|
||||
},
|
||||
win_options = {
|
||||
winhighlight = { Normal = "Normal", FloatBorder = "DiagnosticInfo" },
|
||||
},
|
||||
},
|
||||
mini = {
|
||||
size = {
|
||||
width = "auto",
|
||||
height = "auto",
|
||||
max_height = 15,
|
||||
},
|
||||
position = {
|
||||
row = -2,
|
||||
col = "100%",
|
||||
},
|
||||
}
|
||||
},
|
||||
lsp = {
|
||||
progress = {
|
||||
enabled = true,
|
||||
},
|
||||
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
|
||||
},
|
||||
signature = {
|
||||
auto_open = { enabled = false }, -- disable auto signature help on insert mode
|
||||
},
|
||||
},
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = 'msg_show',
|
||||
any = {
|
||||
{ find = '%d+L, %d+B' },
|
||||
{ find = '; after #%d+' },
|
||||
{ find = '; before #%d+' },
|
||||
{ find = '%d fewer lines' },
|
||||
{ find = '%d more lines' },
|
||||
},
|
||||
},
|
||||
opts = { skip = true },
|
||||
}
|
||||
},
|
||||
messages = {
|
||||
enabled = false,
|
||||
},
|
||||
health = {
|
||||
checker = true,
|
||||
},
|
||||
popupmenu = {
|
||||
enabled = true,
|
||||
backend = "cmp",
|
||||
},
|
||||
signature = {
|
||||
enabled = true,
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
387
lua/themenacesauce/plugins/nvim-cmp.lua
Normal file
387
lua/themenacesauce/plugins/nvim-cmp.lua
Normal file
@ -0,0 +1,387 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- follow latest release.
|
||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||
-- install jsregexp (optional!),
|
||||
build = "make install_jsregexp",
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip", -- autocompletion
|
||||
"rafamadriz/friendly-snippets", -- snippets
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"onsails/lspkind.nvim", -- vs code pictographs
|
||||
"roobert/tailwindcss-colorizer-cmp.nvim",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local has_luasnip, luasnip = pcall(require, 'luasnip')
|
||||
local lspkind = require("lspkind")
|
||||
local colorizer = require("tailwindcss-colorizer-cmp").formatter
|
||||
|
||||
local rhs = function(keys)
|
||||
return vim.api.nvim_replace_termcodes(keys, true, true, true)
|
||||
end
|
||||
|
||||
local lsp_kinds = {
|
||||
Class = ' ',
|
||||
Color = ' ',
|
||||
Constant = ' ',
|
||||
Constructor = ' ',
|
||||
Enum = ' ',
|
||||
EnumMember = ' ',
|
||||
Event = ' ',
|
||||
Field = ' ',
|
||||
File = ' ',
|
||||
Folder = ' ',
|
||||
Function = ' ',
|
||||
Interface = ' ',
|
||||
Keyword = ' ',
|
||||
Method = ' ',
|
||||
Module = ' ',
|
||||
Operator = ' ',
|
||||
Property = ' ',
|
||||
Reference = ' ',
|
||||
Snippet = ' ',
|
||||
Struct = ' ',
|
||||
Text = ' ',
|
||||
TypeParameter = ' ',
|
||||
Unit = ' ',
|
||||
Value = ' ',
|
||||
Variable = ' ',
|
||||
}
|
||||
|
||||
local column = function()
|
||||
local _line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
return col
|
||||
end
|
||||
|
||||
-- luasnip custom function
|
||||
local in_snippet = function()
|
||||
local session = require('luasnip.session')
|
||||
local node = session.current_nodes[vim.api.nvim_get_current_buf()]
|
||||
if not node then
|
||||
return false
|
||||
end
|
||||
local snippet = node.parent.snippet
|
||||
local snip_begin_pos, snip_end_pos = snippet.mark:pos_begin_end()
|
||||
local pos = vim.api.nvim_win_get_cursor(0)
|
||||
if pos[1] - 1 >= snip_begin_pos[1] and pos[1] - 1 <= snip_end_pos[1] then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- return true if the cursor is in leftmost column or at a whitespace char
|
||||
local in_whitespace = function()
|
||||
local col = column()
|
||||
return col == 0 or vim.api.nvim_get_current_line():sub(col, col):match('%s')
|
||||
end
|
||||
|
||||
local in_leading_indent = function()
|
||||
local col = column()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local prefix = line:sub(1, col)
|
||||
return prefix:find('^%s*$')
|
||||
end
|
||||
|
||||
-- custom shift width
|
||||
local shift_width = function()
|
||||
if vim.o.softtabstop <= 0 then
|
||||
return vim.fn.shiftwidth()
|
||||
else
|
||||
return vim.o.softtabstop
|
||||
end
|
||||
end
|
||||
|
||||
-- custom smart backspace
|
||||
local smart_bs = function(dedent)
|
||||
local keys = nil
|
||||
if vim.o.expandtab then
|
||||
if dedent then
|
||||
keys = rhs('<C-D>')
|
||||
else
|
||||
keys = rhs('<BS>')
|
||||
end
|
||||
else
|
||||
local col = column()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local prefix = line:sub(1, col)
|
||||
if in_leading_indent() then
|
||||
keys = rhs('<BS>')
|
||||
else
|
||||
local previous_char = prefix:sub(#prefix, #prefix)
|
||||
if previous_char ~= ' ' then
|
||||
keys = rhs('<BS>')
|
||||
else
|
||||
keys = rhs('<C-\\><C-o>:set expandtab<CR><BS><C-\\><C-o>:set noexpandtab<CR>')
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.api.nvim_feedkeys(keys, 'nt', true)
|
||||
end
|
||||
|
||||
-- custom smart tabs function
|
||||
local smart_tab = function(opts)
|
||||
local keys = nil
|
||||
if vim.o.expandtab then
|
||||
keys = '<Tab>' -- Neovim will insert spaces.
|
||||
else
|
||||
local col = column()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
local prefix = line:sub(1, col)
|
||||
local in_leading_indent = prefix:find('^%s*$')
|
||||
if in_leading_indent then
|
||||
-- inserts a hard tab.
|
||||
keys = '<Tab>'
|
||||
else
|
||||
local sw = shift_width()
|
||||
local previous_char = prefix:sub(#prefix, #prefix)
|
||||
local current_column = #prefix - #previous_char + 1
|
||||
local remainder = (current_column - 1) % sw
|
||||
local move = remainder == 0 and sw or sw - remainder
|
||||
keys = (' '):rep(move)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_feedkeys(rhs(keys), 'nt', true)
|
||||
end
|
||||
|
||||
local select_next_item = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
|
||||
local select_prev_item = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
|
||||
local confirm = function(entry)
|
||||
local behavior = cmp.ConfirmBehavior.Replace
|
||||
if entry then
|
||||
local completion_item = entry.completion_item
|
||||
local newText = ''
|
||||
if completion_item.textEdit then
|
||||
newText = completion_item.textEdit.newText
|
||||
elseif type(completion_item.insertText) == 'string' and completion_item.insertText ~= '' then
|
||||
newText = completion_item.insertText
|
||||
else
|
||||
newText = completion_item.word or completion_item.label or ''
|
||||
end
|
||||
|
||||
-- checks how many characters will be different after the cursor position if we replace,
|
||||
local diff_after = math.max(0, entry.replace_range['end'].character + 1) - entry.context.cursor.col
|
||||
|
||||
-- does the text that will be replaced after the cursor match the suffix
|
||||
-- of the newText to be inserted ? if not, then Insert instead,
|
||||
if entry.context.cursor_after_line:sub(1, diff_after) ~= newText:sub(-diff_after) then
|
||||
behavior = cmp.ConfirmBehavior.Insert
|
||||
end
|
||||
end
|
||||
cmp.confirm({ select = true, behavior = behavior })
|
||||
end
|
||||
|
||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
experimental = {
|
||||
-- HACK: experimenting with ghost text
|
||||
-- look at `toggle_ghost_text()` function below.
|
||||
ghost_text = false,
|
||||
},
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
window = {
|
||||
documentation = {
|
||||
border = {'╭', '─', '╮', '│', '╯', '─', '╰', '│'},
|
||||
},
|
||||
completion = {
|
||||
border = {'┌', '─', '┐', '│', '┘', '─', '└', '│'},
|
||||
}
|
||||
|
||||
},
|
||||
-- config nvim cmp to work with snippet engine
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- autocompletion sources
|
||||
sources = cmp.config.sources({
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "lazydev" },
|
||||
{ name = "nvim_lsp"},
|
||||
{ name = "buffer" }, -- text within current buffer
|
||||
{ name = "path" }, -- file system paths
|
||||
{ name = "tailwindcss-colorizer-cmp" },
|
||||
{ name = "spell", -- for markdown spellchecks completions
|
||||
option = {
|
||||
enable_in_context = function()
|
||||
local ft = vim.bo.filetype
|
||||
return ft == "markdown" or ft == "text"
|
||||
end,
|
||||
},
|
||||
},
|
||||
}),
|
||||
-- mapping = cmp.mapping.preset.insert({
|
||||
-- ["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||
-- ["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||
-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
-- ["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||
-- ["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
-- ["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||
-- }),
|
||||
|
||||
-- NOTE: ! Experimenting with Customized Mappings ! --
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- ['<BS>'] = cmp.mapping(function(_fallback)
|
||||
-- smart_bs()
|
||||
-- end, { 'i', 's' }),
|
||||
|
||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||
['<C-d>'] = cmp.mapping(function()
|
||||
cmp.close_docs()
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-j>'] = cmp.mapping(select_next_item),
|
||||
['<C-k>'] = cmp.mapping(select_prev_item),
|
||||
['<C-n>'] = cmp.mapping(select_next_item),
|
||||
['<C-p>'] = cmp.mapping(select_prev_item),
|
||||
['<Down>'] = cmp.mapping(select_next_item),
|
||||
['<Up>'] = cmp.mapping(select_prev_item),
|
||||
|
||||
['<C-y>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
local entry = cmp.get_selected_entry()
|
||||
confirm(entry)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<CR>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
local entry = cmp.get_selected_entry()
|
||||
confirm(entry)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif has_luasnip and in_snippet() and luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
elseif in_leading_indent() then
|
||||
smart_bs(true) -- true means to dedent
|
||||
elseif in_whitespace() then
|
||||
smart_bs()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
|
||||
['<Tab>'] = cmp.mapping(function(_fallback)
|
||||
if cmp.visible() then
|
||||
-- if there is only one completion candidate then use it.
|
||||
local entries = cmp.get_entries()
|
||||
if #entries == 1 then
|
||||
confirm(entries[1])
|
||||
else
|
||||
cmp.select_next_item()
|
||||
end
|
||||
elseif has_luasnip and luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif in_whitespace() then
|
||||
smart_tab()
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
-- setup lspkind for vscode pictograms in autocompletion dropdown menu
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
-- Add custom lsp_kinds icons
|
||||
vim_item.kind = string.format('%s %s', lsp_kinds[vim_item.kind] or '', vim_item.kind)
|
||||
|
||||
|
||||
-- add menu tags (e.g., [Buffer], [LSP])
|
||||
vim_item.menu = ({
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
luasnip = "[LuaSnip]",
|
||||
nvim_lua = "[Lua]",
|
||||
latex_symbols = "[LaTeX]",
|
||||
})[entry.source.name]
|
||||
|
||||
-- use lspkind and tailwindcss-colorizer-cmp for additional formatting
|
||||
vim_item = lspkind.cmp_format({
|
||||
maxwidth = 25,
|
||||
ellipsis_char = "...",
|
||||
})(entry, vim_item)
|
||||
|
||||
if entry.source.name == "nvim_lsp" then
|
||||
vim_item = colorizer(entry, vim_item)
|
||||
end
|
||||
|
||||
return vim_item
|
||||
end,
|
||||
-- format = lspkind.cmp_format({
|
||||
-- maxwidth = 30,
|
||||
-- ellipsis_char = "...",
|
||||
-- before = require("tailwindcss-colorizer-cmp").formatter
|
||||
-- }),
|
||||
-- format = require("tailwindcss-colorizer-cmp").formatter
|
||||
},
|
||||
})
|
||||
|
||||
-- NOTE: Added Ghost text stuff
|
||||
-- Only show ghost text at word boundaries, not inside keywords. Based on idea
|
||||
-- from: https://github.com/hrsh7th/nvim-cmp/issues/2035#issuecomment-2347186210
|
||||
|
||||
-- local config = require('cmp.config')
|
||||
-- local toggle_ghost_text = function()
|
||||
-- if vim.api.nvim_get_mode().mode ~= 'i' then
|
||||
-- return
|
||||
-- end
|
||||
--
|
||||
-- local cursor_column = vim.fn.col('.')
|
||||
-- local current_line_contents = vim.fn.getline('.')
|
||||
-- local character_after_cursor = current_line_contents:sub(cursor_column, cursor_column)
|
||||
--
|
||||
-- local should_enable_ghost_text = character_after_cursor == '' or vim.fn.match(character_after_cursor, [[\k]]) == -1
|
||||
--
|
||||
-- local current = config.get().experimental.ghost_text
|
||||
-- if current ~= should_enable_ghost_text then
|
||||
-- config.set_global({
|
||||
-- experimental = {
|
||||
-- ghost_text = should_enable_ghost_text,
|
||||
-- },
|
||||
-- })
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ 'InsertEnter', 'CursorMovedI' }, {
|
||||
-- callback = toggle_ghost_text,
|
||||
-- })
|
||||
-- ! Ghost text stuff ! --
|
||||
|
||||
|
||||
end
|
||||
}
|
||||
30
lua/themenacesauce/plugins/nvim-ufo.lua
Normal file
30
lua/themenacesauce/plugins/nvim-ufo.lua
Normal file
@ -0,0 +1,30 @@
|
||||
return {
|
||||
-- Setup folding with nvim-ufo
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
dependencies = {
|
||||
"kevinhwang91/promise-async",
|
||||
},
|
||||
config = function()
|
||||
require("ufo").setup({
|
||||
-- tresitter not required
|
||||
-- ufo uses the same query files for folding (queries/<lang>/folds.scm)
|
||||
-- performance aand stability are better than 'foldmethod=nvim_treesitter#foldexpr()'-
|
||||
provider_selector = function(_,_,_)
|
||||
return { "treesitter", "indent" }
|
||||
end,
|
||||
open_fold_hl_timeout = 0, -- Disable highlight timeout after opening
|
||||
})
|
||||
|
||||
vim.o.foldenable = true
|
||||
vim.o.foldcolumn = '0'
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
|
||||
|
||||
vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
|
||||
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
|
||||
|
||||
end
|
||||
}
|
||||
}
|
||||
96
lua/themenacesauce/plugins/render-markdown.lua
Normal file
96
lua/themenacesauce/plugins/render-markdown.lua
Normal file
@ -0,0 +1,96 @@
|
||||
return {
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
enabled = true,
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
---@module 'render-markdown'
|
||||
ft = { "markdown", "norg", "rmd", "org" },
|
||||
init = function()
|
||||
-- Define colors
|
||||
local color1_bg = "#ff757f"
|
||||
local color2_bg = "#4fd6be"
|
||||
local color3_bg = "#7dcfff"
|
||||
local color4_bg = "#ff9e64"
|
||||
local color5_bg = "#7aa2f7"
|
||||
local color6_bg = "#c0caf5"
|
||||
local color_fg = "#1F2335"
|
||||
|
||||
-- Heading background
|
||||
-- vim.cmd(string.format([[highlight Headline1Bg guifg=%s guibg=%s gui=bold]], color_fg, color1_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline2Bg guifg=%s guibg=%s gui=bold]], color_fg, color2_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline3Bg guifg=%s guibg=%s gui=bold]], color_fg, color3_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline4Bg guifg=%s guibg=%s gui=bold]], color_fg, color4_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline5Bg guifg=%s guibg=%s gui=bold]], color_fg, color5_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline6Bg guifg=%s guibg=%s gui=bold]], color_fg, color6_bg))
|
||||
|
||||
-- Heading fg
|
||||
-- vim.cmd(string.format([[highlight Headline1Fg guifg=%s gui=bold]], colors.color1_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline2Fg guifg=%s gui=bold]], colors.color2_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline3Fg guifg=%s gui=bold]], colors.color3_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline4Fg guifg=%s gui=bold]], colors.color4_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline5Fg guifg=%s gui=bold]], colors.color5_bg))
|
||||
-- vim.cmd(string.format([[highlight Headline6Fg guifg=%s gui=bold]], colors.color6_bg))
|
||||
|
||||
-- force treesitter highlighting for markdown buffers
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
vim.treesitter.start()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
restart_highlighter = true,
|
||||
heading = {
|
||||
sign = false,
|
||||
icons = { " ", " ", " ", " ", " ", " " },
|
||||
backgrounds = {
|
||||
"Headline1Bg",
|
||||
"Headline2Bg",
|
||||
"Headline3Bg",
|
||||
"Headline4Bg",
|
||||
"Headline5Bg",
|
||||
"Headline6Bg",
|
||||
},
|
||||
foregrounds = {
|
||||
"Headline1Fg",
|
||||
"Headline2Fg",
|
||||
"Headline3Fg",
|
||||
"Headline4Fg",
|
||||
"Headline5Fg",
|
||||
"Headline6Fg",
|
||||
},
|
||||
},
|
||||
code = {
|
||||
sign = false,
|
||||
width = "block",
|
||||
right_pad = 1,
|
||||
},
|
||||
bullet = {
|
||||
-- Turn on / off list bullet rendering
|
||||
enabled = true,
|
||||
},
|
||||
checkbox = {
|
||||
-- Turn on / off checkbox state rendering
|
||||
enabled = true,
|
||||
unchecked = {
|
||||
-- Replaces '[ ]' of 'task_list_marker_unchecked'
|
||||
icon = " ",
|
||||
-- Highlight for the unchecked icon
|
||||
highlight = "RenderMarkdownUnchecked",
|
||||
-- Highlight for item associated with unchecked checkbox
|
||||
scope_highlight = nil,
|
||||
},
|
||||
checked = {
|
||||
-- Replaces '[x]' of 'task_list_marker_checked'
|
||||
icon = " ",
|
||||
-- Highlight for the checked icon
|
||||
highlight = "RenderMarkdownChecked",
|
||||
-- Highlight for item associated with checked checkbox
|
||||
scope_highlight = nil,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
28
lua/themenacesauce/plugins/tailwind-tools.lua
Normal file
28
lua/themenacesauce/plugins/tailwind-tools.lua
Normal file
@ -0,0 +1,28 @@
|
||||
return {
|
||||
"roobert/tailwindcss-colorizer-cmp.nvim",
|
||||
{
|
||||
"NvChad/nvim-colorizer.lua",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {},
|
||||
config = function()
|
||||
local nvchadcolorizer = require("colorizer")
|
||||
local tailwindcolorizer = require("tailwindcss-colorizer-cmp")
|
||||
|
||||
nvchadcolorizer.setup({
|
||||
user_default_options = {
|
||||
tailwind = true,
|
||||
},
|
||||
filetypes = { "html", "css", "javascript", "typescript", "jsx", "tsx", "vue", "svelte" },
|
||||
})
|
||||
tailwindcolorizer.setup({
|
||||
color_square_width = 2,
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "BufReadPost", "BufNewFile" }, {
|
||||
callback = function()
|
||||
vim.cmd("ColorizerAttachToBuffer")
|
||||
end,
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
20
lua/themenacesauce/plugins/test.md
Normal file
20
lua/themenacesauce/plugins/test.md
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
##
|
||||
###
|
||||
####
|
||||
#####
|
||||
|
||||
- a
|
||||
- b
|
||||
|
||||
kksfl;jd;ljsfdl;kjsdfl;lsa;jfl;sajflk;sjdfkljsd;fjl;asfjklsajfdl;sjf;lf;klasjfklsjfl;sf
|
||||
|
||||
fdsjf;lksjfdl;skdfsklfjdfslkhghjeiuytc,.cmkl;jcxvl;ixujvidsuf;e;kwj;lkjgioygifuhm
|
||||
|
||||
- [x] amazing
|
||||
Loading…
Reference in New Issue
Block a user