feat: add nvimdots

This commit is contained in:
2024-07-21 02:51:17 -04:00
parent f16942be42
commit e78c5ce3f5
149 changed files with 10623 additions and 43 deletions
+11
View File
@@ -0,0 +1,11 @@
return function()
require("modules.utils").load_plugin("mini.align", {
-- Whether to disable showing non-error feedback
silent = false,
-- Module mappings. Use `''` (empty string) to disable one.
mappings = {
start = "gea",
start_with_preview = "geA",
},
})
end
@@ -0,0 +1,39 @@
return function()
require("modules.utils").load_plugin("autoclose", {
keys = {
["("] = { escape = false, close = true, pair = "()" },
["["] = { escape = false, close = true, pair = "[]" },
["{"] = { escape = false, close = true, pair = "{}" },
["<"] = { escape = true, close = true, pair = "<>", enabled_filetypes = { "rust" } },
[">"] = { escape = true, close = false, pair = "<>" },
[")"] = { escape = true, close = false, pair = "()" },
["]"] = { escape = true, close = false, pair = "[]" },
["}"] = { escape = true, close = false, pair = "{}" },
['"'] = { escape = true, close = true, pair = '""' },
["`"] = { escape = true, close = true, pair = "``" },
["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = { "rust" } },
},
options = {
disable_when_touch = false,
disabled_filetypes = {
"alpha",
"bigfile",
"checkhealth",
"dap-repl",
"diff",
"help",
"log",
"notify",
"NvimTree",
"Outline",
"qf",
"TelescopePrompt",
"toggleterm",
"undotree",
"vimwiki",
},
},
})
end
@@ -0,0 +1,9 @@
return function()
require("modules.utils").load_plugin("nvim-ts-autotag", {
opts = {
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false, -- Auto close on trailing </
},
})
end
@@ -0,0 +1,31 @@
return function()
local ftdetect = {
name = "ftdetect",
opts = { defer = true },
disable = function()
vim.api.nvim_set_option_value("filetype", "bigfile", { scope = "local" })
end,
}
local cmp = {
name = "nvim-cmp",
opts = { defer = true },
disable = function()
require("cmp").setup.buffer({ enabled = false })
end,
}
require("modules.utils").load_plugin("bigfile", {
filesize = 2, -- size of the file in MiB
pattern = { "*" }, -- autocmd pattern
features = { -- features to disable
"indent_blankline",
"lsp",
"syntax",
"treesitter",
"vimopts",
cmp,
ftdetect,
},
})
end
@@ -0,0 +1,44 @@
return function()
require("modules.utils").load_plugin("Comment", {
-- Add a space b/w comment and the line
padding = true,
-- Whether the cursor should stay at its position
sticky = true,
-- Lines to be ignored while (un)comment
ignore = "^$",
-- LHS of toggle mappings in NORMAL mode
toggler = {
-- Line-comment toggle keymap
line = "gcc",
-- Block-comment toggle keymap
block = "gbc",
},
-- LHS of operator-pending mappings in NORMAL and VISUAL mode
opleader = {
-- Line-comment keymap
line = "gc",
-- Block-comment keymap
block = "gb",
},
-- LHS of extra mappings
extra = {
-- Add comment on the line above
above = "gcO",
-- Add comment on the line below
below = "gco",
-- Add comment at the end of line
eol = "gcA",
},
-- We defined mappings in `lua/keymap/init.lua` with description so disable them here.
mappings = {
-- Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
basic = false,
-- Extra mapping; `gco`, `gcO`, `gcA`
extra = false,
},
-- Function to call before (un)comment
pre_hook = require("ts_context_commentstring.integrations.comment_nvim").create_pre_hook(),
-- Function to call after (un)comment
post_hook = nil,
})
end
@@ -0,0 +1,11 @@
return function()
require("modules.utils").load_plugin("diffview", {
diff_binaries = false, -- Show diffs for binaries
enhanced_diff_hl = false, -- See ':h diffview-config-enhanced_diff_hl'
git_cmd = { "git" }, -- The git executable followed by default args.
hg_cmd = { "hg" }, -- The hg executable followed by default args.
use_icons = true, -- Requires nvim-web-devicons
show_help_hints = true, -- Show hints for how to open the help panel
watch_index = true, -- Update views and index buffers when the git index changes.
})
end
+37
View File
@@ -0,0 +1,37 @@
return function()
vim.api.nvim_set_hl(
0,
"FlashLabel",
{ underline = true, bold = true, fg = "Orange", bg = "NONE", ctermfg = "Red", ctermbg = "NONE" }
)
require("modules.utils").load_plugin("flash", {
labels = "asdfghjklqwertyuiopzxcvbnm",
label = {
-- allow uppercase labels
uppercase = true,
-- add a label for the first match in the current window.
-- you can always jump to the first match with `<CR>`
current = true,
-- for the current window, label targets closer to the cursor first
distance = true,
},
modes = {
search = { enabled = false },
-- options used when flash is activated through
-- `f`, `F`, `t`, `T`, `;` and `,` motions
char = {
enabled = true,
-- hide after jump when not using jump labels
autohide = false,
-- show jump labels
jump_labels = false,
-- set to `false` to use the current line only
multi_line = true,
-- When using jump labels, don't use these keys
-- This allows using those keys directly after the motion
label = { exclude = "hjkliardc" },
},
},
})
end
@@ -0,0 +1,31 @@
return function()
require("modules.utils").load_plugin("nvim-highlight-colors", {
render = "background",
enable_hex = true,
enable_short_hex = true,
enable_rgb = true,
enable_hsl = true,
enable_var_usage = true,
enable_named_colors = false,
enable_tailwind = false,
-- Exclude filetypes or buftypes from highlighting
exclude_filetypes = {
"alpha",
"bigfile",
"dap-repl",
"fugitive",
"git",
"notify",
"NvimTree",
"Outline",
"TelescopePrompt",
"toggleterm",
"undotree",
},
exclude_buftypes = {
"nofile",
"prompt",
"terminal",
},
})
end
+3
View File
@@ -0,0 +1,3 @@
return function()
require("modules.utils").load_plugin("hop", { keys = "etovxqpdygfblzhckisuran" })
end
@@ -0,0 +1,6 @@
return function()
require("modules.utils").load_plugin("local-highlight", {
hlgroup = "IlluminatedWordText",
insert_mode = false,
})
end
@@ -0,0 +1,23 @@
return function()
require("modules.utils").load_plugin("persisted", {
save_dir = vim.fn.expand(vim.fn.stdpath("data") .. "/sessions/"), -- directory where session files are saved
silent = false, -- silent nvim message when sourcing session file
use_git_branch = true, -- create session files based on the branch of the git enabled repository
autosave = true, -- automatically save session files when exiting Neovim
should_autosave = function()
if vim.bo.filetype == "alpha" then
return false
end
return true
end, -- function to determine if a session should be autosaved
-- Set `lazy = false` in `plugins/editor.lua` to enable this
autoload = false, -- automatically load the session for the cwd on Neovim startup
on_autoload_no_session = nil, -- function to run when `autoload = true` but there is no session to load
follow_cwd = true, -- change session file name to match current working directory if it changes
allowed_dirs = nil, -- table of dirs that the plugin will auto-save and auto-load from
ignored_dirs = nil, -- table of dirs that are ignored when auto-saving and auto-loading
telescope = { -- options for the telescope extension
reset_prompt_after_deletion = true, -- whether to reset prompt after session deleted
},
})
end
@@ -0,0 +1,53 @@
return function()
---@param threshold number @Use global strategy if nr of lines exceeds this value
local function init_strategy(threshold)
return function()
-- Disable on very large files
local line_count = vim.api.nvim_buf_line_count(0)
if line_count > 7500 then
return nil
end
-- Disable on parser error
local errors = 200
vim.treesitter.get_parser():for_each_tree(function(lt)
if lt:root():has_error() and errors >= 0 then
errors = errors - 1
end
end)
if errors < 0 then
return nil
end
return line_count > threshold and require("rainbow-delimiters").strategy["global"]
or require("rainbow-delimiters").strategy["local"]
end
end
vim.g.rainbow_delimiters = {
strategy = {
[""] = init_strategy(500),
c = init_strategy(300),
cpp = init_strategy(300),
lua = init_strategy(500),
vimdoc = init_strategy(300),
vim = init_strategy(300),
},
query = {
[""] = "rainbow-delimiters",
latex = "rainbow-blocks",
javascript = "rainbow-delimiters-react",
},
highlight = {
"RainbowDelimiterRed",
"RainbowDelimiterOrange",
"RainbowDelimiterYellow",
"RainbowDelimiterGreen",
"RainbowDelimiterBlue",
"RainbowDelimiterCyan",
"RainbowDelimiterViolet",
},
}
require("modules.utils").load_plugin("rainbow_delimiters", nil, true)
end
@@ -0,0 +1,14 @@
return function()
require("modules.utils").load_plugin("smart-splits", {
-- Ignored buffer types (only while resizing)
ignored_buftypes = {
"nofile",
"quickfix",
"prompt",
},
-- Ignored filetypes (only while resizing)
ignored_filetypes = { "NvimTree" },
-- the default number of lines/columns to resize by at a time
default_amount = 3,
})
end
+5
View File
@@ -0,0 +1,5 @@
return function()
vim.g["suda#prompt"] = "Enter administrator password: "
require("modules.utils").load_plugin("suda", nil, true)
end
@@ -0,0 +1,66 @@
return vim.schedule_wrap(function()
local use_ssh = require("core.settings").use_ssh
vim.api.nvim_set_option_value("foldmethod", "expr", {})
vim.api.nvim_set_option_value("foldexpr", "nvim_treesitter#foldexpr()", {})
require("modules.utils").load_plugin("nvim-treesitter", {
ensure_installed = require("core.settings").treesitter_deps,
highlight = {
enable = true,
disable = function(ft, bufnr)
if
vim.tbl_contains({ "gitcommit" }, ft)
or (vim.api.nvim_buf_line_count(bufnr) > 7500 and ft ~= "vimdoc")
then
return true
end
local ok, is_large_file = pcall(vim.api.nvim_buf_get_var, bufnr, "bigfile_disable_treesitter")
return ok and is_large_file
end,
additional_vim_regex_highlighting = false,
},
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
},
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]["] = "@function.outer",
["]m"] = "@class.outer",
},
goto_next_end = {
["]]"] = "@function.outer",
["]M"] = "@class.outer",
},
goto_previous_start = {
["[["] = "@function.outer",
["[m"] = "@class.outer",
},
goto_previous_end = {
["[]"] = "@function.outer",
["[M"] = "@class.outer",
},
},
},
indent = { enable = true },
matchup = { enable = true },
}, false, require("nvim-treesitter.configs").setup)
require("nvim-treesitter.install").prefer_git = true
if use_ssh then
local parsers = require("nvim-treesitter.parsers").get_parser_configs()
for _, parser in pairs(parsers) do
parser.install_info.url = parser.install_info.url:gsub("https://github.com/", "git@github.com:")
end
end
end)
@@ -0,0 +1,7 @@
return function()
vim.g.skip_ts_context_commentstring_module = true
require("modules.utils").load_plugin("ts_context_commentstring", {
-- Whether to update the `commentstring` on the `CursorHold` autocmd
enable_autocmd = false,
})
end
@@ -0,0 +1,12 @@
return function()
require("modules.utils").load_plugin("treesitter-context", {
enable = true,
max_lines = 3, -- How many lines the window should span. Values <= 0 mean no limit.
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
line_numbers = true,
multiline_threshold = 20, -- Maximum number of lines to collapse for a single context line
trim_scope = "outer", -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
mode = "cursor", -- Line used to calculate context. Choices: 'cursor', 'topline'
zindex = 50, -- Ensure compatibility with Glance's preview window
})
end