This commit is contained in:
davidon-top 2023-08-02 16:39:49 +02:00
commit 9d3d05066f
80 changed files with 7776 additions and 0 deletions

11
.latestBackup/after/init.lua Executable file
View file

@ -0,0 +1,11 @@
vim.opt.nu = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.cursorcolumn = true
vim.cmd[[
highlight CursorColumn guibg=none ctermbg=none
highlight link CursorColumn CursorLine
]]

View file

@ -0,0 +1,15 @@
local npairs = require("nvim-autopairs")
local Rule = require("nvim-autopairs.rule")
npairs.setup({
check_ts = true,
ts_config = {
lua = {"string"},
javascript = {"template_string"},
},
enable_check_bracket_line = false,
ignored_next_char = "[%w%.]",
})
local ts_conds = require("nvim-autopairs.ts-conds")

View file

@ -0,0 +1,44 @@
-- local db = require('dashboard')
--
local header = {"",
" /$$ /$$ /$$ /$$ /$$ ",
"| $$$ | $$ | $$ | $$|__/ ",
"| $$$$| $$ /$$$$$$ /$$$$$$ | $$ | $$ /$$ /$$$$$$/$$$$ ",
"| $$ $$ $$ /$$__ $$ /$$__ $$| $$ / $$/| $$| $$_ $$_ $$",
"| $$ $$$$| $$$$$$$$| $$ \\ $$ \\ $$ $$/ | $$| $$ \\ $$ \\ $$",
"| $$\\ $$$| $$_____/| $$ | $$ \\ $$$/ | $$| $$ | $$ | $$",
"| $$ \\ $$| $$$$$$$| $$$$$$/ \\ $/ | $$| $$ | $$ | $$",
"|__/ \\__/ \\_______/ \\______/ \\_/ |__/|__/ |__/ |__/",
"",
"",
"",
"",
"",
"",
"",
}
-- db.custom_header = header
-- db.custom_center = {
-- {
-- icon = ' ',
-- desc ='File Browser ',
-- action = 'Telescope file_browser',
-- shortcut = 'SPC e e'
-- },
-- }
local dashboard = require("alpha.themes.dashboard")
dashboard.section.header.val = header
dashboard.section.buttons.val = {
dashboard.button("SPC e e", " File Tree", ":NeoTreeFloatToggle<cr>"),
dashboard.button("op", "Open Project", ":OP<cr>"),
dashboard.button("oc", "Open Config", ":Config<cr>"),
}
-- dashboard.section.footer.opts.hl = "Constant"
-- dashboard.section.header.opts.hl = "Include"
-- dashboard.section.buttons.opts.hl = "Function"
-- dashboard.section.buttons.opts.hl_shortcut = "Type"
dashboard.opts.opts.noautocmd = true
require("alpha").setup(dashboard.opts)

View file

@ -0,0 +1,9 @@
vim.cmd[[
map <Space>m\ <nop>
map <Space>m/ <nop>
map <Space>mA <nop>
map <Space>mgS <nop>
map <Space>tt <nop>
map <Space>tm <nop>
]]

View file

@ -0,0 +1,9 @@
require('gitsigns').setup {
signs = {
add = { text = '+' },
change = { text = '~' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
},
}

View file

@ -0,0 +1,219 @@
-- local ih = require("inlay-hints")
require('neodev').setup()
-- vim.lsp.ensure_installed({
-- "clangd",
-- "gopls",
-- "jdtls",
-- "eslint",
-- "tailwindcss",
-- "tsserver",
-- "cssmodules_ls",
-- "rome",
-- "jsonls",
-- "sumneko_lua",
-- "pylsp",
-- "rust_analyzer",
-- "stylelint_lsp",
-- })
local navic = require("nvim-navic")
navic.setup {
icons = {
File = "",
Module = "",
Namespace = "",
Package = "",
Class = "",
Method = "",
Property = "",
Field = "",
Constructor = "",
Enum = "",
Interface = "",
Function = "",
Variable = "",
Constant = "",
String = "",
Number = "",
Boolean = "",
Array = "",
Object = "",
Key = "",
Null = "",
EnumMember = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
},
highlight = false,
separator = " > ",
depth_limit = 0,
depth_limit_indicator = "..",
safe_output = true
}
local on_attach = function(client, bufnr)
local nmap = function(keys, func, desc)
if desc then
desc = 'LSP: ' .. desc
end
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
end
-- ih.on_attach(client, bufnr)
require("lsp-inlayhints").on_attach(client, bufnr)
if client.server_capabilities.documentSymbolProvider then
navic.attach(client, bufnr)
require("nvim-navbuddy").attach(client, bufnr)
end
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
-- Lesser used LSP functionality
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
-- Create a command `:Format` local to the LSP buffer
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, { desc = 'Format current buffer with LSP' })
end
local servers = {
clangd = {},
pyright = {},
rust_analyzer = {},
tsserver = {},
-- sumneko_lua = {
-- Lua = {
-- workspace = { checkThirdParty = false },
-- telemetry = { enable = false },
-- },
-- },
}
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require('mason').setup()
require("mason-nvim-dap").setup({automatic_installation = true, handlers = {
function (config)
require("mason-nvim-dap").default_setup(config)
end
}})
local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
}
require("lspconfig").nimls.setup{
cmd = {"nimlsp", "--log", "/tmp/nimlsp.log"},
on_attach = on_attach,
}
require("lspconfig").zls.setup{
cmd = {"zls"},
on_attach = on_attach,
}
-- lspinfo
require('fidget').setup()
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local cmp = require 'cmp'
local luasnip = require 'luasnip'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
-- ["<C-y>"] = cmp.mapping.confirm({ slelect = true}),
["<C-Space><C-Space>"] = cmp.mapping.complete({}),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
-- elseif luasnip.expand_or_jumpable() then
-- luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = "crates" },
},
}
cmp.event:on(
'confirm_done',
cmp_autopairs.on_confirm_done()
)
vim.diagnostic.config({
signs = true,
underline = true,
update_in_insert = true,
virtual_text = true,
})
require("cmp").config.formatting = {
format = require("tailwindcss-colorizer-cmp").formatter,
behavior = cmp.SelectBehavior.Select,
}
-- require('tabnine').setup({
-- disable_auto_comment=true,
-- accept_keymap="<Tab>",
-- dismiss_keymap = "<C-]>",
-- debounce_ms = 300,
-- suggestion_color = {gui = "#808080", cterm = 244},
-- execlude_filetypes = {"TelescopePrompt"}
-- })
require("aerial").setup({})
require("dap")
local sign = vim.fn.sign_define
sign("DapBreakpoint", { text = "", texthl = "DapBreakpoint", linehl = "", numhl = ""})
sign("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
sign("DapLogPoint", { text = "", texthl = "DapLogPoint", linehl = "", numhl = ""})

View file

@ -0,0 +1,8 @@
require("mini.ai").setup({
custom_textobjects = {
[','] = require("mini.ai").gen_spec.pair(',', ',', {})
}
})
require("mini.jump").setup({})
require("mini.sessions").setup({autowrite = false, directory = '~/projects/sessions'})

View file

@ -0,0 +1,10 @@
require("neo-tree").setup({
source_selector = {
winbar = true,
statusline = false,
},
})
vim.keymap.set("n", "<C-\\>", vim.cmd.ToggleTerm)
vim.keymap.set("t", "<C-\\>", vim.cmd.ToggleTerm)

View file

@ -0,0 +1,22 @@
require("presence"):setup({
auto_update = true, -- Update activity based on autocmd events (if `false`, map or manually execute `:lua package.loaded.presence:update()`)
neovim_image_text = "The best PDE, Personalized Development Enviroment", -- Text displayed when hovered over the Neovim image
main_image = "neovim", -- Main image display (either "neovim" or "file")
client_id = "793271441293967371", -- Use your own Discord application client id (not recommended)
log_level = nil, -- Log messages at or above this level (one of the following: "debug", "info", "warn", "error")
debounce_timeout = 15, -- Number of seconds to debounce events (or calls to `:lua package.loaded.presence:update(<filename>, true)`)
enable_line_number = false, -- Displays the current line number instead of the current project
blacklist = {}, -- A list of strings or Lua patterns that disable Rich Presence if the current file name, path, or workspace matches
buttons = true, -- Configure Rich Presence button(s), either a boolean to enable/disable, a static table (`{{ label = "<label>", url = "<url>" }, ...}`, or a function(buffer: string, repo_url: string|nil): table)
file_assets = {}, -- Custom file asset definitions keyed by file names and extensions (see default config at `lua/presence/file_assets.lua` for reference)
show_time = true, -- Show the timer
-- Rich Presence text options
editing_text = "Editing %s", -- Format string rendered when an editable file is loaded in the buffer (either string or function(filename: string): string)
file_explorer_text = "Browsing %s", -- Format string rendered when browsing a file explorer (either string or function(file_explorer_name: string): string)
git_commit_text = "Committing changes", -- Format string rendered when committing changes in git (either string or function(filename: string): string)
plugin_manager_text = "Managing plugins", -- Format string rendered when managing plugins (either string or function(plugin_manager_name: string): string)
reading_text = "Reading %s", -- Format string rendered when a read-only or unmodifiable file is loaded in the buffer (either string or function(filename: string): string)
workspace_text = "Working on %s", -- Format string rendered when in a git repository (either string or function(project_name: string|nil, filename: string): string)
line_number_text = "Line %s out of %s", -- Format string rendered when `enable_line_number` is set to true (either string or function(line_number: number, line_count: number): string)
})

View file

@ -0,0 +1,158 @@
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
end,
},
})
rt.inlay_hints.enable()
rt.runnables.runnables()
rt.hover_actions.hover_actions()
rt.hover_range.hover_range()
rt.open_cargo_toml.open_cargo_toml()
rt.parent_module.parent_module()
rt.join_lines.join_lines()
rt.crate_graph.view_crate_graph(backend, output)
require("crates").setup {
smart_insert = true,
insert_closing_quote = true,
avoid_prerelease = true,
autoload = true,
autoupdate = true,
loading_indicator = true,
date_format = "%Y-%m-%d",
thousands_separator = ".",
notification_title = "Crates",
--curl_args = { "-sL", "--retry", "1" },
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

@ -0,0 +1,762 @@
local conditions = require("heirline.conditions")
local utils = require("heirline.utils")
local colors = {
bright_bg = utils.get_highlight("Folded").bg,
bright_fg = utils.get_highlight("Folded").fg,
red = utils.get_highlight("DiagnosticError").fg,
dark_red = utils.get_highlight("diffDelete").bg,
green = utils.get_highlight("String").fg,
blue = utils.get_highlight("Function").fg,
gray = utils.get_highlight("NonText").fg,
orange = utils.get_highlight("Constant").fg,
purple = utils.get_highlight("Statement").fg,
cyan = utils.get_highlight("Special").fg,
diag_warn = utils.get_highlight("DiagnosticWarn").fg,
diag_error = utils.get_highlight("DiagnosticError").fg,
diag_hint = utils.get_highlight("DiagnosticHint").fg,
diag_info = utils.get_highlight("DiagnosticInfo").fg,
git_del = utils.get_highlight("diffRemoved").fg,
git_add = utils.get_highlight("diffAdded").fg,
git_change = utils.get_highlight("diffChanged").fg,
}
require("heirline").load_colors(colors)
local ViMode = {
-- get vim current mode, this information will be required by the provider
-- and the highlight functions, so we compute it only once per component
-- evaluation and store it as a component attribute
init = function(self)
self.mode = vim.fn.mode(1) -- :h mode()
end,
-- Now we define some dictionaries to map the output of mode() to the
-- corresponding string and color. We can put these into `static` to compute
-- them at initialisation time.
static = {
mode_names = { -- change the strings if you like it vvvvverbose!
n = "N",
no = "N?",
nov = "N?",
noV = "N?",
["no\22"] = "N?",
niI = "Ni",
niR = "Nr",
niV = "Nv",
nt = "Nt",
v = "V",
vs = "Vs",
V = "V_",
Vs = "Vs",
["\22"] = "^V",
["\22s"] = "^V",
s = "S",
S = "S_",
["\19"] = "^S",
i = "I",
ic = "Ic",
ix = "Ix",
R = "R",
Rc = "Rc",
Rx = "Rx",
Rv = "Rv",
Rvc = "Rv",
Rvx = "Rv",
c = "C",
cv = "Ex",
r = "...",
rm = "M",
["r?"] = "?",
["!"] = "!",
t = "T",
},
mode_colors = {
n = "red" ,
i = "green",
v = "cyan",
V = "cyan",
["\22"] = "cyan",
c = "orange",
s = "purple",
S = "purple",
["\19"] = "purple",
R = "orange",
r = "orange",
["!"] = "red",
t = "red",
}
},
-- We can now access the value of mode() that, by now, would have been
-- computed by `init()` and use it to index our strings dictionary.
-- note how `static` fields become just regular attributes once the
-- component is instantiated.
-- To be extra meticulous, we can also add some vim statusline syntax to
-- control the padding and make sure our string is always at least 2
-- characters long. Plus a nice Icon.
provider = function(self)
return "  %2("..self.mode_names[self.mode].."%)"
end,
-- Same goes for the highlight. Now the foreground will change according to the current mode.
hl = function(self)
local mode = self.mode:sub(1, 1) -- get only the first mode character
return { fg = self.mode_colors[mode], bold = true, }
end,
-- Re-evaluate the component only on ModeChanged event!
-- Also allorws the statusline to be re-evaluated when entering operator-pending mode
update = {
"ModeChanged",
pattern = "*:*",
callback = vim.schedule_wrap(function()
vim.cmd("redrawstatus")
end),
},
}
ViMode = utils.surround({ "", "" }, "bright_bg", { ViMode})
local FileNameBlock = {
-- let's first set up some attributes needed by this component and it's children
init = function(self)
self.filename = vim.api.nvim_buf_get_name(0)
end,
}
-- We can now define some children separately and add them later
local FileIcon = {
init = function(self)
local filename = self.filename
local extension = vim.fn.fnamemodify(filename, ":e")
self.icon, self.icon_color = require("nvim-web-devicons").get_icon_color(filename, extension, { default = true })
end,
provider = function(self)
return self.icon and (self.icon .. " ")
end,
hl = function(self)
return { fg = self.icon_color }
end
}
local FileName = {
provider = function(self)
-- first, trim the pattern relative to the current directory. For other
-- options, see :h filename-modifers
local filename = vim.fn.fnamemodify(self.filename, ":.")
if filename == "" then return "[No Name]" end
-- now, if the filename would occupy more than 1/4th of the available
-- space, we trim the file path to its initials
-- See Flexible Components section below for dynamic truncation
if not conditions.width_percent_below(#filename, 0.25) then
filename = vim.fn.pathshorten(filename)
end
return filename
end,
hl = { fg = utils.get_highlight("Directory").fg },
}
local FileFlags = {
{
condition = function()
return vim.bo.modified
end,
provider = "[+]",
hl = { fg = "green" },
},
{
condition = function()
return not vim.bo.modifiable or vim.bo.readonly
end,
provider = "",
hl = { fg = "orange" },
},
}
-- Now, let's say that we want the filename color to change if the buffer is
-- modified. Of course, we could do that directly using the FileName.hl field,
-- but we'll see how easy it is to alter existing components using a "modifier"
-- component
local FileNameModifer = {
hl = function()
if vim.bo.modified then
-- use `force` because we need to override the child's hl foreground
return { fg = "cyan", bold = true, force=true }
end
end,
}
-- let's add the children to our FileNameBlock component
FileNameBlock = utils.insert(FileNameBlock,
FileIcon,
utils.insert(FileNameModifer, FileName), -- a new table where FileName is a child of FileNameModifier
FileFlags,
{ provider = '%<'} -- this means that the statusline is cut here when there's not enough space
)
local FileSize = {
provider = function()
-- stackoverflow, compute human readable file size
local suffix = { 'b', 'k', 'M', 'G', 'T', 'P', 'E' }
local fsize = vim.fn.getfsize(vim.api.nvim_buf_get_name(0))
fsize = (fsize < 0 and 0) or fsize
if fsize < 1024 then
return fsize..suffix[1]
end
local i = math.floor((math.log(fsize) / math.log(1024)))
return string.format("%.2g%s", fsize / math.pow(1024, i), suffix[i + 1])
end
}
local FileLastModified = {
-- did you know? Vim is full of functions!
provider = function()
local ftime = vim.fn.getftime(vim.api.nvim_buf_get_name(0))
return (ftime > 0) and os.date("%c", ftime)
end
}
FileNameBlock = utils.surround({ "", "" }, "bright_bg", FileNameBlock)
-- We're getting minimalists here!
local Ruler = {
-- %l = current line number
-- %L = number of lines in the buffer
-- %c = column number
-- %P = percentage through file of displayed window
provider = "%7(%l/%3L%):%2c %P",
}
Ruler = utils.surround({ "", "" }, "bright_bg", Ruler)
-- I take no credits for this! :lion:
local ScrollBar ={
static = {
sbar = { '', '', '', '', '', '', '', '' }
-- Another variant, because the more choice the better.
-- sbar = { '🭶', '🭷', '🭸', '🭹', '🭺', '🭻' }
},
provider = function(self)
local curr_line = vim.api.nvim_win_get_cursor(0)[1]
local lines = vim.api.nvim_buf_line_count(0)
local i = math.floor((curr_line - 1) / lines * #self.sbar) + 1
return string.rep(self.sbar[i], 2)
end,
hl = { fg = "blue", bg = "bright_bg" },
}
local LSPActive = {
condition = conditions.lsp_attached,
update = {'LspAttach', 'LspDetach'},
-- You can keep it simple,
-- provider = " [LSP]",
-- Or complicate things a bit and get the servers names
provider = function()
local names = {}
for i, server in pairs(vim.lsp.get_active_clients({ bufnr = 0 })) do
table.insert(names, server.name)
end
return " [" .. table.concat(names, " ") .. "]"
end,
hl = { fg = "green", bold = true },
}
LSPActive = utils.surround({ "", "" }, "bright_bg", LSPActive)
-- Full nerd (with icon colors and clickable elements)!
-- works in multi window, but does not support flexible components (yet ...)
local Navic = {
condition = function() return require("nvim-navic").is_available() end,
static = {
-- create a type highlight map
type_hl = {
File = "Directory",
Module = "@include",
Namespace = "@namespace",
Package = "@include",
Class = "@structure",
Method = "@method",
Property = "@property",
Field = "@field",
Constructor = "@constructor",
Enum = "@field",
Interface = "@type",
Function = "@function",
Variable = "@variable",
Constant = "@constant",
String = "@string",
Number = "@number",
Boolean = "@boolean",
Array = "@field",
Object = "@type",
Key = "@keyword",
Null = "@comment",
EnumMember = "@field",
Struct = "@structure",
Event = "@keyword",
Operator = "@operator",
TypeParameter = "@type",
},
-- bit operation dark magic, see below...
enc = function(line, col, winnr)
return bit.bor(bit.lshift(line, 16), bit.lshift(col, 6), winnr)
end,
-- line: 16 bit (65535); col: 10 bit (1023); winnr: 6 bit (63)
dec = function(c)
local line = bit.rshift(c, 16)
local col = bit.band(bit.rshift(c, 6), 1023)
local winnr = bit.band(c, 63)
return line, col, winnr
end
},
init = function(self)
local data = require("nvim-navic").get_data() or {}
local children = {}
-- create a child for each level
for i, d in ipairs(data) do
-- encode line and column numbers into a single integer
local pos = self.enc(d.scope.start.line, d.scope.start.character, self.winnr)
local child = {
{
provider = d.icon,
hl = self.type_hl[d.type],
},
{
-- escape `%`s (elixir) and buggy default separators
provider = d.name:gsub("%%", "%%%%"):gsub("%s*->%s*", ''),
-- highlight icon only or location name as well
-- hl = self.type_hl[d.type],
on_click = {
-- pass the encoded position through minwid
minwid = pos,
callback = function(_, minwid)
-- decode
local line, col, winnr = self.dec(minwid)
vim.api.nvim_win_set_cursor(vim.fn.win_getid(winnr), {line, col})
end,
name = "heirline_navic",
},
},
}
-- add a separator only if needed
if #data > 1 and i < #data then
table.insert(child, {
provider = " > ",
hl = { fg = 'bright_fg' },
})
end
table.insert(children, child)
end
-- instantiate the new child, overwriting the previous one
self.child = self:new(children, 1)
end,
-- evaluate the children containing navic components
provider = function(self)
return self.child:eval()
end,
hl = { fg = "gray" },
update = 'CursorMoved'
}
-- local Diagnostics = {
--
-- condition = conditions.has_diagnostics,
--
-- static = {
-- error_icon = vim.fn.sign_getdefined("DiagnosticSignError")[1].text,
-- warn_icon = vim.fn.sign_getdefined("DiagnosticSignWarn")[1].text,
-- info_icon = vim.fn.sign_getdefined("DiagnosticSignInfo")[1].text,
-- hint_icon = vim.fn.sign_getdefined("DiagnosticSignHint")[1].text,
-- },
--
-- init = function(self)
-- self.errors = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.ERROR })
-- self.warnings = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.WARN })
-- self.hints = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.HINT })
-- self.info = #vim.diagnostic.get(0, { severity = vim.diagnostic.severity.INFO })
-- end,
--
-- update = { "DiagnosticChanged", "BufEnter" },
--
-- {
-- provider = function(self)
-- -- 0 is just another output, we can decide to print it or not!
-- return self.errors > 0 and (self.error_icon .. self.errors .. " ")
-- end,
-- hl = { fg = "diag_error" },
-- },
-- {
-- provider = function(self)
-- return self.warnings > 0 and (self.warn_icon .. self.warnings .. " ")
-- end,
-- hl = { fg = "diag_warn" },
-- },
-- {
-- provider = function(self)
-- return self.info > 0 and (self.info_icon .. self.info .. " ")
-- end,
-- hl = { fg = "diag_info" },
-- },
-- {
-- provider = function(self)
-- return self.hints > 0 and (self.hint_icon .. self.hints)
-- end,
-- hl = { fg = "diag_hint" },
-- },
-- }
local Git = {
condition = conditions.is_git_repo,
init = function(self)
self.status_dict = vim.b.gitsigns_status_dict
self.has_changes = self.status_dict.added ~= 0 or self.status_dict.removed ~= 0 or self.status_dict.changed ~= 0
end,
hl = { fg = "orange" },
{ -- git branch name
provider = function(self)
return "" .. self.status_dict.head
end,
hl = { bold = true }
},
-- You could handle delimiters, icons and counts similar to Diagnostics
{
condition = function(self)
return self.has_changes
end,
provider = "("
},
{
provider = function(self)
local count = self.status_dict.added or 0
return count > 0 and ("+" .. count)
end,
hl = { fg = "git_add" },
},
{
provider = function(self)
local count = self.status_dict.removed or 0
return count > 0 and ("-" .. count)
end,
hl = { fg = "git_del" },
},
{
provider = function(self)
local count = self.status_dict.changed or 0
return count > 0 and ("~" .. count)
end,
hl = { fg = "git_change" },
},
{
condition = function(self)
return self.has_changes
end,
provider = ")",
},
}
local DAPMessages = {
condition = function()
local session = require("dap").session()
return session ~= nil
end,
provider = function()
return "" .. require("dap").status()
end,
hl = "Debug"
-- see Click-it! section for clickable actions
}
local WorkDir = {
provider = function()
local icon = (vim.fn.haslocaldir(0) == 1 and "l" or "g") .. " " .. ""
local cwd = vim.fn.getcwd(0)
cwd = vim.fn.fnamemodify(cwd, ":~")
if not conditions.width_percent_below(#cwd, 0.25) then
cwd = vim.fn.pathshorten(cwd)
end
local trail = cwd:sub(-1) == '/' and '' or "/"
return icon .. cwd .. trail
end,
hl = { fg = "blue", bold = true },
}
local TerminalName = {
-- we could add a condition to check that buftype == 'terminal'
-- or we could do that later (see #conditional-statuslines below)
provider = function()
local tname, _ = vim.api.nvim_buf_get_name(0):gsub(".*:", "")
return "" .. tname
end,
hl = { fg = "blue", bold = true },
}
-------------------------------------------------------------------------------------
local TablineBufnr = {
provider = function(self)
return tostring(self.bufnr) .. ". "
end,
hl = "Comment",
}
-- we redefine the filename component, as we probably only want the tail and not the relative path
local TablineFileName = {
provider = function(self)
-- self.filename will be defined later, just keep looking at the example!
local filename = self.filename
filename = filename == "" and "[No Name]" or vim.fn.fnamemodify(filename, ":t")
return filename
end,
hl = function(self)
return { bold = self.is_active or self.is_visible, italic = true }
end,
}
-- this looks exactly like the FileFlags component that we saw in
-- #crash-course-part-ii-filename-and-friends, but we are indexing the bufnr explicitly
-- also, we are adding a nice icon for terminal buffers.
local TablineFileFlags = {
{
condition = function(self)
return vim.api.nvim_buf_get_option(self.bufnr, "modified")
end,
provider = "[+]",
hl = { fg = "green" },
},
{
condition = function(self)
return not vim.api.nvim_buf_get_option(self.bufnr, "modifiable")
or vim.api.nvim_buf_get_option(self.bufnr, "readonly")
end,
provider = function(self)
if vim.api.nvim_buf_get_option(self.bufnr, "buftype") == "terminal" then
return ""
else
return ""
end
end,
hl = { fg = "orange" },
},
}
-- Here the filename block finally comes together
local TablineFileNameBlock = {
init = function(self)
self.filename = vim.api.nvim_buf_get_name(self.bufnr)
end,
hl = function(self)
if self.is_active then
return "TabLineSel"
-- why not?
-- elseif not vim.api.nvim_buf_is_loaded(self.bufnr) then
-- return { fg = "gray" }
else
return "TabLine"
end
end,
on_click = {
callback = function(_, minwid, _, button)
if (button == "m") then -- close on mouse middle click
vim.schedule(function()
vim.api.nvim_buf_delete(minwid, { force = false })
end)
else
vim.api.nvim_win_set_buf(0, minwid)
end
end,
minwid = function(self)
return self.bufnr
end,
name = "heirline_tabline_buffer_callback",
},
TablineBufnr,
FileIcon, -- turns out the version defined in #crash-course-part-ii-filename-and-friends can be reutilized as is here!
TablineFileName,
TablineFileFlags,
}
-- a nice "x" button to close the buffer
local TablineCloseButton = {
condition = function(self)
return not vim.api.nvim_buf_get_option(self.bufnr, "modified")
end,
{ provider = " " },
{
provider = "",
hl = { fg = "gray" },
on_click = {
callback = function(_, minwid)
vim.schedule(function()
vim.api.nvim_buf_delete(minwid, { force = false })
end)
vim.cmd.redrawtabline()
end,
minwid = function(self)
return self.bufnr
end,
name = "heirline_tabline_close_buffer_callback",
},
},
}
-- The final touch!
local TablineBufferBlock = utils.surround({ "", "" }, function(self)
if self.is_active then
return utils.get_highlight("TabLineSel").bg
else
return utils.get_highlight("TabLine").bg
end
end, { TablineFileNameBlock, TablineCloseButton })
-- and here we go
local BufferLine = utils.make_buflist(
TablineBufferBlock,
{ provider = "", hl = { fg = "gray" } }, -- left truncation, optional (defaults to "<")
{ provider = "", hl = { fg = "gray" } } -- right trunctation, also optional (defaults to ...... yep, ">")
-- by the way, open a lot of buffers and try clicking them ;)
)
local Tabpage = {
provider = function(self)
return "%" .. self.tabnr .. "T " .. self.tabpage .. " %T"
end,
hl = function(self)
if not self.is_active then
return "TabLine"
else
return "TabLineSel"
end
end,
}
local TabpageClose = {
provider = "%999X  %X",
hl = "TabLine",
}
local TabPages = {
-- only show this component if there's 2 or more tabpages
condition = function()
return #vim.api.nvim_list_tabpages() >= 2
end,
{ provider = "%=" },
utils.make_tablist(Tabpage),
TabpageClose,
}
local TabLineOffset = {
condition = function(self)
local win = vim.api.nvim_tabpage_list_wins(0)[1]
local bufnr = vim.api.nvim_win_get_buf(win)
self.winid = win
if vim.bo[bufnr].filetype == "NvimTree" then
self.title = "NvimTree"
return true
elseif vim.bo[bufnr].filetype == "neo-tree" then
self.title = "NeoTree"
return true
elseif vim.bo[bufnr].filetype == "nerdtree" then
self.title = "NerdTree"
return true
end
-- elseif vim.bo[bufnr].filetype == "TagBar" then
-- ...
end,
provider = function(self)
local title = self.title
local width = vim.api.nvim_win_get_width(self.winid)
local pad = math.ceil((width - #title) / 2)
return string.rep(" ", pad) .. title .. string.rep(" ", pad)
end,
hl = function(self)
if vim.api.nvim_get_current_win() == self.winid then
return "TablineSel"
else
return "Tabline"
end
end,
}
local Align = { provider = "%=" }
local Space = { provider = " " }
local StatusLine = {
ViMode, Space, FileNameBlock, Space, Git, Space, Align,
DAPMessages, Align,
LSPActive, Space, Ruler
}
local WinBar = {
utils.surround({"", ""}, "#000000", Navic)
}
local TabBar = {
TabLineOffset, BufferLine, TabPages,
}
require("heirline").setup({
statusline = StatusLine,
tabline = TabBar,
winbar = WinBar,
opts = {
disable_winbar_cb = function(args)
local buf = args.buf
local buftype = vim.tbl_contains({ "prompt", "nofile", "help", "quickfix" }, vim.bo[buf].buftype)
local filetype = vim.tbl_contains({ "gitcommit", "fugitive", "Trouble", "packer", "neo-tree", "nerdtree", "NvimTree" }, vim.bo[buf].filetype)
return buftype or filetype
end,
}
})
vim.o.showtabline = 2
vim.o.laststatus = 3
-- require("lualine").setup {
-- options = {
-- icons_enabled = true,
-- theme = "auto",
-- component_separators = { left = "", right = ""},
-- section_separators = { left = "", right = ""},
-- disabled_filetypes = {
-- statusline = {},
-- winbar = {},
-- },
-- ignore_focus = {},
-- always_divide_middle = true,
-- globalstatus = false,
-- refresh = {
-- statusline = 1000,
-- tabline = 1000,
-- winbar = 1000,
-- }
-- },
-- sections = {
-- lualine_a = {"mode"},
-- lualine_b = {"diff"},
-- lualine_c = {"branch"},
-- lualine_x = {"location"},
-- lualine_y = {"progress"},
-- lualine_z = {"filename"}
-- },
-- inactive_sections = {
-- lualine_a = {},
-- lualine_b = {},
-- lualine_c = {"filename"},
-- lualine_x = {"location"},
-- lualine_y = {},
-- lualine_z = {}
-- },
-- tabline = {},
-- winbar = {},
-- inactive_winbar = {},
-- extensions = {}
-- }

View file

@ -0,0 +1,29 @@
-- require("bufferline").setup {
-- animation = true,
-- auto_hide = true,
-- tabpages = true,
-- closable = true,
-- clickable = true,
-- separator_style = "slant",
-- numbers = "buffer_id",
-- }
--
-- -- file sidebars
-- local nvim_tree_events = require("nvim-tree.events")
-- local bufferline_api = require("bufferline.api")
--
-- local function get_tree_size()
-- return require"nvim-tree.view".View.width
-- end
--
-- nvim_tree_events.subscribe("TreeOpen", function()
-- bufferline_api.set_offset(get_tree_size())
-- end)
--
-- nvim_tree_events.subscribe("Resize", function()
-- bufferline_api.set_offset(get_tree_size())
-- end)
--
-- nvim_tree_events.subscribe("TreeClose", function()
-- bufferline_api.set_offset(0)
-- end)

View file

@ -0,0 +1,12 @@
require "telescope".setup {
pickers = {
colorscheme = {
enable_preview = true
}
}
}
pcall(require("telescope").load_extension, "fzf")
require("telescope").load_extension("dap")
require('telescope').load_extension('projects')

View file

@ -0,0 +1,24 @@
vim.filetype.add({extension = {wgsl = "wgsl"}})
require"nvim-treesitter.configs".setup {
ensure_installed = { "wgsl", "bash", "cmake", "cpp", "dockerfile", "gitignore", "glsl", "go", "graphql", "html", "java", "javascript", "json5", "kotlin", "markdown", "python", "rasi", "regex", "c", "lua", "rust", "scss", "sql", "sxhkdrc", "toml", "tsx", "typescript", "yaml" },
sync_install = false,
auto_install = true,
indent = { enable = true, disable = { 'python' } },
highlight = {
enable = true,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
}
vim.wo.foldmethod = "expr"
vim.wo.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldlevelstart = 99 -- do not close folds when a buffer is opened

1
.latestBackup/init.lua Executable file
View file

@ -0,0 +1 @@
require("config")

82
.latestBackup/lua/.luarc.json Executable file
View file

@ -0,0 +1,82 @@
{
"workspace.library": [
"/home/d/.local/share/nvim/site/pack/packer/start/neodev.nvim/types/stable",
"/usr/share/nvim/runtime/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/hop.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/lsp_signature.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/neoscroll.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/nvim-bqf/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/opt/todo-comments.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/Comment.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/LuaSnip/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/adwaita.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/barbar.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/cmp-buffer/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/cmp-path/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/cmp_luasnip/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/copilot.vim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/crates.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/dashboard-nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/fidget.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/github-nvim-theme/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/gitsigns.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/glow.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/gruvbox-baby/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/gruvbox-material/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/lualine.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/mason.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/material.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/mellow.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/minimal.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/neodev.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/neorg/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/neorg-telescope/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nightfox.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nord.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/numb.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-autopairs/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-cmp/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-dap/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-dap-ui/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-jdtls/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-lspconfig/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-navic/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-tree.lua/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-treesitter/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/nvim-web-devicons/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/oh-lucy.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/one_monokai.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/onedarkpro.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/onenord.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/org-bullets.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/orgmode/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/packer.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/playground/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/plenary.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/popup.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/presence.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/project.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/rust-tools.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/sonokai/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/tailwindcss-colorizer-cmp.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/telescope-dap.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/telescope.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/toggleterm.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/tokyodark.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/which-key.nvim/lua",
"/home/d/.local/share/nvim/site/pack/packer/start/wilder.nvim/lua",
"/home/d/.config/nvim/lua",
"${3rd}/luv/library",
"${3rd}/luv/library",
"/home/d/.local/share/nvim/mason/packages/lua-language-server/libexec/meta/0d6b62fe",
"/home/d/.local/share/nvim/mason/packages/lua-language-server/libexec/meta/306b5cb1"
]
}

View file

@ -0,0 +1,62 @@
local pickers = require "telescope.pickers"
local finders = require "telescope.finders"
local conf = require("telescope.config").values
local actions = require "telescope.actions"
local action_state = require "telescope.actions.state"
vim.api.nvim_create_user_command("OP", function ()
local folders = vim.fn.systemlist("\\ls -d $HOME/projects/*/")
for i, folder in ipairs(folders) do
folders[i] = string.match(string.match(folder, "[^/]*/$"), "^[^/]*")
end
pickers.new({}, {
prompt_title = "Open project",
finder = finders.new_table {
results = folders
},
sorter = conf.generic_sorter({}),
attach_mappings = function (prompt_bufnr, map)
actions.select_default:replace(function ()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
selection = selection[1]
vim.cmd("cd $HOME/projects/" .. selection)
vim.cmd("Alpha")
vim.cmd("BWipeout other")
end)
return true
end
}):find()
end, {})
vim.api.nvim_create_user_command("OD", function ()
local folders = vim.fn.systemlist("\\ls -d */")
for i, folder in ipairs(folders) do
folders[i] = string.match(string.match(folder, "[^/]*/$"), "^[^/]*")
end
pickers.new({}, {
prompt_title = "Open directory",
finder = finders.new_table {
results = folders
},
sorter = conf.generic_sorter({}),
attach_mappings = function (prompt_bufnr, map)
actions.select_default:replace(function ()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
selection = selection[1]
vim.cmd("cd " .. selection)
vim.cmd("Alpha")
vim.cmd("BWipeout other")
end)
return true
end
}):find()
end, {})
vim.api.nvim_create_user_command("Config", function ()
vim.cmd("cd $HOME/.config/nvim")
vim.cmd("Alpha")
vim.cmd("BWipeout other")
vim.cmd("NeoTreeFloatToggle")
end, {})

View file

@ -0,0 +1,4 @@
require("config.packer")
require("config.set")
require("config.map")
require("config.commands")

187
.latestBackup/lua/config/map.lua Executable file
View file

@ -0,0 +1,187 @@
vim.g.mapleader = " "
vim.g.maplocalleader = " "
local wk = require("which-key")
local keys = {
a = {"<cmd>Copilot suggestion accept<cr>", "Copilot"},
e = {
name = "Toggle",
e = {"<cmd>NeoTreeFloatToggle<CR>", "NeoTree"},
w = {vim.cmd.Ex, "netrw"},
l = {
name = "LSP",
k = {"<cmd>LspStop<cr>", "Stop"},
s = {"<cmd>LspStart<cr>", "Start"},
},
g = {"<cmd>NeoTreeFloatToggle git_status<CR>", "Git Status"},
b = {"<cmd>NeoTreeFloatToggle buffers<CR>", "Buffers"},
c = {"<cmd>NeoTreeClose<CR>" , "Close"},
s = {"<cmd>Navbuddy<CR>" , "Symbols"},
o = {function () require("oil").open_float(vim.fn.getcwd()) end, "Oil"},
},
c = {
name = "LSP",
S = {"<cmd>AerialToggle<cr>", "Symbol sidebar"},
w = {function () vim.lsp.buf.workspace_symbol("") end, "workspace symbol"},
d = {function () vim.diagnostic.open_float() end, "diagnostic"},
a = {function () vim.lsp.buf.code_action() end, "code actions"},
r = {function () vim.lsp.buf.references() end, "references"},
n = {function () vim.lsp.buf.rename() end, "rename"},
h = {function () vim.lsp.buf.hover() end, "Hover"},
t = {function () vim.lsp.buf.type_definition() end,"Type Definition"},
s = {"<cmd>Navbuddy<cr>", "Navbuddy"},
-- s = {require("telescope.builtin").lsp_document_symbols, "Document Symbols"},
o = {
name = "Copilot",
a = {"<cmd>Copilot suggestion accept<cr>", "Accept"},
w = {"<cmd>Copilot suggestion accept_word<cr>", "Word"},
l = {"<cmd>Copilot suggestion accept_line<cr>", "Line"},
d = {"<cmd>Copilot suggestion dismiss<cr>", "Decline"},
n = {"<cmd>Copilot suggestion next<cr>", "Next"},
p = {"<cmd>Copilot suggestion prev<cr>", "Previous"},
t = {"<cmd>Copilot suggestion toggle_auto_trigger", "toggle"},
P = {
name = "Panel",
t = {"<cmd>Copilot panel open<cr>", "Open"},
r = {"<cmd>Copilot panel refresg<cr>", "Refresh"},
n = {"<cmd>Copilot panel jump_next<cr>", "Next"},
p = {"<cmd>Copilot panel jump_prev<cr>", "Previous"},
a = {"<cmd>Copilot panel accept<cr>", "Accept"},
},
},
g = {
name = "Goto Preview",
d = {function () require('goto-preview').goto_preview_definition() end, "Definition"},
r = {function () require('goto-preview').goto_preview_references() end, "References"},
t = {function () require("goto-preview").goto_preview_type_definitions() end, "Type"},
i = {function () require("goto-preview").goto_preview_implementation() end, "Implementation"},
c = {function () require("goto-preview").close_all_win() end, "Close"},
},
},
q = {
name = "Nvim",
q = {"<cmd>q<cr>", "Quit"},
W = {"<cmd>wq<cr>", "Save and Quit"},
w = {"<cmd>w<cr>", "Save"},
},
u = {"vim.cmd.UndotreeToggle", "UndoTree"},
b = {
name = "Buffer",
h = {vim.cmd.bprevious, "Previous"},
l = {vim.cmd.bnext, "Next"},
H = {vim.cmd.bfirst, "First"},
L = {vim.cmd.blast, "Last"},
b = {require("telescope.builtin").buffers, "Picker"},
c = {"<cmd>:bp | sp | bn | bd<cr>", "Close"},
},
f = {
name = "Telescope & fzf",
c = {require("telescope.builtin").colorscheme, "Find Colorscheme"},
d = {require("telescope.builtin").diagnostics, "Find Diagnostics"},
w = {require("telescope.builtin").grep_string, "Find current Word"},
f = {require("telescope.builtin").find_files, "telescope find files"},
g = {require("telescope.builtin").live_grep, "live grep"},
b = {require("telescope.builtin").buffers, "buffers"},
h = {require("telescope.builtin").help_tags, "help tags"},
s = {function () require("telescope.builtin").grep_string({ search = vim.fn.input("Grep > ")}); end, "grep search through files"},
p = {"<cmd>Telescope projects<cr>", "Projects"},
},
s = {
name = "Settings",
c = {function ()
vim.opt.scrolloff = 100
end, "Always center cursor"},
x = {function ()
vim.opt.scrolloff = 8
end, "Disable Cursor center"},
f = {function ()
vim.opt.nu = true
vim.opt.relativenumber = true
end, "Fix number and relative numbers"},
m = {function ()
vim.cmd[[
highlight CursorColumn guibg=none ctermbg=none
highlight link CursorColumn CursorLine
]]
end, "Fix cursor highlight"},
},
h = {
name = "Hop",
w = {"<cmd>HopWord<cr>", "Word"},
a = {"<cmd>HopAnywhere<cr>", "Anywhere"},
l = {"<cmd>HopLine<cr>", "Line"},
p = {"<cmd>HopPattern<cr>", "Pattern"},
c = {"<cmd>HopChar1<cr>", "Char1"},
x = {"<cmd>HopChar2<cr>", "Char2"},
h = {vim.cmd.HopChar2, "Hop"},
},
d = {
name = "Debug",
b = {function () require("dap").toggle_breakpoint() end, "toggle breakpoint"},
c = {function () require("dap").continue() end, "launch or continue execution"},
s = {function () require("dap").step_into() end, "step into"},
o = {function () require("dap").step_over() end, "step over"},
r = {function () require("dap").repl.open() end, "open repl"},
w = {
name = "Debug UI",
b = {function () require("dapui").float_element("breakpoints", {}) end, "open breakpoints window"},
c = {function () require("dapui").float_element("console", {}) end, "open integrated console"},
r = {function () require("dapui").float_element("repl", {}) end, "open repl"},
}
},
w = {
name = "workspace",
a = {vim.lsp.buf.add_workspace_folder, "add folder"},
r = {vim.lsp.buf.remove_workspace_folder, "remove folder"},
l = {function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, "list folders"},
},
}
wk.register(keys, {prefix = "<leader>"})
wk.register(keys, {prefix = "<C-Space>"})
wk.register(keys, {prefix = "<C-Space>", mode = "i"})
wk.register(keys, {prefix = "<C-Space>", mode = "v"})
-- LSP
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, {desc = "goto definition"})
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, {})
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, {desc = "goto next"})
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, {desc = "goto prev"})
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end)
vim.keymap.set("i", "<C-h>", function () vim.lsp.buf.hover() end, {})
-- term
vim.keymap.set("n", "<C-\\>", vim.cmd.ToggleTerm)
vim.keymap.set("t", "<C-\\>", vim.cmd.ToggleTerm)
-- center
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- visual move
vim.keymap.set("x", "K", ":move '<-2<CR>gv=gv")
vim.keymap.set("x", "J", ":move '>+1<CR>gv=gv")
-- me lazy
vim.keymap.set("i", "<C-c>", "<Esc>")
-- non char keybinds
vim.keymap.set("n", "<leader>f/", function ()
require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown {
winblend = 10,
previewer = false,
})
end, {desc = "fuzzy find"})
vim.keymap.set('n', '<leader>f?', require('telescope.builtin').oldfiles, { desc = 'Find recently opened files' })
vim.keymap.set("i", "<C-Space>f/", function ()
require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown {
winblend = 10,
previewer = false,
})
end, {desc = "fuzzy find"})
vim.keymap.set('i', '<C-Space>f?', require('telescope.builtin').oldfiles, { desc = 'Find recently opened files' })

View file

@ -0,0 +1,566 @@
vim.cmd [[packadd packer.nvim]]
return require("packer").startup(function(use)
use "wbthomason/packer.nvim"
-- lsp
use {
"neovim/nvim-lspconfig",
requires = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"j-hui/fidget.nvim",
"folke/neodev.nvim",
},
}
use {
"jose-elias-alvarez/null-ls.nvim",
"jay-babu/mason-null-ls.nvim",
}
use {
"SmiteshP/nvim-navic",
requires = "neovim/nvim-lspconfig",
config = function()
require("nvim-navic").setup({
highlight = true,
})
end,
}
use {
"ray-x/lsp_signature.nvim",
event = "BufRead",
config = function() require"lsp_signature".on_attach() end,
}
use {
'stevearc/aerial.nvim',
config = function() require('aerial').setup() end
}
-- cmp && snippets
use {
"hrsh7th/nvim-cmp",
requires = {
"hrsh7th/cmp-nvim-lsp",
"L3MON4D3/LuaSnip",
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"rafamadriz/friendly-snippets"
},
}
use { "zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function ()
require("copilot").setup({
suggestion = {
auto_trigger = true,
keymap = {
accept = "<M-l>",
accept_word = "<M-K>",
}
}
})
end
}
-- use {"mattn/emmet-vim"}
use({
"roobert/tailwindcss-colorizer-cmp.nvim",
config = function()
require("tailwindcss-colorizer-cmp").setup({
color_square_width = 2,
})
end
})
-- syntax highlighting
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate"
}
use 'nvim-treesitter/nvim-treesitter-context'
use {
"nvim-treesitter/nvim-treesitter-textobjects",
after = "nvim-treesitter",
}
use "nvim-treesitter/playground"
-- fzf Telescope
use {
"nvim-telescope/telescope.nvim",
branch = "0.1.x",
requires = {
"nvim-lua/plenary.nvim"
}
}
use {
"nvim-telescope/telescope-fzf-native.nvim",
run = "make",
cond = vim.fn.executable "make" == 1
}
use "nvim-lua/popup.nvim"
-- debugging
use "mfussenegger/nvim-dap"
use "jay-babu/mason-nvim-dap.nvim"
use {
"rcarriga/nvim-dap-ui",
requires = {
"mfussenegger/nvim-dap"
},
config = function()
require("dapui").setup()
end,
}
use "nvim-telescope/telescope-dap.nvim"
-- git
use "tpope/vim-fugitive"
use "tpope/vim-rhubarb"
use "lewis6991/gitsigns.nvim"
-- misc
-- use {"simrat39/inlay-hints.nvim",
-- config = {
-- require("inlay-hints").setup({
-- renderer = "eol"
-- })
-- },
-- }
use {"lvimuser/lsp-inlayhints.nvim",
config = {
require("lsp-inlayhints").setup()
}
}
use {"s1n7ax/nvim-window-picker"}
use {"echasnovski/mini.nvim"}
use {
'stevearc/oil.nvim',
config = function() require('oil').setup({
columns = {
"icon",
"permissions",
"size",
},
keymap = {
["<Esc>"] = "actions.close",
},
view_options = {
show_hidden = true,
},
}) end
}
use {"ThePrimeagen/vim-be-good"}
use 'kazhala/close-buffers.nvim'
use {"VonHeikemen/fine-cmdline.nvim",
requires = {{"MunifTanjim/nui.nvim"}},
config = function()
require("fine-cmdline").setup({
cmdline = {
prompt = ">",
}
})
vim.api.nvim_set_keymap('n', ':', '<cmd>FineCmdline<CR>', {noremap = true})
end
}
use {'stevearc/dressing.nvim',
config = function()
require('dressing').setup()
end
}
use {
'stevearc/overseer.nvim',
config = function()
require('overseer').setup({
strategy = "toggleterm",
})
end
}
use "itchyny/screensaver.vim"
use "christoomey/vim-tmux-navigator"
use { 'anuvyklack/pretty-fold.nvim',
config = function()
require('pretty-fold').setup()
end
}
use 'eandrju/cellular-automaton.nvim'
use {
"ahmedkhalf/project.nvim",
config = function()
require("project_nvim").setup {
}
end
}
use "dhruvasagar/vim-table-mode"
use "editorconfig/editorconfig-vim"
use "andweeb/presence.nvim"
use {
"nacro90/numb.nvim",
config = function ()
require("numb").setup()
end
}
use {"ellisonleao/glow.nvim",
config = function ()
require("glow").setup()
end
}
use {"kylechui/nvim-surround",
config = function ()
require("nvim-surround").setup({})
end
}
-- use {"tpope/vim-surround"}
use {
"phaazon/hop.nvim",
event = "BufRead",
config = function()
require("hop").setup()
-- vim.api.nvim_set_keymap("n", "s", ":HopChar2<cr>", { silent = true })
-- vim.api.nvim_set_keymap("n", "S", ":HopWord<cr>", { silent = true })
end,
}
use {
"nvim-tree/nvim-tree.lua",
requires = {
"nvim-tree/nvim-web-devicons",
},
config = function()
require("nvim-tree").setup({
filters = {
dotfiles = true,
},
})
end,
}
-- misc editing
use "tpope/vim-sleuth"
use "mbbill/undotree"
use {
"windwp/nvim-autopairs",
--config = function() require("nvim-autopairs").setup {} end
}
use {"windwp/nvim-ts-autotag",
config = function ()
require("nvim-ts-autotag").setup()
end
}
use {"mg979/vim-visual-multi",
config = function ()
vim.cmd("let g:VM_leader='<Space>m'")
end
}
-- mics visuals
use { 'bennypowers/nvim-regexplainer',
config = function() require'regexplainer'.setup() end,
requires = {
'nvim-treesitter/nvim-treesitter',
'MunifTanjim/nui.nvim',
} }
use {"rcarriga/nvim-notify",
config = function ()
vim.notify = require("notify")
end
}
use {
'nmac427/guess-indent.nvim',
config = function() require('guess-indent').setup {} end,
}
use('mrjones2014/smart-splits.nvim')
-- use 'glepnir/dashboard-nvim'
use {"goolord/alpha-nvim", config = function () end}
-- use {'romgrk/barbar.nvim', wants = 'nvim-web-devicons'}
--use {"akinsho/bufferline.nvim", tag = "v3.*",}
use "preservim/nerdtree"
use {"nvim-neo-tree/neo-tree.nvim",
branch = "v2.x",
requires = {
"nvim-lua/plenary.nvim",
"nvim-tree/nvim-web-devicons",
"MunifTanjim/nui.nvim",
},
}
use {"jistr/vim-nerdtree-tabs"}
use {
"kevinhwang91/nvim-bqf",
event = { "BufRead", "BufNew" },
config = function()
require("bqf").setup({
auto_enable = true,
preview = {
win_height = 12,
win_vheight = 12,
delay_syntax = 80,
border_chars = { "", "", "", "", "", "", "", "", "" },
},
func_map = {
vsplit = "",
ptogglemode = "z,",
stoggleup = "",
},
filter = {
fzf = {
action_for = { ["ctrl-s"] = "split" },
extra_opts = { "--bind", "ctrl-o:toggle-all", "--prompt", "> " },
},
},
})
end,
}
use {"kyazdani42/nvim-web-devicons"}
use {"ap/vim-css-color"}
use {
"lukas-reineke/indent-blankline.nvim",
config = function()
require('indent_blankline').setup {
char = '',
show_trailing_blankline_indent = false,
filetype_exclude = {"dashboard"},
}
end,
}
use {
"folke/which-key.nvim",
config = function()
local wk = require("which-key")
wk.setup {
popup_mappings = {
scroll_down = "<C-j>",
scroll_up = "<C-k>",
},
window = {
border = "single",
},
}
end
}
use {"rebelot/heirline.nvim",
}
-- use "nvim-lualine/lualine.nvim"
use {
"akinsho/toggleterm.nvim",
tag = "*",
config = function()
require("toggleterm").setup{
direction = "float",
float_opts = {
border = "curved"
},
}
end,
}
use {
"karb94/neoscroll.nvim",
event = "WinScrolled",
config = function()
require("neoscroll").setup({
mappings = {"<C-u>", "<C-d>", "<C-b>", "<C-f>", "<C-y>", "<C-e>", "zt", "zz", "zb"},
hide_cursor = true,
stop_eof = true,
use_local_scrolloff = false,
respect_scrolloff = false,
cursor_scrolls_alone = true,
easing_function = nil,
pre_hook = nil,
post_hook = nil,
})
end
}
use {
"folke/todo-comments.nvim",
event = "BufRead",
config = function()
require("todo-comments").setup{}
end,
}
use {
'numToStr/Comment.nvim',
config = function()
require('Comment').setup()
end
}
use {
"SmiteshP/nvim-navbuddy",
requires = {"neovim/nvim-lspconfig",
"SmiteshP/nvim-navic",
"MunifTanjim/nui.nvim",
"numToStr/Comment.nvim",
"nvim-telescope/telescope.nvim"},
config = function ()
require("nvim-navbuddy").setup({
window = {border="rounded",},
})
end,
}
use {
'rmagatti/goto-preview',
config = function()
require('goto-preview').setup {}
end
}
use {
"felipec/vim-sanegx",
event = "BufRead",
}
use {
"gelguy/wilder.nvim",
config = function()
vim.cmd('call wilder#setup({"modes": [":", "/", "?"]})')
vim.cmd('call wilder#set_option("renderer", wilder#popupmenu_renderer({"highlighter": wilder#basic_highlighter(), "left": [ " ", wilder#popupmenu_devicons(), ], "right": [ " ", wilder#popupmenu_scrollbar(), ], "pumblend": 20}))')
vim.cmd('call wilder#set_option("renderer", wilder#popupmenu_renderer(wilder#popupmenu_border_theme({"highlighter": wilder#basic_highlighter(), "min_width": "100%", "min_height": "50%", "reverse": 0, "highlights": {"border": "Normal",},"border": "rounded"})))')
end,
}
-- lenguage specific
-- nim
use {"alaviss/nim.nvim"}
-- use {"zah/nim.vim"}
-- csv
use {
'cameron-wags/rainbow_csv.nvim',
config = function()
require 'rainbow_csv'.setup()
end,
-- optional lazy-loading below
-- module = {
-- 'rainbow_csv',
-- 'rainbow_csv.fns'
-- },
-- ft = {
-- 'csv',
-- 'tsv',
-- 'csv_semicolon',
-- 'csv_whitespace',
-- 'csv_pipe',
-- 'rfc_csv',
-- 'rfc_semicolon'
-- }
}
-- rust
use {"racer-rust/vim-racer",
config = function ()
vim.cmd [[ let g:racer_cmd = "/usr/bin/racer"]]
end
}
use "simrat39/rust-tools.nvim"
use {
"saecki/crates.nvim",
tag = "v0.3.0",
requires = {
"nvim-lua/plenary.nvim"
},
config = function()
require("crates").setup()
end,
}
-- zig
use "ziglang/zig.vim"
use({
"NTBBloodbath/zig-tools.nvim",
-- Load zig-tools.nvim only in Zig buffers
ft = "zig",
config = function()
-- Initialize with default config
require("zig-tools").setup({
integrations = {
zls = {
hints = true,
}
}
})
end,
})
-- glsl
use {"tikhomirov/vim-glsl"}
-- java
use "mfussenegger/nvim-jdtls"
-- c && c++ && cmake
use { "igankevich/mesonic",
config = function()
vim.cmd[[
let b:meson_command = 'meson'
let b:meson_ninja_command = 'ninja'
autocmd FileType c call ConsiderMesonForLinting()
function ConsiderMesonForLinting()
if filereadable('meson.build')
let g:syntastic_c_checkers = ['meson']
endif
endfunction
]]
end
}
use "cdelledonne/vim-cmake"
-- web
use { "evanleck/vim-svelte" }
use { "posva/vim-vue" }
-- yuck
use "elkowar/yuck.vim"
-- themes
use "xiyaowong/transparent.nvim"
-- f#
use {"adelarsq/neofsharp.vim"}
use {"autozimu/LanguageClient-neovim", branch = "next", run = "bash install.sh"}
use {"ionide/Ionide-vim"}
use "sainnhe/gruvbox-material"
use "shaunsingh/nord.nvim"
use "projekt0n/github-nvim-theme"
use "EdenEast/nightfox.nvim"
use "Everblush/nvim"
use "olimorris/onedarkpro.nvim"
use "rmehri01/onenord.nvim"
use "luisiacc/gruvbox-baby"
use "tiagovla/tokyodark.nvim"
use "cpea2506/one_monokai.nvim"
use "yazeed1s/minimal.nvim"
use "Mofiqul/adwaita.nvim"
use "kvrohit/mellow.nvim"
use "yazeed1s/oh-lucy.nvim"
use "marko-cerovac/material.nvim"
use "sainnhe/sonokai"
use "rebelot/kanagawa.nvim"
use { "catppuccin/nvim", as = "catppuccin", config = function ()
require("catppuccin").setup({
flavor = "macchiato",
navic = {
enabled = true,
custom_bg = "NONE",
},
indent_blankline = {
enabled = true,
colored_indent_levels = true,
},
dap = {
enabled = true,
enable_ui = true,
},
integrations = {
hop = true,
cmp = true,
telescope = true,
which_key = true,
},
-- color_overrides = {
-- macchiato = {
-- base = "#000000",
-- mantle = "#000000",
-- crust = "#000000"
-- }
-- }
})
vim.cmd("colorscheme catppuccin")
end }
end)

View file

@ -0,0 +1,58 @@
-- set leader
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- numbers
vim.opt.nu = true
vim.opt.number = true
vim.opt.relativenumber = true
-- tab && indent
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.o.breakindent = true
-- lines
vim.opt.wrap = true
vim.opt.smarttab = true
-- undo
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
-- search
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.o.ignorecase = true
vim.o.smartcase = true
-- colors
vim.opt.termguicolors = true
vim.cmd("colorscheme catppuccin")
vim.opt.cursorline = true
vim.opt.cursorcolumn = true
vim.cmd[[
highlight CursorColumn guibg=none ctermbg=none
highlight link CursorColumn CursorLine
]]
-- misc
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.scrolloff = 8
vim.opt.sidescrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.o.mouse = "a"
vim.opt.showmode = false
vim.o.completeopt = "menuone,noselect"
-- idfk pls fix nim
vim.opt.path = vim.opt.path + "/home/d/.nimble/bin/**"