Update 24.01.2024

This commit is contained in:
Kristofers Solo
2024-01-24 21:28:12 +02:00
parent f37a67d62f
commit 5f7013e770
105 changed files with 3389 additions and 2488 deletions

View File

@@ -1,2 +1,2 @@
vim.opt_local.wrap = true
vim.opt_local.wrap = false
vim.opt_local.spell = true

5
after/ftplugin/typst.lua Normal file
View File

@@ -0,0 +1,5 @@
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2
vim.opt_local.wrap = true
vim.opt_local.spell = true

View File

@@ -1,131 +0,0 @@
if not pcall(require, "ccc") then
return
end
local ccc = require("ccc")
local ColorInput = require("ccc.input")
local convert = require("ccc.utils.convert")
local RgbHslInput = setmetatable({
name = "RGB/HSL",
max = { 1, 1, 1, 360, 1, 1, 1, 1, 1, 1 },
min = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
delta = { 1 / 255, 1 / 255, 1 / 255, 1, 0.01, 0.01, 0.005, 0.005, 0.005, 0.005 },
bar_name = { "R", "G", "B", "H", "S", "L" },
}, { __index = ColorInput })
function RgbHslInput.format(n, i)
if i <= 3 then
-- RGB
n = n * 255
elseif i >= 5 then
-- S or L of HSL
n = n * 100
end
return ("%6d"):format(n)
end
function RgbHslInput.from_rgb(RGB)
local HSL = convert.rgb2hsl(RGB)
local R, G, B = unpack(RGB)
local H, S, L = unpack(HSL)
return { R, G, B, H, S, L }
end
function RgbHslInput.to_rgb(value)
return { value[1], value[2], value[3] }
end
function RgbHslInput:_set_rgb(RGB)
self.value[1] = RGB[1]
self.value[2] = RGB[2]
self.value[3] = RGB[3]
end
function RgbHslInput:_set_hsl(HSL)
self.value[4] = HSL[1]
self.value[5] = HSL[2]
self.value[6] = HSL[3]
end
function RgbHslInput:callback(index, new_value)
self.value[index] = new_value
local v = self.value
if index <= 3 then
local RGB = { v[1], v[2], v[3] }
local HSL = convert.rgb2hsl(RGB)
self:_set_hsl(HSL)
else
local HSL = { v[4], v[5], v[6] }
local RGB = convert.hsl2rgb(HSL)
self:_set_rgb(RGB)
end
end
ccc.setup({
pickers = {
ccc.picker.custom_entries({
bg = "#1a1b26",
bg_dark = "#16161e",
bg_float = "#16161e",
bg_highlight = "#292e42",
bg_popup = "#16161e",
bg_search = "#3d59a1",
bg_sidebar = "#16161e",
bg_statusline = "#16161e",
bg_visual = "#283457",
black = "#15161e",
blue = "#7aa2f7",
blue0 = "#3d59a1",
blue1 = "#2ac3de",
blue2 = "#0db9d7",
blue5 = "#89ddff",
blue6 = "#b4f9f8",
blue7 = "#394b70",
border = "#15161e",
border_highlight = "#27a1b9",
comment = "#565f89",
cyan = "#7dcfff",
dark3 = "#545c7e",
dark5 = "#737aa2",
delta_add = "#2c5a66",
delta_delete = "#713137",
diff_add = "#20303b",
diff_change = "#1f2231",
diff_delete = "#37222c",
diff_text = "#394b70",
error = "#db4b4b",
fg = "#c0caf5",
fg_dark = "#a9b1d6",
fg_float = "#c0caf5",
fg_gutter = "#3b4261",
fg_sidebar = "#a9b1d6",
git_add = "#449dab",
git_change = "#6183bb",
git_delete = "#914c54",
git_ignore = "#545c7e",
gitSigns_add = "#266d6a",
gitSigns_change = "#536c9e",
gitSigns_delete = "#b2555b",
green = "#9ece6a",
green1 = "#73daca",
green2 = "#41a6b5",
hint = "#1abc9c",
info = "#0db9d7",
magenta = "#bb9af7",
magenta2 = "#ff007c",
none = "NONE",
orange = "#ff9e64",
purple = "#9d7cd8",
red = "#f7768e",
red1 = "#db4b4b",
teal = "#1abc9c",
terminal_black = "#414868",
warning = "#e0af68",
yellow = "#e0af68",
}),
},
inputs = {
RgbHslInput,
},
})

View File

@@ -1,35 +0,0 @@
if not pcall(require, "cheatsheet") then
return
end
local ctactions = require("cheatsheet.telescope.actions")
require("cheatsheet").setup({
-- Whether to show bundled cheatsheets
-- For generic cheatsheets like default, unicode, nerd-fonts, etc
bundled_cheatsheets = {
enabled = { "default", "unicode", "regex", "markdown", "lua" },
disabled = { "nerd-fonts" },
},
-- bundled_cheatsheets = true,
-- For plugin specific cheatsheets
bundled_plugin_cheatsheets = {
enabled = {},
disabled = {},
},
-- bundled_plugin_cheatsheets = true,
-- For bundled plugin cheatsheets, do not show a sheet if you
-- don't have the plugin installed (searches runtimepath for
-- same directory name)
include_only_installed_plugins = true,
-- Key mappings bound inside the telescope window
telescope_mappings = {
["<CR>"] = require("cheatsheet.telescope.actions").select_or_fill_commandline,
["<A-CR>"] = require("cheatsheet.telescope.actions").select_or_execute,
["<C-Y>"] = require("cheatsheet.telescope.actions").copy_cheat_value,
["<C-E>"] = require("cheatsheet.telescope.actions").edit_user_cheatsheet,
},
})

View File

@@ -1,67 +0,0 @@
if not pcall(require, "clangd_extensions") then
return
end
require("clangd_extensions").setup({
inlay_hints = {
inline = vim.fn.has("nvim-0.10") == 1,
-- Options other than `highlight' and `priority' only work
-- if `inline' is disabled
-- Only show inlay hints for the current line
only_current_line = false,
-- Event which triggers a refresh of the inlay hints.
-- You can make this { "CursorMoved" } or { "CursorMoved,CursorMovedI" } but
-- not that this may cause higher CPU usage.
-- This option is only respected when only_current_line and
-- autoSetHints both are true.
only_current_line_autocmd = { "CursorHold" },
-- whether to show parameter hints with the inlay hints or not
show_parameter_hints = true,
-- prefix for parameter hints
parameter_hints_prefix = "<- ",
-- prefix for all the other hints (type, chaining)
other_hints_prefix = "=> ",
-- whether to align to the length of the longest line in the file
max_len_align = true,
-- padding from the left if max_len_align is true
max_len_align_padding = 1,
-- whether to align to the extreme right or not
right_align = false,
-- padding from the right if right_align is true
right_align_padding = 8,
-- The color of the hints
highlight = "Comment",
-- The highlight group priority for extmark
priority = 100,
},
ast = {
role_icons = {
type = "",
declaration = "",
expression = "",
specifier = "",
statement = "",
["template argument"] = "",
},
kind_icons = {
Compound = "",
Recovery = "",
TranslationUnit = "",
PackExpansion = "",
TemplateTypeParm = "",
TemplateTemplateParm = "",
TemplateParamObject = "",
},
highlights = {
detail = "Comment",
},
},
memory_usage = {
border = "none",
},
symbol_info = {
border = "none",
},
})

View File

@@ -1,31 +0,0 @@
if not pcall(require, "cloak") then
return
end
require("cloak").setup({
enabled = true,
cloak_character = "*",
-- The applied highlight group (colors) on the cloaking, see `:h highlight`.
highlight_group = "Comment",
-- Applies the length of the replacement characters for all matched
-- patterns, defaults to the length of the matched pattern.
cloak_length = nil, -- Provide a number if you want to hide the true length of the value.
-- Wether it should try every pattern to find the best fit or stop after the first.
try_all_patterns = true,
patterns = {
{
-- Match any file starting with '.env'.
-- This can be a table to match multiple file patterns.
file_pattern = { ".env*" },
-- Match an equals sign and any character after it.
-- This can also be a table of patterns to cloak,
-- example: cloak_pattern = { ':.+', '-.+' } for yaml files.
cloak_pattern = "=.+",
-- A function, table or string to generate the replacement.
-- The actual replacement will contain the 'cloak_character'
-- where it doesn't cover the original text.
-- If left empty the legacy behavior of keeping the first character is retained.
replace = nil,
},
},
})

View File

@@ -1,68 +0,0 @@
if not pcall(require, "cmake-tools") then
return
end
require("cmake-tools").setup({
cmake_command = "cmake", -- this is used to specify cmake command path
cmake_regenerate_on_save = true, -- auto generate when save CMakeLists.txt
cmake_generate_options = { "-DCMAKE_EXPORT_COMPILE_COMMANDS=1" }, -- this will be passed when invoke `CMakeGenerate`
cmake_build_options = {}, -- this will be passed when invoke `CMakeBuild`
cmake_build_directory = "target/build/", -- this is used to specify generate directory for cmake
cmake_build_directory_prefix = "cmake_build_", -- when cmake_build_directory is set to "", this option will be activated
cmake_soft_link_compile_commands = true, -- this will automatically make a soft link from compile commands file to project root dir
cmake_compile_commands_from_lsp = false, -- this will automatically set compile commands file location using lsp, to use it, please set `cmake_soft_link_compile_commands` to false
cmake_kits_path = nil, -- this is used to specify global cmake kits path, see CMakeKits for detailed usage
cmake_variants_message = {
short = { show = true }, -- whether to show short message
long = { show = true, max_length = 40 }, -- whether to show long message
},
cmake_dap_configuration = { -- debug settings for cmake
name = "cpp",
type = "codelldb",
request = "launch",
stopOnEntry = false,
runInTerminal = true,
console = "integratedTerminal",
},
cmake_executor = { -- executor to use
name = "quickfix", -- name of the executor
opts = {}, -- the options the executor will get, possible values depend on the executor type. See `default_opts` for possible values.
default_opts = { -- a list of default and possible values for executors
quickfix = {
show = "only_on_error", -- "always", "only_on_error"
position = "belowright", -- "bottom", "top"
size = 15,
},
overseer = {
new_task_opts = {}, -- options to pass into the `overseer.new_task` command
on_new_task = function(task) end, -- a function that gets overseer.Task when it is created, before calling `task:start`
},
terminal = {}, -- terminal executor uses the values in cmake_terminal
},
},
cmake_terminal = {
name = "terminal",
opts = {
name = "Main Terminal",
prefix_name = "[CMakeTools]: ", -- This must be included and must be unique, otherwise the terminals will not work. Do not use a simple spacebar " ", or any generic name
split_direction = "vertical", -- "horizontal", "vertical"
split_size = 50,
-- Window handling
single_terminal_per_instance = true, -- Single viewport, multiple windows
single_terminal_per_tab = true, -- Single viewport per tab
keep_terminal_static_location = true, -- Static location of the viewport if avialable
-- Running Tasks
start_insert_in_launch_task = false, -- If you want to enter terminal with :startinsert upon using :CMakeRun
start_insert_in_other_tasks = false, -- If you want to enter terminal with :startinsert upon launching all other cmake tasks in the terminal. Generally set as false
focus_on_main_terminal = false, -- Focus on cmake terminal when cmake task is launched. Only used if executor is terminal.
focus_on_launch_terminal = false, -- Focus on cmake launch terminal when executable target in launched.
},
},
cmake_notifications = {
enabled = true, -- show cmake execution progress in nvim-notify
spinner = { "", "", "", "", "", "", "", "", "", "" }, -- icons used for progress display
refresh_rate_ms = 100, -- how often to iterate icons
},
})

View File

@@ -1,33 +0,0 @@
if not pcall(require, "colorizer") then
return
end
require("colorizer").setup({
filetypes = { "html", "css", "javascript", "lua", "yaml", "conf", "toml", "scss" },
user_default_options = {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
names = false, -- "Name" codes like Blue or blue
RRGGBBAA = true, -- #RRGGBBAA hex codes
AARRGGBB = true, -- 0xAARRGGBB hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
-- Available modes for `mode`: foreground, background, virtualtext
mode = "background", -- Set the display mode.
-- Available methods are false / true / "normal" / "lsp" / "both"
-- True is same as normal
tailwind = true, -- Enable tailwind colors
-- parsers can contain values used in |user_default_options|
sass = {
enable = true,
parsers = { "css" },
}, -- Enable sass colors
virtualtext = "",
},
-- all the sub-options of filetypes apply to buftypes
buftypes = {},
html = { names = true },
css = { names = true },
})

View File

@@ -1,61 +0,0 @@
if not pcall(require, "Comment") then
return
end
require("Comment").setup({
---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 = nil,
---LHS of toggle mappings in NORMAL mode
toggler = {
---Line-comment toggle keymap
line = "gcc",
---Block-comment toggle keymap
block = "gbb",
},
-- -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",
},
--- Enable keybindings
--- NOTE: If given `false` then the plugin won't create any mappings
mappings = {
---Operator-pending mapping; `gcc` `gbc` `gc[count]{motion}` `gb[count]{motion}`
basic = true,
---Extra mapping; `gco`, `gcO`, `gcA`
extra = true,
---Extended mapping; `g>` `g<` `g>[count]{motion}` `g<[count]{motion}`
extended = true,
},
---Function to call before (un)comment
-- pre_hook = function(ctx)
-- local U = require("Comment.utils")
--
-- local location = nil
-- if ctx.ctype == U.ctype.block then
-- location = require("ts_context_commentstring.utils").get_cursor_location()
-- elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
-- location = require("ts_context_commentstring.utils").get_visual_start_location()
-- end
--
-- return require("ts_context_commentstring.internal").calculate_commentstring({
-- key = ctx.ctype == U.ctype.line and "__default" or "__multiline",
-- location = location,
-- })
-- end,
})

View File

@@ -1,139 +0,0 @@
if not pcall(require, "crates") then
return
end
require("crates").setup({
smart_insert = true,
insert_closing_quote = true,
avoid_prerelease = true,
autoload = true,
autoupdate = true,
loading_indicator = true,
date_format = "%d-%m-%Y",
thousands_separator = ".",
notification_title = "Crates",
disable_invalid_feature_diagnostic = false,
text = {
loading = "  Loading",
version = "  %s",
prerelease = "  %s",
yanked = "  %s",
nomatch = "  No match",
upgrade = "  %s",
error = "  Error fetching crate",
},
highlight = {
loading = "CratesNvimLoading",
version = "CratesNvimVersion",
prerelease = "CratesNvimPreRelease",
yanked = "CratesNvimYanked",
nomatch = "CratesNvimNoMatch",
upgrade = "CratesNvimUpgrade",
error = "CratesNvimError",
},
popup = {
autofocus = false,
copy_register = '"',
style = "minimal",
border = "none",
show_version_date = false,
show_dependency_version = true,
max_height = 30,
min_width = 20,
padding = 1,
text = {
title = " %s",
pill_left = "",
pill_right = "",
description = "%s",
created_label = " created ",
created = "%s",
updated_label = " updated ",
updated = "%s",
downloads_label = " downloads ",
downloads = "%s",
homepage_label = " homepage ",
homepage = "%s",
repository_label = " repository ",
repository = "%s",
documentation_label = " documentation ",
documentation = "%s",
crates_io_label = " crates.io ",
crates_io = "%s",
categories_label = " categories ",
keywords_label = " keywords ",
version = " %s",
prerelease = " %s",
yanked = " %s",
version_date = " %s",
feature = " %s",
enabled = " %s",
transitive = " %s",
normal_dependencies_title = " Dependencies",
build_dependencies_title = " Build dependencies",
dev_dependencies_title = " Dev dependencies",
dependency = " %s",
optional = " %s",
dependency_version = " %s",
loading = "",
},
highlight = {
title = "CratesNvimPopupTitle",
pill_text = "CratesNvimPopupPillText",
pill_border = "CratesNvimPopupPillBorder",
description = "CratesNvimPopupDescription",
created_label = "CratesNvimPopupLabel",
created = "CratesNvimPopupValue",
updated_label = "CratesNvimPopupLabel",
updated = "CratesNvimPopupValue",
downloads_label = "CratesNvimPopupLabel",
downloads = "CratesNvimPopupValue",
homepage_label = "CratesNvimPopupLabel",
homepage = "CratesNvimPopupUrl",
repository_label = "CratesNvimPopupLabel",
repository = "CratesNvimPopupUrl",
documentation_label = "CratesNvimPopupLabel",
documentation = "CratesNvimPopupUrl",
crates_io_label = "CratesNvimPopupLabel",
crates_io = "CratesNvimPopupUrl",
categories_label = "CratesNvimPopupLabel",
keywords_label = "CratesNvimPopupLabel",
version = "CratesNvimPopupVersion",
prerelease = "CratesNvimPopupPreRelease",
yanked = "CratesNvimPopupYanked",
version_date = "CratesNvimPopupVersionDate",
feature = "CratesNvimPopupFeature",
enabled = "CratesNvimPopupEnabled",
transitive = "CratesNvimPopupTransitive",
normal_dependencies_title = "CratesNvimPopupNormalDependenciesTitle",
build_dependencies_title = "CratesNvimPopupBuildDependenciesTitle",
dev_dependencies_title = "CratesNvimPopupDevDependenciesTitle",
dependency = "CratesNvimPopupDependency",
optional = "CratesNvimPopupOptional",
dependency_version = "CratesNvimPopupDependencyVersion",
loading = "CratesNvimPopupLoading",
},
keys = {
hide = { "q", "<esc>" },
open_url = { "<cr>" },
select = { "<cr>" },
select_alt = { "s" },
toggle_feature = { "<cr>" },
copy_value = { "yy" },
goto_item = { "gd", "K", "<C-LeftMouse>" },
jump_forward = { "<c-i>" },
jump_back = { "<c-o>", "<C-RightMouse>" },
},
},
src = {
insert_closing_quote = true,
text = {
prerelease = "  pre-release ",
yanked = "  yanked ",
},
},
null_ls = {
enabled = true,
name = "crates.nvim",
},
})

View File

@@ -1,85 +0,0 @@
if not pcall(require, "dap") then
return
end
local dap = require("dap")
local dapui = require("dapui")
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
local mason_registry = require("mason-registry")
vim.keymap.set("n", "<F5>", dap.continue)
vim.keymap.set("n", "<F10>", dap.step_over)
vim.keymap.set("n", "<F11>", dap.step_into)
vim.keymap.set("n", "<F12>", dap.step_out)
dapui.setup()
require("nvim-dap-virtual-text").setup({})
-- Python
local debugpy = mason_registry.get_package("debugpy")
local debugpy_path = debugpy:get_install_path() .. "/venv/bin/python"
require("dap-python").setup(debugpy_path)
local codelldb = mason_registry.get_package("codelldb")
local codelldb_path = codelldb:get_install_path() .. "/codelldb"
local liblldb_path = codelldb:get_install_path() .. "/extension/lldb/lib/liblldb.so"
-- Rust
require("rust-tools").setup({
dap = {
adapter = require("rust-tools.dap").get_codelldb_adapter(codelldb_path, liblldb_path),
},
})
-- dap.configurations.rust = {}
-- C/C++
-- FIX: not working
dap.adapters.lldb = {
type = "executable",
command = codelldb_path,
name = "lldb",
}
dap.configurations.cpp = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
-- 💀
-- 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,
},
}
-- If you want to use this for Rust and C, add something like this:
dap.configurations.c = dap.configurations.cpp

View File

@@ -1,10 +0,0 @@
if not pcall(require, "git-worktree") then
return
end
local worktree = require("git-worktree")
worktree.on_tree_change(function(op, metadata)
if op == worktree.Operations.Switch then
print("Switched from " .. metadata.prev_path .. " to " .. metadata.path)
end
end)

View File

@@ -1,33 +0,0 @@
if not pcall(require, "gitsigns") then
return
end
require("gitsigns").setup({
signs = {
add = { hl = "GitSignsAdd", text = "", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" },
change = {
hl = "GitSignsChange",
text = "",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
delete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
topdelete = {
hl = "GitSignsDelete",
text = "",
numhl = "GitSignsDeleteNr",
linehl = "GitSignsDeleteLn",
},
changedelete = {
hl = "GitSignsChange",
text = "",
numhl = "GitSignsChangeNr",
linehl = "GitSignsChangeLn",
},
},
})

View File

@@ -1,18 +0,0 @@
if not pcall(require, "harpoon") then
return
end
local ui = require("harpoon.ui")
vim.keymap.set("n", "<F1>", function()
ui.nav_file(1)
end)
vim.keymap.set("n", "<F2>", function()
ui.nav_file(2)
end)
vim.keymap.set("n", "<F3>", function()
ui.nav_file(3)
end)
vim.keymap.set("n", "<F4>", function()
ui.nav_file(4)
end)

View File

@@ -1,57 +0,0 @@
if not pcall(require, "illuminate") then
return
end
require("illuminate").configure({
providers = {
"lsp",
"treesitter",
"regex",
},
-- delay: delay in milliseconds
delay = 100,
-- filetype_overrides: filetype specific overrides.
-- The keys are strings to represent the filetype while the values are tables that
-- supports the same keys passed to .configure except for filetypes_denylist and filetypes_allowlist
filetype_overrides = {},
-- filetypes_denylist: filetypes to not illuminate, this overrides filetypes_allowlist
filetypes_denylist = {
"alpha",
"NvimTree",
"dirvish",
"fugitive",
},
-- filetypes_allowlist: filetypes to illuminate, this is overridden by filetypes_denylist
filetypes_allowlist = {},
-- modes_denylist: modes to not illuminate, this overrides modes_allowlist
-- See `:help mode()` for possible values
modes_denylist = {},
-- modes_allowlist: modes to illuminate, this is overridden by modes_denylist
-- See `:help mode()` for possible values
modes_allowlist = {},
-- providers_regex_syntax_denylist: syntax to not illuminate, this overrides providers_regex_syntax_allowlist
-- Only applies to the 'regex' provider
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
providers_regex_syntax_denylist = {},
-- providers_regex_syntax_allowlist: syntax to illuminate, this is overridden by providers_regex_syntax_denylist
-- Only applies to the 'regex' provider
-- Use :echom synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name')
providers_regex_syntax_allowlist = {},
-- under_cursor: whether or not to illuminate under the cursor
under_cursor = true,
-- large_file_cutoff: number of lines at which to use large_file_config
-- The `under_cursor` option is disabled when this cutoff is hit
large_file_cutoff = nil,
-- large_file_config: config to use for large files (based on large_file_cutoff).
-- Supports the same keys passed to .configure
-- If nil, vim-illuminate will be disabled for large files.
large_file_overrides = nil,
-- min_count_to_highlight: minimum number of matches required to perform highlighting
min_count_to_highlight = 1,
})
vim.keymap.set("n", "<A-n>", function()
require("illuminate").goto_next_reference()
end, { noremap = true })
vim.keymap.set("n", "<A-p>", function()
require("illuminate").goto_prev_reference()
end, { noremap = true })

View File

@@ -1,30 +0,0 @@
if not pcall(require, "indent_blankline") then
return
end
vim.opt.list = true
vim.opt.listchars:append("space:⋅")
vim.opt.listchars:append("eol:↴")
require("indent_blankline").setup({
char = "",
show_trailing_blankline_indent = true,
show_first_indent_level = true,
use_treesitter = true,
show_end_of_line = true,
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = false,
buftype_exclude = { "terminal", "nofile" },
filetype_exclude = {
"NvimTree",
"Trouble",
"alpha",
"dashboard",
"help",
"lazy",
"neogitstatus",
"packer",
"startify",
},
})

View File

@@ -1,325 +0,0 @@
if not pcall(require, "lsp-zero") then
return
end
local lsp = require("lsp-zero").preset({
float_border = "rounded",
call_servers = "local",
configure_diagnostics = true,
setup_servers_on_start = true,
set_lsp_keymaps = {
preserve_mappings = false,
omit = { "<F1>", "<F2>", "<F3>", "<F4>", "<F5>" },
},
manage_nvim_cmp = {
set_sources = "recommended",
set_basic_mappings = false,
set_extra_mappings = false,
use_luasnip = true,
set_format = true,
documentation_window = true,
},
})
lsp.on_attach(function(_, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
-- lsp.default_keymaps({ buffer = bufnr })
local nmap = function(keys, func, desc)
if desc then
desc = "LSP: " .. desc
end
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
end
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<C-K>", vim.lsp.buf.signature_help, "Signature Documentation")
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
end)
lsp.ensure_installed({
"bashls",
"clangd",
"cmake",
"cssls",
"emmet_ls",
"html",
"jedi_language_server",
"jsonls",
"lua_ls",
"sqlls",
"tailwindcss",
"taplo",
"texlab",
"tsserver",
})
lsp.configure("clangd", {
capabilities = {
offsetEncoding = { "utf-16" },
},
on_attach = function()
require("clangd_extensions.inlay_hints").setup_autocmd()
require("clangd_extensions.inlay_hints").set_inlay_hints()
end,
})
lsp.configure("bashls", {
filetypes = {
"sh",
"bash",
"zsh",
},
})
lsp.configure("emmet_ls", {
filetypes = {
"html",
"htmldjango",
"typescriptreact",
"javascriptreact",
"css",
"sass",
"scss",
"less",
"eruby",
},
})
lsp.configure("texlab", {
settings = {
texlab = {
auxDirectory = ".",
bibtexFormatter = "texlab",
build = {
args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
executable = "xelatex",
forwardSearchAfter = false,
onSave = false,
},
chktex = {
onEdit = false,
onOpenAndSave = false,
},
diagnosticsDelay = 0,
formatterLineLength = 120,
forwardSearch = {
args = {},
},
latexFormatter = "latexindent",
latexindent = {
modifyLineBreaks = false,
},
},
},
})
if not pcall(require, "neodev") then
return
end
require("neodev").setup()
require("lspconfig").lua_ls.setup(lsp.nvim_lua_ls({
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim", "awesome", "client" },
},
-- workspace = {
-- Make the server aware of Neovim runtime files
-- library = vim.api.nvim_get_runtime_file("", true),
-- },
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
root_pattern = {
".stylua.toml",
".luarc.json",
".luarc.jsonc",
".luacheckrc",
"stylua.toml",
"selene.toml",
"selene.yml",
".git",
},
format = {
enable = false,
},
},
},
}))
lsp.setup()
if not pcall(require, "null-ls") then
return
end
local null_ls = require("null-ls")
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local formatting = null_ls.builtins.formatting
-- https://github.com/prettier-solidity/prettier-plugin-solidity
local diagnostics = null_ls.builtins.diagnostics
null_ls.setup({
sources = {
-- Here you can add tools not supported by mason.nvim
-- make sure the source name is supported by null-ls
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
diagnostics.luacheck.with({ extra_args = { "--globals", "vim" } }),
formatting.cbfmt.with({ extra_filetypes = { "vimwiki" } }),
formatting.prettier.with({
extra_filetypes = { "toml" },
extra_args = {
"--no-semi",
"--double-quote",
"--no-bracket-spacing",
"--tab-width",
"4",
"--bracket-same-line",
"--html-whitespace-sensitivity",
"strict",
},
}),
-- formatting.markdownlint.with({ extra_filetypes = { "vimwiki" }, }),
formatting.markdown_toc.with({ extra_filetypes = { "vimwiki" } }),
-- formatting.shellharden.with({ extra_filetypes = { "bash", "csh", "ksh", "zsh" } }),
-- formatting.shfmt.with({ extra_filetypes = { "bash", "csh", "ksh", "zsh" } }),
},
})
-- See mason-null-ls.nvim's documentation for more details:
-- https://github.com/jay-babu/mason-null-ls.nvim#setup
require("mason-null-ls").setup({
ensure_installed = {
"black",
"cbfmt",
"clang_format",
"cmake_format",
"cmake_lint",
"cpplint",
"djlint",
"google_java_format",
"luacheck",
"markdown_toc",
"mypy",
"stylua",
"usort",
"yamlfmt",
"rustywind",
"letexindent",
},
automatic_installation = true,
handlers = {
-- Here you can add functions to register sources.
-- See https://github.com/jay-babu/mason-null-ls.nvim#handlers-usage
--
-- If left empty, mason-null-ls will use a "default handler"
-- to register all sources
},
})
local cmp = require("cmp")
local cmp_action = require("lsp-zero").cmp_action()
local luasnip = require("luasnip")
local kind_icons = {
Text = "󰉿",
Method = "󰆧",
Function = "󰊕",
Constructor = "",
Field = "󰜢",
Variable = "󰀫",
Class = "󰠱",
Interface = "",
Module = "",
Property = "󰜢",
Unit = "󰑭",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "󰈇",
Folder = "󰉋",
EnumMember = "",
Constant = "󰏿",
Struct = "󰙅",
Event = "",
Operator = "󰆕",
TypeParameter = "",
}
cmp.setup({
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-u>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(),
["<C-e>"] = cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
}),
-- Accept currently selected item. If none selected, `select` first item.
-- Set `select` to `false` to only confirm explicitly selected items.
["<cr>"] = cmp.mapping.confirm({ select = true }),
},
sources = {
{ name = "gh_issues" },
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "crates" },
{ name = "path" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "neorg" },
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
formatting = {
fields = { "abbr", "kind", "menu" },
format = function(entry, vim_item)
vim_item.kind = kind_icons[vim_item.kind]
vim_item.menu = ({
nvim_lsp = "[LSP]",
nvim_lua = "[api]",
luasnip = "[snip]",
path = "[path]",
emoji = "[emoji]",
neorg = "[neorg]",
buffer = "[buf]",
gh_issues = "[issues]",
})[entry.source.name]
return vim_item
end,
},
experimental = {
ghost_text = true,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))

View File

@@ -1,35 +0,0 @@
if not pcall(require, "lualine") then
return
end
require("lualine").setup({
options = {
component_separators = { left = "|", right = "|" },
},
--[[ Available components
`branch` (git branch)
`buffers` (shows currently available buffers)
`diagnostics` (diagnostics count from your preferred source)
`diff` (git diff status)
`encoding` (file encoding)
`fileformat` (file format)
`filename`
`filesize`
`filetype`
`hostname`
`location` (location in file in line:column format)
`mode` (vim mode)
`progress` (%progress in file)
`searchcount` (number of search matches when hlsearch is active)
`selectioncount` (number of selected characters or lines)
`tabs` (shows currently available tabs)
`windows` (shows currently available windows) ]]
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = { "filename", "diff", "lsp_progress" },
lualine_x = { "diagnostics", "encoding", "filetype", "filesize" },
lualine_y = { "progress" },
lualine_z = { "location" },
},
})

View File

@@ -1,75 +0,0 @@
if not pcall(require, "luasnip") then
return
end
local ls = require("luasnip")
require("luasnip/loaders/from_vscode").lazy_load()
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
vim.keymap.set({ "i", "s" }, "<C-j>", function()
if ls.expand_or_jumpable() then
ls.expand_or_jump()
end
end, { silent = true })
vim.keymap.set({ "i", "s" }, "<C-k>", function()
if ls.jumpable(-1) then
ls.jump(-1)
end
end, { silent = true })
vim.keymap.set({ "i" }, "<C-l>", function()
if ls.choice_active() then
ls.change_choice(1)
end
end, { silent = true })
vim.keymap.set({ "i" }, "<C-h>", function()
if ls.choice_active() then
ls.change_choice(-1)
end
end, { silent = true })
ls.config.set_config({
-- This tells LuaSnip to remember to keep around the last snippet.
-- You can jump back into it even if you move outside of the selection
history = true,
-- This one is cool cause if you have dynamic snippets, it updates as you type!
updateevents = "TextChanged,TextChangedI",
-- Autosnippets:
enable_autosnippets = true,
-- Crazy highlights!!
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { " « ", "NonTest" } },
},
},
},
})

View File

@@ -1,31 +0,0 @@
if not pcall(require, "neorg") then
return
end
require("neorg").setup({
load = {
["core.defaults"] = {}, -- Loads default behaviour
["core.concealer"] = {}, -- Adds pretty icons to your documents
["core.dirman"] = { -- Manages Neorg workspaces
config = {
workspaces = {
university = "~/neorg/University",
},
default_workspace = "university",
},
},
["core.completion"] = {
config = {
engine = "nvim-cmp",
name = "[Neorg]",
},
},
["core.export.markdown"] = {},
["core.summary"] = {
config = {
strategy = "default",
},
},
-- ["core.ui.calendar"] = {},
},
})

View File

@@ -1,37 +0,0 @@
if not pcall(require, "obsidian") then
return
end
require("obsidian").setup({
dir = "~/obsidian",
notes_subdir = "university",
completion = {
nvim_cmp = true,
min_chars = 2,
new_notes_location = "current_dir",
prepend_note_id = true,
},
mappings = {
["gf"] = require("obsidian.mapping").gf_passthrough(),
},
-- templates = {
-- subdir = "university/templates",
-- date_format = "%Y.%m.%d",
-- time_format = "%H:%M:%S",
-- },
backlinks = {
height = 10,
wrap = true,
},
follow_url_func = function(url)
vim.fn.jobstart({ "xdg-open", url })
end,
use_advanced_uri = true,
open_app_foreground = false,
open_notes_in = "current",
})

View File

@@ -1,135 +0,0 @@
if not pcall(require, "oil") then
return
end
local nmap = require("solo.mappings").nmap
nmap("-", vim.cmd.Oil, "Open parent directory")
require("oil").setup({
-- Oil will take over directory buffers (e.g. `vim .` or `:e src/`)
-- Set to false if you still want to use netrw.
default_file_explorer = true,
-- Id is automatically added at the beginning, and name at the end
-- See :help oil-columns
columns = {
"icon",
-- "permissions",
"size",
-- "mtime",
},
-- Buffer-local options to use for oil buffers
buf_options = {
buflisted = false,
bufhidden = "hide",
},
-- Window-local options to use for oil buffers
win_options = {
wrap = false,
signcolumn = "no",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "n",
},
-- Restore window options to previous values when leaving an oil buffer
restore_win_options = true,
-- Skip the confirmation popup for simple operations
skip_confirm_for_simple_edits = false,
-- Deleted files will be removed with the trash_command (below).
delete_to_trash = true,
-- Change this to customize the command used when deleting to trash
trash_command = "trash-put",
-- Selecting a new/moved/renamed file or directory will prompt you to save changes first
prompt_save_on_select_new_entry = true,
-- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap
-- options with a `callback` (e.g. { callback = function() ... end, desc = "", nowait = true })
-- Additionally, if it is a string that matches "actions.<name>",
-- it will use the mapping at require("oil.actions").<name>
-- Set to `false` to remove a keymap
-- See :help oil-actions for a list of all available actions
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<leader>v"] = "actions.select_vsplit",
["<leader>h"] = "actions.select_split",
["<leader>t"] = "actions.select_tab",
["<leader>p"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-r>"] = "actions.refresh",
["Y"] = "actions.copy_entry_path",
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["."] = "actions.toggle_hidden",
},
-- Set to false to disable all of the above keymaps
use_default_keymaps = false,
view_options = {
-- Show files and directories that start with "."
show_hidden = true,
-- This function defines what is considered a "hidden" file
is_hidden_file = function(name, bufnr)
return vim.startswith(name, ".")
end,
-- This function defines what will never be shown, even when `show_hidden` is set
is_always_hidden = function(name, bufnr)
return false
end,
},
-- Configuration for the floating window in oil.open_float
float = {
-- Padding around the floating window
padding = 2,
max_width = 0,
max_height = 0,
border = "rounded",
win_options = {
winblend = 10,
},
-- This is the config that will be passed to nvim_open_win.
-- Change values here to customize the layout
override = function(conf)
return conf
end,
},
-- Configuration for the actions floating preview window
preview = {
-- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- min_width and max_width can be a single value or a list of mixed integer/float types.
-- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total"
max_width = 0.9,
-- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total"
min_width = { 40, 0.4 },
-- optionally define an integer/float for the exact width of the preview window
width = nil,
-- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%)
-- min_height and max_height can be a single value or a list of mixed integer/float types.
-- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total"
max_height = 0.9,
-- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total"
min_height = { 5, 0.1 },
-- optionally define an integer/float for the exact height of the preview window
height = nil,
border = "rounded",
win_options = {
winblend = 0,
},
},
-- Configuration for the floating progress window
progress = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = { 10, 0.9 },
min_height = { 5, 0.1 },
height = nil,
border = "rounded",
minimized_border = "none",
win_options = {
winblend = 0,
},
},
})

View File

@@ -1,50 +0,0 @@
if not pcall(require, "runner") then
return
end
local runner = require("runner")
local choice = require("runner.handlers.helpers").choice
local helpers = require("runner.handlers.helpers")
runner.setup({
position = "right", -- position of the terminal window when using the shell_handler
-- can be: top, left, right, bottom
-- will be overwritten when using the telescope mapping to open horizontally or vertically
width = 50, -- width of window when position is left or right
height = 10, -- height of window when position is top or bottom
})
runner.set_handler(
"cpp",
choice({
Cmake = function()
-- vim.cmd.CMakeBuild()
vim.cmd.CMakeRun()
end,
Makefile = helpers.shell_handler("make"),
["g++"] = helpers.shell_handler(
"g++ " .. vim.fn.expand("%") .. " -o " .. vim.fn.expand("%:r") .. " && " .. vim.fn.expand("%:r")
),
Custom = helpers.shell_handler("", true),
})
)
runner.set_handler(
"c",
choice({
Cmake = vim.cmd.CMakeRun,
Makefile = helpers.shell_handler("make"),
["gcc"] = helpers.shell_handler(
"gcc " .. vim.fn.expand("%") .. " -o " .. vim.fn.expand("%:r") .. " && " .. vim.fn.expand("%:r")
),
Custom = helpers.shell_handler("", true),
})
)
-- runner.set_handler(
-- "python",
-- choice({
-- Python = helpers.shell_handler("python " .. vim.fn.expand("%:t")),
-- Custom = helpers.shell_handler("", true),
-- })
-- )

View File

@@ -1,30 +0,0 @@
if not pcall(require, "rust-tools") then
return
end
require("rust-tools").setup({
tools = {
on_initialized = function()
vim.api.nvim_create_autocmd({ "BufEnter", "CursorHold", "InsertLeave", "BufWritePost" }, {
group = vim.api.nvim_create_augroup("InitializeRustAnalyzer", { clear = true }),
pattern = { "*.rs" },
callback = function()
vim.lsp.codelens.refresh()
end,
})
end,
reload_workspace_from_cargo_toml = true,
inlay_hints = {
auto = true,
only_current_line = false,
show_parameter_hints = true,
parameter_hints_prefix = " <- ",
other_hints_prefix = " => ",
max_len_align = false,
max_len_align_padding = 1,
right_align = false,
right_align_padding = 7,
highlight = "Comment",
},
},
})

View File

@@ -14,13 +14,12 @@ ls.add_snippets("rust", {
"modtest",
fmt(
[[
#[cfg(test)]
mod tests {{
use super::*;
{}
}}
]],
#[cfg(test)]
mod tests {{
use super::*;
{}
}}
]],
{
i(1),
}

View File

@@ -0,0 +1,89 @@
local run_formatter = function(text)
local split = vim.split(text, "\n")
local result = table.concat(vim.list_slice(split, 2, #split - 1), "\n")
-- Finds sql-format-via-python somewhere in your nvim config path
local bin = vim.api.nvim_get_runtime_file("bin/sql-format-via-python.py", false)[1]
local j = require("plenary.job"):new({
command = "python",
args = { bin },
writer = { result },
})
return j:sync()
end
local embedded_sql = vim.treesitter.query.parse(
"rust",
[[
(macro_invocation
(scoped_identifier
path: (identifier) @path (#eq? @path "sqlx"))
(token_tree
(raw_string_literal) @sql)
(#offset! @sql 1 0 -1 0))
]]
)
local get_root = function(bufnr)
local parser = vim.treesitter.get_parser(bufnr, "rust", {})
local tree = parser:parse()[1]
return tree:root()
end
local format_dat_sql = function(bufnr)
bufnr = bufnr or vim.api.nvim_get_current_buf()
if vim.bo[bufnr].filetype ~= "rust" then
vim.notify("can only be used in rust")
return
end
local root = get_root(bufnr)
local changes = {}
for id, node in embedded_sql:iter_captures(root, bufnr, 0, -1) do
local name = embedded_sql.captures[id]
if name == "sql" then
-- { start row, start col, end row, end col }
local range = { node:range() }
local indentation = string.rep(" ", range[2])
-- Run the formatter, based on the node text
local formatted = run_formatter(vim.treesitter.get_node_text(node, bufnr))
-- Add some indentation (can be anything you like!)
for idx, line in ipairs(formatted) do
formatted[idx] = indentation .. line
end
-- Keep track of changes
-- But insert them in reverse order of the file,
-- so that when we make modifications, we don't have
-- any out of date line numbers
table.insert(changes, 1, {
start = range[1] + 1,
final = range[3],
formatted = formatted,
})
end
end
for _, change in ipairs(changes) do
vim.api.nvim_buf_set_lines(bufnr, change.start, change.final, false, change.formatted)
end
end
vim.api.nvim_create_user_command("SqlMagic", function()
format_dat_sql()
end, {})
local group = vim.api.nvim_create_augroup("rust-sql-magic", { clear = true })
vim.api.nvim_create_autocmd("BufWritePre", {
group = group,
pattern = "*.rs",
callback = function()
format_dat_sql()
end,
})

View File

@@ -1,177 +0,0 @@
if not pcall(require, "telescope") then
return
end
vim.keymap.set("n", "<C-p>", require("telescope.builtin").git_files, {})
local telescope = require("telescope")
local actions = require("telescope.actions")
telescope.setup({
defaults = {
vimgrep_arguments = {
"rg",
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
"--smart-case",
"--hidden",
},
prompt_prefix = "",
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = { ".git/", ".spl", "target/" },
mappings = {
i = {
["<Down>"] = actions.cycle_history_next,
["<Up>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
["<C-D>"] = actions.delete_buffer + actions.move_to_top,
-- ["<C-Y>"] = actions.remove_selection
},
},
},
pickers = {
find_files = {
hidden = true,
follow = true,
},
},
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
},
media_files = {
-- filetypes whitelist
filetypes = { "png", "webp", "jpg", "jpeg", "mp4", "webm" },
find_cmd = "rg",
},
emoji = {
action = function(emoji)
-- argument emoji is a table.
-- {name="", value="", cagegory="", description=""}
vim.fn.setreg("*", emoji.value)
print([[Press p or "*p to paste this emoji]] .. emoji.value)
-- insert emoji when picked
-- vim.api.nvim_put({ emoji.value }, 'c', false, true)
end,
},
["ui-select"] = {
require("telescope.themes").get_dropdown({
-- even more opts
}),
-- pseudo code / specification for writing custom displays, like the one
-- for "codeactions"
-- specific_opts = {
-- [kind] = {
-- make_indexed = function(items) -> indexed_items, width,
-- make_displayer = function(widths) -> displayer
-- make_display = function(displayer) -> function(e)
-- make_ordinal = function(e) -> string
-- },
-- -- for example to disable the custom builtin "codeactions" display
-- do the following
-- codeactions = false,
-- }
},
lazy = {
-- Optional theme (the extension doesn't set a default theme)
theme = "dropdown",
previewer = false,
-- Whether or not to show the icon in the first column
show_icon = true,
-- Mappings for the actions
mappings = {
open_in_browser = "<C-o>",
open_in_file_browser = "<M-b>",
open_in_find_files = "<C-f>",
open_in_live_grep = "<C-g>",
open_plugins_picker = "<C-b>", -- Works only after having called first another action
open_lazy_root_find_files = "<C-r>f",
open_lazy_root_live_grep = "<C-r>g",
},
-- Other telescope configuration options
},
http = {
-- How the mozilla url is opened. By default will be configured based on OS:
open_url = "xdg-open %s", -- UNIX
-- open_url = 'open %s' -- OSX
-- open_url = 'start %s' -- Windows
},
heading = {
treesitter = true,
picker_opts = {
layout_config = { width = 0.8, preview_width = 0.5 },
layout_strategy = "horizontal",
},
},
bibtex = {
-- Depth for the *.bib file
depth = 1,
-- Custom format for citation label
custom_formats = {},
-- Format to use for citation label.
-- Try to match the filetype by default, or use 'plain'
format = "",
-- Path to global bibliographies (placed outside of the project)
global_files = {},
-- Define the search keys to use in the picker
search_keys = { "author", "year", "title" },
-- Template for the formatted citation
citation_format = "{{author}} ({{year}}), {{title}}.",
-- Only use initials for the authors first name
citation_trim_firstname = true,
-- Max number of authors to write in the formatted citation
-- following authors will be replaced by "et al."
citation_max_auth = 2,
-- Context awareness disabled by default
context = false,
-- Fallback to global/directory .bib files if context not found
-- This setting has no effect if context = false
context_fallback = true,
-- Wrapping in the preview window is disabled by default
wrap = false,
},
undo = {
use_delta = true,
use_custom_command = nil, -- setting this implies `use_delta = false`. Accepted format is: { "bash", "-c", "echo '$DIFF' | delta" }
side_by_side = false,
diff_context_lines = vim.o.scrolloff,
entry_format = "state #$ID, $STAT, $TIME",
time_format = "",
mappings = {
i = {
-- IMPORTANT: Note that telescope-undo must be available when telescope is configured if
-- you want to replicate these defaults and use the following actions. This means
-- installing as a dependency of telescope in it's `requirements` and loading this
-- extension from there instead of having the separate plugin definition as outlined
-- above.
["<cr>"] = require("telescope-undo.actions").yank_additions,
["<S-cr>"] = require("telescope-undo.actions").yank_deletions,
["<C-cr>"] = require("telescope-undo.actions").restore,
},
},
},
},
})
pcall(telescope.load_extension, "fzf")
pcall(telescope.load_extension, "media_files") -- Telescope media_files
pcall(telescope.load_extension, "git_worktree") -- Telescope git_worktree
pcall(telescope.load_extension, "lazy") -- Telescope lazy
pcall(telescope.load_extension, "software-licenses") -- Telescope software-licenses list
pcall(telescope.load_extension, "http") -- Telescope http list
pcall(telescope.load_extension, "heading") -- Telescope heading
pcall(telescope.load_extension, "luasnip") -- Telescope luasnip
pcall(telescope.load_extension, "git_diffs") -- Telescope git_diffs diff_commits
pcall(telescope.load_extension, "bibtex") -- Telescope bibtex
pcall(telescope.load_extension, "undo") -- Telescope undo

View File

@@ -1,82 +0,0 @@
if not pcall(require, "nvim-treesitter") then
return
end
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "cpp", "lua", "rust", "python", "markdown" }, -- one of "all" or a list of languages
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
-- List of parsers to ignore installing (for "all")
ignore_install = { "latex" },
modules = {},
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = { "markdown" },
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
},
indent = {
enable = true,
},
autopairs = {
enable = true,
},
autotag = {
enable = true,
enable_rename = true,
enable_close = true,
enable_close_on_slash = true,
filetypes = {
"astro",
"glimmer",
"handlebars",
"hbs",
"html",
"htmldjango",
"javascript",
"javascriptreact",
"jsx",
"markdown",
"php",
"rescript",
"svelte",
"tsx",
"typescript",
"typescriptreact",
"vue",
"xml",
},
},
-- incremenral_selection = {
-- enable = true,
-- keymaps = {
-- init_selection = "<C-space>",
-- node_selection = "<C-space>",
-- scope_selection = "<C-space>",
-- node_deselection = "<C-backspace>",
-- },
-- },
rainbow = {
enable = true,
-- disable = { "jsx", "cpp" }, list of languages you want to disable the plugin for
extended_mode = true, -- Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
max_file_lines = nil, -- Do not enable for files with more than n lines, int
-- colors = {}, -- table of hex strings
-- termcolors = {}, -- table of colour name strings
},
})

View File

@@ -1,346 +0,0 @@
if not pcall(require, "which-key") then
return
end
local which_key = require("which-key")
local builtin = require("telescope.builtin")
local extensions = require("telescope").extensions
local setup = {
plugins = {
marks = true, -- shows a list of your marks on " and `
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
spelling = {
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
suggestions = 20, -- how many suggestions should be shown in the list?
},
-- the presets plugin, adds help for a bunch of default keybindings in Neovim
-- No actual key bindings are created
presets = {
operators = false, -- adds help for operators like d, y, ... and registers them for motion / text object completion
motions = true, -- adds help for motions
text_objects = true, -- help for text objects triggered after entering an operator
windows = true, -- default bindings on <c-w>
nav = true, -- misc bindings to work with windows
z = true, -- bindings for folds, spelling and others prefixed with z
g = true, -- bindings for prefixed with g
},
},
-- add operators that will trigger motion and text object completion
-- to enable all native operators, set the preset / operators plugin above
-- operators = { gc = "Comments" },
key_labels = {
-- override the label used to display some keys. It doesn"t effect WK in any other way.
-- For example:
-- ["<space>"] = "SPC",
-- ["<cr>"] = "RET",
-- ["<tab>"] = "TAB",
},
icons = {
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo
separator = "", -- symbol used between a key and it"s label
group = "+", -- symbol prepended to a group
},
popup_mappings = {
scroll_down = "<c-d>", -- binding to scroll down inside the popup
scroll_up = "<c-u>", -- binding to scroll up inside the popup
},
window = {
border = "rounded", -- none, single, double, shadow
position = "bottom", -- bottom, top
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]
padding = { 2, 2, 2, 2 }, -- extra window padding [top, right, bottom, left]
winblend = 0,
},
layout = {
height = { min = 4, max = 25 }, -- min and max height of the columns
width = { min = 20, max = 50 }, -- min and max width of the columns
spacing = 3, -- spacing between columns
align = "left", -- align columns left, center or right
},
ignore_missing = true, -- enable this to hide mappings for which you didn"t specify a label
hidden = { "<silent>", "<cmd>", "<Cmd>", "<cr>", "call", "lua", "^:", "^ " }, -- hide mapping boilerplate
show_help = true, -- show help message on the command line when the popup is visible
triggers = "auto", -- automatically setup triggers
-- triggers = {"<leader>"} -- or specify a list manually
triggers_blacklist = {
-- list of mode / prefixes that should never be hooked by WhichKey
-- this is mostly relevant for key maps that start with a native binding
-- most people should not need to change this
i = { "j", "k" },
v = { "j", "k" },
},
}
local opts = {
mode = "n", -- NORMAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local vopts = {
mode = "v", -- VISUAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
-- NOTE: Prefer using : over <cmd> as the latter avoids going back in normal-mode.
-- see https://neovim.io/doc/user/map.html#:map-cmd
local vmappings = {}
local mappings = {
c = { vim.cmd.bdelete, "[C]lose Buffer" },
x = { "<cmd>!chmod +x %<cr>", "chmod & run" },
mr = { "<cmd>CellularAutomaton make_it_rain<cr>", "[M]ake it [R]ain" },
u = { vim.cmd.UndotreeToggle, "Toggle [U]ndotree" },
T = { vim.cmd.TagbarToggle, "Toggle [T]agbar" },
["/"] = {
function()
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ previewer = false }))
end,
"Current Buffer Fuzzy",
},
f = {
function()
builtin.find_files(require("telescope.themes").get_dropdown({ previewer = false }))
end,
"Find [F]iles",
},
F = { builtin.live_grep, "Live Grep" },
b = { builtin.buffers, "Find [B]uffers" },
ha = { require("harpoon.mark").add_file, "[H]arpoon [A]dd File" },
hm = { require("harpoon.ui").toggle_quick_menu, "[H]arpoon [M]enu" },
s = {
name = "Telescope [S]earch",
s = { builtin.grep_string, "[S]tring under the cursor" },
e = { builtin.symbols, "[E]moji" },
d = { builtin.diagnostic, "[D]iagnostics" },
b = { builtin.git_branches, "Checkout [B]ranch" },
h = { builtin.help_tags, "[H]elp" },
M = { builtin.man_pages, "[M]an Pages" },
r = { builtin.oldfiles, "Open [R]ecent Files" },
R = { builtin.registers, "[R]egisters" },
g = { builtin.live_grep, "[G]rep" },
G = { builtin.git_files, "[G]it Files" },
k = { builtin.keymaps, "[K]eymaps" },
C = { builtin.commands, "[C]ommands" },
t = { vim.cmd.TodoTelescope, "[T]odo" },
m = { extensions.media_files.media_files, "[M]edia" },
c = {
function()
builtin.colorscheme({ enable_preview = true })
end,
"[C]olorscheme with Preview",
},
l = { extensions.lazy.lazy, "[L]azy" },
L = { extensions.luasnip.luasnip, "[L]uasnip" },
D = {
name = "[D]evelopment",
s = { "<cmd>Telescope software-licenses find<cr>", "[S]oftware Licenses" },
h = { extensions.http.list, "[H]TTP" },
},
H = { extensions.heading.heading, "[H]eading" },
},
gg = { vim.cmd.LazyGit, "Lazygit" },
gb = {
function()
vim.cmd.Gitsigns("blame_line")
end,
"[G]it [B]lame",
},
gw = { require("telescope").extensions.git_worktree.git_worktrees, "[G]it Change [W]orktree" },
gn = { require("telescope").extensions.git_worktree.create_git_worktree, "[G]it Create [N]ew Worktree" },
gd = { require("telescope").extensions.git_diffs.diff_commits, "[G]it [D]iff" },
l = {
name = "[L]SP",
ca = { vim.lsp.buf.code_action, "[C]ode [A]ction" },
D = { vim.lsp.buf.type_definition, "Type [D]efinitions" },
f = {
function()
vim.lsp.buf.format({ async = true })
end,
"[F]ormat",
},
o = { vim.diagnostic.open_float, "[O]pen Float" },
s = { vim.diagnostic.setloclist, "[S]etloclist" },
j = {
function()
vim.diagnostic.goto_next()
vim.cmd("norm zz")
end,
"Next Diagnostic",
},
k = {
function()
vim.diagnostic.goto_prev()
vim.cmd("norm zz")
end,
"Prev Diagnostic",
},
r = { vim.lsp.buf.rename, "[R]ename" },
ds = { builtin.lsp_document_symbols, "[D]ocument [S]ymbols" },
w = {
d = { builtin.diagnostics, "[W]orkspace [D]iagnostics" },
s = { builtin.lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols" },
a = { vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder" },
r = { vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder" },
l = {
function()
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end,
"[W]orkspace [L]ist Folder",
},
},
q = { builtin.quickfix, "Telescope [Q]uickfix" },
},
r = {
name = "[R]ust",
e = { vim.cmd.RustExpandMacro, "[E]xpand macro" },
c = { vim.cmd.RustOpenCargo, "Open [C]argo.toml" },
p = { vim.cmd.RustParentModule, "[P]arent module" },
h = { vim.cmd.RustHoverActions, "[H]over actions" },
g = { vim.cmd.RustViewCrateGraph, "View Create [G]raph" },
d = { vim.cmd.RustOpenExternalDocs, "Open External [D]ocs" },
r = { vim.cmd.RustRunnables, "Open [R]unnables" },
a = { vim.cmd.RustCodeAction, "Code [A]ction Groups" },
},
L = {
name = "[L]anguage settings",
c = { "<cmd>setlocal formatoptions-=cro<cr>", "Disable autocomment" },
C = { "<cmd>setlocal formatoptions=cro<cr>", "Enable autocomment" },
s = { "<cmd>setlocal spell!<cr>", "Toggle spellchecker" },
e = { "<cmd>setlocal spell spelllang=en_us<cr>", "Enable English spellchecker" },
l = { "<cmd>setlocal spell spelllang=lv_LV<cr>", "Enable Lavian spellchecker" },
I = { "<cmd>setlocal autoindent<cr>", "Enable autoindent" },
i = { "<cmd>setlocal noautoindent<cr>", "Disable autoindent" },
},
d = {
name = "[D]AP",
d = { require("dap").toggle_breakpoint, "Set breakpoint" },
D = {
function()
require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: "))
end,
"Set Breakpoint with Condition",
},
p = {
name = "[P]ython",
m = { require("dap-python").test_method, "Test [M]ethod" },
c = { require("dap-python").test_class, "Test [C]lass" },
s = { require("dap-python").debug_selection, "Debug [S]election" },
},
r = {
name = "[R]ust",
d = { vim.cmd.RustDebuggables, "[D]ebug" },
},
t = { require("dapui").toggle, "[T]oggle DAP-UI" },
c = { require("dap").continue, "Launch Debug Sessions and Resume Execution" },
i = { require("dap").step_into, "Step [I]nto Code" },
o = { require("dap").step_over, "Step [O]ver Code" },
O = { require("dap").step_out, "Step [O]ut of Code" },
T = { require("dap").terminate, "[T]erminate" },
l = { require("dap").run_last, "Run [L]ast" },
h = { require("dap.ui.widgets").hover, "[H]over" },
P = { require("dap.ui.widgets").preview, "[P]review" },
f = {
function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.frames)
end,
"[F]rames",
},
s = {
function()
local widgets = require("dap.ui.widgets")
widgets.centered_float(widgets.scopes)
end,
"[S]copes",
},
},
w = {
name = "Vim[W]iki",
w = { vim.cmd.VimwikiIndex, "Open index file" },
t = { vim.cmd.VimwikiTabIndex, "Open Index File in New [T]ab" },
s = { vim.cmd.VimwikiUISelect, "Display List of Wikis" },
i = { vim.cmd.VimwikiDiaryIndex, "Open Diary Index" },
h = { vim.cmd.Vimwiki2HTML, "Convert File to HTML" },
H = { vim.cmd.Vimwiki2HTMLBrowse, "Convert File to HTML and open in Browser" },
n = { vim.cmd.VimwikiGoto, "Goto link provided by an argument" },
d = { vim.cmd.VimwikiDeleteFile, "Rename file" },
r = { vim.cmd.VimwikiRenameFile, "Delete file" },
},
t = {
name = "Vim[T]ex",
b = { vim.cmd.VimtexCompile, "[B]uild" },
v = { vim.cmd.VimtexView, "[V]iew" },
w = { vim.cmd.VimtexCountWords, "[W]ord Count" },
t = { vim.cmd.VimtexTocToggle, "[T]able of Contents" },
c = { vim.cmd.VimtexClean, "[C]lean aux" },
e = { vim.cmd.VimtexErrors, "Report [E]rrors" },
i = { vim.cmd.VimtexInfo, "[I]nfo" },
B = { builtin.bibtex, "Telescope [B]ibtex" },
},
p = {
name = "Tem[p]lates",
l = {
name = "[L]aTeX",
p = {
function()
vim.cmd.read("~/Templates/LaTeX/PhilPaper.tex")
end,
"PhilPaper.tex",
},
l = {
function()
vim.cmd.read("~/Templates/LaTeX/Letter.tex")
end,
"Letter.tex",
},
g = {
function()
vim.cmd.read("~/Templates/LaTeX/Glossary.tex")
end,
"Glossary.tex",
},
h = {
function()
vim.cmd.read("~/Templates/LaTeX/HandOut.tex")
end,
"HandOut.tex",
},
b = {
function()
vim.cmd.read("~/Templates/LaTeX/PhilBeamer.tex")
end,
"PhilBeamer.tex",
},
s = {
function()
vim.cmd.read("~/Templates/LaTeX/SubFile.tex")
end,
"SubFile.tex",
},
r = {
function()
vim.cmd.read("~/Templates/LaTeX/Root.tex")
end,
"Root.tex",
},
m = {
function()
vim.cmd.read("~/Templates/LaTeX/MultipleAnswer.tex")
end,
"MultipleAnswer.tex",
},
},
c = {
name = "[C]make",
},
},
}
which_key.setup(setup)
which_key.register(mappings, opts, vopts, vmappings)