Complete refactor + moved to [lsp-zero](https://github.com/VonHeikemen/lsp-zero.nvim)

This commit is contained in:
Kristofers Solo
2023-08-09 02:01:47 +03:00
parent 9e449312d7
commit 5871bcd430
71 changed files with 2023 additions and 2204 deletions

View File

@@ -1,131 +0,0 @@
local status_ok, ccc = pcall(require, "ccc")
if not status_ok then
return
end
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,21 +0,0 @@
local status_ok, cmake = pcall(require, "cmake-tools")
if not status_ok then
return
end
cmake.setup({
cmake_command = "cmake",
cmake_build_directory = "target/build/",
cmake_build_directory_prefix = "cmake_build_", -- when cmake_build_directory is "", this option will be activated
cmake_generate_options = { "-D", "CMAKE_EXPORT_COMPILE_COMMANDS=1" },
cmake_soft_link_compile_commands = true, -- if softlink compile commands json file
cmake_build_options = {},
cmake_console_size = 15, -- cmake output window height
cmake_console_position = "belowright", -- "belowright", "aboveleft", ...
cmake_show_console = "always", -- "always", "only_on_error"
cmake_dap_configuration = { name = "cpp", type = "codelldb", request = "launch" }, -- dap configuration, optional
cmake_variants_message = {
short = { show = true },
long = { show = true, max_length = 40 },
},
})

View File

@@ -1,95 +0,0 @@
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" },
},
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]",
buffer = "[buf]",
path = "[path]",
emoji = "[emoji]",
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,
},
})

View File

@@ -1,75 +0,0 @@
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

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

@@ -1,62 +0,0 @@
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,
})

View File

@@ -1,144 +0,0 @@
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",
},
})

View File

@@ -1,65 +1,5 @@
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 = {},
-- },
})
local dap = require("dap")
local dapui = require("dapui")
vim.fn.sign_define("DapBreakpoint", { text = "", texthl = "DiagnosticSignError", linehl = "", numhl = "" })

View File

@@ -1,14 +0,0 @@
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

@@ -1,17 +0,0 @@
local status_ok, harpoon = pcall(require, "harpoon")
if not status_ok then
return
end
local mark = require("harpoon.mark")
local ui = require("harpoon.ui")
harpoon.setup()
local keymap = vim.keymap.set
local opts = { silent = true }
for i = 1, 12, 1 do
keymap("n", "<F" .. i .. ">", function()
ui.nav_file(i)
end)
end

View File

@@ -1,8 +0,0 @@
local status_ok, hologram = pcall(require, "hologram")
if not status_ok then
return
end
hologram.setup({
auto_display = true,
})

View File

@@ -1,13 +0,0 @@
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

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

View File

@@ -1,80 +0,0 @@
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",
},
})

314
after/plugin/lsp.lua Normal file
View File

@@ -0,0 +1,314 @@
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 = {},
},
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(client, bufnr)
-- see :help lsp-zero-keybindings
-- to learn the available actions
lsp.default_keymaps({ buffer = bufnr })
local opts = { buffer = bufnr }
local bind = vim.keymap.set
bind("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<cr>", opts)
bind("n", "gd", "<cmd>lua require('telescope.builtin').lsp_definitions()<cr>", opts)
bind("n", "K", "<cmd>lua vim.lsp.buf.hover()<cr>", opts)
bind("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<cr>", opts)
bind("n", "gr", "<cmd>lua require('telescope.builtin').lsp_references()<cr>", opts)
bind("n", "gl", "<cmd>lua vim.diagnostic.open_float()<cr>", opts)
end)
lsp.ensure_installed({
"bashls",
"clangd",
"cmake",
"cssls",
"emmet_ls",
"html",
"jedi_language_server",
"jsonls",
"lua_ls",
"ruff_lsp",
"rust_analyzer",
"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,
},
},
},
})
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()
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.remark.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 = {
"cmake_lint",
"codespell",
"cpplint",
"luacheck",
"misspell",
"mypy",
"beautysh",
"cbfmt",
"clang_format",
"cmake_format",
"djlint",
"google_java_format",
"phpcbf",
"prettier",
"remark",
"markdown_toc",
"shellharden",
"shfmt",
"stylua",
"usort",
"yamlfmt",
},
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" },
},
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]",
buffer = "[buf]",
path = "[path]",
emoji = "[emoji]",
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,24 +0,0 @@
local status_ok, lualine = pcall(require, "lualine")
if not status_ok then
return
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 = { "diff" },
lualine_x = { "lsp_progress", "diagnostics" },
lualine_y = { "filename" },
lualine_z = { "location", "progress" },
},
})

View File

@@ -1,7 +1,4 @@
local status_ok, ls = pcall(require, "luasnip")
if not status_ok then
return
end
local ls = require("luasnip")
require("luasnip/loaders/from_vscode").lazy_load()
@@ -89,23 +86,6 @@ 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",
@@ -201,14 +181,11 @@ ls.add_snippets(nil, {
]],
{
i(1),
c(
2,
{
t("Kristofers Solo"),
t("Kristiāns Francis Cagulis, kc22015"),
t("Kristiāns Francis Cagulis"),
}
),
c(2, {
t("Kristofers Solo"),
t("Kristiāns Francis Cagulis, kc22015"),
t("Kristiāns Francis Cagulis"),
}),
i(0),
}
)

View File

@@ -1,6 +0,0 @@
local status_ok, markdown_preview = pcall(require, "markdown-preview")
if not status_ok then
return
end
markdown_preview.setup({})

View File

@@ -1,126 +0,0 @@
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

@@ -1,124 +0,0 @@
local status_ok, oil = pcall(require, "oil")
if not status_ok then
return
end
oil.setup({
-- 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",
},
-- Oil will take over directory buffers (e.g. `vim .` or `:e src/`
default_file_explorer = true,
-- 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-put` command.
delete_to_trash = true,
-- 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 = {
["?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-L>"] = "actions.select_vsplit",
["C-J>"] = "actions.select_split",
["<C-t>"] = "actions.select_tab",
["<C-p>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-r>"] = "actions.refresh",
["-"] = "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 = true,
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,
},
},
-- 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,10 +0,0 @@
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
})

View File

@@ -1,17 +0,0 @@
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", "package.json", ".venv", "Cargo.toml", "requirements.txt", "CMakeLists.txt" },
})
local tele_status_ok, telescope = pcall(require, "telescope")
if not tele_status_ok then
return
end
telescope.load_extension("projects")

View File

@@ -1,14 +0,0 @@
local status_ok, tabnine = pcall(require, "tabnine")
if not status_ok then
return
end
tabnine.setup({
disable_auto_comment = true,
accept_keymap = "<Tab>",
dismiss_keymap = "<C-c>",
debounce_ms = 800,
suggestion_color = { gui = "#808080", cterm = 244 },
exclude_filetypes = { "TelescopePrompt" },
log_file_path = nil, -- absolute path to Tabnine log file,
})

View File

@@ -1,89 +0,0 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
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/", "node_modules", ".venv/" },
mappings = {
i = {
["<Down>"] = actions.cycle_history_next,
["<Up>"] = actions.cycle_history_prev,
["<C-j>"] = actions.move_selection_next,
["<C-k>"] = actions.move_selection_previous,
},
},
},
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,
-- }
},
},
})
telescope.load_extension("fzf")
telescope.load_extension("media_files")
telescope.load_extension("emoji")
telescope.load_extension("ui-select")
telescope.load_extension("color_names")

View File

@@ -1,69 +0,0 @@
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

@@ -1,69 +0,0 @@
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

@@ -1,59 +0,0 @@
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
},
})

View File

@@ -1,7 +1,4 @@
local status_ok, which_key = pcall(require, "which-key")
if not status_ok then
return
end
local which_key = require("which-key")
local setup = {
plugins = {
@@ -94,7 +91,7 @@ local vmappings = {
local mappings = {
[";"] = { vim.cmd.Alpha, "Dashboard" },
["/"] = { "<Plug>(comment_toggle_linewise_current)", "Comment toggle current line" },
c = { vim.cmd.Bdelete, "Close Buffer" },
c = { vim.cmd.bdelete, "Close Buffer" },
f = {
"<cmd>lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown({previewer = false}))<cr>",
"Find files",
@@ -106,7 +103,7 @@ local mappings = {
u = { vim.cmd.UndotreeToggle, "UndotreeToggle" },
t = { vim.cmd.TagbarToggle, "Toggle Tagbar" },
m = { require("harpoon.mark").add_file, "Add file to harpoon" },
h = { require("harpoon.ui").toggle_quick_menu, "Add file to harpoon" },
h = { require("harpoon.ui").toggle_quick_menu, "Open harpoon menu" },
n = { vim.cmd.Oil, "Open Oil" },
g = {
name = "Git",
@@ -133,16 +130,6 @@ local mappings = {
"Workspace Symbols",
},
e = { "<cmd>Telescope quickfix<cr>", "Telescope Quickfix" },
R = {
name = "Rust",
e = { vim.cmd.RustExpandMacro, "Expand macro" },
c = { vim.cmd.RustOpenCargo, "Open cargo.toml" },
p = { vim.cmd.RustParentModule, "Parent module" },
h = { vim.cmd.RustHoverActions, "Hover actions" },
g = { vim.cmd.RustViewCrateGraph, "View create graph" },
d = { vim.cmd.RustOpenExternalDocs, "Open external docs" },
R = { vim.cmd.RustRunnables, "Open runnables" },
},
},
s = {
name = "Search",
@@ -164,17 +151,28 @@ local mappings = {
"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" },
-- },
r = {
name = "Rust",
e = { vim.cmd.RustExpandMacro, "Expand macro" },
c = { vim.cmd.RustOpenCargo, "Open cargo.toml" },
p = { vim.cmd.RustParentModule, "Parent module" },
h = { vim.cmd.RustHoverActions, "Hover actions" },
g = { vim.cmd.RustViewCrateGraph, "View create graph" },
d = { vim.cmd.RustOpenExternalDocs, "Open external docs" },
R = { vim.cmd.RustRunnables, "Open runnables" },
a = { vim.cmd.RustCodeAction, "Code action groups" },
},
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" },
},
L = {
name = "Language settings",
c = { "<cmd>setlocal formatoptions-=cro<cr>", "Disable autocomment" },

View File

@@ -1,65 +0,0 @@
local status_ok, zen_mode = pcall(require, "zen-mode")
if not status_ok then
return
end
zen_mode.setup({
window = {
backdrop = 0.95, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal
-- height and width can be:
-- * an absolute number of cells when > 1
-- * a percentage of the width / height of the editor when <= 1
-- * a function that returns the width or the height
width = 120, -- width of the Zen window
height = 1, -- height of the Zen window
-- by default, no options are changed for the Zen window
-- uncomment any of the options below, or add other vim.wo options you want to apply
options = {
signcolumn = "no", -- disable signcolumn
-- number = false, -- disable number column
-- relativenumber = false, -- disable relative numbers
cursorline = false, -- disable cursorline
cursorcolumn = false, -- disable cursor column
foldcolumn = "0", -- disable fold column
list = false, -- disable whitespace characters
},
},
plugins = {
-- disable some global vim options (vim.o...)
-- comment the lines to not apply the options
options = {
enabled = true,
ruler = false, -- disables the ruler text in the cmd line area
showcmd = false, -- disables the command in the last line of the screen
},
twilight = { enabled = true }, -- enable to start Twilight when zen mode opens
gitsigns = { enabled = false }, -- disables git signs
tmux = { enabled = false }, -- disables the tmux statusline
-- this will change the font size on kitty when in zen mode
-- to make this work, you need to set the following kitty options:
-- - allow_remote_control socket-only
-- - listen_on unix:/tmp/kitty
kitty = {
enabled = false,
font = "+4", -- font size increment
},
-- this will change the font size on alacritty when in zen mode
-- requires Alacritty Version 0.10.0 or higher
-- uses `alacritty msg` subcommand to change font size
alacritty = {
enabled = false,
font = "14", -- font size
},
-- this will change the font size on wezterm when in zen mode
-- See also the Plugins/Wezterm section in this projects README
wezterm = {
enabled = false,
-- can be either an absolute font size or the number of incremental steps
font = "+4", -- (10% increase per step)
},
},
-- callback where you can add custom code when the Zen window opens
on_open = function(win) end,
-- callback where you can add custom code when the Zen window closes
on_close = function() end,
})