yes there's a bit of java in my nvim config why do you ask?
This commit is contained in:
6
after/ftplugin/c.lua
Normal file
6
after/ftplugin/c.lua
Normal file
@ -0,0 +1,6 @@
|
||||
local misc = require('core.misc')
|
||||
local map_local = misc.map_local
|
||||
|
||||
-- sort #includes <> (very jank)
|
||||
-- TODO: rewrite in a semi-sane way
|
||||
map_local("n", "cri", "mz/^#include.*<.*>$<CR>ggVGN:sort<CR>`z<cmd>delm z<CR>:nohlsearch<Bar>:echo<CR>")
|
@ -1 +0,0 @@
|
||||
vim.cmd('startinsert | 1')
|
@ -1 +0,0 @@
|
||||
gitcommit.lua
|
@ -1 +0,0 @@
|
||||
vim.treesitter.start()
|
@ -1,255 +0,0 @@
|
||||
-- NOTE: Make sure you're $JAVA_HOME is correct (prob should be 17 or higher)
|
||||
local java_cmds = vim.api.nvim_create_augroup('java_cmds', {clear = true})
|
||||
local cache_vars = {}
|
||||
|
||||
local root_files = {
|
||||
'.git',
|
||||
'mvnw',
|
||||
'gradlew',
|
||||
'pom.xml',
|
||||
'build.gradle',
|
||||
}
|
||||
|
||||
local features = {
|
||||
-- change this to `true` to enable codelens
|
||||
codelens = true,
|
||||
|
||||
-- change this to `true` if you have `nvim-dap`,
|
||||
-- `java-test` and `java-debug-adapter` installed
|
||||
debugger = true,
|
||||
}
|
||||
|
||||
local function get_jdtls_paths()
|
||||
if cache_vars.paths then
|
||||
return cache_vars.paths
|
||||
end
|
||||
|
||||
local path = {}
|
||||
path.data_dir = vim.fn.stdpath('cache') .. '/nvim-jdtls'
|
||||
local jdtls_install = require('mason-registry').get_package('jdtls'):get_install_path()
|
||||
path.java_agent = jdtls_install .. '/lombok.jar'
|
||||
path.launcher_jar = vim.fn.glob(jdtls_install .. '/plugins/org.eclipse.equinox.launcher_*.jar')
|
||||
path.platform_config = jdtls_install .. '/config_linux'
|
||||
path.bundles = {}
|
||||
|
||||
-- Include java-test bundle if present
|
||||
local java_test_path = require('mason-registry')
|
||||
.get_package('java-test')
|
||||
:get_install_path()
|
||||
|
||||
local java_test_bundle = vim.split(
|
||||
vim.fn.glob(java_test_path .. '/extension/server/*.jar'),
|
||||
'\n'
|
||||
)
|
||||
|
||||
if java_test_bundle[1] ~= '' then
|
||||
vim.list_extend(path.bundles, java_test_bundle)
|
||||
end
|
||||
|
||||
-- Include java-debug-adapter bundle if present
|
||||
local java_debug_path = require('mason-registry')
|
||||
.get_package('java-debug-adapter')
|
||||
:get_install_path()
|
||||
|
||||
local java_debug_bundle = vim.split(
|
||||
vim.fn.glob(java_debug_path .. '/extension/server/com.microsoft.java.debug.plugin-*.jar'),
|
||||
'\n'
|
||||
)
|
||||
|
||||
if java_debug_bundle[1] ~= '' then
|
||||
vim.list_extend(path.bundles, java_debug_bundle)
|
||||
end
|
||||
|
||||
-- Useful if you're starting jdtls with a Java version that's
|
||||
-- different from the one the project uses.
|
||||
path.runtimes = {
|
||||
-- Note: the field `name` must be a valid `ExecutionEnvironment`,
|
||||
-- you can find the list here:
|
||||
-- https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
|
||||
--
|
||||
-- This example assume you are using sdkman: https://sdkman.io
|
||||
-- {
|
||||
-- name = 'JavaSE-17',
|
||||
-- path = vim.fn.expand('~/.sdkman/candidates/java/17.0.6-tem'),
|
||||
-- },
|
||||
-- {
|
||||
-- name = 'JavaSE-18',
|
||||
-- path = vim.fn.expand('~/.sdkman/candidates/java/18.0.2-amzn'),
|
||||
-- },
|
||||
}
|
||||
|
||||
cache_vars.paths = path
|
||||
return path
|
||||
end
|
||||
|
||||
local function enable_codelens(bufnr)
|
||||
pcall(vim.lsp.codelens.refresh)
|
||||
|
||||
vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
buffer = bufnr,
|
||||
group = java_cmds,
|
||||
desc = 'refresh codelens',
|
||||
callback = function()
|
||||
pcall(vim.lsp.codelens.refresh)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
local function enable_debugger(bufnr)
|
||||
require('jdtls').setup_dap({hotcodereplace = 'auto'})
|
||||
require('jdtls.dap').setup_dap_main_class_configs()
|
||||
|
||||
local opts = {buffer = bufnr}
|
||||
vim.keymap.set('n', '<leader>df', "<cmd>lua require('jdtls').test_class()<cr>", opts)
|
||||
vim.keymap.set('n', '<leader>dn', "<cmd>lua require('jdtls').test_nearest_method()<cr>", opts)
|
||||
end
|
||||
|
||||
local function jdtls_on_attach(client, bufnr)
|
||||
if features.debugger then
|
||||
enable_debugger(bufnr)
|
||||
end
|
||||
|
||||
if features.codelens then
|
||||
enable_codelens(bufnr)
|
||||
end
|
||||
|
||||
-- The following mappings are based on the suggested usage of nvim-jdtls
|
||||
-- https://github.com/mfussenegger/nvim-jdtls#usage
|
||||
local opts = {buffer = bufnr}
|
||||
vim.keymap.set('n', 'cri', "<cmd>lua require('jdtls').organize_imports()<cr>", opts)
|
||||
vim.keymap.set('n', 'crv', "<cmd>lua require('jdtls').extract_variable()<cr>", opts)
|
||||
vim.keymap.set('x', 'crv', "<esc><cmd>lua require('jdtls').extract_variable(true)<cr>", opts)
|
||||
vim.keymap.set('n', 'crc', "<cmd>lua require('jdtls').extract_constant()<cr>", opts)
|
||||
vim.keymap.set('x', 'crc', "<esc><cmd>lua require('jdtls').extract_constant(true)<cr>", opts)
|
||||
vim.keymap.set('x', 'crm', "<esc><Cmd>lua require('jdtls').extract_method(true)<cr>", opts)
|
||||
end
|
||||
|
||||
local function jdtls_setup(event)
|
||||
local jdtls = require('jdtls')
|
||||
|
||||
local path = get_jdtls_paths()
|
||||
local data_dir = path.data_dir .. '/' .. vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
|
||||
|
||||
if cache_vars.capabilities == nil then
|
||||
jdtls.extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
||||
|
||||
local ok_cmp, cmp_lsp = pcall(require, 'cmp_nvim_lsp')
|
||||
cache_vars.capabilities = vim.tbl_deep_extend(
|
||||
'force',
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
ok_cmp and cmp_lsp.default_capabilities() or {}
|
||||
)
|
||||
end
|
||||
|
||||
-- The command that starts the language server
|
||||
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
|
||||
local cmd = {
|
||||
'java',
|
||||
|
||||
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
'-Dosgi.bundles.defaultStartLevel=4',
|
||||
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
'-Dlog.protocol=true',
|
||||
'-Dlog.level=ALL',
|
||||
'-javaagent:' .. path.java_agent,
|
||||
'-Xms1G',
|
||||
'--add-modules=ALL-SYSTEM',
|
||||
'--add-opens',
|
||||
'java.base/java.util=ALL-UNNAMED',
|
||||
'--add-opens',
|
||||
'java.base/java.lang=ALL-UNNAMED',
|
||||
'-jar', path.launcher_jar,
|
||||
'-configuration', path.platform_config,
|
||||
'-data', data_dir,
|
||||
}
|
||||
|
||||
local lsp_settings = {
|
||||
java = {
|
||||
-- jdt = {
|
||||
-- ls = {
|
||||
-- vmargs = "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m"
|
||||
-- }
|
||||
-- },
|
||||
eclipse = {
|
||||
downloadSources = true,
|
||||
},
|
||||
configuration = {
|
||||
updateBuildConfiguration = 'interactive',
|
||||
runtimes = path.runtimes,
|
||||
},
|
||||
maven = {
|
||||
downloadSources = true,
|
||||
},
|
||||
implementationsCodeLens = {
|
||||
enabled = true,
|
||||
},
|
||||
referencesCodeLens = {
|
||||
enabled = true,
|
||||
},
|
||||
-- inlayHints = {
|
||||
-- parameterNames = {
|
||||
-- enabled = 'all' -- literals, all, none
|
||||
-- }
|
||||
-- },
|
||||
format = {
|
||||
enabled = true,
|
||||
-- settings = {
|
||||
-- profile = 'asdf'
|
||||
-- },
|
||||
}
|
||||
},
|
||||
signatureHelp = {
|
||||
enabled = true,
|
||||
},
|
||||
completion = {
|
||||
favoriteStaticMembers = {
|
||||
'org.hamcrest.MatcherAssert.assertThat',
|
||||
'org.hamcrest.Matchers.*',
|
||||
'org.hamcrest.CoreMatchers.*',
|
||||
'org.junit.jupiter.api.Assertions.*',
|
||||
'java.util.Objects.requireNonNull',
|
||||
'java.util.Objects.requireNonNullElse',
|
||||
'org.mockito.Mockito.*',
|
||||
},
|
||||
},
|
||||
contentProvider = {
|
||||
preferred = 'fernflower',
|
||||
},
|
||||
extendedClientCapabilities = jdtls.extendedClientCapabilities,
|
||||
sources = {
|
||||
organizeImports = {
|
||||
starThreshold = 9999,
|
||||
staticStarThreshold = 9999,
|
||||
}
|
||||
},
|
||||
codeGeneration = {
|
||||
toString = {
|
||||
template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}',
|
||||
},
|
||||
useBlocks = true,
|
||||
},
|
||||
}
|
||||
|
||||
-- This starts a new client & server,
|
||||
-- or attaches to an existing client & server depending on the `root_dir`.
|
||||
jdtls.start_or_attach({
|
||||
cmd = cmd,
|
||||
settings = lsp_settings,
|
||||
on_attach = jdtls_on_attach,
|
||||
capabilities = cache_vars.capabilities,
|
||||
root_dir = jdtls.setup.find_root(root_files),
|
||||
flags = {
|
||||
allow_incremental_sync = true,
|
||||
},
|
||||
init_options = {
|
||||
bundles = path.bundles,
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = java_cmds,
|
||||
pattern = {'java'},
|
||||
desc = 'Setup jdtls',
|
||||
callback = jdtls_setup,
|
||||
})
|
20
after/ftplugin/netrw.lua
Normal file
20
after/ftplugin/netrw.lua
Normal file
@ -0,0 +1,20 @@
|
||||
local misc = require("core.misc")
|
||||
local map_local = misc.map_local
|
||||
|
||||
map_local("n", "h", "-", { noremap = false, remap = true }) -- Go up a directory
|
||||
map_local("n", "l", "<CR>", { noremap = false, remap = true }) -- Go down a directory / open a file
|
||||
map_local("n", ".", "gh", { noremap = false, remap = true }) -- Toggle hidden files
|
||||
map_local("n", "P", "<C-w>z", { noremap = false, remap = true }) -- Close preview window
|
||||
|
||||
-- Close netrw only if it isn't the last window
|
||||
map_local("n", "<esc>", function()
|
||||
if #vim.api.nvim_tabpage_list_wins(0) > 1 then
|
||||
vim.api.nvim_win_close(0, false)
|
||||
end
|
||||
end)
|
||||
|
||||
-- change neovim root
|
||||
map_local("n", "rt", function()
|
||||
vim.api.nvim_set_current_dir(vim.b.netrw_curdir)
|
||||
vim.notify("root dir updated: "..vim.b.netrw_curdir, vim.log.levels.LOW, { title = misc.appid })
|
||||
end)
|
@ -1,3 +1,28 @@
|
||||
local misc = require('core.misc')
|
||||
|
||||
-- make sure norg parsers are installed before opening a norg file, currently
|
||||
-- there are two parsers: norg, and norg_meta
|
||||
local found = {}
|
||||
found[0] = 0 -- used to store the number of elements in the table
|
||||
|
||||
-- check for the parsers
|
||||
misc.loopf(vim.fn.stdpath("data").."/site/pack/deps/opt/nvim-treesitter/parser",
|
||||
function(file)
|
||||
if string.find(file, "norg") then
|
||||
found[file] = true
|
||||
found[0] = found[0] + 1
|
||||
end
|
||||
end, "so")
|
||||
|
||||
-- if the parsers don't exist download them
|
||||
if found[0] < 2 and
|
||||
(not found["norg.so"] or not found["norg_meta.so"]) then
|
||||
vim.cmd("Neorg sync-parsers")
|
||||
end
|
||||
|
||||
-- set colorcolumn in norg buffers
|
||||
vim.opt_local.colorcolumn = { 80 }
|
||||
|
||||
-- make text wrap at the colorcolumn automatically
|
||||
vim.api.nvim_set_option_value("textwidth",
|
||||
tonumber(vim.api.nvim_get_option_value("colorcolumn", {})), { buf = 0 })
|
||||
vim.api.nvim_win_set_option(0, 'colorcolumn', '0')
|
||||
|
@ -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',
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -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+", "")
|
||||
}
|
@ -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
|
||||
}
|
@ -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,
|
||||
},
|
||||
}
|
3
after/plugin/colorscheme.lua
Normal file
3
after/plugin/colorscheme.lua
Normal file
@ -0,0 +1,3 @@
|
||||
local misc = require('core.misc')
|
||||
|
||||
misc.colorscheme('mellow')
|
@ -1,6 +0,0 @@
|
||||
local status_ok, comment = pcall(require, "Comment")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
comment.setup {}
|
@ -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,
|
||||
}
|
||||
}
|
@ -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,
|
||||
}
|
||||
}
|
@ -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'
|
||||
}
|
@ -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
|
||||
}
|
@ -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,
|
||||
},
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
local status_ok, harpoon = pcall(require, "harpoon")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
harpoon.setup {}
|
@ -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"
|
||||
}
|
||||
},
|
||||
}
|
@ -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
|
||||
},
|
||||
}
|
@ -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,
|
||||
}
|
@ -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
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
local status_ok, lschoice = pcall(require, "cmp_luasnip_choice")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
lschoice.setup {}
|
@ -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()
|
@ -1,8 +0,0 @@
|
||||
local status_ok, marks = pcall(require, "marks")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
marks.setup {
|
||||
default_mappings = true,
|
||||
}
|
@ -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
|
||||
},
|
||||
}
|
@ -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',
|
||||
},
|
||||
}
|
@ -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",
|
||||
}
|
@ -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"] = {},
|
||||
}
|
||||
}
|
@ -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,
|
||||
}
|
@ -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"
|
||||
}
|
@ -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 = "?",
|
||||
}
|
||||
})
|
@ -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,
|
||||
},
|
||||
},
|
||||
}
|
@ -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,
|
||||
}
|
||||
}
|
@ -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
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
local status_ok, tabline = pcall(require, "tar")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
tabline.setup {
|
||||
closeicon = "%#Constant#[x]"
|
||||
}
|
@ -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,
|
||||
})
|
@ -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" },
|
||||
},
|
||||
},
|
||||
}
|
@ -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
|
||||
}
|
||||
}
|
@ -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 = '-',
|
||||
}
|
@ -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,
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
if (g.loaded_undotree) then
|
||||
g.undotree_DiffAutoOpen = 0
|
||||
end
|
@ -1,8 +0,0 @@
|
||||
local status_ok, urlview = pcall(require, "urlview")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
urlview.setup {
|
||||
default_picker = 'telescope',
|
||||
}
|
@ -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',
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user