Initial commit
This commit is contained in:
104
home/apps/nvim/lua/plugins/colors.lua
Normal file
104
home/apps/nvim/lua/plugins/colors.lua
Normal file
@@ -0,0 +1,104 @@
|
||||
return {
|
||||
{
|
||||
"rebelot/kanagawa.nvim",
|
||||
lazy = false,
|
||||
priority = 1024,
|
||||
config = function()
|
||||
local transparent = true
|
||||
if vim.g.neovide then
|
||||
transparent = false
|
||||
end
|
||||
local color_overrides = {}
|
||||
if transparent then
|
||||
color_overrides = { theme = { all = { ui = { bg_gutter = "NONE" } } } }
|
||||
end
|
||||
require("kanagawa").setup({
|
||||
transparent = transparent,
|
||||
compile = false,
|
||||
undercurl = false,
|
||||
commentStyle = { italic = false, bold = false },
|
||||
keywordStyle = { italic = false, bold = false },
|
||||
statementStyle = { italic = false, bold = false },
|
||||
colors = color_overrides,
|
||||
overrides = function(colors)
|
||||
return {
|
||||
["Boolean"] = { bold = false },
|
||||
["Todo"] = { bold = false },
|
||||
["@variable.builtin"] = { italic = false },
|
||||
["@string.escape"] = { bold = false },
|
||||
["@keyword.operator"] = { bold = false },
|
||||
["@comment.error"] = { bold = false },
|
||||
["@comment.warning"] = { bold = false },
|
||||
["@comment.note"] = { bold = false },
|
||||
["Conceal"] = { bold = false },
|
||||
["CursorLineNr"] = { bold = false },
|
||||
["CurSearch"] = { bold = false },
|
||||
["MatchParen"] = { bold = false },
|
||||
["ModeMsg"] = { bold = false },
|
||||
["FloatTitle"] = { bold = false },
|
||||
["Title"] = { bold = false },
|
||||
["LinePad"] = { fg = colors.theme.ui.nontext, bg = colors.theme.ui.bg_gutter },
|
||||
["FloatBorder"] = { fg = colors.theme.ui.float.fg_border, bg = not transparent and colors.theme.ui.bg or "NONE" },
|
||||
["CmdlineCommand"] = { fg = colors.theme.diag.warning, bg = colors.theme.ui.bg },
|
||||
["Pmenu"] = { bg = colors.theme.ui.bg_m3 },
|
||||
["PmenuSbar"] = { bg = colors.theme.ui.bg_m1 },
|
||||
["PmenuThumb"] = { bg = colors.theme.term[9] },
|
||||
["PmenuSel"] = { bg = colors.theme.bg_visual },
|
||||
["NormalFloat"] = { bg = not transparent and colors.theme.ui.float.bg or "NONE" },
|
||||
["Whitespace"] = { fg = "#606060" },
|
||||
["NonText"] = { fg = "#606060" },
|
||||
-- Markdown
|
||||
["RenderMarkdownUnchecked"] = { fg = "#54546d" },
|
||||
["RenderMarkdownChecked"] = { fg = "#54546D" },
|
||||
["RenderMarkdownWip"] = { fg = "#7FB4CA" },
|
||||
["RenderMarkdownCanceled"] = { fg = "#54546D" },
|
||||
["RenderMarkdownImportant"] = { fg = "#FFA066" },
|
||||
["RenderMarkdownUnknown"] = { fg = "#727169" },
|
||||
["RenderMarkdownIdea"] = { fg = "#FFA066" },
|
||||
["RenderMarkdownStar"] = { fg = "#FFA066" },
|
||||
["RenderMarkdownPositive"] = { link = "@diff.plus" },
|
||||
["RenderMarkdownNegative"] = { link = "@diff.minus" },
|
||||
["RenderMarkdownCheckedScope"] = { fg = "#54546D", strikethrough = true },
|
||||
["RenderMarkdownH1"] = { fg = "#957FB8", bg = "#2A2A37" },
|
||||
["RenderMarkdownH1Bg"] = { fg = "#957FB8", bg = "#2A2A37" },
|
||||
["RenderMarkdownH2"] = { fg = "#98BB6C", bg = "#2A2A37" },
|
||||
["RenderMarkdownH2Bg"] = { fg = "#98BB6C", bg = "#2A2A37" },
|
||||
["RenderMarkdownH3"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH3Bg"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH4"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH4Bg"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH5"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH5Bg"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH6"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownH6Bg"] = { fg = "#7FB4CA", bg = "#2A2A37" },
|
||||
["RenderMarkdownCode"] = { bg = "#24252D" },
|
||||
["RenderMarkdownCodeInline"] = { bg = "#24252D" },
|
||||
}
|
||||
end,
|
||||
})
|
||||
local termcolors = {
|
||||
"#282A2E",
|
||||
"#A54242",
|
||||
"#8C9440",
|
||||
"#DE935F",
|
||||
"#5F819D",
|
||||
"#85678F",
|
||||
"#5E8D87",
|
||||
"#707880",
|
||||
"#373B41",
|
||||
"#FF5555",
|
||||
"#B5BD68",
|
||||
"#F0C674",
|
||||
"#81A2BE",
|
||||
"#B294BB",
|
||||
"#8ABEB7",
|
||||
"#C5C8C6",
|
||||
}
|
||||
vim.cmd("colorscheme kanagawa-wave")
|
||||
for i, color in ipairs(termcolors) do
|
||||
vim.g["terminal_color_" .. i - 1] = color
|
||||
end
|
||||
vim.api.nvim_set_hl(0, "ExchangeRegion", { link = "CursorLine" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
107
home/apps/nvim/lua/plugins/editing.lua
Normal file
107
home/apps/nvim/lua/plugins/editing.lua
Normal file
@@ -0,0 +1,107 @@
|
||||
return {
|
||||
{
|
||||
name = "scripter",
|
||||
dir = vim.fn.stdpath("config") .. "/lua/scripter",
|
||||
keys = {
|
||||
{ "<leader>ss", desc = "Reset Scripter" },
|
||||
{ "<leader>sr", desc = "Temporarily Set Scripter to Cyrillic" },
|
||||
{ "<leader>sR", desc = "Set Scripter to Cyrillic" },
|
||||
},
|
||||
config = function()
|
||||
local scripter = require("scripter")
|
||||
local presets = require("scripter.presets")
|
||||
scripter.setup({
|
||||
consume = false,
|
||||
})
|
||||
vim.keymap.set("n", "<leader>ss", scripter.mapping.set_script({}))
|
||||
vim.keymap.set("n", "<leader>sr", scripter.mapping.set_script(presets.cyrillic, true))
|
||||
vim.keymap.set("n", "<leader>sR", scripter.mapping.set_script(presets.cyrillic, false))
|
||||
vim.keymap.set("i", "<bs>", function()
|
||||
scripter.reset()
|
||||
vim.api.nvim_feedkeys("\b", "n", false);
|
||||
end)
|
||||
end
|
||||
},
|
||||
{
|
||||
name = "multiline",
|
||||
dir = vim.fn.stdpath("config") .. "/lua/multiline",
|
||||
keys = {
|
||||
{ "<C-n>", desc = "Surround with newlines" },
|
||||
{ "o", desc = "Begin a new line below" },
|
||||
{ "O", desc = "Begin a new line above" },
|
||||
{ "yo", desc = "Begin a new line below and repeat it [count] times" },
|
||||
{ "yO", desc = "Begin a new line above and repeat it [count] times" },
|
||||
{ "<C-n>d", desc = "Remove newline surround" },
|
||||
{ "<C-n>D", desc = "Remove all newline surround" },
|
||||
{ "<C-n>f", desc = "Set newline surround" },
|
||||
{ "<C-n>b", desc = "Break selection into a new line" },
|
||||
},
|
||||
config = function()
|
||||
local multiline = require("multiline")
|
||||
multiline.setup({})
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<C-n>", multiline.surround_newlines(""), {})
|
||||
vim.keymap.set("n", "o", multiline.next_surround("\"_S"), {})
|
||||
vim.keymap.set("n", "O", multiline.prev_surround("\"_S"), {})
|
||||
vim.keymap.set("n", "yo", "o")
|
||||
vim.keymap.set("n", "yO", "O")
|
||||
vim.keymap.set("n", "<C-n>d", multiline.remove_surround, {})
|
||||
vim.keymap.set("n", "<C-n>D", multiline.remove_all_surround, {})
|
||||
vim.keymap.set("n", "<C-n>f", multiline.set_surround, {})
|
||||
vim.keymap.set("v", "<C-n>b", multiline.break_into_lines, {})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"tommcdo/vim-exchange",
|
||||
keys = {
|
||||
{ "cxx", desc = "Exchange line" },
|
||||
{ "cx", desc = "Exchange motion" },
|
||||
{ "X", desc = "Exchange selection" },
|
||||
{ "cxc", desc = "Clear exchange" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"echasnovski/mini.surround",
|
||||
keys = {
|
||||
{ "ss", desc = "Surround: Add", mode = { "n", "v" } },
|
||||
{ "sd", desc = "Surround: Delete" },
|
||||
{ "sf", desc = "Surround: Find (right)" },
|
||||
{ "sF", desc = "Surround: Find (left)" },
|
||||
{ "sr", desc = "Surround: Replace" },
|
||||
},
|
||||
opts = {
|
||||
mappings = {
|
||||
add = "ss",
|
||||
delete = "sd",
|
||||
find = "sf",
|
||||
find_left = "sF",
|
||||
highlight = "",
|
||||
replace = "sr",
|
||||
update_n_lines = "sn",
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"nmac427/guess-indent.nvim",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<leader>gi", "<cmd>GuessIndent<cr>", "Guess Indentation" },
|
||||
},
|
||||
opts = {
|
||||
auto_cmd = true,
|
||||
on_tab_options = {
|
||||
["expandtab"] = false,
|
||||
},
|
||||
on_space_options = {
|
||||
["expandtab"] = true,
|
||||
["tabstop"] = "detected",
|
||||
["shiftwidth"] = "detected",
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
217
home/apps/nvim/lua/plugins/lsp.lua
Normal file
217
home/apps/nvim/lua/plugins/lsp.lua
Normal file
@@ -0,0 +1,217 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {},
|
||||
build = ":TSUpdate",
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<leader>w", "<cmd>Format<cr>", desc = "Format" },
|
||||
{ "<leader>W", "<cmd>Format<cr><cmd>write<cr>", desc = "Format & Write" },
|
||||
},
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
-- TODO: Gotta make this into an quick toggle
|
||||
|
||||
-- vim.api.nvim_create_autocmd("LspAttach", {
|
||||
-- callback = function(args)
|
||||
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
--
|
||||
-- if client and client.server_capabilities.inlayHintProvider then
|
||||
-- vim.lsp.inlay_hint.enable(true, { bufnr = args.buf })
|
||||
-- end
|
||||
-- end
|
||||
-- })
|
||||
require("lspconfig").lua_ls.setup({
|
||||
on_init = function(client)
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = { version = "LuaJIT" },
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = { vim.env.VIMRUNTIME },
|
||||
},
|
||||
})
|
||||
end,
|
||||
settings = { Lua = {} },
|
||||
capabilities = capabilities,
|
||||
})
|
||||
local lsp_servers = {
|
||||
"rust_analyzer",
|
||||
"clangd",
|
||||
"pylsp",
|
||||
"marksman",
|
||||
"taplo",
|
||||
"zls",
|
||||
"ts_ls",
|
||||
"gopls",
|
||||
"texlab",
|
||||
"qmlls",
|
||||
}
|
||||
local lsp_config = require("lspconfig")
|
||||
for _, lsp_server in ipairs(lsp_servers) do
|
||||
lsp_config[lsp_server].setup({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
end
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
||||
callback = function(ev)
|
||||
vim.api.nvim_buf_create_user_command(ev.buf, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
end
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
"hrsh7th/cmp-emoji",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local kinds = {
|
||||
Field = { " Field", "Identifier" },
|
||||
Class = { " Type", "Type" },
|
||||
Variable = { " Variable", "Statement" },
|
||||
Method = { " Method", "Function" },
|
||||
Function = { " Function", "Function" },
|
||||
Enum = { " Enum", "Boolean" },
|
||||
Keyword = { " Keyword", "Keyword" },
|
||||
Constant = { " Const", "Boolean" },
|
||||
Struct = { " Struct", "Type" },
|
||||
Interface = { " Trait", "Type" },
|
||||
Module = { " Module", "Statement" },
|
||||
EnumMember = { " Value", "Boolean" },
|
||||
File = { " File", "Statement" },
|
||||
Snippet = { " Snippet", "Keyword" },
|
||||
Value = { " Value", "Number" },
|
||||
Property = { " Field", "Identifier" },
|
||||
Reference = { " Reference", "Statement" },
|
||||
Text = { " Text", "String" },
|
||||
Folder = { " Folder", "Statement" },
|
||||
-- Left as an exercise to the reader
|
||||
-- Constructor = "",
|
||||
-- Unit = "",
|
||||
-- Color = "",
|
||||
-- Event = "",
|
||||
-- Operator = "",
|
||||
-- TypeParameter = "",
|
||||
}
|
||||
for kind, link in pairs(kinds) do
|
||||
vim.api.nvim_set_hl(0, "CmpItemKind" .. kind, { link = link[2] })
|
||||
end
|
||||
local omnicomplete = function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.mapping.confirm({ select = true })(fallback)
|
||||
else
|
||||
cmp.mapping.complete()(fallback)
|
||||
end
|
||||
end
|
||||
local formatting = {
|
||||
format = function(_, vim_item)
|
||||
local custom = kinds[vim_item.kind]
|
||||
if custom then
|
||||
vim_item.kind = string.format("%-12s", custom[1])
|
||||
else
|
||||
vim_item.kind = string.format("%-12s", vim_item.kind)
|
||||
end
|
||||
if vim_item.abbr then
|
||||
local content = vim_item.abbr
|
||||
local fixed_width = 32
|
||||
if #content > fixed_width then
|
||||
local ellipsis = ""
|
||||
vim_item.abbr = " " .. vim.fn.strcharpart(content, 0, fixed_width - 1) .. ellipsis
|
||||
else
|
||||
vim_item.abbr = " " .. string.format("%-32s", content)
|
||||
end
|
||||
end
|
||||
vim_item.menu = ""
|
||||
return vim_item
|
||||
end,
|
||||
fields = {
|
||||
"abbr",
|
||||
"kind",
|
||||
},
|
||||
}
|
||||
local mapping = ({
|
||||
-- QWERTY mappings
|
||||
["<C-h>"] = { i = omnicomplete, c = omnicomplete },
|
||||
["<C-j>"] = { i = cmp.mapping.select_next_item(), c = cmp.mapping.select_next_item() },
|
||||
["<C-k>"] = { i = cmp.mapping.select_prev_item(), c = cmp.mapping.select_prev_item() },
|
||||
["<C-l>"] = { i = cmp.mapping.abort(), c = cmp.mapping.abort() },
|
||||
["<A-j>"] = { i = cmp.mapping.scroll_docs(6), c = cmp.mapping.scroll_docs(6) },
|
||||
["<A-k>"] = { i = cmp.mapping.scroll_docs(-6), c = cmp.mapping.scroll_docs(-6) },
|
||||
-- Colemak mappings
|
||||
["<C-n>"] = { i = omnicomplete, c = omnicomplete },
|
||||
["<C-e>"] = { i = cmp.mapping.select_next_item(), c = cmp.mapping.select_next_item() },
|
||||
["<C-i>"] = { i = cmp.mapping.select_prev_item(), c = cmp.mapping.select_prev_item() },
|
||||
["<C-o>"] = { i = cmp.mapping.abort(), c = cmp.mapping.abort() },
|
||||
["<A-e>"] = { i = cmp.mapping.scroll_docs(6), c = cmp.mapping.scroll_docs(6) },
|
||||
["<A-i>"] = { i = cmp.mapping.scroll_docs(-6), c = cmp.mapping.scroll_docs(-6) },
|
||||
})
|
||||
local window = {
|
||||
completion = {
|
||||
side_padding = 0,
|
||||
},
|
||||
documentation = {
|
||||
max_width = 64,
|
||||
max_height = 16,
|
||||
},
|
||||
}
|
||||
cmp.setup({
|
||||
-- completion = {
|
||||
-- autocomplete = true,
|
||||
-- completeopt = "menu,menuone",
|
||||
-- },
|
||||
formatting = formatting,
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
sources = cmp.config.sources({
|
||||
-- FIXME: Suggestion sorting is bogus;
|
||||
-- All the useful suggestions are at the bottom
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
{ name = "buffer" },
|
||||
{ name = "render-markdown" },
|
||||
{ name = "emoji" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
mapping = mapping,
|
||||
window = window,
|
||||
})
|
||||
cmp.setup.cmdline("/", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
mapping = mapping,
|
||||
})
|
||||
cmp.setup.cmdline(":", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{
|
||||
name = 'cmdline',
|
||||
option = { ignore_cmds = { 'Man', '!' } }
|
||||
},
|
||||
}),
|
||||
mapping = mapping,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
71
home/apps/nvim/lua/plugins/lualine.lua
Normal file
71
home/apps/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,71 @@
|
||||
local lualine_pad = {
|
||||
"",
|
||||
separator = { left = "", right = "" },
|
||||
padding = 0,
|
||||
color = "Normal",
|
||||
fmt = function(input, context)
|
||||
local winnr = vim.fn.tabpagewinnr(context.tabnr)
|
||||
return string.rep("⠀", require("winpad").get_pad_size(winnr)) .. input
|
||||
end
|
||||
}
|
||||
return {
|
||||
{
|
||||
"letieu/harpoon-lualine",
|
||||
dependencies = {
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"winpad",
|
||||
"letieu/harpoon-lualine",
|
||||
},
|
||||
config = true,
|
||||
opts = {
|
||||
options = {
|
||||
theme = "auto",
|
||||
refresh = { statusline = 1000, tabline = 1000, winbar = 1000 },
|
||||
section_separators = { left = "▌", right = "▐" },
|
||||
component_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
lualine_pad,
|
||||
{
|
||||
"mode",
|
||||
separator = { left = "" },
|
||||
},
|
||||
},
|
||||
lualine_b = { "filename", "diff" },
|
||||
lualine_c = {},
|
||||
lualine_x = {
|
||||
{
|
||||
"harpoon2",
|
||||
icon = "",
|
||||
indicators = { "1", "2", "3", "4", "5" },
|
||||
active_indicators = { "1", "2", "3", "4", "5" },
|
||||
color = { fg = "#a0a0c0" },
|
||||
color_active = { fg = "#fc6346" },
|
||||
},
|
||||
-- It's him! The legendary cat2!
|
||||
{ function() return "🐈" end }, "diagnostics"
|
||||
},
|
||||
lualine_y = { "branch" },
|
||||
lualine_z = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = { lualine_pad },
|
||||
lualine_b = { "filename" },
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = { function() return "👀" end },
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
31
home/apps/nvim/lua/plugins/markdown.lua
Normal file
31
home/apps/nvim/lua/plugins/markdown.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
return {
|
||||
"MeanderingProgrammer/render-markdown.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
checkbox = {
|
||||
position = "inline",
|
||||
unchecked = {
|
||||
icon = " [ ]",
|
||||
},
|
||||
checked = {
|
||||
icon = " []",
|
||||
scope_highlight = "RenderMarkdownCheckedScope",
|
||||
},
|
||||
custom = {
|
||||
in_progress = { raw = "[/]", rendered = " []", highlight = "RenderMarkdownWip", scope_highlight = nil },
|
||||
todo = { raw = "[-]", rendered = " []", highlight = "RenderMarkdownCanceled", scope_highlight = "RenderMarkdownCheckedScope" },
|
||||
important = { raw = "[!]", rendered = " []", highlight = "RenderMarkdownImportant", scope_highlight = nil },
|
||||
unknown = { raw = "[?]", rendered = " []", highlight = "RenderMarkdownUnknown", scope_highlight = nil },
|
||||
idea = { raw = "[@]", rendered = " []", highlight = "RenderMarkdownIdea", scope_highlight = nil },
|
||||
starred = { raw = "[*]", rendered = " []", highlight = "RenderMarkdownStar", scope_highlight = nil },
|
||||
positive = { raw = "[+]", rendered = " [+]", highlight = "RenderMarkdownPositive", scope_highlight = nil },
|
||||
negative = { raw = "[=]", rendered = " [-]", highlight = "RenderMarkdownNegative", scope_highlight = nil },
|
||||
},
|
||||
},
|
||||
code = {
|
||||
above = "█",
|
||||
below = "█",
|
||||
inline_pad = 1,
|
||||
},
|
||||
},
|
||||
}
|
||||
175
home/apps/nvim/lua/plugins/misc.lua
Normal file
175
home/apps/nvim/lua/plugins/misc.lua
Normal file
@@ -0,0 +1,175 @@
|
||||
return {
|
||||
{
|
||||
"akinsho/toggleterm.nvim",
|
||||
keys = {
|
||||
{ "<C-Space>", desc = "Toggle Terminal" },
|
||||
{ "<leader>mr", "<cmd>TermExec cmd=\"make run\"<cr>", desc = "Make (run)" },
|
||||
{ "<leader>mb", "<cmd>TermExec cmd=\"make build\"<cr>", desc = "Make (build)" },
|
||||
{ "<leader>mc", "<cmd>TermExec cmd=\"make clean\"<cr>", desc = "Make (clean)" },
|
||||
{ "<leader>mt", "<cmd>TermExec cmd=\"make test\"<cr>", desc = "Make (test)" },
|
||||
},
|
||||
opts = {
|
||||
autochdir = true,
|
||||
open_mapping = "<C-Space>",
|
||||
direction = "float",
|
||||
shade_terminals = false,
|
||||
float_opts = {
|
||||
border = require("globals").border_chars,
|
||||
},
|
||||
highlights = {
|
||||
["FloatBorder"] = {
|
||||
link = "FloatBorder"
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name = "winpad",
|
||||
dir = vim.fn.stdpath("config") .. "/lua/winpad",
|
||||
config = function()
|
||||
local winpad = require("winpad")
|
||||
winpad.setup({
|
||||
enabled = true,
|
||||
})
|
||||
vim.keymap.set("n", "<leader>x", winpad.toggle, { desc = "Toggle Window Padding" })
|
||||
end
|
||||
},
|
||||
{
|
||||
"backdround/global-note.nvim",
|
||||
keys = {
|
||||
{ "<leader>nn", "<cmd>ProjectNote<cr>", desc = "Project Note" },
|
||||
{ "<leader>nf", "<cmd>FileNote<cr>", desc = "File Note" },
|
||||
{ "<leader>N", "<cmd>GlobalNote<cr>", desc = "Global Note" },
|
||||
},
|
||||
config = function()
|
||||
local global_note = require("global-note")
|
||||
global_note.setup({
|
||||
title = "Global Note",
|
||||
directory = "~/Documents/Notes/Repos",
|
||||
filename = "global_note.md",
|
||||
command_name = "GlobalNote",
|
||||
window_config = function()
|
||||
local window_height = vim.api.nvim_list_uis()[1].height
|
||||
local window_width = vim.api.nvim_list_uis()[1].width
|
||||
return {
|
||||
relative = "editor",
|
||||
border = require("globals").border_chars,
|
||||
title = "Note",
|
||||
title_pos = "center",
|
||||
width = math.floor(0.7 * window_width),
|
||||
height = math.floor(0.85 * window_height),
|
||||
row = math.floor(0.05 * window_height),
|
||||
col = math.floor(0.15 * window_width),
|
||||
}
|
||||
end,
|
||||
additional_presets = {
|
||||
project = {
|
||||
title = "Project Note",
|
||||
command_name = "ProjectNote",
|
||||
filename = function()
|
||||
local repo = vim.system({
|
||||
"git",
|
||||
"rev-parse",
|
||||
"--show-toplevel",
|
||||
}, {
|
||||
text = true,
|
||||
}):wait()
|
||||
if repo.stderr ~= "" then
|
||||
vim.notify(repo.stderr, vim.log.levels.WARN)
|
||||
return nil
|
||||
end
|
||||
|
||||
local project_name = vim.fs.basename(repo.stdout:gsub("\n", ""))
|
||||
if project_name == nil then
|
||||
vim.notify("Unable to get project name ", vim.log.levels.WARN)
|
||||
return nil
|
||||
end
|
||||
|
||||
return project_name .. ".md"
|
||||
end,
|
||||
},
|
||||
file = {
|
||||
title = "File Note",
|
||||
command_name = "FileNote",
|
||||
directory = vim.fn.getcwd,
|
||||
filename = "notes.md",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"moll/vim-bbye",
|
||||
keys = {
|
||||
{ "<leader>bd", "<cmd>Bdelete<cr>", desc = "Delete current buffer" },
|
||||
{ "<leader>bD", "<cmd>Bwipeout<cr>", desc = "Delete all buffers" },
|
||||
{ "<leader>bc", desc = "Clean buffers" }, -- TODO: Implement the thing
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/oil.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
keys = {
|
||||
{ "<leader>e", "<cmd>Oil<cr>", desc = "File Explorer" },
|
||||
{ "<leader>E", "<cmd>Oil ./<cr>", desc = "CWD Explorer" },
|
||||
},
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
keys = {
|
||||
{ "<leader>za", desc = "Add buffer to harpoon" },
|
||||
{ "<leader>zs", desc = "Seek harpoon buffers" },
|
||||
{ "<leader>zd", desc = "Remove buffer from harpoon" },
|
||||
{ "<leader>zx", desc = "Previous harpoon buffer" },
|
||||
{ "<leader>zc", desc = "Next harpoon buffer" },
|
||||
{ "<leader>1" },
|
||||
{ "<leader>2" },
|
||||
{ "<leader>3" },
|
||||
{ "<leader>4" },
|
||||
},
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon:setup({
|
||||
settings = { save_on_ui_close = true, save_on_toggle = true },
|
||||
})
|
||||
vim.keymap.set("n", "<leader>za", function() harpoon:list():add() end)
|
||||
vim.keymap.set("n", "<leader>zs",
|
||||
function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list(), {
|
||||
border = require("globals").border_chars,
|
||||
title = " Buffers ",
|
||||
title_pos = "center",
|
||||
})
|
||||
end)
|
||||
vim.keymap.set("n", "<leader>zd", function() harpoon:list():remove() end)
|
||||
vim.keymap.set("n", "<leader>zx", function() harpoon:list():prev() end)
|
||||
vim.keymap.set("n", "<leader>zc", function() harpoon:list():next() end)
|
||||
local keys = "1234567890"
|
||||
for i = 1, #keys do
|
||||
local key = keys:sub(i, i)
|
||||
vim.keymap.set("n", string.format("<leader>%s", key), function()
|
||||
harpoon:list():select(i)
|
||||
end)
|
||||
end
|
||||
harpoon:extend({
|
||||
UI_CREATE = function(cx)
|
||||
for i = 1, #keys do
|
||||
local key = keys:sub(i, i)
|
||||
vim.keymap.set("n", key, function()
|
||||
harpoon:list():select(i)
|
||||
end, { buffer = cx.bufnr })
|
||||
end
|
||||
vim.keymap.set("n", "<C-v>", function()
|
||||
harpoon.ui:select_menu_item({ vsplit = true })
|
||||
end, { buffer = cx.bufnr })
|
||||
vim.keymap.set("n", "<C-s>", function()
|
||||
harpoon.ui:select_menu_item({ split = true })
|
||||
end, { buffer = cx.bufnr })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
89
home/apps/nvim/lua/plugins/motion.lua
Normal file
89
home/apps/nvim/lua/plugins/motion.lua
Normal file
@@ -0,0 +1,89 @@
|
||||
return {
|
||||
{
|
||||
"xiaoshihou514/squirrel.nvim",
|
||||
keys = {
|
||||
{ "<C-m>", desc = "Hop" },
|
||||
},
|
||||
config = function()
|
||||
require("squirrel.utils").key_iter.keys = "ntesiroa"
|
||||
vim.keymap.set({ "n", "v" }, "<C-m>", function()
|
||||
vim.cmd(".mark '")
|
||||
require("squirrel.hop").hop()
|
||||
end)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"ggandor/leap.nvim",
|
||||
keys = {
|
||||
{ "M", "<Plug>(leap)", desc = "Leap" },
|
||||
},
|
||||
config = function()
|
||||
local leap = require("leap")
|
||||
leap.opts.safe_lables = ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
branch = "main",
|
||||
config = function()
|
||||
local move_actions = {
|
||||
["f"] = "function",
|
||||
["t"] = "class",
|
||||
["r"] = "return",
|
||||
["a"] = "parameter",
|
||||
["d"] = "comment",
|
||||
}
|
||||
local goto_next_start = {}
|
||||
local goto_next_end = {}
|
||||
local goto_previous_start = {}
|
||||
local goto_previous_end = {}
|
||||
for letter, action in pairs(move_actions) do
|
||||
local letter_lower = string.lower(letter)
|
||||
local letter_upper = string.upper(letter)
|
||||
goto_next_start["]" .. letter_lower] = {
|
||||
query = string.format("@%s.outer", action),
|
||||
desc = string.format("Next %s start", action),
|
||||
}
|
||||
goto_next_end["]" .. letter_upper] = {
|
||||
query = string.format("@%s.outer", action),
|
||||
desc = string.format("Next %s end", action),
|
||||
}
|
||||
goto_previous_start["[" .. letter_lower] = {
|
||||
query = string.format("@%s.outer", action),
|
||||
desc = string.format("Previous %s start", action),
|
||||
}
|
||||
goto_previous_end["[" .. letter_upper] = {
|
||||
query = string.format("@%s.outer", action),
|
||||
desc = string.format("Previous %s end", action),
|
||||
}
|
||||
end
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
["af"] = { query = "@function.outer", desc = "function" },
|
||||
["if"] = { query = "@function.inner", desc = "function" },
|
||||
["at"] = { query = "@class.outer", desc = "type" },
|
||||
["it"] = { query = "@class.inner", desc = "type" },
|
||||
["aa"] = { query = "@parameter.outer", desc = "parameter" },
|
||||
["ia"] = { query = "@parameter.inner", desc = "parameter" },
|
||||
["ac"] = { query = "@call.outer", desc = "call" },
|
||||
["ic"] = { query = "@call.inner", desc = "call" },
|
||||
["ad"] = { query = "@comment.outer", desc = "comment" },
|
||||
["id"] = { query = "@comment.inner", desc = "comment" },
|
||||
},
|
||||
include_surrounding_whitespace = true,
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
goto_next_start = goto_next_start,
|
||||
goto_next_end = goto_next_end,
|
||||
goto_previous_start = goto_previous_start,
|
||||
goto_previous_end = goto_previous_end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
29
home/apps/nvim/lua/plugins/snip.lua
Normal file
29
home/apps/nvim/lua/plugins/snip.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
"L3MON4D3/LuaSnip",
|
||||
keys = {
|
||||
{ "<C-q>", desc = "Expand Snippet", mode = "i" },
|
||||
},
|
||||
config = function()
|
||||
local ls = require("luasnip")
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<C-q>", function() ls.expand_or_jump() end, { silent = true })
|
||||
-- vim.keymap.set({ "i", "s" }, "<Tab>", function() ls.jump(1) end, { silent = true })
|
||||
-- vim.keymap.set({ "i", "s" }, "<S-Tab>", function() ls.jump(-1) end, { silent = true })
|
||||
|
||||
vim.keymap.set({ "i", "s" }, "<Tab>", function()
|
||||
if ls.choice_active() then
|
||||
ls.change_choice(1)
|
||||
else
|
||||
vim.api.nvim_feedkeys("\t", "n", false);
|
||||
end
|
||||
end, { silent = true })
|
||||
|
||||
ls.setup({
|
||||
link_roots = true,
|
||||
keep_roots = true,
|
||||
delete_check_events = "TextChanged",
|
||||
})
|
||||
|
||||
require("luasnip.loaders.from_lua").load({ paths = vim.fn.stdpath('config') .. "/snippets" })
|
||||
end,
|
||||
}
|
||||
204
home/apps/nvim/lua/plugins/telescope.lua
Normal file
204
home/apps/nvim/lua/plugins/telescope.lua
Normal file
@@ -0,0 +1,204 @@
|
||||
return {
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>t", desc = "Resume Search" },
|
||||
{ "<leader>f", desc = "Find All Files" },
|
||||
{ "<leader>F", desc = "Find Git Files" },
|
||||
{ "<leader>/", desc = "FZF In File" },
|
||||
{ "<leader>G", desc = "Grep Text" },
|
||||
{ "<leader>Z", desc = "Buffer Telescope Menu" },
|
||||
{ "<leader>d", desc = "Local Diagnostics" },
|
||||
{ "<leader>D", desc = "Global Diagnostics" },
|
||||
{ "<leader>gc", desc = "List Commits" },
|
||||
{ "<leader>gC", desc = "List All Commits" },
|
||||
{ "<leader>gs", desc = "Git Status" },
|
||||
{ "<leader>hk", desc = "Search keymaps" },
|
||||
{ "gO", desc = "Local Symbols" },
|
||||
{ "gS", desc = "Global Symbols" },
|
||||
{ "grr", desc = "References" },
|
||||
{ "gri", desc = "Definitions" },
|
||||
},
|
||||
config = function()
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
require('telescope.pickers.layout_strategies').horizontal_merged =
|
||||
function(picker, max_columns, max_lines, layout_config)
|
||||
local layout = require('telescope.pickers.layout_strategies').horizontal(picker, max_columns,
|
||||
max_lines,
|
||||
layout_config)
|
||||
local overdraw_chars = require("globals").border_chars_joined
|
||||
|
||||
layout.results.line = layout.results.line - 1
|
||||
layout.results.height = layout.results.height + 1
|
||||
layout.results.title = ''
|
||||
layout.results.borderchars = require("globals").border_chars_telescope_results
|
||||
|
||||
layout.prompt.borderchars = require("globals").border_chars_telescope_prompt
|
||||
|
||||
if layout.preview then
|
||||
layout.preview.title = ''
|
||||
end
|
||||
return layout
|
||||
end
|
||||
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
prompt_prefix = " ",
|
||||
selection_caret = "👉",
|
||||
sorting_strategy = "ascending",
|
||||
layout_config = {
|
||||
width = 0.90,
|
||||
height = 0.90,
|
||||
prompt_position = "top",
|
||||
preview_width = 0.5,
|
||||
},
|
||||
layout_strategy = "horizontal_merged",
|
||||
wrap_results = true,
|
||||
borderchars = require("globals").border_chars_alternate,
|
||||
default_mappings = {
|
||||
n = {
|
||||
["<Esc>"] = actions.close,
|
||||
["j"] = actions.move_selection_next,
|
||||
["k"] = actions.move_selection_previous,
|
||||
["h"] = actions.select_default,
|
||||
["l"] = actions.close,
|
||||
["H"] = actions.move_to_top,
|
||||
["L"] = actions.move_to_bottom,
|
||||
["<M-j>"] = actions.preview_scrolling_down,
|
||||
["<M-k>"] = actions.preview_scrolling_up,
|
||||
["<M-h>"] = actions.preview_scrolling_left,
|
||||
["<M-l>"] = actions.preview_scrolling_right,
|
||||
},
|
||||
i = {
|
||||
["<Esc>"] = false,
|
||||
["<C-c>"] = false,
|
||||
-- QWERTY mappings
|
||||
["<C-h>"] = actions.select_default,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-l>"] = actions.close,
|
||||
["<M-j>"] = actions.preview_scrolling_down,
|
||||
["<M-k>"] = actions.preview_scrolling_up,
|
||||
["<M-h>"] = actions.preview_scrolling_left,
|
||||
["<M-l>"] = actions.preview_scrolling_right,
|
||||
-- Colemak mappings
|
||||
["<C-n>"] = actions.select_default,
|
||||
["<C-e>"] = actions.move_selection_next,
|
||||
["<C-i>"] = actions.move_selection_previous,
|
||||
["<C-o>"] = actions.close,
|
||||
["<M-e>"] = actions.preview_scrolling_down,
|
||||
["<M-i>"] = actions.preview_scrolling_up,
|
||||
["<M-n>"] = actions.preview_scrolling_left,
|
||||
["<M-o>"] = actions.preview_scrolling_right,
|
||||
-- TODO: actions.select_{horizontal, vertical, tab}
|
||||
},
|
||||
},
|
||||
initial_mode = "insert",
|
||||
},
|
||||
pickers = {
|
||||
diagnostics = {
|
||||
disable_coordinates = true,
|
||||
},
|
||||
find_files = {
|
||||
hidden = true,
|
||||
file_ignore_patterns = { "^%.git" },
|
||||
},
|
||||
},
|
||||
})
|
||||
require("telescope").load_extension("fzf")
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>t", builtin.resume, {})
|
||||
vim.keymap.set("n", "<leader>f", builtin.find_files, {})
|
||||
vim.keymap.set("n", "<leader>F", builtin.git_files, {})
|
||||
vim.keymap.set("n", "<leader>/", builtin.current_buffer_fuzzy_find, {})
|
||||
vim.keymap.set("n", "<leader>G", builtin.live_grep, {})
|
||||
vim.keymap.set("n", "<leader>Z", builtin.buffers, {})
|
||||
vim.keymap.set("n", "<leader>d", function()
|
||||
builtin.diagnostics({
|
||||
bufnr = 0,
|
||||
severity_bound = 0,
|
||||
})
|
||||
end, {})
|
||||
vim.keymap.set("n", "<leader>D", builtin.diagnostics, {})
|
||||
vim.keymap.set("n", "<leader>gc", builtin.git_bcommits, {})
|
||||
vim.keymap.set("n", "<leader>gC", builtin.git_commits, {})
|
||||
vim.keymap.set("n", "<leader>gs", builtin.git_status, {})
|
||||
vim.keymap.set("n", "<leader>hk", builtin.keymaps, {})
|
||||
vim.keymap.set("n", "gO", builtin.lsp_document_symbols, {})
|
||||
vim.keymap.set("n", "gS", builtin.lsp_workspace_symbols, {})
|
||||
vim.keymap.set("n", "grr", builtin.lsp_references, {})
|
||||
vim.keymap.set("n", "gri", builtin.lsp_definitions, {})
|
||||
vim.api.nvim_set_hl(0, "TelescopeBorder", { link = "FloatBorder" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"aznhe21/actions-preview.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "gra", desc = "Code Actions" },
|
||||
},
|
||||
config = function()
|
||||
require("actions-preview").setup({
|
||||
diff = {
|
||||
ctxlen = 2,
|
||||
algorithm = "histogram",
|
||||
},
|
||||
backend = { "telescope" },
|
||||
telescope = {
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "cursor",
|
||||
layout_config = {
|
||||
preview_width = 0.6,
|
||||
width = 0.8,
|
||||
height = 16,
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set({ "n", "v" }, "gra", require("actions-preview").code_actions)
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
event = "BufEnter",
|
||||
opts = {
|
||||
signs = true,
|
||||
keywords = {
|
||||
ERROR = {
|
||||
icon = "🐈",
|
||||
color = "error",
|
||||
alt = { "ISSUE", "FUCK" },
|
||||
},
|
||||
TODO = {
|
||||
icon = "📝",
|
||||
color = "info",
|
||||
alt = { "NOTE" },
|
||||
},
|
||||
FIX = {
|
||||
icon = "👀",
|
||||
color = "warning",
|
||||
alt = { "WARN", "FIXME" },
|
||||
},
|
||||
},
|
||||
color = {
|
||||
error = { "DiagnosticError" },
|
||||
warning = { "DiagnosticWarning" },
|
||||
info = { "DiagnosticInfo" },
|
||||
},
|
||||
highlight = {
|
||||
keyword = "fg",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
40
home/apps/nvim/lua/plugins/visual.lua
Normal file
40
home/apps/nvim/lua/plugins/visual.lua
Normal file
@@ -0,0 +1,40 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
name = "center",
|
||||
dir = vim.fn.stdpath("config") .. "/lua/center",
|
||||
config = function()
|
||||
require("center").setup({
|
||||
enabled = true,
|
||||
skip_filetypes = {
|
||||
"buffer_manager",
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{
|
||||
"stevearc/dressing.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
input = {
|
||||
border = require("globals").border_chars,
|
||||
},
|
||||
select = {
|
||||
builtin = {
|
||||
border = require("globals").border_chars,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
opts = {
|
||||
color_icons = true,
|
||||
default = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user