Moved plugin configs

This commit is contained in:
Kristofers Solo
2023-04-23 23:15:03 +03:00
parent a7e28fe683
commit 3728ed740f
24 changed files with 31 additions and 43 deletions

View File

@@ -0,0 +1,86 @@
local status_ok, bufferline = pcall(require, "bufferline")
if not status_ok then
return
end
bufferline.setup({
options = {
close_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
right_mouse_command = "Bdelete! %d", -- can be a string | function, see "Mouse actions"
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
},
highlights = {
fill = {
fg = { attribute = "fg", highlight = "ff0000" },
bg = { attribute = "bg", highlight = "TabLine" },
},
background = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
buffer_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
close_button = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
close_button_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
tab_selected = {
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
tab = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
tab_close = {
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "Normal" },
},
duplicate_selected = {
fg = { attribute = "fg", highlight = "TabLineSel" },
bg = { attribute = "bg", highlight = "TabLineSel" },
italic = true,
},
duplicate_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
italic = true,
},
duplicate = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
italic = true,
},
modified = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
modified_selected = {
fg = { attribute = "fg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
modified_visible = {
fg = { attribute = "fg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
separator = {
fg = { attribute = "bg", highlight = "TabLine" },
bg = { attribute = "bg", highlight = "TabLine" },
},
separator_selected = {
fg = { attribute = "bg", highlight = "Normal" },
bg = { attribute = "bg", highlight = "Normal" },
},
indicator_selected = {
fg = { attribute = "fg", highlight = "LspDiagnosticsDefaultHint" },
bg = { attribute = "bg", highlight = "Normal" },
},
},
})

95
after/plugin/cmp.lua Normal file
View File

@@ -0,0 +1,95 @@
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
local luasnip_status_ok, luasnip = pcall(require, "luasnip")
if not luasnip_status_ok then
return
end
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 = "path" },
{ name = "luasnip" },
{ name = "buffer", keyword_length = 1 },
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
formatting = {
fields = { "kind", "abbr", "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]",
buffer = "[buf]",
path = "[path]",
emoji = "[emoji]",
gh_issues = "[issues]",
})[entry.source.name]
return vim_item
end,
},
experimental = {
ghost_text = true,
native_menu = false,
},
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
},
})

View File

@@ -0,0 +1,75 @@
local plenary_status_ok, plenary = pcall(require, "plenary.job")
if not plenary_status_ok then
return
end
local source = {}
local enabled = true
source.new = function()
return setmetatable({ cache = {} }, { __index = source })
end
source.complete = function(self, _, callback)
if not enabled then
return
end
local bufnr = vim.api.nvim_get_current_buf()
-- This just makes sure that we only hit the GH API once per session.
--
-- You could remove this if you wanted, but this just makes it so we're
-- good programming citizens.
if not self.cache[bufnr] then
plenary
:new({
-- Uses `gh` executable to request the issues from the remote repository.
"gh",
"issue",
"list",
"--limit",
"1000",
"--json",
"title,number,body",
on_exit = function(job)
local result = job:result()
local parser_status_ok, parsed = pcall(vim.json.decode, table.concat(result, ""))
if not parser_status_ok then
enabled = false
return
end
local items = {}
for _, gh_item in ipairs(parsed) do
gh_item.body = string.gsub(gh_item.body or "", "\r", "")
table.insert(items, {
label = string.format("#%s", gh_item.number),
documentation = {
kind = "markdown",
value = string.format("# %s\n\n%s", gh_item.title, gh_item.body),
},
})
end
callback({ items = items, isIncomplete = false })
self.cache[bufnr] = items
end,
})
:start()
else
callback({ items = self.cache[bufnr], isIncomplete = false })
end
end
source.get_trigger_characters = function()
return { "#" }
end
source.is_available = function()
return vim.bo.filetype == "gitcommit"
end
require("cmp").register_source("gh_issues", source.new())

View File

@@ -0,0 +1,34 @@
local status_ok, colorizer = pcall(require, "colorizer")
if not status_ok then
return
end
colorizer.setup({
filetypes = { "html", "css", "js", "lua", "yaml", "conf", "toml" },
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

@@ -0,0 +1,22 @@
local theme_status_ok, dracula = pcall(require, "dracula")
if not theme_status_ok then
return
end
dracula.setup({
-- show the '~' characters after the end of buffers
show_end_of_buffer = true, -- default false
-- use transparent background
transparent_bg = true, -- default false
-- set custom lualine background color
-- lualine_bg_color = "#44475a", -- default nil
-- set italic comment
italic_comment = true, -- default false
-- overrides the default highlights see `:h synIDattr`
overrides = {
-- Examples
-- NonText = { fg = dracula.colors().white }, -- set NonText fg to white
-- NvimTreeIndentMarker = { link = "NonText" }, -- link to NonText highlight
-- Nothing = {} -- clear highlight of Nothing
},
})

62
after/plugin/comment.lua Normal file
View File

@@ -0,0 +1,62 @@
local status_ok, comment = pcall(require, "Comment")
if not status_ok then
return
end
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,
})

144
after/plugin/crates.lua Normal file
View File

@@ -0,0 +1,144 @@
local status_ok, crates = pcall(require, "crates")
if not status_ok then
return
end
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 ",
},
coq = {
enabled = false,
name = "Crates",
},
},
null_ls = {
enabled = false,
name = "Crates",
},
})

200
after/plugin/dap.lua Normal file
View File

@@ -0,0 +1,200 @@
local status_mason_dap_ok, mason_dap = pcall(require, "mason-nvim-dap")
if not status_mason_dap_ok then
return
end
local dap_status_ok, dap = pcall(require, "dap")
if not dap_status_ok then
return
end
local dap_ui_status_ok, dapui = pcall(require, "dapui")
if not dap_ui_status_ok then
return
end
local dap_install_status_ok, dap_install = pcall(require, "dap-install")
if not dap_install_status_ok then
return
end
mason_dap.setup({
automatic_installation = true,
automatic_setup = true,
})
-- add other configs here
dapui.setup({
layouts = {
{
elements = {
"scopes",
"breakpoints",
"stacs",
"watches",
},
size = 40,
position = "left",
},
{
elements = {
"repl",
"console",
},
size = 10,
position = "bottom",
},
},
-- sidebar = {
-- elements = {
-- {
-- id = "scopes",
-- size = 0.25, -- Can be float or integer > 1
-- },
-- { id = "breakpoints", size = 0.25 },
-- },
-- size = 40,
-- position = "right", -- Can be "left", "right", "top", "bottom"
-- },
-- tray = {
-- elements = {},
-- },
})
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
-- Python
dap.adapters.python = {
type = "executable",
command = vim.fn.stdpath("data") .. "/mason/bin/debugpy-adapter",
}
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 = "Launch file",
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
program = "${file}", -- This configuration will launch the current file if used.
pythonPath = function()
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
local cwd = vim.fn.getcwd()
if vim.fn.executable(cwd .. "/venv/bin/python") == 1 then
return cwd .. "/venv/bin/python"
elseif vim.fn.executable(cwd .. "/.venv/bin/python") == 1 then
return cwd .. "/.venv/bin/python"
else
return "/usr/bin/python"
end
end,
},
}
-- C/C++/Rust
dap.adapters.lldb = {
type = "executable",
command = vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension/adapter/codelldb", -- adjust as needed, must be absolute 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
dap.configurations.rust = dap.configurations.cpp
-- JavaScript
dap.adapters.firefox = {
type = "executable",
command = "node",
args = { vim.fn.stdpath("data") .. "/mason/packages/firefox-debug-adapter/dist/adapter.bundle.js" },
}
dap.configurations.typescript = {
{
name = "Debug with Librewolf",
type = "firefox",
request = "launch",
reAttach = true,
url = "http://localhost:3000",
webRoot = "${workspaceFolder}",
firefoxExecutable = "/usr/bin/librewolf",
},
}
dap.configurations.javascript = {
{
name = "Debug with Librewolf",
type = "firefox",
request = "launch",
reAttach = true,
url = "http://localhost:3000",
webRoot = "${workspaceFolder}",
firefoxExecutable = "/usr/bin/librewolf",
},
}
-- Bash
dap.adapters.bashdb = {
type = "executable",
command = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/bash-debug-adapter",
name = "bashdb",
}
dap.configurations.sh = {
{
type = "bashdb",
request = "launch",
name = "Launch file",
showDebugOutput = true,
pathBashdb = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir/bashdb",
pathBashdbLib = vim.fn.stdpath("data") .. "/mason/packages/bash-debug-adapter/extension/bashdb_dir",
trace = true,
file = "${file}",
program = "${file}",
cwd = "${workspaceFolder}",
pathCat = "bat",
pathBash = "/bin/zash",
pathMkfifo = "mkfifo",
pathPkill = "pkill",
args = {},
env = {},
terminalKind = "integrated",
},
}

14
after/plugin/gitsigns.lua Normal file
View File

@@ -0,0 +1,14 @@
local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then
return
end
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

@@ -0,0 +1,13 @@
vim.g.Illuminate_ftblacklist = { "alpha", "NvimTree" }
vim.api.nvim_set_keymap(
"n",
"<A-n>",
"<cmd>lua require('illuminate').next_reference{wrap=true}<cr>",
{ noremap = true }
)
vim.api.nvim_set_keymap(
"n",
"<A-p>",
"<cmd>lua require('illuminate').next_reference{reverse=true,wrap=true}<cr>",
{ noremap = true }
)

View File

@@ -0,0 +1,6 @@
local status_ok, impatient = pcall(require, "impatient")
if not status_ok then
return
end
impatient.enable_profile()

View File

@@ -0,0 +1,80 @@
local status_ok, indent_blankline = pcall(require, "indent_blankline")
if not status_ok then
return
end
local g = vim.g
local opt = vim.opt
local cmd = vim.cmd
g.indent_blankline_buftype_exclude = { "terminal", "nofile" }
g.indent_blankline_filetype_exclude = {
"help",
"startify",
"dashboard",
"packer",
"neogitstatus",
"NvimTree",
"Trouble",
}
g.indentLine_enabled = 1
g.indent_blankline_char = ""
g.indent_blankline_show_trailing_blankline_indent = false
g.indent_blankline_show_first_indent_level = true
g.indent_blankline_use_treesitter = true
g.indent_blankline_show_current_context = true
g.indent_blankline_context_patterns = {
"class",
"return",
"function",
"method",
"^if",
"^while",
"jsx_element",
"^for",
"^object",
"^table",
"block",
"arguments",
"if_statement",
"else_clause",
"jsx_element",
"jsx_self_closing_element",
"try_statement",
"catch_clause",
"import_statement",
"operation_type",
}
vim.wo.colorcolumn = "99999"
cmd([[highlight IndentBlanklineIndent1 guifg=#C678DD gui=nocombine]])
cmd([[highlight IndentBlanklineIndent2 guifg=#E5C07B gui=nocombine]])
cmd([[highlight IndentBlanklineIndent3 guifg=#98C379 gui=nocombine]])
cmd([[highlight IndentBlanklineIndent4 guifg=#56B6C2 gui=nocombine]])
cmd([[highlight IndentBlanklineIndent5 guifg=#61AFEF gui=nocombine]])
cmd([[highlight IndentBlanklineIndent6 guifg=#E06C75 gui=nocombine]])
opt.list = true
opt.listchars:append("space:⋅")
opt.listchars:append("eol:↴")
indent_blankline.setup({
char = "",
show_trailing_blankline_indent = false,
show_first_indent_level = true,
use_treesitter = true,
show_end_of_line = true,
space_char_blankline = " ",
show_current_context = true,
show_current_context_start = true,
char_highlight_list = {
"IndentBlanklineIndent1",
"IndentBlanklineIndent2",
"IndentBlanklineIndent3",
"IndentBlanklineIndent4",
"IndentBlanklineIndent5",
"IndentBlanklineIndent6",
},
buftype_exclude = { "terminal", "nofile" },
filetype_exclude = {
"help",
"packer",
"NvimTree",
},
})

58
after/plugin/lualine.lua Normal file
View File

@@ -0,0 +1,58 @@
local status_ok, lualine = pcall(require, "lualine")
if not status_ok then
return
end
local hide_in_width = function()
return vim.fn.winwidth(0) > 80
end
local diagnostics = {
"diagnostics",
sources = { "nvim_diagnostic" },
sections = { "error", "warn" },
symbols = { error = "", warn = "" },
colored = false,
always_visible = true,
}
local diff = {
"diff",
colored = false,
symbols = { added = "", modified = "", removed = "" }, -- changes diff symbols
cond = hide_in_width,
}
local filetype = {
"filetype",
icons_enabled = false,
}
local location = {
"location",
padding = 0,
}
local spaces = function()
return "spaces: " .. vim.api.nvim_buf_get_option(0, "shiftwidth")
end
lualine.setup({
options = {
globalstatus = true,
icons_enabled = true,
theme = "auto",
component_separators = { left = "", right = "" },
section_separators = { left = "", right = "" },
disabled_filetypes = { "alpha", "dashboard" },
always_divide_middle = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch" },
lualine_c = { diagnostics },
lualine_x = { diff, "encoding", filetype },
lualine_y = { location },
lualine_z = { "progress" },
},
})

174
after/plugin/luasnip.lua Normal file
View File

@@ -0,0 +1,174 @@
local status_ok, ls = pcall(require, "luasnip")
if not status_ok then
return
end
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)
vim.keymap.set({ "i" }, "<C-h>", function()
if ls.choice_active() then
ls.change_choice(-1)
end
end)
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" } },
},
},
},
})
local get_year = function()
return os.date("%Y")
end
local get_date = function()
return os.date("%d.%m.%Y")
end
local same = function(index)
return f(function(arg)
return arg[1]
end, { index })
end
ls.add_snippets(nil, {
all = {},
lua = {
s(
"status",
fmt(
[[
local status_ok, {} = pcall(require, "{}")
if not status_ok then
return
end
]],
{
i(1),
same(1),
}
)
),
},
rust = {
s(
"modtest",
fmt(
[[
#[cfg(test)]
mod test {{
{}
{}
}}
]],
{
c(1, { t(" use super::*"), t("") }),
i(0),
}
)
),
},
python = {},
cpp = {
s(
"copy",
fmt(
[[
// Copyright {}
// Author - Kristiāns Francis Cagulis, kc22015
// {}
// Programma izveidota: {}
]],
{
get_year(),
i(1),
get_date(),
}
)
),
s(
"fn",
fmt(
[[
// {};
// funkcija {}({}) -
// {}
{} {{
}}
]],
{
same(1),
f(function(function_name)
if not function_name[1][1] then
function_name[1][1] = ""
end
local words = {}
for word in function_name[1][1]:gmatch("%w+") do
table.insert(words, word)
end
return words[2] or ""
end, { 1 }),
i(2),
i(0),
i(1),
}
)
),
},
})

126
after/plugin/nvim-tree.lua Normal file
View File

@@ -0,0 +1,126 @@
local status_ok, nvim_tree = pcall(require, "nvim-tree")
if not status_ok then
return
end
local function on_attach(bufnr)
local api_status_ok, api = pcall(require, "nvim-tree.api")
if not api_status_ok then
return
end
local function opts(desc)
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
end
local keymap = vim.keymap.set
-- Default mappings. Feel free to modify or remove as you wish.
--
-- BEGIN_DEFAULT_ON_ATTACH
keymap("n", "<C-]>", api.tree.change_root_to_node, opts("CD"))
keymap("n", "<C-e>", api.node.open.replace_tree_buffer, opts("Open: In Place"))
keymap("n", "<C-k>", api.node.show_info_popup, opts("Info"))
keymap("n", "<C-r>", api.fs.rename_sub, opts("Rename: Omit Filename"))
keymap("n", "<C-t>", api.node.open.tab, opts("Open: New Tab"))
keymap("n", "v", api.node.open.vertical, opts("Open: Vertical Split"))
keymap("n", "x", api.node.open.horizontal, opts("Open: Horizontal Split"))
keymap("n", "<BS>", api.node.navigate.parent_close, opts("Close Directory"))
keymap("n", "<cr>", api.node.open.edit, opts("Open"))
keymap("n", "<Tab>", api.node.open.preview, opts("Open Preview"))
keymap("n", ">", api.node.navigate.sibling.next, opts("Next Sibling"))
keymap("n", "<", api.node.navigate.sibling.prev, opts("Previous Sibling"))
keymap("n", ".", api.node.run.cmd, opts("Run Command"))
keymap("n", "-", api.tree.change_root_to_parent, opts("Up"))
keymap("n", "a", api.fs.create, opts("Create"))
keymap("n", "bmv", api.marks.bulk.move, opts("Move Bookmarked"))
keymap("n", "B", api.tree.toggle_no_buffer_filter, opts("Toggle No Buffer"))
keymap("n", "c", api.fs.copy.node, opts("Copy"))
keymap("n", "C", api.tree.toggle_git_clean_filter, opts("Toggle Git Clean"))
keymap("n", "[c", api.node.navigate.git.prev, opts("Prev Git"))
keymap("n", "]c", api.node.navigate.git.next, opts("Next Git"))
keymap("n", "d", api.fs.remove, opts("Delete"))
keymap("n", "D", api.fs.trash, opts("Trash"))
keymap("n", "E", api.tree.expand_all, opts("Expand All"))
keymap("n", "e", api.fs.rename_basename, opts("Rename: Basename"))
keymap("n", "]e", api.node.navigate.diagnostics.next, opts("Next Diagnostic"))
keymap("n", "[e", api.node.navigate.diagnostics.prev, opts("Prev Diagnostic"))
keymap("n", "F", api.live_filter.clear, opts("Clean Filter"))
keymap("n", "f", api.live_filter.start, opts("Filter"))
keymap("n", "g?", api.tree.toggle_help, opts("Help"))
keymap("n", "gy", api.fs.copy.absolute_path, opts("Copy Absolute Path"))
keymap("n", "H", api.tree.toggle_hidden_filter, opts("Toggle Dotfiles"))
keymap("n", "I", api.tree.toggle_gitignore_filter, opts("Toggle Git Ignore"))
keymap("n", "J", api.node.navigate.sibling.last, opts("Last Sibling"))
keymap("n", "K", api.node.navigate.sibling.first, opts("First Sibling"))
keymap("n", "m", api.marks.toggle, opts("Toggle Bookmark"))
keymap("n", "o", api.node.open.edit, opts("Open"))
keymap("n", "O", api.node.open.no_window_picker, opts("Open: No Window Picker"))
keymap("n", "p", api.fs.paste, opts("Paste"))
keymap("n", "P", api.node.navigate.parent, opts("Parent Directory"))
keymap("n", "q", api.tree.close, opts("Close"))
keymap("n", "r", api.fs.rename, opts("Rename"))
keymap("n", "R", api.tree.reload, opts("Refresh"))
keymap("n", "s", api.node.run.system, opts("Run System"))
keymap("n", "S", api.tree.search_node, opts("Search"))
keymap("n", "U", api.tree.toggle_custom_filter, opts("Toggle Hidden"))
keymap("n", "W", api.tree.collapse_all, opts("Collapse"))
keymap("n", "x", api.fs.cut, opts("Cut"))
keymap("n", "y", api.fs.copy.filename, opts("Copy Name"))
keymap("n", "Y", api.fs.copy.relative_path, opts("Copy Relative Path"))
keymap("n", "<2-LeftMouse>", api.node.open.edit, opts("Open"))
keymap("n", "<2-RightMouse>", api.tree.change_root_to_node, opts("CD"))
-- You will need to insert "your code goes here" for any mappings with a custom action_cb
keymap("n", "l", api.node.open.edit, opts("Open"))
end
nvim_tree.setup({
on_attach = on_attach,
update_focused_file = {
enable = true,
update_cwd = true,
},
renderer = {
root_folder_modifier = ":t",
icons = {
glyphs = {
default = "",
symlink = "",
folder = {
arrow_open = "",
arrow_closed = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "",
untracked = "U",
deleted = "",
ignored = "",
},
},
},
},
diagnostics = {
enable = true,
show_on_dirs = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
view = {
width = 30,
-- height = 30,
side = "left",
},
})

View File

@@ -0,0 +1,10 @@
local status_ok, persistence = pcall(require, "persistence")
if not status_ok then
return
end
persistence.setup({
dir = vim.fn.expand(vim.fn.stdpath("state") .. "/sessions/"), -- directory where session files are saved
options = { "buffers", "curdir", "tabpages", "winsize" }, -- sessionoptions used for saving
pre_save = nil, -- a function to call before saving the session
})

17
after/plugin/project.lua Normal file
View File

@@ -0,0 +1,17 @@
local status_ok, project = pcall(require, "project_nvim")
if not status_ok then
return
end
project.setup({
-- detection_methods = { "lsp", "pattern" }, -- NOTE: lsp detection will get annoying with multiple langs in one project
detection_methods = { "pattern" },
-- patterns used to detect root dir, when **"pattern"** is in detection_methods
patterns = { ".git", "Makefile", "package.json", ".venv", "Cargo.toml", "requirements.txt" },
})
local tele_status_ok, telescope = pcall(require, "telescope")
if not tele_status_ok then
return
end
telescope.load_extension("projects")

View File

@@ -0,0 +1,52 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
local actions = require("telescope.actions")
telescope.setup({
defaults = {
prompt_prefix = "",
selection_caret = "",
path_display = { "smart" },
file_ignore_patterns = { ".git/", "node_modules" },
mappings = {
i = {
["<Down>"] = actions.cycle_history_next,
["<Up>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
},
},
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,
},
},
})
telescope.load_extension("fzf")
telescope.load_extension("media_files")
telescope.load_extension("emoji")

69
after/plugin/todo.lua Normal file
View File

@@ -0,0 +1,69 @@
local status_ok, todo = pcall(require, "todo-comments")
if not status_ok then
return
end
todo.setup({
signs = true, -- show icons in the signs column
sign_priority = 8, -- sign priority
-- keywords recognized as todo comments
keywords = {
FIX = {
icon = "", -- icon used for the sign, and in search results
color = "error", -- can be a hex color, or a named color (see below)
alt = { "FIXME", "BUG", "FIXIT", "ISSUE" }, -- a set of other keywords that all map to this FIX keywords
-- signs = false, -- configure signs for some keywords individually
},
TODO = { icon = "", color = "info" },
HACK = { icon = "", color = "warning" },
WARN = { icon = "", color = "warning", alt = { "WARNING", "XXX" } },
PERF = { icon = "", alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" } },
NOTE = { icon = "", color = "hint", alt = { "INFO" } },
TEST = { icon = "", color = "test", alt = { "TESTING", "PASSED", "FAILED" } },
},
gui_style = {
fg = "NONE", -- The gui style to use for the fg highlight group.
bg = "BOLD", -- The gui style to use for the bg highlight group.
},
merge_keywords = true, -- when true, custom keywords will be merged with the defaults
-- highlighting of the line containing the todo comment
-- * before: highlights before the keyword (typically comment characters)
-- * keyword: highlights of the keyword
-- * after: highlights after the keyword (todo text)
highlight = {
multiline = true, -- enable multine todo comments
multiline_pattern = "^.", -- lua pattern to match the next multiline from the start of the matched keyword
multiline_context = 10, -- extra lines that will be re-evaluated when changing a line
before = "", -- "fg" or "bg" or empty
keyword = "wide", -- "fg", "bg", "wide", "wide_bg", "wide_fg" or empty. (wide and wide_bg is the same as bg, but will also highlight surrounding characters, wide_fg acts accordingly but with fg)
after = "fg", -- "fg" or "bg" or empty
pattern = [[.*<(KEYWORDS)\s*:]], -- pattern or table of patterns, used for highlighting (vim regex)
comments_only = true, -- uses treesitter to match keywords in comments only
max_line_len = 400, -- ignore lines longer than this
exclude = {}, -- list of file types to exclude highlighting
},
-- list of named colors where we try to extract the guifg from the
-- list of highlight groups or use the hex color if hl not found as a fallback
colors = {
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
warning = { "DiagnosticWarn", "WarningMsg", "#FBBF24" },
info = { "DiagnosticInfo", "#2563EB" },
hint = { "DiagnosticHint", "#10B981" },
default = { "Identifier", "#7C3AD" },
test = { "Identifier", "#FF00FF" },
},
search = {
command = "rg",
args = {
"--color=never",
"--no-heading",
"--with-filename",
"--line-number",
"--column",
},
-- regex that will be used to match keywords.
-- don't replace the (KEYWORDS) placeholder
pattern = [[\b(KEYWORDS):]], -- ripgrep regex
-- pattern = [[\b(KEYWORDS)\b]], -- match without the extra colon. You'll likely get false positives
},
})

View File

@@ -0,0 +1,69 @@
local status_ok, toggleterm = pcall(require, "toggleterm")
if not status_ok then
return
end
toggleterm.setup({
size = 20,
open_mapping = [[<c-\>]],
hide_numbers = true,
shade_terminals = true,
shading_factor = 2,
start_in_insert = true,
insert_mappings = true,
persist_size = true,
direction = "float",
close_on_exit = true,
shell = vim.o.shell,
float_opts = {
border = "curved",
winblend = 0,
highlights = {
border = "Normal",
background = "Normal",
},
},
})
function _G.set_terminal_keymaps()
local opts = { noremap = true }
vim.api.nvim_buf_set_keymap(0, "t", "<esc>", [[<C-\><C-n>]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<C-h>", [[<C-\><C-n><C-W>h]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<C-j>", [[<C-\><C-n><C-W>j]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<C-k>", [[<C-\><C-n><C-W>k]], opts)
vim.api.nvim_buf_set_keymap(0, "t", "<C-l>", [[<C-\><C-n><C-W>l]], opts)
end
vim.cmd("autocmd! TermOpen term://* lua set_terminal_keymaps()")
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
function _LAZYGIT_TOGGLE()
lazygit:toggle()
end
local node = Terminal:new({ cmd = "node", hidden = true })
function _NODE_TOGGLE()
node:toggle()
end
local ncdu = Terminal:new({ cmd = "ncdu", hidden = true })
function _NCDU_TOGGLE()
ncdu:toggle()
end
local btop = Terminal:new({ cmd = "btop", hidden = true })
function _BTOP_TOGGLE()
btop:toggle()
end
local python = Terminal:new({ cmd = "python", hidden = true })
function _PYTHON_TOGGLE()
python:toggle()
end
local rust = Terminal:new({ cmd = "cargo run", hidden = true })
function _CARGO_RUN()
rust:toggle()
end

View File

@@ -0,0 +1,59 @@
local status_ok, configs = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
end
configs.setup({
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = "all", -- 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")
highlight = {
enable = true,
disable = {},
-- 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 = false,
},
autopairs = {
enable = true,
},
autotag = {
enable = true,
filetypes = {
"html",
"htmldjango",
"javascript",
"typescript",
"javascriptreact",
"typescriptreact",
"svelte",
"vue",
"tsx",
"jsx",
"rescript",
"xml",
"php",
"markdown",
"glimmer",
"handlebars",
"hbs",
},
},
indent = { enable = true, disable = { "" } },
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
},
})

275
after/plugin/whichkey.lua Normal file
View File

@@ -0,0 +1,275 @@
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
return
end
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 = {
["/"] = { "<Plug>(comment_toggle_linewise_visual)", "Comment toggle linewise (visual)" },
}
local mappings = {
[";"] = { vim.cmd.Alpha, "Dashboard" },
["/"] = { "<Plug>(comment_toggle_linewise_current)", "Comment toggle current line" },
c = { vim.cmd.Bdelete, "Close Buffer" },
h = { "<cmd>nohlsearch<cr>", "No Highlight" },
f = {
"<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})<cr>",
"Find files",
},
e = { vim.cmd.NvimTreeToggle, "Explorer" },
F = { "<cmd>Telescope live_grep theme=ivy<cr>", "Find Text" },
P = { "<cmd>lua require('telescope').extensions.projects.projects()<cr>", "Projects" },
b = { "<cmd>Telescope buffers<cr>", "Find Buffers" },
u = { vim.cmd.UndotreeToggle, "UndotreeToggle" },
x = { "<cmd>!chmod +x %<cr>", "Make executable" },
B = {
name = "Buffers",
j = { "<cmd>BufferLinePick<cr>", "Jump" },
f = { "<cmd>Telescope buffers<cr>", "Find" },
b = { "<cmd>BufferLineCyclePrev<cr>", "Previous" },
n = { "<cmd>BufferLineCycleNext<cr>", "Next" },
-- w = { "<cmd>BufferWipeout<cr>", "Wipeout" }, -- TODO: implement this for bufferline
e = {
"<cmd>BufferLinePickClose<cr>",
"Pick which buffer to close",
},
h = { "<cmd>BufferLineCloseLeft<cr>", "Close all to the left" },
l = {
"<cmd>BufferLineCloseRight<cr>",
"Close all to the right",
},
D = {
"<cmd>BufferLineSortByDirectory<cr>",
"Sort by directory",
},
L = {
"<cmd>BufferLineSortByExtension<cr>",
"Sort by language",
},
},
p = {
name = "Packer",
c = { "<cmd>PackerCompile<cr>", "Compile" },
i = { "<cmd>PackerInstall<cr>", "Install" },
s = { "<cmd>PackerSync<cr>", "Sync" },
S = { "<cmd>PackerStatus<cr>", "Status" },
u = { "<cmd>PackerUpdate<cr>", "Update" },
},
g = {
name = "Git",
g = { "<cmd>lua _LAZYGIT_TOGGLE()<cr>", "Lazygit" },
j = { "<cmd>lua require('gitsigns').next_hunk()<cr>", "Next Hunk" },
k = { "<cmd>lua require('gitsigns').prev_hunk()<cr>", "Prev Hunk" },
l = { "<cmd>lua require('gitsigns').blame_line()<cr>", "Blame" },
p = { "<cmd>lua require('gitsigns').preview_hunk()<cr>", "Preview Hunk" },
r = { "<cmd>lua require('gitsigns').reset_hunk()<cr>", "Reset Hunk" },
R = { "<cmd>lua require('gitsigns').reset_buffer()<cr>", "Reset Buffer" },
s = { "<cmd>lua require('gitsigns').stage_hunk()<cr>", "Stage Hunk" },
u = {
"<cmd>lua require 'gitsigns'.undo_stage_hunk()<cr>",
"Undo Stage Hunk",
},
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
d = {
"<cmd>Gitsigns diffthis HEAD<cr>",
"Git Diff",
},
},
l = {
name = "LSP",
a = { "<cmd>lua vim.lsp.buf.code_action()<cr>", "Code Action" },
d = { "<cmd>Telescope diagnostics bufnr=0 theme=get_ivy<cr>", "Buffer Diagnostics" },
w = {
"<cmd>Telescope diagnostics<cr>",
"Workspace Diagnostics",
},
f = { "<cmd>lua vim.lsp.buf.format({ async = true })<cr>", "Format" },
i = { "<cmd>LspInfo<cr>", "Info" },
j = {
"<cmd>lua vim.diagnostic.goto_next()<cr>",
"Next Diagnostic",
},
k = {
"<cmd>lua vim.diagnostic.goto_prev()<cr>",
"Prev Diagnostic",
},
l = { "<cmd>lua vim.lsp.codelens.run()<cr>", "CodeLens Action" },
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
s = { "<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols" },
S = {
"<cmd>Telescope lsp_dynamic_workspace_symbols<cr>",
"Workspace Symbols",
},
e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
R = {
name = "Rust",
e = { "<cmd>RustExpandMacro<cr>", "Expand macro" },
c = { "<cmd>RustOpenCargo<cr>", "Open cargo.toml" },
p = { "<cmd>RustParentModule<cr>", "Parent module" },
h = { "<cmd>RustHoverActions<cr>", "Hover actions" },
g = { "<cmd>RustViewCrateGraph<cr>", "View create graph" },
d = { "<cmd>RustOpenExternalDocs<cr>", "Open external docs" },
},
},
s = {
name = "Search",
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
f = { "<cmd>Telescope find_files<cr>", "Find File" },
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
H = { "<cmd>Telescope highlights<cr>", "Find highlight groups" },
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },
R = { "<cmd>Telescope registers<cr>", "Registers" },
t = { "<cmd>Telescope live_grep<cr>", "Text" },
k = { "<cmd>Telescope keymaps<cr>", "Keymaps" },
C = { "<cmd>Telescope commands<cr>", "Commands" },
T = { "<cmd>TodoTelescope<cr>", "Todo" },
m = { "<cmd>lua require('telescope').extensions.media_files.media_files()<cr>", "Media" },
p = {
"<cmd>lua require('telescope.builtin').colorscheme({enable_preview = true})<cr>",
"Colorscheme with Preview",
},
},
t = {
name = "Terminal",
n = { "<cmd>lua _NODE_TOGGLE()<cr>", "Node" },
u = { "<cmd>lua _NCDU_TOGGLE()<cr>", "NCDU" },
b = { "<cmd>lua _BTOP_TOGGLE()<cr>", "Btop" },
p = { "<cmd>lua _PYTHON_TOGGLE()<cr>", "Python" },
c = { "<cmd>lua _CARGO_RUN()<cr>", "Cargo run" },
f = { "<cmd>ToggleTerm direction=float<cr>", "Float" },
h = { "<cmd>ToggleTerm size=10 direction=horizontal<cr>", "Horizontal" },
v = { "<cmd>ToggleTerm size=80 direction=vertical<cr>", "Vertical" },
},
w = {
name = "Vimwiki",
w = { "<Plug>VimwikiIndex", "Open index file" },
t = { "<Plug>VimwikiTabIndex", "Open index file in new tab" },
s = { "<Plug>VimwikiUISelect", "Display list of wikis" },
i = { "<Plug>VimwikiDiaryIndex", "Open diary index" },
h = { "<Plug>Vimwiki2HTML", "Convert file to HTML" },
H = { "<Plug>Vimwiki2HTMLBrowse", "Convert file to HTML and open in browser" },
n = { "<Plug>VimwikiGoto", "Goto link provided by an argument" },
d = { "<Plug>VimwikiDeleteFile", "Rename file" },
r = { "<Plug>VimwikiRenameFile", "Delete file" },
},
L = {
name = "Language 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 = "DAP",
d = { "<cmd>lua require('dap').toggle_breakpoint()<cr>", "Set breakpoint" },
t = { "<cmd>lua require('dapui').toggle()<cr>", "Toggle DAP-UI" },
c = { "<cmd>lua require('dap').continue()<cr>", "Launch debug sessions and resume execution" },
i = { "<cmd>lua require('dap').step_into()<cr>", "Step into code" },
o = { "<cmd>lua require('dap').step_over()<cr>", "Step over code" },
O = { "<cmd>lua require('dap').step_out()<cr>", "Step out of code" },
r = { "<cmd>lua require('dap).repl.open()<cr>", "Inspect state" },
T = { "<cmd>lua require('dap').terminate()<cr>", "Terminate" },
l = { "<cmd>lua require('dap').run_last()<cr>", "Run last" },
},
q = {
name = "Persistence",
s = { "<cmd>lua require('persistence').load()<cr>", "Current directory" },
l = { "<cmd>lua require('persistence').load({ last = true })<cr>", "Last session" },
d = { "<cmd>lua require('persistence').stop()<cr>", "Stop" },
},
}
which_key.setup(setup)
which_key.register(mappings, opts, vopts, vmappings)