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
@@ -0,0 +1,47 @@
-- https://github.com/mfussenegger/nvim-dap/wiki/C-C---Rust-(via--codelldb)
return function()
local dap = require("dap")
local utils = require("modules.utils.dap")
local is_windows = require("core.global").is_windows
dap.adapters.codelldb = {
type = "server",
port = "${port}",
executable = {
command = vim.fn.exepath("codelldb"), -- Find codelldb on $PATH
args = { "--port", "${port}" },
detached = is_windows and false or true,
},
}
dap.configurations.c = {
{
name = "Debug",
type = "codelldb",
request = "launch",
program = utils.input_exec_path(),
cwd = "${workspaceFolder}",
stopOnEntry = false,
terminal = "integrated",
},
{
name = "Debug (with args)",
type = "codelldb",
request = "launch",
program = utils.input_exec_path(),
args = utils.input_args(),
cwd = "${workspaceFolder}",
stopOnEntry = false,
terminal = "integrated",
},
{
name = "Attach to a running process",
type = "codelldb",
request = "attach",
program = utils.input_exec_path(),
stopOnEntry = false,
waitFor = true,
},
}
dap.configurations.cpp = dap.configurations.c
dap.configurations.rust = dap.configurations.c
end
@@ -0,0 +1,100 @@
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#go
-- https://github.com/golang/vscode-go/blob/master/docs/debugging.md
return function()
local dap = require("dap")
local utils = require("modules.utils.dap")
if not require("mason-registry").is_installed("go-debug-adapter") then
vim.notify(
"Automatically installing `go-debug-adapter` for go debugging",
vim.log.levels.INFO,
{ title = "nvim-dap" }
)
local go_dbg = require("mason-registry").get_package("go-debug-adapter")
go_dbg:install():once(
"closed",
vim.schedule_wrap(function()
if go_dbg:is_installed() then
vim.notify("Successfully installed `go-debug-adapter`", vim.log.levels.INFO, { title = "nvim-dap" })
end
end)
)
end
dap.adapters.go = {
type = "executable",
command = "node",
args = {
require("mason-registry").get_package("go-debug-adapter"):get_install_path()
.. "/extension/dist/debugAdapter.js",
},
}
dap.configurations.go = {
{
type = "go",
name = "Debug (file)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_file_path(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (file with args)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_file_path(),
args = utils.input_args(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (executable)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_exec_path(),
args = utils.input_args(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
mode = "exec",
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (test file)",
request = "launch",
cwd = "${workspaceFolder}",
program = utils.input_file_path(),
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
mode = "test",
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
{
type = "go",
name = "Debug (using go.mod)",
request = "launch",
cwd = "${workspaceFolder}",
program = "./${relativeFileDirname}",
console = "integratedTerminal",
dlvToolPath = vim.fn.exepath("dlv"),
mode = "test",
showLog = true,
showRegisters = true,
stopOnEntry = false,
},
}
end
@@ -0,0 +1,36 @@
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#ccrust-via-lldb-vscode
return function()
local dap = require("dap")
local utils = require("modules.utils.dap")
dap.adapters.lldb = {
type = "executable",
command = vim.fn.exepath("lldb-vscode"), -- Find lldb-vscode on $PATH
}
dap.configurations.c = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = utils.input_exec_path(),
cwd = "${workspaceFolder}",
args = utils.input_args(),
env = utils.get_env(),
-- if you change `runInTerminal` to true, you might need to change the yama/ptrace_scope setting:
--
-- echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
--
-- Otherwise you might get the following error:
--
-- Error on launch: Failed to attach to the target process
--
-- But you should be aware of the implications:
-- https://www.kernel.org/doc/html/latest/admin-guide/LSM/Yama.html
runInTerminal = false,
},
}
dap.configurations.cpp = dap.configurations.c
dap.configurations.rust = dap.configurations.c
end
@@ -0,0 +1,74 @@
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation#python
-- https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
return function()
local dap = require("dap")
local utils = require("modules.utils.dap")
local is_windows = require("core.global").is_windows
local debugpy_root = require("mason-registry").get_package("debugpy"):get_install_path()
dap.adapters.python = function(callback, config)
if config.request == "attach" then
local port = (config.connect or config).port
local host = (config.connect or config).host or "127.0.0.1"
callback({
type = "server",
port = assert(port, "`connect.port` is required for a python `attach` configuration"),
host = host,
options = { source_filetype = "python" },
})
else
callback({
type = "executable",
command = is_windows and debugpy_root .. "/venv/Scripts/pythonw.exe"
or debugpy_root .. "/venv/bin/python",
args = { "-m", "debugpy.adapter" },
options = { source_filetype = "python" },
})
end
end
dap.configurations.python = {
{
-- The first three options are required by nvim-dap
type = "python", -- the type here established the link to the adapter definition: `dap.adapters.python`
request = "launch",
name = "Debug",
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
console = "integratedTerminal",
program = utils.input_file_path(),
pythonPath = function()
local venv = vim.env.CONDA_PREFIX
if venv then
return is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python"
else
return is_windows and "pythonw.exe" or "python3"
end
end,
},
{
-- NOTE: This setting is for people using venv
type = "python",
request = "launch",
name = "Debug (using venv)",
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
console = "integratedTerminal",
program = utils.input_file_path(),
pythonPath = function()
-- Prefer the venv that is defined by the designated environment variable.
local cwd, venv = vim.fn.getcwd(), os.getenv("VIRTUAL_ENV")
local python = venv and (is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python") or ""
if vim.fn.executable(python) == 1 then
return python
end
-- Otherwise, fall back to check if there are any local venvs available.
venv = vim.fn.isdirectory(cwd .. "/venv") == 1 and cwd .. "/venv" or cwd .. "/.venv"
python = is_windows and venv .. "/Scripts/pythonw.exe" or venv .. "/bin/python"
if vim.fn.executable(python) == 1 then
return python
else
return is_windows and "pythonw.exe" or "python3"
end
end,
},
}
end
@@ -0,0 +1,21 @@
local M = {}
local bind = require("keymap.bind")
local map_cmd = bind.map_cmd
local did_load_debug_mappings = false
local debug_keymap = {
["nv|K"] = map_cmd("<Cmd>lua require('dapui').eval()<CR>")
:with_noremap()
:with_nowait()
:with_desc("Evaluate expression under cursor"),
}
function M.load_extras()
if not did_load_debug_mappings then
require("modules.utils.keymap").amend("Debugging", "_debugging", debug_keymap)
did_load_debug_mappings = true
end
end
return M
@@ -0,0 +1,72 @@
return function()
local icons = {
ui = require("modules.utils.icons").get("ui"),
dap = require("modules.utils.icons").get("dap"),
}
require("modules.utils").load_plugin("dapui", {
force_buffers = true,
icons = {
expanded = icons.ui.ArrowOpen,
collapsed = icons.ui.ArrowClosed,
current_frame = icons.ui.Indicator,
},
mappings = {
-- Use a table to apply multiple mappings
edit = "e",
expand = { "<CR>", "<2-LeftMouse>" },
open = "o",
remove = "d",
repl = "r",
toggle = "t",
},
layouts = {
{
elements = {
-- Provide as ID strings or tables with "id" and "size" keys
{
id = "scopes",
size = 0.3, -- Can be float or integer > 1
},
{ id = "watches", size = 0.3 },
{ id = "stacks", size = 0.3 },
{ id = "breakpoints", size = 0.1 },
},
size = 0.3,
position = "right",
},
{
elements = {
{ id = "console", size = 0.55 },
{ id = "repl", size = 0.45 },
},
position = "bottom",
size = 0.25,
},
},
controls = {
enabled = true,
-- Display controls in this session
element = "repl",
icons = {
pause = icons.dap.Pause,
play = icons.dap.Play,
step_into = icons.dap.StepInto,
step_over = icons.dap.StepOver,
step_out = icons.dap.StepOut,
step_back = icons.dap.StepBack,
run_last = icons.dap.RunLast,
terminate = icons.dap.Terminate,
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = "single", -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { "q", "<Esc>" },
},
},
render = { indent = 1, max_value_lines = 85 },
})
end
@@ -0,0 +1,84 @@
return function()
local dap = require("dap")
local dapui = require("dapui")
local mason_dap = require("mason-nvim-dap")
local icons = { dap = require("modules.utils.icons").get("dap") }
local colors = require("modules.utils").get_palette()
local mappings = require("tool.dap.dap-keymap")
-- Initialize debug hooks
_G._debugging = false
local function debug_init_cb()
_G._debugging = true
mappings.load_extras()
dapui.open({ reset = true })
end
local function debug_terminate_cb()
if _debugging then
_G._debugging = false
dapui.close()
end
end
dap.listeners.after.event_initialized["dapui_config"] = debug_init_cb
dap.listeners.before.event_terminated["dapui_config"] = debug_terminate_cb
dap.listeners.before.event_exited["dapui_config"] = debug_terminate_cb
dap.listeners.before.disconnect["dapui_config"] = debug_terminate_cb
-- We need to override nvim-dap's default highlight groups, AFTER requiring nvim-dap for catppuccin.
vim.api.nvim_set_hl(0, "DapStopped", { fg = colors.green })
vim.fn.sign_define(
"DapBreakpoint",
{ text = icons.dap.Breakpoint, texthl = "DapBreakpoint", linehl = "", numhl = "" }
)
vim.fn.sign_define(
"DapBreakpointCondition",
{ text = icons.dap.BreakpointCondition, texthl = "DapBreakpoint", linehl = "", numhl = "" }
)
vim.fn.sign_define("DapStopped", { text = icons.dap.Stopped, texthl = "DapStopped", linehl = "", numhl = "" })
vim.fn.sign_define(
"DapBreakpointRejected",
{ text = icons.dap.BreakpointRejected, texthl = "DapBreakpoint", linehl = "", numhl = "" }
)
vim.fn.sign_define("DapLogPoint", { text = icons.dap.LogPoint, texthl = "DapLogPoint", linehl = "", numhl = "" })
---A handler to setup all clients defined under `tool/dap/clients/*.lua`
---@param config table
local function mason_dap_handler(config)
local dap_name = config.name
local ok, custom_handler = pcall(require, "user.configs.dap-clients." .. dap_name)
if not ok then
-- Use preset if there is no user definition
ok, custom_handler = pcall(require, "tool.dap.clients." .. dap_name)
end
if not ok then
-- Default to use factory config for clients(s) that doesn't include a spec
mason_dap.default_setup(config)
return
elseif type(custom_handler) == "function" then
-- Case where the protocol requires its own setup
-- Make sure to set
-- * dap.adpaters.<dap_name> = { your config }
-- * dap.configurations.<lang> = { your config }
-- See `codelldb.lua` for a concrete example.
custom_handler(config)
else
vim.notify(
string.format(
"Failed to setup [%s].\n\nClient definition under `tool/dap/clients` must return\na fun(opts) (got '%s' instead)",
config.name,
type(custom_handler)
),
vim.log.levels.ERROR,
{ title = "nvim-dap" }
)
end
end
require("modules.utils").load_plugin("mason-nvim-dap", {
ensure_installed = require("core.settings").dap_deps,
automatic_installation = true,
handlers = { mason_dap_handler },
})
end
+109
View File
@@ -0,0 +1,109 @@
return function()
local icons = {
kind = require("modules.utils.icons").get("kind", true),
type = require("modules.utils.icons").get("type", true),
misc = require("modules.utils.icons").get("misc", true),
ui = require("modules.utils.icons").get("ui", true),
}
require("modules.utils").load_plugin("dropbar", {
bar = {
hover = false,
truncate = true,
pick = { pivots = "etovxqpdygfblzhckisuran" },
},
sources = {
path = {
relative_to = function()
-- Only show the leaf filename in dropbar
return vim.fn.expand("%:p:h")
end,
},
terminal = {
name = function(buf)
local name = vim.api.nvim_buf_get_name(buf)
local term = select(2, require("toggleterm.terminal").identify(name))
-- Trying to "snag" a display name from toggleterm
if term then
return term.display_name or term.name
else
return name
end
end,
},
},
icons = {
enable = true,
kinds = {
use_devicons = true,
symbols = {
-- Type
Array = icons.type.Array,
Boolean = icons.type.Boolean,
Null = icons.type.Null,
Number = icons.type.Number,
Object = icons.type.Object,
String = icons.type.String,
Text = icons.type.String,
-- Kind
BreakStatement = icons.kind.Break,
Call = icons.kind.Call,
CaseStatement = icons.kind.Case,
Class = icons.kind.Class,
Color = icons.kind.Color,
Constant = icons.kind.Constant,
Constructor = icons.kind.Constructor,
ContinueStatement = icons.kind.Continue,
Declaration = icons.kind.Declaration,
Delete = icons.kind.Delete,
DoStatement = icons.kind.Loop,
Enum = icons.kind.Enum,
EnumMember = icons.kind.EnumMember,
Event = icons.kind.Event,
Field = icons.kind.Field,
File = icons.kind.File,
ForStatement = icons.kind.Loop,
Function = icons.kind.Function,
Identifier = icons.kind.Variable,
Interface = icons.kind.Interface,
Keyword = icons.kind.Keyword,
List = icons.kind.List,
Lsp = icons.misc.LspAvailable,
Method = icons.kind.Method,
Module = icons.kind.Module,
Namespace = icons.kind.Namespace,
Operator = icons.kind.Operator,
Package = icons.kind.Package,
Pair = icons.kind.List,
Property = icons.kind.Property,
Reference = icons.kind.Reference,
Regex = icons.kind.Regex,
Repeat = icons.kind.Loop,
Scope = icons.kind.Statement,
Snippet = icons.kind.Snippet,
Statement = icons.kind.Statement,
Struct = icons.kind.Struct,
SwitchStatement = icons.kind.Switch,
Type = icons.kind.Interface,
TypeParameter = icons.kind.TypeParameter,
Unit = icons.kind.Unit,
Value = icons.kind.Value,
Variable = icons.kind.Variable,
WhileStatement = icons.kind.Loop,
-- Microsoft-specific icons
Folder = icons.kind.Folder,
-- ccls-specific icons
Macro = icons.kind.Macro,
Terminal = icons.kind.Terminal,
},
},
ui = {
bar = { separator = "" },
menu = { indicator = icons.ui.ArrowClosed },
},
},
})
end
+19
View File
@@ -0,0 +1,19 @@
return function()
require("modules.utils").load_plugin("fcitx5", {
msg = nil, -- string | nil: printed when startup is completed
imname = { -- fcitx5.Imname | nil: imnames on each mode set as prior. See `:h map-table` for more in-depth information.
norm = nil, -- string | nil: imname to set in normal mode. if nil, will restore the mode on exit.
ins = nil,
cmd = nil,
vis = nil,
sel = nil,
opr = nil,
term = nil,
lang = nil,
},
remember_prior = true, -- boolean: if true, it remembers the mode on exit and restore it when entering the mode again.
-- if false, uses what was set in config.
define_autocmd = true, -- boolean: if true, defines autocmd at `ModeChanged` to switch fcitx5 mode.
log = "warn", -- string: log level (default: warn)
})
end
+201
View File
@@ -0,0 +1,201 @@
return function()
local icons = {
diagnostics = require("modules.utils.icons").get("diagnostics"),
documents = require("modules.utils.icons").get("documents"),
git = require("modules.utils.icons").get("git"),
ui = require("modules.utils.icons").get("ui"),
}
require("modules.utils").load_plugin("nvim-tree", {
auto_reload_on_write = true,
create_in_closed_folder = false,
disable_netrw = false,
hijack_cursor = true,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = true,
open_on_tab = false,
respect_buf_cwd = false,
sort_by = "name",
sync_root_with_cwd = true,
on_attach = function(bufnr)
require("nvim-tree.api").config.mappings.default_on_attach(bufnr)
vim.keymap.del("n", "<C-e>", { buffer = bufnr })
end,
view = {
adaptive_size = false,
centralize_selection = false,
width = 30,
side = "left",
preserve_window_proportions = false,
number = false,
relativenumber = false,
signcolumn = "yes",
float = {
enable = false,
open_win_config = {
relative = "editor",
border = "rounded",
width = 30,
height = 30,
row = 1,
col = 1,
},
},
},
renderer = {
add_trailing = false,
group_empty = true,
highlight_git = true,
full_name = false,
highlight_opened_files = "none",
special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md", "CMakeLists.txt" },
symlink_destination = true,
indent_markers = {
enable = true,
icons = {
corner = "",
edge = "",
item = "",
none = " ",
},
},
root_folder_label = ":.:s?.*?/..?",
icons = {
webdev_colors = true,
git_placement = "after",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
padding = " ",
symlink_arrow = " 󰁔 ",
glyphs = {
default = icons.documents.Default, --
symlink = icons.documents.Symlink, --
bookmark = icons.ui.Bookmark,
git = {
unstaged = icons.git.Mod_alt,
staged = icons.git.Add, --󰄬
unmerged = icons.git.Unmerged,
renamed = icons.git.Rename, --󰁔
untracked = icons.git.Untracked, -- "󰞋"
deleted = icons.git.Remove, --
ignored = icons.git.Ignore, --◌
},
folder = {
arrow_open = icons.ui.ArrowOpen,
arrow_closed = icons.ui.ArrowClosed,
-- arrow_open = "",
-- arrow_closed = "",
default = icons.ui.Folder,
open = icons.ui.FolderOpen,
empty = icons.ui.EmptyFolder,
empty_open = icons.ui.EmptyFolderOpen,
symlink = icons.ui.SymlinkFolder,
symlink_open = icons.ui.FolderOpen,
},
},
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = true,
update_root = true,
ignore_list = {},
},
filters = {
dotfiles = false,
custom = { ".DS_Store" },
exclude = {},
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
},
open_file = {
quit_on_open = false,
resize_window = false,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
buftype = {
"help",
"nofile",
"prompt",
"quickfix",
"terminal",
},
filetype = {
"dap-repl",
"diff",
"fugitive",
"fugitiveblame",
"git",
"notify",
"NvimTree",
"Outline",
"qf",
"TelescopePrompt",
"toggleterm",
"undotree",
},
},
},
},
remove_file = {
close_window = true,
},
},
diagnostics = {
enable = false,
show_on_dirs = false,
debounce_delay = 50,
icons = {
hint = icons.diagnostics.Hint_alt,
info = icons.diagnostics.Information_alt,
warning = icons.diagnostics.Warning_alt,
error = icons.diagnostics.Error_alt,
},
},
filesystem_watchers = {
enable = true,
debounce_delay = 50,
},
git = {
enable = true,
ignore = false,
show_on_dirs = true,
timeout = 400,
},
trash = {
cmd = "gio trash",
require_confirm = true,
},
live_filter = {
prefix = "[FILTER]: ",
always_show_folders = true,
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
dev = false,
diagnostics = false,
git = false,
profile = false,
watcher = false,
},
},
})
end
+13
View File
@@ -0,0 +1,13 @@
return function()
require("modules.utils").load_plugin("project_nvim", {
manual_mode = false,
detection_methods = { "lsp", "pattern" },
patterns = { ".git", "_darcs", ".hg", ".bzr", ".svn", "Makefile", "package.json" },
ignore_lsp = { "null-ls", "copilot" },
exclude_dirs = {},
show_hidden = false,
silent_chdir = true,
scope_chdir = "global",
datapath = vim.fn.stdpath("data"),
})
end
+141
View File
@@ -0,0 +1,141 @@
return function()
local builtin = require("telescope.builtin")
local extensions = require("telescope").extensions
require("modules.utils").load_plugin("search", {
collections = {
-- Search using filenames
file = {
initial_tab = 1,
tabs = {
{
name = "Files",
tele_func = function(opts)
opts = opts or {}
if vim.fn.isdirectory(".git") == 1 then
builtin.git_files(opts)
else
builtin.find_files(opts)
end
end,
},
{
name = "Frecency",
tele_func = function()
extensions.frecency.frecency()
end,
},
{
name = "Oldfiles",
tele_func = function()
builtin.oldfiles()
end,
},
{
name = "Buffers",
tele_func = function()
builtin.buffers()
end,
},
},
},
-- Search using patterns
pattern = {
initial_tab = 1,
tabs = {
{
name = "Word in project",
tele_func = function()
extensions.live_grep_args.live_grep_args()
end,
},
{
name = "Word under cursor",
tele_func = function(opts)
opts = opts or {}
builtin.grep_string(opts)
end,
},
},
},
-- Search Git objects (branches, commits)
git = {
initial_tab = 1,
tabs = {
{
name = "Branches",
tele_func = function()
builtin.git_branches()
end,
},
{
name = "Commits",
tele_func = function()
builtin.git_commits()
end,
},
{
name = "Commit content",
tele_func = function()
extensions.advanced_git_search.search_log_content()
end,
},
{
name = "Diff current file with commit",
tele_func = function()
extensions.advanced_git_search.diff_commit_file()
end,
},
},
},
-- Retrieve dossiers
dossier = {
initial_tab = 1,
tabs = {
{
name = "Sessions",
tele_func = function()
extensions.persisted.persisted()
end,
},
{
name = "Projects",
tele_func = function()
extensions.projects.projects({})
end,
},
{
name = "Zoxide",
tele_func = function()
extensions.zoxide.list()
end,
},
},
},
-- Miscellaneous
misc = {
initial_tab = 1,
tabs = {
{
name = "Colorschemes",
tele_func = function()
builtin.colorscheme({ enable_preview = true })
end,
},
{
name = "Notify",
tele_func = function()
extensions.notify.notify()
end,
},
{
name = "Undo History",
tele_func = function()
extensions.undo.undo()
end,
},
},
},
},
})
end
@@ -0,0 +1,24 @@
return function()
require("modules.utils").load_plugin("smartyank", {
highlight = {
enabled = false, -- highlight yanked text
higroup = "IncSearch", -- highlight group of yanked text
timeout = 2000, -- timeout for clearing the highlight
},
clipboard = {
enabled = true,
},
tmux = {
enabled = true,
-- remove `-w` to disable copy to host client's clipboard
cmd = { "tmux", "set-buffer", "-w" },
},
osc52 = {
enabled = true,
escseq = "tmux", -- use tmux escape sequence, only enable if you're using remote tmux and have issues (see #4)
ssh_only = true, -- false to OSC52 yank also in local sessions
silent = false, -- true to disable the "n chars copied" echo
echo_hl = "Directory", -- highlight group of the OSC52 echo message
},
})
end
+27
View File
@@ -0,0 +1,27 @@
return function()
require("modules.utils").load_plugin("sniprun", {
selected_interpreters = {}, -- " use those instead of the default for the current filetype
repl_enable = {}, -- " enable REPL-like behavior for the given interpreters
repl_disable = {}, -- " disable REPL-like behavior for the given interpreters
interpreter_options = {}, -- " intepreter-specific options, consult docs / :SnipInfo <name>
-- " you can combo different display modes as desired
display = {
"TempFloatingWindowOk", -- display ok results in the floating window
"NvimNotifyErr", -- display err results with the nvim-notify plugin
-- "Classic", -- display results in the command line"
-- "VirtualText", -- display results in virtual text"
-- "LongTempFloatingWindow", -- display results in the long floating window
-- "Terminal" -- display results in a vertical split
-- "TerminalWithCode" -- display results and code history in a vertical split
},
display_options = {
terminal_width = 45,
notification_timeout = 5000,
},
-- " miscellaneous compatibility/adjustement settings
inline_messages = 0, -- " inline_message (0/1) is a one-line way to display messages
-- " to workaround sniprun not being able to display anything
borders = "single", -- " display borders around floating windows
-- " possible values are 'none', 'single', 'double', or 'shadow'
})
end
+102
View File
@@ -0,0 +1,102 @@
return function()
local icons = { ui = require("modules.utils.icons").get("ui", true) }
local lga_actions = require("telescope-live-grep-args.actions")
require("modules.utils").load_plugin("telescope", {
defaults = {
vimgrep_arguments = {
"rg",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
},
initial_mode = "insert",
prompt_prefix = " " .. icons.ui.Telescope .. " ",
selection_caret = icons.ui.ChevronRight,
scroll_strategy = "limit",
results_title = false,
layout_strategy = "horizontal",
path_display = { "absolute" },
selection_strategy = "reset",
sorting_strategy = "ascending",
color_devicons = true,
file_ignore_patterns = { ".git/", ".cache", "build/", "%.class", "%.pdf", "%.mkv", "%.mp4", "%.zip" },
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.85,
height = 0.92,
preview_cutoff = 120,
},
file_previewer = require("telescope.previewers").vim_buffer_cat.new,
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
file_sorter = require("telescope.sorters").get_fuzzy_file,
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
},
extensions = {
aerial = {
show_lines = false,
show_nesting = {
["_"] = false, -- This key will be the default
lua = true, -- You can set the option for specific filetypes
},
},
fzf = {
fuzzy = false,
override_generic_sorter = true,
override_file_sorter = true,
case_mode = "smart_case",
},
frecency = {
show_scores = true,
show_unindexed = true,
ignore_patterns = { "*.git/*", "*/tmp/*" },
},
live_grep_args = {
auto_quoting = true, -- enable/disable auto-quoting
mappings = { -- extend mappings
i = {
["<C-k>"] = lga_actions.quote_prompt(),
["<C-i>"] = lga_actions.quote_prompt({ postfix = " --iglob " }),
},
},
},
undo = {
side_by_side = true,
mappings = {
i = {
["<cr>"] = require("telescope-undo.actions").yank_additions,
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
["<C-cr>"] = require("telescope-undo.actions").restore,
},
},
},
advanced_git_search = {
diff_plugin = "diffview",
git_flags = { "-c", "delta.side-by-side=true" },
entry_default_author_or_date = "author", -- one of "author" or "date"
},
},
})
require("telescope").load_extension("frecency")
require("telescope").load_extension("fzf")
require("telescope").load_extension("live_grep_args")
require("telescope").load_extension("notify")
require("telescope").load_extension("projects")
require("telescope").load_extension("undo")
require("telescope").load_extension("zoxide")
require("telescope").load_extension("persisted")
require("telescope").load_extension("aerial")
require("telescope").load_extension("advanced_git_search")
end
@@ -0,0 +1,51 @@
return function()
require("modules.utils").load_plugin("toggleterm", {
-- size can be a number or function which is passed the current terminal
size = function(term)
if term.direction == "horizontal" then
return vim.o.lines * 0.30
elseif term.direction == "vertical" then
return vim.o.columns * 0.40
end
end,
on_open = function(term)
-- Prevent infinite calls from freezing neovim.
-- Only set these options specific to this terminal buffer.
vim.api.nvim_set_option_value("foldmethod", "manual", { scope = "local" })
vim.api.nvim_set_option_value("foldexpr", "0", { scope = "local" })
-- Prevent horizontal terminal from obscuring `nvim-tree`.
local api = require("nvim-tree.api")
local tree = require("nvim-tree.view")
if tree.is_visible() and term.direction == "horizontal" then
local width = vim.fn.winwidth(tree.get_winnr())
api.tree.toggle()
tree.View.width = width
api.tree.toggle(false, true)
end
end,
highlights = {
Normal = {
link = "Normal",
},
NormalFloat = {
link = "NormalFloat",
},
FloatBorder = {
link = "FloatBorder",
},
},
open_mapping = false, -- [[<c-\>]],
hide_numbers = true, -- hide the number column in toggleterm buffers
shade_filetypes = {},
shade_terminals = false,
shading_factor = "1", -- the degree by which to darken to terminal colour, default: 1 for dark backgrounds, 3 for light
start_in_insert = true,
persist_mode = false,
insert_mappings = true, -- whether or not the open mapping applies in insert mode
persist_size = true,
direction = "horizontal",
close_on_exit = true, -- close the terminal window when the process exits
shell = vim.o.shell, -- change the default shell
})
end
+38
View File
@@ -0,0 +1,38 @@
return function()
local icons = {
ui = require("modules.utils.icons").get("ui", true),
}
require("modules.utils").load_plugin("trouble", {
auto_open = false,
auto_close = false,
auto_jump = false,
auto_preview = true,
auto_refresh = true,
focus = false, -- do not focus the window when opened
follow = true,
restore = true,
icons = {
indent = {
fold_open = icons.ui.ArrowOpen,
fold_closed = icons.ui.ArrowClosed,
},
folder_closed = icons.ui.Folder,
folder_open = icons.ui.FolderOpen,
},
modes = {
project_diagnostics = {
mode = "diagnostics",
filter = {
any = {
{
function(item)
return item.filename:find(vim.fn.getcwd(), 1, true)
end,
},
},
},
},
},
})
end
@@ -0,0 +1,71 @@
return function()
local icons = {
ui = require("modules.utils.icons").get("ui"),
misc = require("modules.utils.icons").get("misc"),
git = require("modules.utils.icons").get("git", true),
cmp = require("modules.utils.icons").get("cmp", true),
}
require("which-key").register({
["<leader>"] = {
b = {
name = icons.ui.Buffer .. " Buffer",
},
d = {
name = icons.ui.Bug .. " Debug",
},
f = {
name = icons.ui.Telescope .. " Fuzzy Find",
},
g = {
name = icons.git.Git .. "Git",
},
l = {
name = icons.misc.LspAvailable .. " Lsp",
},
n = {
name = icons.ui.FolderOpen .. " Nvim Tree",
},
p = {
name = icons.ui.Package .. " Package",
},
s = {
name = icons.cmp.tmux .. "Session",
},
S = {
name = icons.ui.Search .. " Search",
},
W = {
name = icons.ui.Window .. " Window",
},
},
})
require("modules.utils").load_plugin("which-key", {
plugins = {
presets = {
operators = false,
motions = false,
text_objects = false,
windows = false,
nav = false,
z = true,
g = true,
},
},
icons = {
breadcrumb = icons.ui.Separator,
separator = icons.misc.Vbar,
group = "",
},
window = {
border = "none",
position = "bottom",
margin = { 1, 0, 1, 0 },
padding = { 1, 1, 1, 1 },
winblend = 0,
},
})
end
+65
View File
@@ -0,0 +1,65 @@
return function()
local wilder = require("wilder")
local icons = { ui = require("modules.utils.icons").get("ui") }
wilder.set_option("use_python_remote_plugin", 0)
wilder.set_option("pipeline", {
wilder.branch(
wilder.cmdline_pipeline({ use_python = 0, fuzzy = 1, fuzzy_filter = wilder.lua_fzy_filter() }),
wilder.vim_search_pipeline(),
{
wilder.check(function(_, x)
return x == ""
end),
wilder.history(),
wilder.result({
draw = {
function(_, x)
return icons.ui.Calendar .. " " .. x
end,
},
}),
}
),
})
local popupmenu_renderer = wilder.popupmenu_renderer(wilder.popupmenu_border_theme({
border = "rounded",
highlights = {
default = "Pmenu",
border = "PmenuBorder", -- highlight to use for the border
accent = wilder.make_hl("WilderAccent", "CmpItemAbbr", "CmpItemAbbrMatch"),
},
empty_message = wilder.popupmenu_empty_message_with_spinner(),
highlighter = wilder.lua_fzy_highlighter(),
left = {
" ",
wilder.popupmenu_devicons(),
wilder.popupmenu_buffer_flags({
flags = " a + ",
icons = { ["+"] = icons.ui.Pencil, a = icons.ui.Indicator, h = icons.ui.File },
}),
},
right = {
" ",
wilder.popupmenu_scrollbar(),
},
}))
local wildmenu_renderer = wilder.wildmenu_renderer({
apply_incsearch_fix = false,
highlighter = wilder.lua_fzy_highlighter(),
separator = " | ",
left = { " ", wilder.wildmenu_spinner(), " " },
right = { " ", wilder.wildmenu_index() },
})
wilder.set_option(
"renderer",
wilder.renderer_mux({
[":"] = popupmenu_renderer,
["/"] = wildmenu_renderer,
substitute = wildmenu_renderer,
})
)
require("modules.utils").load_plugin("wilder", { modes = { ":", "/", "?" } })
end