yes there's a bit of java in my nvim config why do you ask?

This commit is contained in:
2024-08-09 02:45:31 -04:00
parent ad76983d96
commit c489d39369
104 changed files with 2058 additions and 2796 deletions

View File

@ -1,16 +0,0 @@
local status_ok, actions = pcall(require, "actions-preview")
if not status_ok then
return
end
actions.setup {
backend = { "telescope" },
telescope = require("telescope.themes").get_dropdown {
borderchars = {
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' };
},
layout_strategy = 'cursor',
}
}

View File

@ -1,10 +0,0 @@
local status_ok, indent = pcall(require, "auto-indent")
if not status_ok then
return
end
indent.setup {
indentexpr = function(lnum)
return require("nvim-treesitter.indent").get_indent(lnum)
end
}

View File

@ -1,8 +0,0 @@
local status_ok, autopairs = pcall(require, "ultimate-autopair")
if not status_ok then
return
end
autopairs.setup {
ignored_next_char = string.gsub("!@#$%^&*()_+", "%s+", "")
}

View File

@ -1,143 +0,0 @@
local status_ok, cmp = pcall(require, "cmp")
if not status_ok then
return
end
local function has_words_before()
unpack = unpack or table.unpack
local line, col = unpack(a.nvim_win_get_cursor(0))
return col ~= 0 and a.nvim_buf_get_lines(0, line - 1, line, true)
[1]:sub(col, col):match("%s") == nil
end
local luasnip = require('luasnip')
local neogen = require('neogen')
require("luasnip.loaders.from_vscode").lazy_load()
cmp.setup {
sources = cmp.config.sources({
{ name = 'nvim_lsp', priority = 999 },
{ name = 'luasnip_choice', priority = 750 },
{ name = 'buffer', max_item_count = 3 },
{ name = 'async_path', max_item_count = 5 },
{ name = 'nvim_lua' },
{ name = 'neorg' },
{ name = 'calc' },
{ name = 'cmdline' },
{ name = 'nvim_lsp_signature_help' }
}),
window = {
completion = {
scrollbar = false,
border = 'solid',
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
},
documentation = {
border = 'solid',
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
}
},
view = {
entries = { name = 'custom', selection_order = 'near_cursor' },
},
experimental = {
ghost_text = true
},
formatting = {
fields = {'menu', 'abbr', 'kind'},
format = function(entry, item)
local menu_icon = {
nvim_lsp = 'λ',
nvim_lua = 'v',
calc = '+',
luasnip = '%',
buffer = '@',
path = '#',
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
-- mappings -----------------------------------------------------------------
mapping = cmp.mapping.preset.insert({
["<Tab>"] = cmp.mapping(function(fallback)
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
elseif cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
if #cmp.get_entries() == 1 then
cmp.confirm({ select = true })
end
elseif neogen.jumpable() then
neogen.jump_next()
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)
elseif neogen.jumpable(true) then
neogen.jump_prev()
else
fallback()
end
end, { "i", "s" }),
['<CR>'] = cmp.mapping {
i = function(fallback)
if cmp.visible() and cmp.get_active_entry() then
cmp.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false })
else
fallback()
end
end,
s = cmp.mapping.confirm({ select = true }),
c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace,
select = true }),
},
["<C-u>"] = cmp.mapping.scroll_docs(-4),
["<C-d>"] = cmp.mapping.scroll_docs(4),
['<ESC>'] = cmp.mapping.close(),
["<C-e>"] = cmp.mapping.abort(),
}),
sorting = {
comparators = {
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
require("cmp-under-comparator").under,
cmp.config.compare.kind,
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
}
},
enabled = function()
local context = require 'cmp.config.context'
if a.nvim_get_mode().mode == 'c' then
return true
else
return not context.in_treesitter_capture("comment")
and not context.in_syntax_group("Comment")
end
end
}

View File

@ -1,13 +0,0 @@
local status_ok, colorizer = pcall(require, "colorizer")
if not status_ok then
return
end
colorizer.setup {
filetypes = { '*' },
user_default_options = {
names = false,
RRGGBBAA = true,
AARRGGBB = true,
},
}

View File

@ -0,0 +1,3 @@
local misc = require('core.misc')
misc.colorscheme('mellow')

View File

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

View File

@ -1,16 +0,0 @@
local status_ok, dressing = pcall(require, "dressing")
if not status_ok then
return
end
dressing.setup {
input = {
enabled = true,
title_pos = "center",
border = 'single',
relative = "win"
},
select = {
enabled = true,
}
}

View File

@ -1,14 +0,0 @@
local status_ok, fidget = pcall(require, "fidget")
if not status_ok then
return
end
fidget.setup {
text = {
spinner = "line",
done = ":)",
},
window = {
zindex = 1,
}
}

View File

@ -1,9 +0,0 @@
local status_ok, yodel = pcall(require, "git-yodel")
if not status_ok then
return
end
yodel.setup {
border = 'shadow',
position = 'auto'
}

View File

@ -1,69 +0,0 @@
local status_ok, gitsigns = pcall(require, "gitsigns")
if not status_ok then
return
end
gitsigns.setup {
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '-' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = {
interval = 1000,
follow_files = true
},
attach_to_untracked = true,
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
preview_config = {
border = 'shadow',
},
on_attach = function(bufnr)
local gs = package.loaded.gitsigns
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end
-- Navigation
map('n', ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true})
map('n', '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true})
-- Actions
map('n', '<leader>hs', gs.stage_hunk)
map('n', '<leader>hr', gs.reset_hunk)
map('v', '<leader>hs', function() gs.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('v', '<leader>hr', function() gs.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
map('n', '<leader>hS', gs.stage_buffer)
map('n', '<leader>hu', gs.undo_stage_hunk)
map('n', '<leader>hR', gs.reset_buffer)
map('n', '<leader>hp', gs.preview_hunk)
map('n', '<leader>hb', function() gs.blame_line{full=true} end)
map('n', '<leader>tb', gs.toggle_current_line_blame)
map('n', '<leader>hd', gs.diffthis)
map('n', '<leader>hD', function() gs.diffthis('~') end)
map('n', '<leader>td', gs.toggle_deleted)
-- Text object
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
end
}

View File

@ -1,29 +0,0 @@
local status_ok, glance = pcall(require, "glance")
if not status_ok then
return
end
glance.setup {
detached = function(winid)
return vim.api.nvim_win_get_width(winid) < 100
end,
border = {
enable = true,
top_char = '',
},
theme = {
enable = false,
},
folds = {
fold_closed = '>',
fold_open = 'V',
folded = true,
},
indent_lines = {
enable = false,
},
winbar = {
enable = true,
},
}

View File

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

View File

@ -1,28 +0,0 @@
local status_ok, headlines = pcall(require, "headlines")
if not status_ok then
return
end
headlines.setup {
norg = {
headline_highlights = {
"@neorg.headings.1.title",
"@neorg.headings.2.title",
"@neorg.headings.3.title",
"@neorg.headings.4.title",
"@neorg.headings.5.title",
"@neorg.headings.6.title"
},
bullets = { "", "", "", "" },
},
markdown = {
headline_highlights = {
"@neorg.headings.1.title",
"@neorg.headings.2.title",
"@neorg.headings.3.title",
"@neorg.headings.4.title",
"@neorg.headings.5.title",
"@neorg.headings.6.title"
}
},
}

View File

@ -1,15 +0,0 @@
local status_ok, ibl = pcall(require, "ibl")
if not status_ok then
return
end
ibl.setup {
indent = {
char = '',
},
scope = {
enabled = true,
show_start = false,
show_end = false
},
}

View File

@ -1,23 +0,0 @@
local status_ok, jabs = pcall(require, "jabs")
if not status_ok then
return
end
jabs.setup {
offset = { bottom = 2, right = 2 },
symbols = {
current = "@",
split = "|",
alternate = "*",
hidden = "\\",
locked = "=",
ro = "=",
edited = "+",
terminal = ">_",
default_file = "~",
terminal_symbol = ">_",
},
use_devicons = false,
}

View File

@ -1,92 +0,0 @@
local status_ok, lspconfig = pcall(require, "lspconfig")
if not status_ok then
return
end
-- configure lsp when attached
local function lsp_attach(client, bufnr)
-- helper functions
local function set_lsp_sign(name, text)
vim.fn.sign_define(name, { text = text, texthl = name })
end
local function map(m, lhs, rhs)
local opts = { remap = false, silent = true, buffer = bufnr }
vim.keymap.set(m, lhs, rhs, opts)
end
set_lsp_sign("DiagnosticSignError", "x")
set_lsp_sign("DiagnosticSignWarn" , "!")
set_lsp_sign("DiagnosticSignInfo" , "i")
set_lsp_sign("DiagnosticSignHint" , "h")
-- LSP actions
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<cr>')
map('n', 'gD', '<cmd>lua vim.lsp.buf.definition()<cr>')
-- map('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<cr>')
map('n', 'gI', '<cmd>lua vim.lsp.buf.implementation()<cr>')
map('n', 'gY', '<cmd>lua vim.lsp.buf.type_definition()<cr>')
map('n', 'gR', '<cmd>lua vim.lsp.buf.references()<cr>')
map('n', '<S-Tab>', '<cmd>lua vim.lsp.buf.signature_help()<cr>')
map('n', '<leader>lr', '<cmd>lua vim.lsp.buf.rename()<cr>')
map('n', '<F2>', '<cmd>lua vim.lsp.buf.rename()<cr>')
map('n', '<F4>', '<cmd>lua vim.lsp.buf.code_action()<cr>')
-- Diagnostics
map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<cr>')
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<cr>')
vim.api.nvim_buf_create_user_command(bufnr, 'LspFormat', function()
vim.lsp.buf.format()
end, {desc = 'Format buffer with language server'})
vim.api.nvim_buf_create_user_command('LspWorkspaceAdd', function()
vim.lsp.buf.add_workspace_folder()
end, { desc = 'Add folder to workspace' })
vim.api.nvim_buf_create_user_command('LspWorkspaceList', function()
vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders()))
end, { desc = 'List workspace folders' })
vim.api.nvim_buf_create_user_command('LspWorkspaceRemove', function()
vim.lsp.buf.remove_workspace_folder()
end, { desc = 'Remove folder from workspace' })
end
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = false,
underline = true,
severity_sort = true,
})
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
vim.lsp.handlers.hover, {
border = 'solid',
})
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
vim.lsp.handlers.signature_help, {
border = 'solid',
})
-- get servers and attach to them
local status_ok1, mason = pcall(require, "mason")
if not status_ok1 then
return
end
mason.setup {}
local status_ok2, masonlspconfig = pcall(require, "mason-lspconfig")
if not status_ok2 then
return
end
masonlspconfig.setup {}
masonlspconfig.setup_handlers {
function (server_name)
lspconfig[server_name].setup { on_attach = lsp_attach }
end,
-- specific servers can be setup as follows:
-- ["rust_analyzer"] = function ()
-- require("rust-tools").setup {}
-- end
-- check out :help mason-lspconfig for more info
}

View File

@ -1,13 +0,0 @@
local status_ok, lines = pcall(require, "lsp_lines")
if not status_ok then
return
end
lines.setup()
vim.diagnostic.config {
virtual_lines = {
highlight_whole_line = false,
only_current_line = true
}
}

View File

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

View File

@ -1,15 +0,0 @@
local status_ok, luasnip = pcall(require, "luasnip")
if not status_ok then
return
end
luasnip.config.set_config {
-- return back into snippet
history = true,
-- update on text insert
updateevents = "TextChanged,TextChangedI"
}
require("luasnip.loaders.from_vscode").lazy_load()
require("luasnip.loaders.from_snipmate").lazy_load()

View File

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

View File

@ -1,29 +0,0 @@
local status_ok, mason = pcall(require, "mason")
if not status_ok then
return
end
mason.setup {
ui = {
border = "shadow",
width = 0.6,
height = 0.9,
icons = {
package_installed = "+",
package_pending = "?",
package_uninstalled = "x"
}
},
keymaps = {
toggle_package_expand = "<CR>",
install_package = "i", -- Keymap to install the package under the current cursor position
update_package = "u", -- Keymap to reinstall/update the package under the current cursor position
check_package_version = "c", -- Keymap to check for new version for the package under the current cursor position
update_all_packages = "U", -- Keymap to update all installed packages
check_outdated_packages = "C", -- Keymap to check which installed packages are outdated
uninstall_package = "r", -- Keymap to uninstall a package
cancel_installation = "<C-c>", -- Keymap to cancel a package installation
apply_language_filter = "<C-f>", -- Keymap to apply language filter
},
}

View File

@ -1,17 +0,0 @@
local status_ok, masontool = pcall(require, "mason-tool-installer")
if not status_ok then
return
end
masontool.setup {
ensure_installed = {
'lua-language-server',
'bash-language-server',
'editorconfig-checker',
'stylua',
'shellcheck',
'clangd',
'html-lsp',
'css-lsp',
},
}

View File

@ -1,10 +0,0 @@
local status_ok, neogen = pcall(require, "neogen")
if not status_ok then
return
end
neogen.setup {
enabled = true,
input_after_comment = true,
snippet_engine = "luasnip",
}

View File

@ -1,65 +0,0 @@
local status_ok, neorg = pcall(require, "neorg")
if not status_ok then
return
end
local status_ok2, luarocks = pcall(require, "luarocks-nvim")
if not status_ok2 then
return
end
luarocks.setup {}
local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or
(os.getenv("HOME").."/Documents")).."/notes/"
neorg.setup {
load = {
["core.defaults"] = {},
["core.esupports.metagen"] = {
config = {
type = "auto",
update_date = true,
}
},
["core.dirman"] = {
config = {
workspaces = {
home = wsphome.."home",
robotics = wsphome.."robotics",
school = wsphome.."school"
},
index = "index.norg",
default_workspace = "home"
}
},
["core.summary"] = {},
["core.concealer"] = {
config = {
dim_code_blocks = {
padding = { right = 2, },
content_only = false,
width = "content",
},
folds = false,
icon_preset = "basic",
}
},
["core.export"] = {},
["core.completion"] = {
config = {
engine = "nvim-cmp",
}
},
["core.qol.toc"] = {
config = {
close_after_use = true
}
},
["core.presenter"] = {
config = {
zen_mode = "zen-mode",
}
},
["core.integrations.telescope"] = {},
}
}

View File

@ -1,32 +0,0 @@
local status_ok, notify = pcall(require, "notify")
if not status_ok then
return
end
notify.setup {
timeout = 3000,
minimum_width = 35,
icons = {
DEBUG = "B",
ERROR = "x",
INFO = "i",
TRACE = "t",
WARN = "!"
},
max_height = function() return math.floor(vim.o.lines * 0.75) end,
max_width = function() return math.floor(vim.o.columns * 0.5) end,
on_open = function(win, record)
if record.title[1] == '' then record.title[1] = 'Unkown' end
vim.api.nvim_win_set_config(win, {
title = {
{ ' '..record.title[1]..' ', 'Notify'..record.level..'Title' }
},
title_pos = 'center',
border = 'single'
})
end,
render = function(bufnr, notif)
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
end,
}

View File

@ -1,20 +0,0 @@
local status_ok, project = pcall(require, "project_nvim")
if not status_ok then
return
end
project.setup {
detection_methods = { "pattern", "lsp" },
patterns = {
".git",
"Makefile",
"_darcs",
".hg",
".bzr",
".svn",
"package.json",
"index.norg"
},
show_hidden = false,
scope = "tab"
}

View File

@ -1,47 +0,0 @@
local status_ok, sfm = pcall(require, "sfm")
if not status_ok then
return
end
sfm.setup {
view = {
side = 'right',
width = 35,
},
mappings = {
custom_only = false,
list = {
{ key = 's', action = 'toggle_selection' }
}
},
renderer = {
icons = {
file = {
default = "#",
symlink = "#",
},
folder = {
default = "[|",
open = "[/",
symlink = "[|",
symlink_open = "[/",
},
indicator = {
folder_closed = "",
folder_open = "",
file = "",
},
selection = "*"
}
}
}:load_extension('sfm-git', {
icons = {
unstaged = "+",
staged = "S",
unmerged = "U",
renamed = "r",
untracked = "?",
deleted = "-",
ignored = "?",
}
})

View File

@ -1,28 +0,0 @@
local status_ok, smartsplits = pcall(require, "smart-splits")
if not status_ok then
return
end
smartsplits.setup {
default_amount = 3,
resize_mode = {
quit_key = '<leader>r',
resize_keys = {
'<C-h>',
'<C-j>',
'<C-k>',
'<C-l>',
},
silent = true,
hooks = {
on_enter = function()
vim.notify("Resize mode on", vim.log.levels.INFO, { title = "Smart Splits" })
vim.cmd('unmap <leader>r')
end,
on_leave = function()
vim.notify("Resize Mode off", vim.log.levels.INFO, { title = "Smart Splits" })
vim.keymap.set('n', '<leader>r', smartsplits.start_resize_mode, {})
end,
},
},
}

View File

@ -1,115 +0,0 @@
local status_ok, alpha = pcall(require, "alpha")
if not status_ok then
return
end
local function button(sc, txt, cmd, kopts, opts)
opts = opts or {
position = "center",
shortcut = sc:gsub("<leader>", "LDR"),
cursor = 0,
width = 49,
align_shortcut = "right",
hl_shortcut = "AlphaShortcut",
hl = "AlphaText",
}
if cmd then
kopts = kopts or { noremap = true, silent = true, nowait = true }
opts.keymap = { "n", sc, cmd, kopts }
end
local function on_press()
local key = vim.api.nvim_replace_termcodes(cmd, true, false, true)
vim.api.nvim_feedkeys(key, "t", false)
end
return {
type = "button",
val = txt,
opts = opts,
on_press = on_press,
}
end
local header = {
'█▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ █▀▀▀▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀▀▀█ ',
'█ ░█████▀▀▀▀▀█████▓▄ ▀▀▀▀ ░ ░█ ░█ ░█ █ ',
'█ ▒███████ ▓███████ ▒██ ▓███ ▓███ ▓███ █ ',
'█ ▓███████ ▓███████ ▓█████████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███ ██████████████ █ ',
'█ ▓███████ ▓███████ ███▄██████████████ █ ',
'█ ▓███████ ▓███████ ██████▀▀██████████ █ ',
'▀ ▓███████ ▓███████▄ ▄▄███████████ █ ',
'█ ▓███████ ██████████████████ █▄▄▄',
'█ ▓███████▀▀ ▀ ▀ ▀████████████████▄ ▄ █',
'█▄▄▄▄▄▄▄ ▀ █▀▀▀▀▀▀▀▀▀▀▀▀█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█',
' █ ▀ █ ',
' ▀▀▀▀▀ ',
}
local footer = {
'▄ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄',
}
alpha.setup {
layout = {
{ type = 'text', val = function()
local padding = {}
for i = 1, math.floor((vim.api.nvim_win_get_height(0) - #header - 6 - #footer) / 2), 1 do
table.insert(padding, " ")
end
return padding
end },
{ type = 'text', val = header, opts = {
position = 'center',
hl = 'AlphaHeader',
} },
{ type = 'padding', val = 1 },
{ type = 'group', val = {
button('f', '? Find files', '<cmd>Telescope find_files<CR>'),
button('r', '↺ Recent files', '<cmd>Telescope oldfiles <CR>'),
button('n', '▣ Neorg workspace', '<cmd>Telescope neorg switch_workspace<CR>'),
button('m', '≡ Menu', '<cmd>lua require("core.conf").configmenu()<CR>'),
button('q', '✖ Quit', '<cmd>wqa<CR>'),
} },
{ type = 'text', val = footer, opts = {
position = 'center',
hl = 'AlphaFooter',
} },
},
opts = {
keymap = {
press = '<CR>',
press_queue = nil
},
setup = function()
vim.api.nvim_create_autocmd('User', {
pattern = 'AlphaReady',
desc = 'disable stuff for alpha',
callback = function()
vim.opt.laststatus = 0
vim.opt.showtabline = 0
vim.opt.more = false
vim.opt.showcmd = false
vim.opt.ruler = false
vim.opt.number = false
vim.opt.relativenumber = false
end,
})
vim.api.nvim_create_autocmd('BufUnload', {
buffer = 0,
desc = 'enable stuff after alpha closes',
callback = function()
vim.opt.laststatus = 3
vim.opt.showtabline = 2
vim.opt.more = true
vim.opt.showcmd = true
vim.opt.ruler = true
vim.opt.number = false
vim.opt.relativenumber = false
end,
})
end,
}
}

View File

@ -1,78 +0,0 @@
local status_ok, el = pcall(require, "el")
if not status_ok then
return
end
el.reset_windows()
local builtin = require("el.builtin")
local sections = require("el.sections")
local c = require("core.statusbar.components")
local function hl(fg, b)
b = b or false
return c.extract_hl({
bg = { ["StatusLine"] = "bg" },
fg = { [fg] = "fg" },
bold = b,
})
end
local modes = {
-- display name, mode, highlight group
n = { "Normal", "N", hl("@neorg.headings.1.title") },
niI = { "Normal", "N", hl("@neorg.headings.1.title") },
niR = { "Normal", "N", hl("@neorg.headings.1.title") },
niV = { "Normal", "N", hl("@neorg.headings.1.title") },
no = { "N·OpPd", "?" },
v = { "Visual", "V", hl("@neorg.headings.2.title") },
V = { "V·Line", "Vl", hl("@neorg.headings.2.title") },
[""] = { "V·Block", "Vb", hl("@neorg.headings.2.title") },
s = { "Select", "S" },
S = { "S·Line", "Sl" },
[""] = { "S·Block", "Sb" },
i = { "Insert", "I", hl("@neorg.headings.4.title") },
ic = { "ICompl", "Ic" },
R = { "Replace", "R", hl("@neorg.headings.5.title") },
Rv = { "VReplace", "Rv", hl("@neorg.headings.5.title") },
c = { "Command", "C", hl("@neorg.headings.3.title") },
cv = { "Vim Ex", "E" },
ce = { "Ex (r)", "E" },
r = { "Prompt", "P" },
rm = { "More", "M" },
["r?"] = { "Confirm", "Cn" },
["!"] = { "Shell", "S" },
nt = { "Term", "T" },
t = { "Term", "T" },
}
el.setup {
generator = function()
return {
{ { " " }, c.mode { modes = modes, hl_icon_only = false } },
{ sections.split, required = true },
{ sections.collapse_builtin { { builtin.filetype }, { " " } } },
{ sections.maximum_width(c.fn_tail, 0.50), required = true },
{ sections.collapse_builtin { { " " }, { builtin.modified_flag } } },
{ sections.split, required = true },
{ c.lsp_srvname },
{ c.diagnostics {
fmt = "[%s]",
hl_err = hl("DiagnosticError", true),
hl_warn = hl("DiagnosticWarn", true),
hl_info = hl("DiagnosticInfo", true),
hl_hint = hl("DiagnosticHint", true)
}},
{ c.git_branch { icon = "*", fmt = " %s%s" } },
{ c.git_changes_buf {
fmt = "[%s]",
hl_insert = hl("GitSignsAdd", true),
hl_change = hl("GitSignsChange", true),
hl_delete = hl("GitSignsDelete", true),
}},
{ { " " }, c.line {
fmt = "[%s]",
}, required = true },
}
end
}

View File

@ -1,8 +0,0 @@
local status_ok, tabline = pcall(require, "tar")
if not status_ok then
return
end
tabline.setup {
closeicon = "%#Constant#[x]"
}

View File

@ -1,97 +0,0 @@
local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
return
end
local actions = require('telescope.actions')
local action_layout = require("telescope.actions.layout")
local function telescopew()
if vim.o.columns <= 80 then
return vim.o.columns
else
return 0.8
end
end
telescope.setup {
defaults = {
borderchars = {
prompt = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
results = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
preview = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
},
winblend = 0,
layout_strategy = 'horizontal',
sorting_strategy = 'descending',
scroll_strategy = 'limit',
layout_config = {
horizontal = {
width = telescopew(),
height = 20,
prompt_position = 'bottom',
anchor = 'N',
}
},
preview = {
-- add image previews via chafa
mime_hook = function(filepath, bufnr, opts)
local function is_image(filepath)
local image_extensions = { -- supported image formats
'png',
'jpg',
'jpe',
'jpeg',
'webp',
'gif'
}
local split_path = vim.split(filepath:lower(), '.', { plain=true })
local extension = split_path[#split_path]
return vim.tbl_contains(image_extensions, extension)
end
if is_image(filepath) and vim.fn.executable('chafa') == 1 then
local term = vim.api.nvim_open_term(bufnr, {})
local function send_output(_, data, _)
for _, d in ipairs(data) do
vim.api.nvim_chan_send(term, d..'\r\n')
end
end
vim.fn.jobstart({
'chafa', '-C', 'on', '--animate', 'off', '-s',
'23x18', '--clear', filepath
}, { on_stdout = send_output, stdout_buffered = true, pty = true })
a.nvim_set_option_value("number", false, { buf = bufnr })
else
require("telescope.previewers.utils").set_preview_message(bufnr,
opts.winid, "File cannot be previewed")
end
end
},
mappings = {
i = {
["<esc>"] = actions.close,
['<C-h>'] = 'which_key',
['<C-j>'] = actions.move_selection_next,
['<C-k>'] = actions.move_selection_previous,
['<C-l>'] = actions.select_default,
['<C-u>'] = actions.preview_scrolling_up,
['<C-d>'] = actions.preview_scrolling_down,
["<C-p>"] = action_layout.toggle_preview
},
n = {
["gg"] = actions.move_to_top,
["G"] = actions.move_to_bottom,
},
},
}
}
telescope.load_extension('file_browser')
telescope.load_extension('projects')
telescope.load_extension('fzf')
telescope.load_extension('harpoon')
a.nvim_create_autocmd('User', {
pattern = 'TelescopePreviewerLoaded',
callback = function()
vim.opt.winblend = 0
end,
})

View File

@ -1,36 +0,0 @@
local status_ok, todocomments = pcall(require, "todo-comments")
if not status_ok then
return
end
todocomments.setup {
keywords = {
FIX = {
icon = "# ",
alt = { "FIXME", "BUG" },
},
HACK = {
icon = "* ",
color = "warning",
},
WARN = {
icon = "! ",
color = "warning",
alt = { "WARNING", "XXX" },
},
NOTE = {
icon = "i ",
color = "hint",
alt = { "INFO", "TODO" },
},
PERF = {
icon = "@ ",
alt = { "OPTIM", "PERFORMANCE", "OPTIMIZE" },
},
TEST = {
icon = "@ ",
color = "test",
alt = { "TESTING", "PASSED", "FAILED" },
},
},
}

View File

@ -1,36 +0,0 @@
local status_ok, treesitter = pcall(require, "nvim-treesitter.configs")
if not status_ok then
return
end
treesitter.setup {
ensure_installed = {
"c",
"lua",
"bash",
"vim",
"vimdoc",
"query",
"git_rebase",
"gitattributes",
"gitcommit",
"gitignore",
"git_config",
},
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
disable = function(lang, buf)
if lang == "diff" then return true end
local max_filesize = 1024 * 100 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end
},
indent = {
enable = true
}
}

View File

@ -1,10 +0,0 @@
local status_ok, tc = pcall(require, "treesitter-context")
if not status_ok then
return
end
tc.setup{
enable = true,
line_numbers = true,
separator = '-',
}

View File

@ -1,9 +0,0 @@
local status_ok, treesj = pcall(require, "treesj")
if not status_ok then
return
end
treesj.setup {
use_default_keymaps = false,
max_join_length = 120,
}

View File

@ -1,3 +0,0 @@
if (g.loaded_undotree) then
g.undotree_DiffAutoOpen = 0
end

View File

@ -1,8 +0,0 @@
local status_ok, urlview = pcall(require, "urlview")
if not status_ok then
return
end
urlview.setup {
default_picker = 'telescope',
}

View File

@ -1,21 +0,0 @@
local status_ok, whichkey = pcall(require, "which-key")
if not status_ok then
return
end
whichkey.setup {
icons = {
breadcrumb = '>>',
separator = '->',
},
winblend = 0,
window = {
border = 'shadow',
margin = { 1, .1, 2, .1 },
},
layout = {
width = { min = 20, max = 50 },
align = 'center',
}
}