kitchen sink again :(
This commit is contained in:
3
.stylua.toml
Normal file
3
.stylua.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
indent_type = "Spaces" # Use spaces instead of tabs
|
||||||
|
indent_width = 2 # Number of spaces per indent level
|
||||||
|
quote_style = "ForceDouble" # Always use double quotes for strings
|
@ -1,136 +0,0 @@
|
|||||||
local misc = require('core.misc')
|
|
||||||
local lsp = require('core.lsp.functions')
|
|
||||||
local map, auto = misc.map, misc.auto
|
|
||||||
|
|
||||||
local jdtls = require('jdtls')
|
|
||||||
local jdtls_install = require('mason-registry').get_package('jdtls'):get_install_path()
|
|
||||||
|
|
||||||
-- make sure to check if things with 💀 need updating
|
|
||||||
local config = {
|
|
||||||
cmd = {
|
|
||||||
'java', -- 💀
|
|
||||||
'-jar', vim.fn.glob(jdtls_install..'/plugins/org.eclipse.equinox.launcher_*.jar'), -- 💀
|
|
||||||
'-configuration', jdtls_install..'/config_linux',
|
|
||||||
'-data', vim.fn.stdpath('cache')..'/nvim-jdtls',
|
|
||||||
|
|
||||||
'--add-modules=ALL-SYSTEM',
|
|
||||||
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
|
|
||||||
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
|
|
||||||
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
|
||||||
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
|
||||||
'-Dlog.level=ALL',
|
|
||||||
'-Dlog.protocol=true',
|
|
||||||
'-Dosgi.bundles.defaultStartLevel=4',
|
|
||||||
'-Xmx1G',
|
|
||||||
},
|
|
||||||
root_dir = vim.fs.dirname(vim.fs.find({
|
|
||||||
'gradlew',
|
|
||||||
'.git',
|
|
||||||
'mvnw',
|
|
||||||
'settings.gradle', -- Gradle (multi-project)
|
|
||||||
'settings.gradle.kts', -- Gradle (multi-project)
|
|
||||||
'build.xml', -- Ant
|
|
||||||
'pom.xml', -- Maven
|
|
||||||
}, { upward = true })[1]),
|
|
||||||
|
|
||||||
-- don't print out status messages
|
|
||||||
handlers = {
|
|
||||||
['language/status'] = function() end
|
|
||||||
},
|
|
||||||
|
|
||||||
on_attach = function(_, bufnr)
|
|
||||||
-- add some jdtls specific mappings
|
|
||||||
local opts = { buffer = bufnr }
|
|
||||||
map('n', 'cri', jdtls.organize_imports, opts)
|
|
||||||
map('n', 'crv', jdtls.extract_variable, opts)
|
|
||||||
map('n', 'crc', jdtls.extract_constant, opts)
|
|
||||||
map('x', 'crv', function() jdtls.extract_variable(true) end, opts)
|
|
||||||
map('x', 'crc', function() jdtls.extract_constant(true) end, opts)
|
|
||||||
map('x', 'crm', function() jdtls.extract_method(true) end, opts)
|
|
||||||
|
|
||||||
pcall(vim.lsp.codelens.refresh)
|
|
||||||
auto('BufWritePost', {
|
|
||||||
buffer = bufnr,
|
|
||||||
desc = 'refresh codelens',
|
|
||||||
callback = function()
|
|
||||||
pcall(vim.lsp.codelens.refresh)
|
|
||||||
end
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
capabilities = lsp.capabilities
|
|
||||||
}
|
|
||||||
|
|
||||||
-- generate the path to the java file(s)
|
|
||||||
---@type string|nil
|
|
||||||
local cache_path = vim.fs.joinpath(vim.fn.stdpath("cache"), "/JavaVersion.class")
|
|
||||||
---@type string|nil
|
|
||||||
local src_path = vim.fs.joinpath(vim.fn.stdpath("config"), "/extras/JavaVersion.java")
|
|
||||||
|
|
||||||
-- if either path is invalid
|
|
||||||
if not cache_path or not src_path then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
--- build a cache of the JavaVersion code
|
|
||||||
local function build_cache()
|
|
||||||
-- check if we have javac
|
|
||||||
vim.system({ "javac" }, {}, function(out)
|
|
||||||
if out.code == 127 then
|
|
||||||
cache_path = nil
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- compile our code
|
|
||||||
vim.system({ 'javac', src_path, '-d', vim.fn.stdpath("cache") }, {}, function(out)
|
|
||||||
if out.code ~= 0 then
|
|
||||||
cache_path = nil
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- check if we have a compiled version of JavaVersion
|
|
||||||
local f, _ = io.open(cache_path, "r")
|
|
||||||
if not f then -- if we don't have a cache
|
|
||||||
build_cache()
|
|
||||||
else
|
|
||||||
io.close(f)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- check the java version
|
|
||||||
local buffer = {}
|
|
||||||
vim.fn.jobstart({
|
|
||||||
config.cmd[1],
|
|
||||||
(cache_path and "JavaVersion") or src_path
|
|
||||||
}, {
|
|
||||||
cwd = vim.fn.stdpath("cache"),
|
|
||||||
stdin = nil,
|
|
||||||
on_stdout = function(_, data, _)
|
|
||||||
table.insert(buffer, table.concat(data))
|
|
||||||
end,
|
|
||||||
on_exit = function(_, exit_code, _)
|
|
||||||
local v = vim.version.parse(table.concat(buffer))
|
|
||||||
|
|
||||||
-- if there's an error, no version info, or the java version is
|
|
||||||
-- less than 17 stop the lsp from starting
|
|
||||||
if exit_code ~= 0 then
|
|
||||||
vim.notify(string.format(
|
|
||||||
"java version check failed: exit code %s", exit_code),
|
|
||||||
vim.log.levels.ERROR, { title = misc.appid })
|
|
||||||
return
|
|
||||||
elseif not v then
|
|
||||||
vim.notify("no java version info found", vim.log.levels.ERROR,
|
|
||||||
{ title = misc.appid })
|
|
||||||
return
|
|
||||||
elseif v.major < 17 then
|
|
||||||
vim.notify(string.format(
|
|
||||||
"java version %s < 17.0.0 Cannot run jdtls, bailing out",
|
|
||||||
v[1].."."..v[2].."."..v[3]),
|
|
||||||
vim.log.levels.ERROR, { title = misc.appid })
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start lsp
|
|
||||||
jdtls.start_or_attach(config)
|
|
||||||
end
|
|
||||||
})
|
|
@ -1,3 +1 @@
|
|||||||
local misc = require('core.misc')
|
vim.cmd("colorscheme mellow")
|
||||||
|
|
||||||
misc.colorscheme('mellow')
|
|
||||||
|
20
init.lua
20
init.lua
@ -1,3 +1,6 @@
|
|||||||
|
-- TODO: after switching to dep with lazy loading check out vim-startuptime
|
||||||
|
-- again
|
||||||
|
|
||||||
-- enable performance stuff
|
-- enable performance stuff
|
||||||
if vim.fn.has("nvim-0.9") == true then
|
if vim.fn.has("nvim-0.9") == true then
|
||||||
vim.loader.enable()
|
vim.loader.enable()
|
||||||
@ -11,18 +14,17 @@ end
|
|||||||
vim.cmd("packadd dep")
|
vim.cmd("packadd dep")
|
||||||
|
|
||||||
-- load miscellaneous utilities
|
-- load miscellaneous utilities
|
||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
|
|
||||||
-- load user config
|
-- load user config
|
||||||
misc.include('conf.opts') -- setup options
|
misc.include("conf.opts") -- setup options
|
||||||
misc.include('conf.binds') -- setup keybinds
|
misc.include("conf.binds") -- setup keybinds
|
||||||
misc.include('conf.autos') -- setup autos
|
misc.include("conf.autos") -- setup autos
|
||||||
misc.include('conf.context') -- setup context menu
|
|
||||||
|
|
||||||
-- load plugins
|
-- load plugins
|
||||||
require('dep') {
|
require("dep") {
|
||||||
{ 'squibid/dep',
|
{ "squibid/dep",
|
||||||
url = 'https://git.squi.bid/dep',
|
url = "https://git.squi.bid/dep",
|
||||||
branch = "dev"
|
branch = "dev"
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -31,7 +33,7 @@ require('dep') {
|
|||||||
local plugs = {}
|
local plugs = {}
|
||||||
|
|
||||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/conf/plugins/*.lua", true)) do
|
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/conf/plugins/*.lua", true)) do
|
||||||
local ret = misc.include('conf.plugins.'..file:gsub('^.*/', ''):gsub('%.lua$', ''))
|
local ret = misc.include("conf.plugins."..file:gsub("^.*/", ""):gsub("%.lua$", ""))
|
||||||
if type(ret) ~= "boolean" then
|
if type(ret) ~= "boolean" then
|
||||||
plugs[#plugs + 1] = ret
|
plugs[#plugs + 1] = ret
|
||||||
end
|
end
|
||||||
|
@ -1,37 +1,37 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local auto, augroup = misc.auto, misc.augroup
|
local auto, augroup = misc.auto, misc.augroup
|
||||||
|
|
||||||
-- auto commands which interact with bufferes without modifying them
|
-- auto commands which interact with bufferes without modifying them
|
||||||
local bufcheck = augroup('bufcheck')
|
local bufcheck = augroup("bufcheck")
|
||||||
-- auto commands which modify things on the filesystem
|
-- auto commands which modify things on the filesystem
|
||||||
local fsmod = augroup('fsmod')
|
local fsmod = augroup("fsmod")
|
||||||
|
|
||||||
auto('FocusGained', {
|
auto("FocusGained", {
|
||||||
group = bufcheck,
|
group = bufcheck,
|
||||||
desc = 'Update contents of file.',
|
desc = "Update contents of file.",
|
||||||
command = 'checktime'
|
command = "checktime"
|
||||||
})
|
})
|
||||||
|
|
||||||
auto('TextYankPost', {
|
auto("TextYankPost", {
|
||||||
group = bufcheck,
|
group = bufcheck,
|
||||||
desc = 'Highlight on yank.',
|
desc = "Highlight on yank.",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank { timeout = 250 }
|
vim.highlight.on_yank { timeout = 250 }
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
auto('BufRead', {
|
auto("BufRead", {
|
||||||
group = bufcheck,
|
group = bufcheck,
|
||||||
desc = 'Return to the last place the buffer was closed in.',
|
desc = "Return to the last place the buffer was closed in.",
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.fn.setpos('.', vim.fn.getpos("'\""))
|
vim.fn.setpos(".", vim.fn.getpos("'\""))
|
||||||
vim.cmd("norm! zz")
|
vim.cmd("norm! zz")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
auto('BufWritePre', {
|
auto("BufWritePre", {
|
||||||
group = fsmod,
|
group = fsmod,
|
||||||
desc = 'remove trailing spaces on file save',
|
desc = "remove trailing spaces on file save",
|
||||||
callback = function()
|
callback = function()
|
||||||
local pos = vim.api.nvim_win_get_cursor(0)
|
local pos = vim.api.nvim_win_get_cursor(0)
|
||||||
vim.cmd([[%s/\s\+$//e]])
|
vim.cmd([[%s/\s\+$//e]])
|
||||||
@ -39,12 +39,12 @@ auto('BufWritePre', {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
auto('BufWritePre', {
|
auto("BufWritePre", {
|
||||||
group = fsmod,
|
group = fsmod,
|
||||||
desc = 'Basically mkdir -p.',
|
desc = "Basically mkdir -p.",
|
||||||
callback = function(ctx)
|
callback = function(ctx)
|
||||||
if ctx.match:match("^%w%w+://") then return end
|
if ctx.match:match("^%w%w+://") then return end
|
||||||
local dir = vim.fn.fnamemodify(ctx.file, ':p:h')
|
local dir = vim.fn.fnamemodify(ctx.file, ":p:h")
|
||||||
vim.fn.mkdir(dir, 'p')
|
vim.fn.mkdir(dir, "p")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
-- vim binds
|
-- vim binds
|
||||||
vim.g.mapleader = ' ' -- set leader key
|
vim.g.mapleader = " " -- set leader key
|
||||||
|
|
||||||
map('x', '<leader>p', [["_dP]], { desc = 'Greatest remap of all time.' })
|
map("x", "<leader>p", [["_dP]], { desc = "Greatest remap of all time." })
|
||||||
map('n', '<esc>', ':nohlsearch<Bar>:echo<CR>', { desc = 'Clear search.' })
|
map("n", "<esc>", ":nohlsearch<Bar>:echo<CR>", { desc = "Clear search." })
|
||||||
-- move selected text up/down
|
-- move selected text up/down
|
||||||
map('v', '<S-k>', ":m '<-2<CR>gv=gv", { desc = 'Move selected text up.' })
|
map("v", "<S-k>", ":m '<-2<CR>gv=gv", { desc = "Move selected text up." })
|
||||||
map('v', '<S-j>', ":m '>+1<CR>gv=gv", { desc = 'Move selected text down.' })
|
map("v", "<S-j>", ":m '>+1<CR>gv=gv", { desc = "Move selected text down." })
|
||||||
|
|
||||||
-- the cursor STAYS IN THE MIDDLE
|
-- the cursor STAYS IN THE MIDDLE
|
||||||
map('n', '<S-j>', 'mzJ`z<cmd>delm z<CR>') -- when combining lines
|
map("n", "<S-j>", "mzJ`z<cmd>delm z<CR>") -- when combining lines
|
||||||
map('n', 'n', 'nzzzv') -- when searching
|
map("n", "n", "nzzzv") -- when searching
|
||||||
map('n', 'N', 'Nzzzv')
|
map("n", "N", "Nzzzv")
|
||||||
map('n', '<C-d>', '<C-d>zzzv') -- half page jumping
|
map("n", "<C-d>", "<C-d>zzzv") -- half page jumping
|
||||||
map('n', '<C-u>', '<C-u>zzzv')
|
map("n", "<C-u>", "<C-u>zzzv")
|
||||||
|
|
||||||
map('n', '<leader>x', function() -- execute order 111
|
map({ "n", "i" }, "<C-c>", "<Esc>")
|
||||||
|
|
||||||
|
map("n", "<leader>x", function() -- execute order 111
|
||||||
local fn = vim.fn.expand("%:p")
|
local fn = vim.fn.expand("%:p")
|
||||||
if vim.fn.getftype(fn) == "file" then
|
if vim.fn.getftype(fn) == "file" then
|
||||||
local perm = vim.fn.getfperm(fn)
|
local perm = vim.fn.getfperm(fn)
|
||||||
@ -31,14 +33,14 @@ map('n', '<leader>x', function() -- execute order 111
|
|||||||
else
|
else
|
||||||
vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid })
|
vim.notify("File doesn't exist", vim.log.levels.INFO, { title = misc.appid })
|
||||||
end
|
end
|
||||||
end, { desc = 'toggle executable flag of the file' })
|
end, { desc = "toggle executable flag of the file" })
|
||||||
|
|
||||||
-- good spell suggestion ui
|
-- good spell suggestion ui
|
||||||
-- (stolen from https://github.com/neovim/neovim/pull/25833)
|
-- (stolen from https://github.com/neovim/neovim/pull/25833)
|
||||||
vim.keymap.set('n', 'z=', function()
|
vim.keymap.set("n", "z=", function()
|
||||||
local spell_on_choice = vim.schedule_wrap(function(_, idx)
|
local spell_on_choice = vim.schedule_wrap(function(_, idx)
|
||||||
if type(idx) == 'number' then
|
if type(idx) == "number" then
|
||||||
vim.cmd('normal! '..idx..'z=')
|
vim.cmd("normal! "..idx.."z=")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -46,15 +48,15 @@ vim.keymap.set('n', 'z=', function()
|
|||||||
spell_on_choice(nil, vim.v.count)
|
spell_on_choice(nil, vim.v.count)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local cword = vim.fn.expand('<cword>')
|
local cword = vim.fn.expand("<cword>")
|
||||||
local prompt = 'Change '..vim.inspect(cword)..' to:'
|
local prompt = "Change "..vim.inspect(cword).." to:"
|
||||||
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice)
|
vim.ui.select(vim.fn.spellsuggest(cword, vim.o.lines), { prompt = prompt }, spell_on_choice)
|
||||||
end, { desc = 'Shows spelling suggestions' })
|
end, { desc = "Shows spelling suggestions" })
|
||||||
|
|
||||||
-- quickfix
|
-- quickfix
|
||||||
map('n', '<M-j>', '<cmd>cnext<CR>')
|
map("n", "<M-j>", "<cmd>cnext<CR>")
|
||||||
map('n', '<M-k>', '<cmd>cprev<CR>')
|
map("n", "<M-k>", "<cmd>cprev<CR>")
|
||||||
map('n', '<M-c>', '<cmd>cclose<CR>')
|
map("n", "<M-c>", "<cmd>cclose<CR>")
|
||||||
|
|
||||||
-- man pages
|
-- man pages
|
||||||
map('n', '<C-k>', '<cmd>Man<CR>')
|
map("n", "<C-k>", "<cmd>Man<CR>")
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
-- clear menu
|
|
||||||
vim.cmd([[:aunmenu PopUp]])
|
|
||||||
|
|
||||||
-- add menu items
|
|
||||||
vim.cmd([[:amenu PopUp.Save\ Buffer <cmd>:w<CR>]])
|
|
||||||
vim.cmd([[:amenu PopUp.Save\ All\ Buffers <cmd>:wa<CR>]])
|
|
||||||
vim.cmd([[:nmenu PopUp.Select\ All ggVG]])
|
|
||||||
vim.cmd([[:nmenu PopUp.Undo u]])
|
|
||||||
vim.cmd([[:nmenu PopUp.Redo <C-r>]])
|
|
||||||
vim.cmd([[:nmenu PopUp.Inspect <cmd>Inspect<CR>]])
|
|
||||||
vim.cmd([[:amenu PopUp.-1- <nop>]]) -- dividers
|
|
||||||
vim.cmd([[:nmenu PopUp.Copy\ Line yy]])
|
|
||||||
vim.cmd([[:vmenu PopUp.Copy\ Selection y]])
|
|
||||||
vim.cmd([[:amenu PopUp.Paste p]])
|
|
||||||
vim.cmd([[:vmenu PopUp.Cut d]])
|
|
||||||
vim.cmd([[:nmenu PopUp.Cut dd]])
|
|
||||||
vim.cmd([[:vmenu PopUp.-2- <nop>]]) -- dividers
|
|
||||||
vim.cmd([[:nmenu PopUp.-2- <nop>]]) -- dividers
|
|
||||||
vim.cmd([[:vmenu PopUp.Format\ Selection =]])
|
|
||||||
vim.cmd([[:nmenu PopUp.Format\ Line ==]])
|
|
@ -1,4 +1,4 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local auto = misc.auto
|
local auto = misc.auto
|
||||||
|
|
||||||
-- color stuff
|
-- color stuff
|
||||||
@ -17,6 +17,7 @@ vim.opt.scrolloff = 5
|
|||||||
vim.opt.wrap = true -- wraping lines
|
vim.opt.wrap = true -- wraping lines
|
||||||
vim.opt.linebreak = true -- fix where line is wraped
|
vim.opt.linebreak = true -- fix where line is wraped
|
||||||
vim.opt.cursorline = true
|
vim.opt.cursorline = true
|
||||||
|
vim.opt.colorcolumn = { 80 }
|
||||||
|
|
||||||
-- indents + tabs
|
-- indents + tabs
|
||||||
local tabwidth = 2
|
local tabwidth = 2
|
||||||
@ -31,7 +32,7 @@ vim.opt.softtabstop = tabwidth
|
|||||||
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
||||||
-- (yoinked from kickstart.nvim)
|
-- (yoinked from kickstart.nvim)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.opt.clipboard = 'unnamedplus' -- system clipboard
|
vim.opt.clipboard = "unnamedplus" -- system clipboard
|
||||||
end)
|
end)
|
||||||
|
|
||||||
vim.opt.updatetime = 200
|
vim.opt.updatetime = 200
|
||||||
@ -49,12 +50,12 @@ vim.opt.showmatch = true
|
|||||||
vim.opt.incsearch = true
|
vim.opt.incsearch = true
|
||||||
|
|
||||||
-- wild menus
|
-- wild menus
|
||||||
vim.opt.wildoptions = 'pum'
|
vim.opt.wildoptions = "pum"
|
||||||
vim.opt.pumblend = 3
|
vim.opt.pumblend = 3
|
||||||
vim.opt.pumheight = 20
|
vim.opt.pumheight = 20
|
||||||
|
|
||||||
vim.opt.wildignorecase = true
|
vim.opt.wildignorecase = true
|
||||||
vim.opt.wildignore = '*.o'
|
vim.opt.wildignore = "*.o"
|
||||||
|
|
||||||
-- netrw
|
-- netrw
|
||||||
vim.g.netrw_banner = 0
|
vim.g.netrw_banner = 0
|
||||||
@ -63,26 +64,31 @@ vim.g.netrw_liststyle = 1
|
|||||||
vim.g.netrw_sizestyle = "H"
|
vim.g.netrw_sizestyle = "H"
|
||||||
vim.g.netrw_hide = 1
|
vim.g.netrw_hide = 1
|
||||||
|
|
||||||
|
-- border (this doesn"t actually do anything within vim, I"m just setting it
|
||||||
|
-- here so it"s easy to find)
|
||||||
|
vim.g.border_style = "solid"
|
||||||
|
|
||||||
-- folding
|
-- folding
|
||||||
auto("FileType", {
|
auto("FileType", {
|
||||||
callback = function()
|
callback = function()
|
||||||
|
-- FIXME: it causes errors every once in a while
|
||||||
-- support lsp folding
|
-- support lsp folding
|
||||||
if vim.fn.has("nvim-0.11") then
|
-- if vim.fn.has("nvim-0.11") then
|
||||||
auto('LspAttach', {
|
-- auto("LspAttach", {
|
||||||
callback = function(args)
|
-- callback = function(args)
|
||||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
-- local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
if not client then
|
-- if not client then
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
|
|
||||||
if client:supports_method('textDocument/foldingRange') then
|
-- if client:supports_method("textDocument/foldingRange") then
|
||||||
local win = vim.api.nvim_get_current_win()
|
-- local win = vim.api.nvim_get_current_win()
|
||||||
vim.wo[win][0].foldmethod = "expr"
|
-- vim.wo[win][0].foldmethod = "expr"
|
||||||
vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()'
|
-- vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()"
|
||||||
end
|
-- end
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
end
|
-- end
|
||||||
|
|
||||||
-- or just rely on treesitter
|
-- or just rely on treesitter
|
||||||
if require("nvim-treesitter.parsers").has_parser() then
|
if require("nvim-treesitter.parsers").has_parser() then
|
||||||
@ -96,7 +102,7 @@ auto("FileType", {
|
|||||||
|
|
||||||
-- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()"
|
-- lsp folding: vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()"
|
||||||
-- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release
|
-- waiting on https://github.com/neovim/neovim/pull/31311 to hit a release
|
||||||
require('core.lsp.functions').add_capabilities({
|
require("core.lsp.functions").add_capabilities({
|
||||||
textDocument = {
|
textDocument = {
|
||||||
foldingRange = {
|
foldingRange = {
|
||||||
dynamicRegistration = false,
|
dynamicRegistration = false,
|
||||||
@ -108,13 +114,29 @@ require('core.lsp.functions').add_capabilities({
|
|||||||
vim.opt.foldlevelstart = 99
|
vim.opt.foldlevelstart = 99
|
||||||
vim.opt.foldlevel = 99
|
vim.opt.foldlevel = 99
|
||||||
vim.opt.foldenable = true
|
vim.opt.foldenable = true
|
||||||
vim.o.fillchars = 'fold: '
|
vim.o.fillchars = "fold: "
|
||||||
|
|
||||||
_G.Fold_text = require('core.folding')
|
_G.Fold_text = require("core.folding")
|
||||||
vim.opt.foldtext = 'v:lua.Fold_text()'
|
vim.opt.foldtext = "v:lua.Fold_text()"
|
||||||
|
|
||||||
-- statusline
|
-- statusline
|
||||||
function _G.Status()
|
function _G.Status()
|
||||||
|
local function percentage()
|
||||||
|
local percent, line, lines
|
||||||
|
|
||||||
|
line = vim.api.nvim_win_get_cursor(0)[1]
|
||||||
|
lines = vim.api.nvim_buf_line_count(0)
|
||||||
|
|
||||||
|
percent = math.floor((line / lines) * 100)
|
||||||
|
if percent == 0 then
|
||||||
|
return "Top"
|
||||||
|
elseif percent == 100 then
|
||||||
|
return "Bot"
|
||||||
|
end
|
||||||
|
|
||||||
|
return percent.."%%"
|
||||||
|
end
|
||||||
|
|
||||||
return table.concat {
|
return table.concat {
|
||||||
"%t", -- file name
|
"%t", -- file name
|
||||||
" %h", -- help buffer tag
|
" %h", -- help buffer tag
|
||||||
@ -125,8 +147,10 @@ function _G.Status()
|
|||||||
-- print out the number of lsp clients attached
|
-- print out the number of lsp clients attached
|
||||||
"λ"..#vim.lsp.get_clients({ bufnr = 0 }).." ",
|
"λ"..#vim.lsp.get_clients({ bufnr = 0 }).." ",
|
||||||
|
|
||||||
|
"%<", -- we can start truncating here (I want to keep the file name)
|
||||||
"%l,%c%V", -- line, column-virtual column
|
"%l,%c%V", -- line, column-virtual column
|
||||||
" %P" -- percentage through display window
|
"%<", -- we can start truncating here
|
||||||
|
" "..percentage() -- percentage through the buffer
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
vim.o.statusline="%!v:lua.Status()"
|
vim.o.statusline="%!v:lua.Status()"
|
||||||
|
@ -1,38 +1,38 @@
|
|||||||
local lsp = require('core.lsp.functions')
|
local lsp = require("core.lsp.functions")
|
||||||
|
|
||||||
return { 'hrsh7th/nvim-cmp',
|
return { "hrsh7th/nvim-cmp",
|
||||||
requires = {
|
requires = {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
"nvim-treesitter/nvim-treesitter",
|
||||||
'lukas-reineke/cmp-under-comparator', -- better results
|
"lukas-reineke/cmp-under-comparator", -- better results
|
||||||
'xzbdmw/colorful-menu.nvim' -- fancy colors
|
"xzbdmw/colorful-menu.nvim" -- fancy colors
|
||||||
},
|
},
|
||||||
|
|
||||||
-- suppliers for completions (they require nvim-cmp to be loaded before they are)
|
-- suppliers for completions (they require nvim-cmp to be loaded before they are)
|
||||||
deps = {
|
deps = {
|
||||||
'hrsh7th/cmp-buffer', -- buffers
|
"hrsh7th/cmp-buffer", -- buffers
|
||||||
'FelipeLema/cmp-async-path', -- path
|
"FelipeLema/cmp-async-path", -- path
|
||||||
{ 'hrsh7th/cmp-nvim-lsp',
|
{ "hrsh7th/cmp-nvim-lsp",
|
||||||
function()
|
function()
|
||||||
-- add lsp capabilities
|
-- add lsp capabilities
|
||||||
lsp.add_capabilities(require('cmp_nvim_lsp').default_capabilities())
|
lsp.add_capabilities(require("cmp_nvim_lsp").default_capabilities())
|
||||||
end
|
end
|
||||||
}, -- lsp
|
}, -- lsp
|
||||||
'hrsh7th/cmp-nvim-lsp-signature-help', -- completion information
|
"hrsh7th/cmp-nvim-lsp-signature-help", -- completion information
|
||||||
{ 'L3MON4D3/cmp-luasnip-choice', -- luasnip
|
{ "L3MON4D3/cmp-luasnip-choice", -- luasnip
|
||||||
requires = 'L3MON4D3/LuaSnip'
|
requires = "L3MON4D3/LuaSnip"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
function()
|
function()
|
||||||
local cmp = require('cmp')
|
local cmp = require("cmp")
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
-- setup cmp
|
-- setup cmp
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
-- disable when in comments
|
-- disable when in comments
|
||||||
enabled = function()
|
enabled = function()
|
||||||
local context = require('cmp.config.context')
|
local context = require("cmp.config.context")
|
||||||
if vim.api.nvim_get_mode().mode == 'c' then
|
if vim.api.nvim_get_mode().mode == "c" then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return not context.in_treesitter_capture("comment")
|
return not context.in_treesitter_capture("comment")
|
||||||
@ -42,12 +42,12 @@ return { 'hrsh7th/nvim-cmp',
|
|||||||
|
|
||||||
-- completion sources
|
-- completion sources
|
||||||
sources = cmp.config.sources {
|
sources = cmp.config.sources {
|
||||||
{ name = 'nvim_lsp', priority = 999 },
|
{ name = "nvim_lsp", priority = 999 },
|
||||||
{ name = 'luasnip_choice', priority = 750 },
|
{ name = "luasnip_choice", priority = 750 },
|
||||||
{ name = 'buffer', max_item_count = 3 },
|
{ name = "buffer", max_item_count = 3 },
|
||||||
{ name = 'async_path', max_item_count = 5 },
|
{ name = "async_path", max_item_count = 5 },
|
||||||
{ name = 'neorg' },
|
{ name = "neorg" },
|
||||||
{ name = 'nvim_lsp_signature_help' }
|
{ name = "nvim_lsp_signature_help" }
|
||||||
},
|
},
|
||||||
|
|
||||||
-- how to sort results
|
-- how to sort results
|
||||||
@ -56,7 +56,7 @@ return { 'hrsh7th/nvim-cmp',
|
|||||||
cmp.config.compare.exact,
|
cmp.config.compare.exact,
|
||||||
cmp.config.compare.offset,
|
cmp.config.compare.offset,
|
||||||
cmp.config.compare.score,
|
cmp.config.compare.score,
|
||||||
require('cmp-under-comparator').under,
|
require("cmp-under-comparator").under,
|
||||||
cmp.config.compare.kind,
|
cmp.config.compare.kind,
|
||||||
cmp.config.compare.sort_text,
|
cmp.config.compare.sort_text,
|
||||||
cmp.config.compare.length,
|
cmp.config.compare.length,
|
||||||
@ -68,11 +68,11 @@ return { 'hrsh7th/nvim-cmp',
|
|||||||
window = {
|
window = {
|
||||||
completion = {
|
completion = {
|
||||||
scrollbar = false,
|
scrollbar = false,
|
||||||
border = 'solid',
|
border = vim.g.border_style,
|
||||||
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
|
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
|
||||||
},
|
},
|
||||||
documentation = {
|
documentation = {
|
||||||
border = 'solid',
|
border = vim.g.border_style,
|
||||||
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
|
winhighlight = "Normal:WinBarNC,FloatBorder:WinBarNC,Search:WinBarNC",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -80,22 +80,22 @@ return { 'hrsh7th/nvim-cmp',
|
|||||||
-- position of window
|
-- position of window
|
||||||
view = {
|
view = {
|
||||||
entries = {
|
entries = {
|
||||||
name = 'custom',
|
name = "custom",
|
||||||
selection_order = 'near_cursor'
|
selection_order = "near_cursor"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
-- formatting of content
|
-- formatting of content
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = { 'menu', 'abbr', 'kind' },
|
fields = { "menu", "abbr", "kind" },
|
||||||
format = function(entry, item)
|
format = function(entry, item)
|
||||||
local hl_info = require("colorful-menu").cmp_highlights(entry)
|
local hl_info = require("colorful-menu").cmp_highlights(entry)
|
||||||
local menu_icon = {
|
local menu_icon = {
|
||||||
nvim_lsp = 'λ',
|
nvim_lsp = "λ",
|
||||||
luasnip = '%',
|
luasnip = "%",
|
||||||
buffer = '@',
|
buffer = "@",
|
||||||
path = '#',
|
path = "#",
|
||||||
async_path = '#'
|
async_path = "#"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- add a little icon
|
-- add a little icon
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
return { 'numToStr/Comment.nvim',
|
return { "numToStr/Comment.nvim",
|
||||||
function()
|
function()
|
||||||
require('Comment').setup {
|
require("Comment").setup {
|
||||||
ignore = '^$'
|
ignore = "^$"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,50 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'mfussenegger/nvim-dap',
|
return { "mfussenegger/nvim-dap",
|
||||||
requires = {
|
requires = {
|
||||||
'williamboman/mason.nvim',
|
"williamboman/mason.nvim",
|
||||||
'nvim-telescope/telescope.nvim',
|
"nvim-telescope/telescope.nvim",
|
||||||
},
|
},
|
||||||
disable = not vim.fn.has("nvim-0.8.0"),
|
disable = not vim.fn.has("nvim-0.8.0"),
|
||||||
branch = '0.8.0',
|
branch = "0.8.0",
|
||||||
function()
|
function()
|
||||||
|
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
|
||||||
local codelldb_port = 13000
|
local codelldb_port = 13000
|
||||||
dap.adapters.codelldb = {
|
dap.adapters.codelldb = {
|
||||||
type = 'server',
|
type = "server",
|
||||||
host = '127.0.0.1',
|
host = "127.0.0.1",
|
||||||
port = codelldb_port,
|
port = codelldb_port,
|
||||||
executable = {
|
executable = {
|
||||||
command = require('mason-registry').get_package('codelldb'):get_install_path()..'/codelldb',
|
command = require("mason-registry").get_package("codelldb"):get_install_path().."/codelldb",
|
||||||
args = { '--port', codelldb_port }
|
args = { "--port", codelldb_port }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dap.configurations.c = {
|
dap.configurations.c = {
|
||||||
{
|
{
|
||||||
name = 'LLDB: Launch',
|
name = "LLDB: Launch",
|
||||||
type = 'codelldb',
|
type = "codelldb",
|
||||||
request = 'launch',
|
request = "launch",
|
||||||
program = function()
|
program = function()
|
||||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd()..'/', 'file')
|
return vim.fn.input("Path to executable: ", vim.fn.getcwd().."/", "file")
|
||||||
end,
|
end,
|
||||||
cwd = '${workspaceFolder}',
|
cwd = "${workspaceFolder}",
|
||||||
stopOnEntry = false,
|
stopOnEntry = false,
|
||||||
args = {},
|
args = {},
|
||||||
console = 'integratedTerminal'
|
console = "integratedTerminal"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
map('n', '<Leader>ec', dap.continue, { desc = "dap continue " })
|
map("n", "<Leader>ec", dap.continue, { desc = "dap continue " })
|
||||||
map('n', '<Leader>el', dap.run_last, { desc = "dap run last" })
|
map("n", "<Leader>el", dap.run_last, { desc = "dap run last" })
|
||||||
map('n', '<Leader>et', dap.terminate, { desc = "dap terminate " })
|
map("n", "<Leader>et", dap.terminate, { desc = "dap terminate " })
|
||||||
map('n', '<Leader>eb', require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" })
|
map("n", "<Leader>eb", require("dap.breakpoints").toggle, { desc = "dap toggle breakpoint" })
|
||||||
map('n', '<Leader>e]', dap.step_over, { desc = "dap step over" })
|
map("n", "<Leader>e]", dap.step_over, { desc = "dap step over" })
|
||||||
map('n', '<Leader>e[', dap.step_back, { desc = "dap step back" })
|
map("n", "<Leader>e[", dap.step_back, { desc = "dap step back" })
|
||||||
map('n', '<Leader>er', dap.repl.toggle, { desc = "dap repl toggle" })
|
map("n", "<Leader>er", dap.repl.toggle, { desc = "dap repl toggle" })
|
||||||
map('n', '<Leader>eR', dap.restart, { desc = "dap restart" })
|
map("n", "<Leader>eR", dap.restart, { desc = "dap restart" })
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
local branch = nil
|
|
||||||
if vim.fn.has("nvim-0.7.0") then
|
|
||||||
branch = 'nvim-0.7'
|
|
||||||
elseif vim.fn.has("nvim-0.5.0") then
|
|
||||||
branch = 'nvim-0.5'
|
|
||||||
end
|
|
||||||
|
|
||||||
return { 'stevearc/dressing.nvim',
|
|
||||||
disable = true or not vim.fn.has("nvim-0.5.0"),
|
|
||||||
branch = branch,
|
|
||||||
requires = 'nvim-telescope/telescope.nvim',
|
|
||||||
function()
|
|
||||||
require('dressing').setup {
|
|
||||||
input = {
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
@ -1,11 +1,11 @@
|
|||||||
return { 'j-hui/fidget.nvim',
|
return { "j-hui/fidget.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.9.0"),
|
disable = not vim.fn.has("nvim-0.9.0"),
|
||||||
branch = "v1.5.0",
|
branch = "v1.5.0",
|
||||||
function()
|
function()
|
||||||
local notification_defaults = require("fidget.notification").default_config
|
local notification_defaults = require("fidget.notification").default_config
|
||||||
notification_defaults["icon"] = ""
|
notification_defaults["icon"] = ""
|
||||||
|
|
||||||
require('fidget').setup {
|
require("fidget").setup {
|
||||||
progress = {
|
progress = {
|
||||||
display = {
|
display = {
|
||||||
progress_icon = {
|
progress_icon = {
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'lewis6991/gitsigns.nvim',
|
return { "lewis6991/gitsigns.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.9.0"),
|
disable = not vim.fn.has("nvim-0.9.0"),
|
||||||
function()
|
function()
|
||||||
local gs = require("gitsigns")
|
local gs = require("gitsigns")
|
||||||
|
|
||||||
gs.setup {
|
gs.setup {
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = '│' },
|
add = { text = "│" },
|
||||||
change = { text = '│' },
|
change = { text = "│" },
|
||||||
delete = { text = '-' },
|
delete = { text = "-" },
|
||||||
topdelete = { text = '‾' },
|
topdelete = { text = "‾" },
|
||||||
changedelete = { text = '~' },
|
changedelete = { text = "~" },
|
||||||
untracked = { text = '┆' }
|
untracked = { text = "┆" }
|
||||||
},
|
},
|
||||||
|
|
||||||
signcolumn = true,
|
signcolumn = true,
|
||||||
@ -27,51 +27,51 @@ return { 'lewis6991/gitsigns.nvim',
|
|||||||
},
|
},
|
||||||
|
|
||||||
attach_to_untracked = true,
|
attach_to_untracked = true,
|
||||||
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>',
|
current_line_blame_formatter = "<author>, <author_time:%Y-%m-%d> - <summary>",
|
||||||
|
|
||||||
preview_config = { border = 'solid' },
|
preview_config = { border = vim.g.border_style },
|
||||||
|
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
local opts = { buffer = bufnr }
|
local opts = { buffer = bufnr }
|
||||||
|
|
||||||
-- Navigation
|
-- Navigation
|
||||||
map('n', ']c', function()
|
map("n", "]c", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then
|
||||||
return ']c'
|
return "]c"
|
||||||
end
|
end
|
||||||
vim.schedule(function() gs.next_hunk() end)
|
vim.schedule(function() gs.next_hunk() end)
|
||||||
return '<Ignore>'
|
return "<Ignore>"
|
||||||
end, { expr = true, buffer = bufnr })
|
end, { expr = true, buffer = bufnr })
|
||||||
|
|
||||||
map('n', '[c', function()
|
map("n", "[c", function()
|
||||||
if vim.wo.diff then
|
if vim.wo.diff then
|
||||||
return '[c'
|
return "[c"
|
||||||
end
|
end
|
||||||
vim.schedule(function() gs.prev_hunk() end)
|
vim.schedule(function() gs.prev_hunk() end)
|
||||||
return '<Ignore>'
|
return "<Ignore>"
|
||||||
end, { expr = true, buffer = bufnr })
|
end, { expr = true, buffer = bufnr })
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
map('n', '<leader>hs', gs.stage_hunk, opts)
|
map("n", "<leader>hs", gs.stage_hunk, opts)
|
||||||
map('n', '<leader>hr', gs.reset_hunk, opts)
|
map("n", "<leader>hr", gs.reset_hunk, opts)
|
||||||
map('v', '<leader>hs', function()
|
map("v", "<leader>hs", function()
|
||||||
gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') }
|
gs.stage_hunk { vim.fn.line("."), vim.fn.line("v") }
|
||||||
end, opts)
|
end, opts)
|
||||||
map('v', '<leader>hr', function()
|
map("v", "<leader>hr", function()
|
||||||
gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') }
|
gs.reset_hunk { vim.fn.line("."), vim.fn.line("v") }
|
||||||
end, opts)
|
end, opts)
|
||||||
map('n', '<leader>hS', gs.stage_buffer, opts)
|
map("n", "<leader>hS", gs.stage_buffer, opts)
|
||||||
map('n', '<leader>hu', gs.undo_stage_hunk, opts)
|
map("n", "<leader>hu", gs.undo_stage_hunk, opts)
|
||||||
map('n', '<leader>hR', gs.reset_buffer, opts)
|
map("n", "<leader>hR", gs.reset_buffer, opts)
|
||||||
map('n', '<leader>hp', gs.preview_hunk, opts)
|
map("n", "<leader>hp", gs.preview_hunk, opts)
|
||||||
map('n', '<leader>hb', function() gs.blame_line { full=true } end, opts)
|
map("n", "<leader>hb", function() gs.blame_line { full=true } end, opts)
|
||||||
map('n', '<leader>tb', gs.toggle_current_line_blame, opts)
|
map("n", "<leader>tb", gs.toggle_current_line_blame, opts)
|
||||||
map('n', '<leader>hd', gs.diffthis, opts)
|
map("n", "<leader>hd", gs.diffthis, opts)
|
||||||
map('n', '<leader>hD', function() gs.diffthis('~') end, opts)
|
map("n", "<leader>hD", function() gs.diffthis("~") end, opts)
|
||||||
map('n', '<leader>td', gs.toggle_deleted, opts)
|
map("n", "<leader>td", gs.toggle_deleted, opts)
|
||||||
|
|
||||||
-- Text object
|
-- Text object
|
||||||
map({ 'o', 'x' }, 'ih', ':<C-U>Gitsigns select_hunk<CR>', opts)
|
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", opts)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'ThePrimeagen/harpoon',
|
return { "ThePrimeagen/harpoon",
|
||||||
disable = not vim.fn.has("nvim-0.8.0"),
|
disable = not vim.fn.has("nvim-0.8.0"),
|
||||||
commit = 'e76cb03',
|
commit = "e76cb03",
|
||||||
branch = 'harpoon2',
|
branch = "harpoon2",
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = "nvim-lua/plenary.nvim",
|
||||||
function()
|
function()
|
||||||
local harpoon = require("harpoon")
|
local harpoon = require("harpoon")
|
||||||
|
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
return { 'lukas-reineke/headlines.nvim',
|
|
||||||
requires = 'nvim-treesitter/nvim-treesitter',
|
|
||||||
function()
|
|
||||||
require('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 = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
1
lua/conf/plugins/helpful.lua
Normal file
1
lua/conf/plugins/helpful.lua
Normal file
@ -0,0 +1 @@
|
|||||||
|
return { "tweekmonster/helpful.vim" }
|
5
lua/conf/plugins/hml.lua
Normal file
5
lua/conf/plugins/hml.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
return { "mawkler/hml.nvim",
|
||||||
|
function()
|
||||||
|
require("hml").setup {}
|
||||||
|
end
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
return { 'jbyuki/instant.nvim',
|
return { "jbyuki/instant.nvim",
|
||||||
function()
|
function()
|
||||||
vim.g.instant_username = "squibid"
|
vim.g.instant_username = "squibid"
|
||||||
end
|
end
|
||||||
|
@ -1,64 +1,64 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local lsp = require('core.lsp.functions')
|
local lsp = require("core.lsp.functions")
|
||||||
local map, auto = misc.map, misc.auto
|
local map, auto = misc.map, misc.auto
|
||||||
|
|
||||||
return { 'mfussenegger/nvim-jdtls',
|
return { "mfussenegger/nvim-jdtls",
|
||||||
disable = not vim.fn.has("nvim-0.6.0"),
|
disable = not vim.fn.has("nvim-0.6.0"),
|
||||||
requires = 'mfussenegger/nvim-dap',
|
requires = "mfussenegger/nvim-dap",
|
||||||
function()
|
function()
|
||||||
auto("FileType", {
|
auto("FileType", {
|
||||||
pattern = "java",
|
pattern = "java",
|
||||||
callback = function()
|
callback = function()
|
||||||
local jdtls = require('jdtls')
|
local jdtls = require("jdtls")
|
||||||
local jdtls_install = require('mason-registry').get_package('jdtls'):get_install_path()
|
local jdtls_install = require("mason-registry").get_package("jdtls"):get_install_path()
|
||||||
|
|
||||||
-- make sure to check if things with 💀 need updating
|
-- make sure to check if things with 💀 need updating
|
||||||
local config = {
|
local config = {
|
||||||
cmd = {
|
cmd = {
|
||||||
'java', -- 💀
|
"/usr/lib/jvm/openjdk21/bin/java", -- 💀
|
||||||
'-jar', vim.fn.glob(jdtls_install..'/plugins/org.eclipse.equinox.launcher_*.jar'), -- 💀
|
"-jar", vim.fn.glob(jdtls_install.."/plugins/org.eclipse.equinox.launcher_*.jar"), -- 💀
|
||||||
'-configuration', jdtls_install..'/config_linux',
|
"-configuration", jdtls_install.."/config_linux",
|
||||||
'-data', vim.fn.stdpath('cache')..'/nvim-jdtls',
|
"-data", vim.fn.stdpath("cache").."/nvim-jdtls",
|
||||||
|
|
||||||
'--add-modules=ALL-SYSTEM',
|
"--add-modules=ALL-SYSTEM",
|
||||||
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
|
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
|
||||||
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
|
"--add-opens", "java.base/java.util=ALL-UNNAMED",
|
||||||
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
||||||
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
"-Declipse.product=org.eclipse.jdt.ls.core.product",
|
||||||
'-Dlog.level=ALL',
|
"-Dlog.level=ALL",
|
||||||
'-Dlog.protocol=true',
|
"-Dlog.protocol=true",
|
||||||
'-Dosgi.bundles.defaultStartLevel=4',
|
"-Dosgi.bundles.defaultStartLevel=4",
|
||||||
'-Xmx1G',
|
"-Xmx1G",
|
||||||
},
|
},
|
||||||
root_dir = vim.fs.dirname(vim.fs.find({
|
root_dir = vim.fs.dirname(vim.fs.find({
|
||||||
'gradlew',
|
"gradlew",
|
||||||
'.git',
|
".git",
|
||||||
'mvnw',
|
"mvnw",
|
||||||
'settings.gradle', -- Gradle (multi-project)
|
"settings.gradle", -- Gradle (multi-project)
|
||||||
'settings.gradle.kts', -- Gradle (multi-project)
|
"settings.gradle.kts", -- Gradle (multi-project)
|
||||||
'build.xml', -- Ant
|
"build.xml", -- Ant
|
||||||
'pom.xml', -- Maven
|
"pom.xml", -- Maven
|
||||||
}, { upward = true })[1]),
|
}, { upward = true })[1]),
|
||||||
|
|
||||||
-- don't print out status messages
|
-- don"t print out status messages
|
||||||
handlers = {
|
handlers = {
|
||||||
['language/status'] = function() end
|
["language/status"] = function() end
|
||||||
},
|
},
|
||||||
|
|
||||||
on_attach = function(_, bufnr)
|
on_attach = function(_, bufnr)
|
||||||
-- add some jdtls specific mappings
|
-- add some jdtls specific mappings
|
||||||
local opts = { buffer = bufnr }
|
local opts = { buffer = bufnr }
|
||||||
map('n', 'cri', jdtls.organize_imports, opts)
|
map("n", "cri", jdtls.organize_imports, opts)
|
||||||
map('n', 'crv', jdtls.extract_variable, opts)
|
map("n", "crv", jdtls.extract_variable, opts)
|
||||||
map('n', 'crc', jdtls.extract_constant, opts)
|
map("n", "crc", jdtls.extract_constant, opts)
|
||||||
map('x', 'crv', function() jdtls.extract_variable(true) end, opts)
|
map("x", "crv", function() jdtls.extract_variable(true) end, opts)
|
||||||
map('x', 'crc', function() jdtls.extract_constant(true) end, opts)
|
map("x", "crc", function() jdtls.extract_constant(true) end, opts)
|
||||||
map('x', 'crm', function() jdtls.extract_method(true) end, opts)
|
map("x", "crm", function() jdtls.extract_method(true) end, opts)
|
||||||
|
|
||||||
pcall(vim.lsp.codelens.refresh)
|
pcall(vim.lsp.codelens.refresh)
|
||||||
auto('BufWritePost', {
|
auto("BufWritePost", {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
desc = 'refresh codelens',
|
desc = "refresh codelens",
|
||||||
callback = function()
|
callback = function()
|
||||||
pcall(vim.lsp.codelens.refresh)
|
pcall(vim.lsp.codelens.refresh)
|
||||||
end
|
end
|
||||||
@ -88,7 +88,7 @@ return { 'mfussenegger/nvim-jdtls',
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- compile our code
|
-- compile our code
|
||||||
vim.system({ 'javac', src_path, '-d', vim.fn.stdpath("cache") }, {}, function(out)
|
vim.system({ "javac", src_path, "-d", vim.fn.stdpath("cache") }, {}, function(out)
|
||||||
if out.code ~= 0 then
|
if out.code ~= 0 then
|
||||||
cache_path = nil
|
cache_path = nil
|
||||||
end
|
end
|
||||||
@ -98,7 +98,7 @@ return { 'mfussenegger/nvim-jdtls',
|
|||||||
|
|
||||||
-- check if we have a compiled version of JavaVersion
|
-- check if we have a compiled version of JavaVersion
|
||||||
local f, _ = io.open(cache_path, "r")
|
local f, _ = io.open(cache_path, "r")
|
||||||
if not f then -- if we don't have a cache
|
if not f then -- if we don"t have a cache
|
||||||
build_cache()
|
build_cache()
|
||||||
else
|
else
|
||||||
io.close(f)
|
io.close(f)
|
||||||
@ -118,12 +118,15 @@ return { 'mfussenegger/nvim-jdtls',
|
|||||||
on_exit = function(_, exit_code, _)
|
on_exit = function(_, exit_code, _)
|
||||||
local v = vim.version.parse(table.concat(buffer))
|
local v = vim.version.parse(table.concat(buffer))
|
||||||
|
|
||||||
-- if there's an error, no version info, or the java version is
|
-- if there"s an error, no version info, or the java version is
|
||||||
-- less than 17 stop the lsp from starting
|
-- less than 17 stop the lsp from starting
|
||||||
if exit_code ~= 0 then
|
if exit_code ~= 0 then
|
||||||
vim.notify(string.format(
|
vim.notify(string.format(
|
||||||
"java version check failed: exit code %s", exit_code),
|
"java version check failed: exit code %s", exit_code),
|
||||||
vim.log.levels.ERROR, { title = misc.appid })
|
vim.log.levels.ERROR, { title = misc.appid })
|
||||||
|
vim.notify(string.format(
|
||||||
|
"%s", vim.inspect(buffer)),
|
||||||
|
vim.log.levels.ERROR, { title = misc.appid })
|
||||||
return
|
return
|
||||||
elseif not v then
|
elseif not v then
|
||||||
vim.notify("no java version info found", vim.log.levels.ERROR,
|
vim.notify("no java version info found", vim.log.levels.ERROR,
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
return { 'kawre/leetcode.nvim',
|
return { "kawre/leetcode.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
'nvim-lua/plenary.nvim',
|
"nvim-lua/plenary.nvim",
|
||||||
'nvim-telescope/telescope.nvim',
|
"nvim-telescope/telescope.nvim",
|
||||||
'MunifTanjim/nui.nvim',
|
"MunifTanjim/nui.nvim",
|
||||||
'nvim-treesitter/nvim-treesitter'
|
"nvim-treesitter/nvim-treesitter"
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- because we're using treesitter make sure to install the html parser
|
-- because we"re using treesitter make sure to install the html parser
|
||||||
vim.cmd("TSUpdate html")
|
vim.cmd("TSUpdate html")
|
||||||
end,
|
end,
|
||||||
function()
|
function()
|
||||||
require('leetcode').setup {
|
require("leetcode").setup {
|
||||||
lang = "java"
|
lang = "java"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
return { 'whynothugo/lsp_lines',
|
return { "whynothugo/lsp_lines",
|
||||||
url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim',
|
url = "https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.8.0")
|
disable = not vim.fn.has("nvim-0.8.0")
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'L3MON4D3/LuaSnip',
|
return { "L3MON4D3/LuaSnip",
|
||||||
branch = 'v2.3.0',
|
branch = "v2.3.0",
|
||||||
disable = not vim.fn.has("nvim-0.7.0"),
|
disable = not vim.fn.has("nvim-0.7.0"),
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd('make install_jsregexp')
|
vim.cmd("make install_jsregexp")
|
||||||
end,
|
end,
|
||||||
function()
|
function()
|
||||||
local luasnip = require('luasnip')
|
local luasnip = require("luasnip")
|
||||||
local types = require("luasnip.util.types")
|
local types = require("luasnip.util.types")
|
||||||
|
|
||||||
luasnip.config.set_config {
|
luasnip.config.set_config {
|
||||||
@ -57,8 +57,8 @@ return { 'L3MON4D3/LuaSnip',
|
|||||||
|
|
||||||
-- load all snippets from snippet directory
|
-- load all snippets from snippet directory
|
||||||
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do
|
for _, file in ipairs(vim.api.nvim_get_runtime_file("lua/snippets/*.lua", true)) do
|
||||||
local fn = file:gsub('^.*/', ''):gsub('%.lua$', '')
|
local fn = file:gsub("^.*/", ""):gsub("%.lua$", "")
|
||||||
local ret = misc.include('snippets.'..fn)
|
local ret = misc.include("snippets."..fn)
|
||||||
if type(ret) ~= "boolean" then
|
if type(ret) ~= "boolean" then
|
||||||
luasnip.add_snippets(fn, ret, { key = fn })
|
luasnip.add_snippets(fn, ret, { key = fn })
|
||||||
end
|
end
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local lsp = require('core.lsp.functions')
|
local lsp = require("core.lsp.functions")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'williamboman/mason-lspconfig.nvim',
|
return { "williamboman/mason-lspconfig.nvim",
|
||||||
requires = {
|
requires = {
|
||||||
'williamboman/mason.nvim',
|
"williamboman/mason.nvim",
|
||||||
{ 'neovim/nvim-lspconfig',
|
{ "neovim/nvim-lspconfig",
|
||||||
disable = not vim.fn.has("nvim-0.8.0"),
|
disable = not vim.fn.has("nvim-0.8.0"),
|
||||||
function()
|
function()
|
||||||
lsp.setup()
|
lsp.setup()
|
||||||
@ -13,15 +13,15 @@ return { 'williamboman/mason-lspconfig.nvim',
|
|||||||
},
|
},
|
||||||
|
|
||||||
-- these two update some lsp capabilities and therefore must be run first
|
-- these two update some lsp capabilities and therefore must be run first
|
||||||
-- 'hrsh7th/cmp-nvim-lsp',
|
-- "hrsh7th/cmp-nvim-lsp",
|
||||||
-- 'kevinhwang91/nvim-ufo'
|
-- "kevinhwang91/nvim-ufo"
|
||||||
},
|
},
|
||||||
function()
|
function()
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require("lspconfig")
|
||||||
local util = require('lspconfig.util')
|
local util = require("lspconfig.util")
|
||||||
|
|
||||||
-- setup language servers
|
-- setup language servers
|
||||||
require('mason-lspconfig').setup {
|
require("mason-lspconfig").setup {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"clangd",
|
"clangd",
|
||||||
@ -42,9 +42,9 @@ return { 'williamboman/mason-lspconfig.nvim',
|
|||||||
|
|
||||||
-- setup luals
|
-- setup luals
|
||||||
["lua_ls"] = function(server_name)
|
["lua_ls"] = function(server_name)
|
||||||
local root_files = { '.luarc.json', '.luarc.jsonc', '.luacheckrc',
|
local root_files = { ".luarc.json", ".luarc.jsonc", ".luacheckrc",
|
||||||
'.stylua.toml', 'stylua.toml', 'selene.toml', 'selene.yml',
|
".stylua.toml", "stylua.toml", "selene.toml", "selene.yml",
|
||||||
'README.md'
|
"README.md"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- FIXME: luals seems to start up twice and sends back twice the
|
-- FIXME: luals seems to start up twice and sends back twice the
|
||||||
@ -53,10 +53,10 @@ return { 'williamboman/mason-lspconfig.nvim',
|
|||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = { "vim", 'mp' }
|
globals = { "vim", "mp" }
|
||||||
},
|
},
|
||||||
runtime = {
|
runtime = {
|
||||||
version = 'LuaJIT'
|
version = "LuaJIT"
|
||||||
},
|
},
|
||||||
format = {
|
format = {
|
||||||
enable = false
|
enable = false
|
||||||
@ -76,7 +76,7 @@ return { 'williamboman/mason-lspconfig.nvim',
|
|||||||
return root
|
return root
|
||||||
end
|
end
|
||||||
|
|
||||||
root = util.root_pattern('lua/')(fname)
|
root = util.root_pattern("lua/")(fname)
|
||||||
if root then
|
if root then
|
||||||
return root
|
return root
|
||||||
end
|
end
|
||||||
@ -107,7 +107,7 @@ return { 'williamboman/mason-lspconfig.nvim',
|
|||||||
usePlaceholders = true,
|
usePlaceholders = true,
|
||||||
clangdFileStatus = true,
|
clangdFileStatus = true,
|
||||||
fallback_flags = {
|
fallback_flags = {
|
||||||
"-xc" -- makes clangd think we're using c instead of c++
|
"-xc" -- makes clangd think we"re using c instead of c++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
return { 'williamboman/mason.nvim',
|
return { "williamboman/mason.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.7.0"),
|
disable = not vim.fn.has("nvim-0.7.0"),
|
||||||
function()
|
function()
|
||||||
local mason = require('mason')
|
local mason = require("mason")
|
||||||
|
|
||||||
mason.setup {
|
mason.setup {
|
||||||
ui = {
|
ui = {
|
||||||
border = "solid",
|
border = vim.g.border_style,
|
||||||
width = 0.8,
|
width = 0.8,
|
||||||
height = 0.9,
|
height = 0.9,
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
return { 'mellow-theme/mellow.nvim',
|
return { "mellow-theme/mellow.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.8.0"),
|
disable = not vim.fn.has("nvim-0.8.0"),
|
||||||
requires = 'nvim-treesitter/nvim-treesitter',
|
requires = "nvim-treesitter/nvim-treesitter",
|
||||||
function()
|
function()
|
||||||
vim.g.mellow_variant = "dark"
|
vim.g.mellow_variant = "dark"
|
||||||
local c = require("mellow.colors")[vim.g.mellow_variant]
|
local c = require("mellow.colors")[vim.g.mellow_variant]
|
||||||
@ -10,26 +10,26 @@ return { 'mellow-theme/mellow.nvim',
|
|||||||
["NormalNC"] = { link = "Normal" },
|
["NormalNC"] = { link = "Normal" },
|
||||||
|
|
||||||
-- make floats darker
|
-- make floats darker
|
||||||
["NormalFloat"] = { fg = c.fg, bg = c.bg_dark },
|
["NormalFloat"] = { fg = c.fg, bg = "#111111" },
|
||||||
["FloatBorder"] = { link = "NormalFloat" },
|
["FloatBorder"] = { link = "NormalFloat" },
|
||||||
|
|
||||||
-- neorg headings, looks extra good with lukas-reineke/headlines.nvim
|
-- neorg headings, looks extra good with lukas-reineke/headlines.nvim
|
||||||
["@neorg.headings.1.title"] = { fg = c.yellow, bg = "#2a211c" },
|
["@neorg.headings.1.title"] = { fg = c.yellow, bg = "#2a211c" },
|
||||||
["@neorg.headings.1.icon"] = { link = "@neorg.headings.1.title" },
|
["@neorg.headings.1.icon"] = { link = "@neorg.headings.1.title" },
|
||||||
|
|
||||||
["@neorg.headings.2.title"] = { fg = c.blue, bg = '#201e25' },
|
["@neorg.headings.2.title"] = { fg = c.blue, bg = "#201e25" },
|
||||||
["@neorg.headings.2.icon"] = { link = "@neorg.headings.2.title" },
|
["@neorg.headings.2.icon"] = { link = "@neorg.headings.2.title" },
|
||||||
|
|
||||||
["@neorg.headings.3.title"] = { fg = c.cyan, bg = '#2b1b20' },
|
["@neorg.headings.3.title"] = { fg = c.cyan, bg = "#2b1b20" },
|
||||||
["@neorg.headings.3.icon"] = { link = "@neorg.headings.3.title" },
|
["@neorg.headings.3.icon"] = { link = "@neorg.headings.3.title" },
|
||||||
|
|
||||||
["@neorg.headings.4.title"] = { fg = c.green, bg = '#1d201e' },
|
["@neorg.headings.4.title"] = { fg = c.green, bg = "#1d201e" },
|
||||||
["@neorg.headings.4.icon"] = { link = "@neorg.headings.4.title" },
|
["@neorg.headings.4.icon"] = { link = "@neorg.headings.4.title" },
|
||||||
|
|
||||||
["@neorg.headings.5.title"] = { fg = c.magenta, bg = '#251a21' },
|
["@neorg.headings.5.title"] = { fg = c.magenta, bg = "#251a21" },
|
||||||
["@neorg.headings.5.icon"] = { link = "@neorg.headings.5.title" },
|
["@neorg.headings.5.icon"] = { link = "@neorg.headings.5.title" },
|
||||||
|
|
||||||
["@neorg.headings.6.title"] = { fg = c.white, bg = '#212126' },
|
["@neorg.headings.6.title"] = { fg = c.white, bg = "#212126" },
|
||||||
["@neorg.headings.6.icon"] = { link = "@neorg.headings.6.title" },
|
["@neorg.headings.6.icon"] = { link = "@neorg.headings.6.title" },
|
||||||
|
|
||||||
-- make blink actually look nice
|
-- make blink actually look nice
|
||||||
|
@ -1,52 +0,0 @@
|
|||||||
return { 'echasnovski/mini.clue',
|
|
||||||
disable = true,
|
|
||||||
-- disable = not vim.fn.has("nvim-0.9.0"),
|
|
||||||
branch = "stable",
|
|
||||||
function()
|
|
||||||
local miniclue = require('mini.clue')
|
|
||||||
miniclue.setup({
|
|
||||||
triggers = {
|
|
||||||
-- Leader triggers
|
|
||||||
{ mode = 'n', keys = '<Leader>' },
|
|
||||||
{ mode = 'x', keys = '<Leader>' },
|
|
||||||
|
|
||||||
-- Built-in completion
|
|
||||||
{ mode = 'i', keys = '<C-x>' },
|
|
||||||
|
|
||||||
-- `g` key
|
|
||||||
{ mode = 'n', keys = 'g' },
|
|
||||||
{ mode = 'x', keys = 'g' },
|
|
||||||
|
|
||||||
-- Marks
|
|
||||||
{ mode = 'n', keys = "'" },
|
|
||||||
{ mode = 'n', keys = '`' },
|
|
||||||
{ mode = 'x', keys = "'" },
|
|
||||||
{ mode = 'x', keys = '`' },
|
|
||||||
|
|
||||||
-- Registers
|
|
||||||
{ mode = 'n', keys = '"' },
|
|
||||||
{ mode = 'x', keys = '"' },
|
|
||||||
{ mode = 'i', keys = '<C-r>' },
|
|
||||||
{ mode = 'c', keys = '<C-r>' },
|
|
||||||
|
|
||||||
-- Window commands
|
|
||||||
{ mode = 'n', keys = '<C-w>' },
|
|
||||||
|
|
||||||
-- `z` key
|
|
||||||
{ mode = 'n', keys = 'z' },
|
|
||||||
{ mode = 'x', keys = 'z' },
|
|
||||||
},
|
|
||||||
|
|
||||||
clues = {
|
|
||||||
-- Enhance this by adding descriptions for <Leader> mapping groups
|
|
||||||
miniclue.gen_clues.builtin_completion(),
|
|
||||||
miniclue.gen_clues.g(),
|
|
||||||
miniclue.gen_clues.marks(),
|
|
||||||
miniclue.gen_clues.registers(),
|
|
||||||
miniclue.gen_clues.windows(),
|
|
||||||
miniclue.gen_clues.z(),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
end
|
|
||||||
}
|
|
@ -1,19 +1,19 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'danymat/neogen',
|
return { "danymat/neogen",
|
||||||
requires = {
|
requires = {
|
||||||
'nvim-treesitter/nvim-treesitter',
|
"nvim-treesitter/nvim-treesitter",
|
||||||
'L3MON4D3/LuaSnip'
|
"L3MON4D3/LuaSnip"
|
||||||
},
|
},
|
||||||
function()
|
function()
|
||||||
local neogen = require('neogen')
|
local neogen = require("neogen")
|
||||||
neogen.setup {
|
neogen.setup {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
input_after_comment = true,
|
input_after_comment = true,
|
||||||
snippet_engine = "luasnip",
|
snippet_engine = "luasnip",
|
||||||
}
|
}
|
||||||
|
|
||||||
map('n', '<leader>d', neogen.generate)
|
map("n", "<leader>d", neogen.generate)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
-- WARNING: neorg does some pretty stupid stuff when it comes to the plugins it
|
-- WARNING: neorg does some pretty stupid stuff when it comes to the plugins it
|
||||||
-- wants (using luarocks), in order to get around all that bullshit I've
|
-- wants (using luarocks), in order to get around all that bullshit I"ve
|
||||||
-- manually added it's dependencies. Because I don't want this to randomly break
|
-- manually added it"s dependencies. Because I don"t want this to randomly break
|
||||||
-- I've also pinned neorg to the latest working version that I've messed around
|
-- I"ve also pinned neorg to the latest working version that I"ve messed around
|
||||||
-- with.
|
-- with.
|
||||||
--
|
--
|
||||||
-- NOTE: for my future self to update this thingy while not breaking
|
-- NOTE: for my future self to update this thingy while not breaking
|
||||||
@ -36,7 +36,7 @@ local function populate_workspaces(path, cache)
|
|||||||
if string.sub(n, 1, 1) == "." or (t ~= "directory" and t ~= "link") then
|
if string.sub(n, 1, 1) == "." or (t ~= "directory" and t ~= "link") then
|
||||||
goto continue
|
goto continue
|
||||||
end
|
end
|
||||||
-- make sure this still works if the last charachter in the path isn't a '/'
|
-- make sure this still works if the last charachter in the path isn"t a "/"
|
||||||
workspaces[n] = (string.sub(path, #path, #path) == "/") and path..n or path.."/"..n
|
workspaces[n] = (string.sub(path, #path, #path) == "/") and path..n or path.."/"..n
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
@ -61,32 +61,32 @@ local function populate_workspaces(path, cache)
|
|||||||
return workspaces
|
return workspaces
|
||||||
end
|
end
|
||||||
|
|
||||||
return { 'nvim-neorg/neorg',
|
return { "nvim-neorg/neorg",
|
||||||
disable = not vim.fn.has("nvim-0.10.0"),
|
disable = not vim.fn.has("nvim-0.10.0"),
|
||||||
branch = 'v9.3.0',
|
branch = "v9.3.0",
|
||||||
requires = {
|
requires = {
|
||||||
'nvim-lua/plenary.nvim',
|
"nvim-lua/plenary.nvim",
|
||||||
'nvim-treesitter/nvim-treesitter',
|
"nvim-treesitter/nvim-treesitter",
|
||||||
'folke/zen-mode.nvim',
|
"folke/zen-mode.nvim",
|
||||||
'hrsh7th/nvim-cmp',
|
"hrsh7th/nvim-cmp",
|
||||||
{ 'nvim-neorg/neorg-telescope',
|
{ "nvim-neorg/neorg-telescope",
|
||||||
requires = 'nvim-telescope/telescope.nvim'
|
requires = "nvim-telescope/telescope.nvim"
|
||||||
},
|
},
|
||||||
|
|
||||||
-- NOTE: these are usually installed by neorg via luarocks, the versions
|
-- NOTE: these are usually installed by neorg via luarocks, the versions
|
||||||
-- were picked based on the neorg-scm-1.rockspec found in the root of the
|
-- were picked based on the neorg-scm-1.rockspec found in the root of the
|
||||||
-- neorg repo
|
-- neorg repo
|
||||||
{ 'nvim-neotest/nvim-nio',
|
{ "nvim-neotest/nvim-nio",
|
||||||
branch = 'v1.7.0'
|
branch = "v1.7.0"
|
||||||
},
|
},
|
||||||
{ 'nvim-neorg/lua-utils.nvim',
|
{ "nvim-neorg/lua-utils.nvim",
|
||||||
branch = 'v1.0.2'
|
branch = "v1.0.2"
|
||||||
},
|
},
|
||||||
{ 'MunifTanjim/nui.nvim',
|
{ "MunifTanjim/nui.nvim",
|
||||||
branch = '0.3.0'
|
branch = "0.3.0"
|
||||||
},
|
},
|
||||||
{ 'pysan3/pathlib.nvim',
|
{ "pysan3/pathlib.nvim",
|
||||||
branch = 'v2.2.2'
|
branch = "v2.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ return { 'nvim-neorg/neorg',
|
|||||||
local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or
|
local wsphome = (os.getenv("XDG_DOCUMENTS_DIR") or
|
||||||
(os.getenv("HOME").."/Documents")).."/notes/"
|
(os.getenv("HOME").."/Documents")).."/notes/"
|
||||||
|
|
||||||
require('neorg').setup {
|
require("neorg").setup {
|
||||||
load = {
|
load = {
|
||||||
-- not sure how to sort the modules so ima just put the empty ones first
|
-- not sure how to sort the modules so ima just put the empty ones first
|
||||||
["core.defaults"] = {},
|
["core.defaults"] = {},
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
return { 'norcalli/nvim-colorizer.lua',
|
return { "norcalli/nvim-colorizer.lua",
|
||||||
disable = not vim.fn.has("nvim-0.4.0") and not vim.fn.has("termguicolors"),
|
disable = not vim.fn.has("nvim-0.4.0") and not vim.fn.has("termguicolors"),
|
||||||
function()
|
function()
|
||||||
require('colorizer').setup(nil, {
|
require("colorizer").setup(nil, {
|
||||||
names = false,
|
names = false,
|
||||||
css = true
|
css = true
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
return { 'squibid/nyooom',
|
return { "squibid/nyooom",
|
||||||
url = 'https://git.squi.bid/nyooom',
|
url = "https://git.squi.bid/nyooom",
|
||||||
pin = true,
|
pin = true,
|
||||||
function()
|
function()
|
||||||
require('nyooom').setup {}
|
require("nyooom").setup {}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,85 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
local permission_hlgroups = {
|
-- helper function to parse output
|
||||||
['-'] = 'NonText',
|
local function parse_output(proc)
|
||||||
['r'] = 'DiagnosticSignWarn',
|
local result = proc:wait()
|
||||||
['w'] = 'DiagnosticSignHint',
|
local ret = {}
|
||||||
['x'] = 'DiagnosticSignOk',
|
if result.code == 0 then
|
||||||
|
for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do
|
||||||
|
-- Remove trailing slash
|
||||||
|
line = line:gsub("/$", "")
|
||||||
|
ret[line] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
|
-- build git status cache
|
||||||
|
local function new_git_status()
|
||||||
|
return setmetatable({}, {
|
||||||
|
__index = function(self, key)
|
||||||
|
local ignore_proc = vim.system(
|
||||||
|
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
|
||||||
|
{
|
||||||
|
cwd = key,
|
||||||
|
text = true,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
local tracked_proc = vim.system({ "git", "ls-tree", "HEAD", "--name-only" }, {
|
||||||
|
cwd = key,
|
||||||
|
text = true,
|
||||||
|
})
|
||||||
|
local ret = {
|
||||||
|
ignored = parse_output(ignore_proc),
|
||||||
|
tracked = parse_output(tracked_proc),
|
||||||
}
|
}
|
||||||
|
|
||||||
return { 'stevearc/oil.nvim',
|
rawset(self, key, ret)
|
||||||
|
return ret
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
local git_status = new_git_status()
|
||||||
|
|
||||||
|
local permission_hlgroups = {
|
||||||
|
["-"] = "NonText",
|
||||||
|
["r"] = "DiagnosticSignWarn",
|
||||||
|
["w"] = "DiagnosticSignHint",
|
||||||
|
["x"] = "DiagnosticSignOk",
|
||||||
|
}
|
||||||
|
|
||||||
|
return { "stevearc/oil.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.8.0"),
|
disable = not vim.fn.has("nvim-0.8.0"),
|
||||||
|
deps = {
|
||||||
|
{ "refractalize/oil-git-status.nvim",
|
||||||
function()
|
function()
|
||||||
|
require("oil-git-status").setup {
|
||||||
|
symbols = { -- customize the symbols that appear in the git status columns
|
||||||
|
index = {
|
||||||
|
["A"] = "+",
|
||||||
|
["D"] = "-",
|
||||||
|
["M"] = "~",
|
||||||
|
},
|
||||||
|
working_tree = {
|
||||||
|
["A"] = "+",
|
||||||
|
["D"] = "-",
|
||||||
|
["M"] = "~",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
},
|
||||||
|
function()
|
||||||
|
-- Clear git status cache on refresh
|
||||||
|
local refresh = require("oil.actions").refresh
|
||||||
|
local orig_refresh = refresh.callback
|
||||||
|
refresh.callback = function(...)
|
||||||
|
git_status = new_git_status()
|
||||||
|
orig_refresh(...)
|
||||||
|
end
|
||||||
|
|
||||||
require("oil").setup {
|
require("oil").setup {
|
||||||
-- ID is automatically added at the beginning, and name at the end
|
-- ID is automatically added at the beginning, and name at the end
|
||||||
-- See :help oil-columns
|
-- See :help oil-columns
|
||||||
@ -26,7 +95,7 @@ return { 'stevearc/oil.nvim',
|
|||||||
return hls
|
return hls
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ "size", highlight = '@number' }
|
{ "size", highlight = "@number" }
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Window-local options to use for oil buffers
|
-- Window-local options to use for oil buffers
|
||||||
@ -34,7 +103,7 @@ return { 'stevearc/oil.nvim',
|
|||||||
number = false,
|
number = false,
|
||||||
relativenumber = false,
|
relativenumber = false,
|
||||||
wrap = false,
|
wrap = false,
|
||||||
signcolumn = "no",
|
signcolumn = "yes:2",
|
||||||
cursorcolumn = false,
|
cursorcolumn = false,
|
||||||
foldcolumn = "0",
|
foldcolumn = "0",
|
||||||
spell = false,
|
spell = false,
|
||||||
@ -100,11 +169,16 @@ return { 'stevearc/oil.nvim',
|
|||||||
|
|
||||||
-- This function defines what is considered a "hidden" file
|
-- This function defines what is considered a "hidden" file
|
||||||
is_hidden_file = function(name, bufnr)
|
is_hidden_file = function(name, bufnr)
|
||||||
if name == ".." then -- show previous directory
|
local dir = require("oil").get_current_dir(bufnr)
|
||||||
return false
|
local is_dotfile = vim.startswith(name, ".") and name ~= ".."
|
||||||
|
-- if no local directory (e.g. for ssh connections), just hide dotfiles
|
||||||
|
if not dir then
|
||||||
|
return is_dotfile
|
||||||
|
end
|
||||||
|
-- dotfiles are considered hidden unless tracked
|
||||||
|
if is_dotfile then
|
||||||
|
return not git_status[dir].tracked[name]
|
||||||
end
|
end
|
||||||
local m = name:match("^%.")
|
|
||||||
return m ~= nil
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- This function defines what will never be shown, even when `show_hidden` is set
|
-- This function defines what will never be shown, even when `show_hidden` is set
|
||||||
@ -134,27 +208,27 @@ return { 'stevearc/oil.nvim',
|
|||||||
|
|
||||||
-- Configuration for the floating window in oil.open_float
|
-- Configuration for the floating window in oil.open_float
|
||||||
float = {
|
float = {
|
||||||
border = "solid"
|
border = vim.g.border_style
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Configuration for the floating action confirmation window
|
-- Configuration for the floating action confirmation window
|
||||||
confirmation = {
|
confirmation = {
|
||||||
border = "solid"
|
border = vim.g.border_style
|
||||||
},
|
},
|
||||||
-- Configuration for the floating progress window
|
-- Configuration for the floating progress window
|
||||||
progress = {
|
progress = {
|
||||||
border = "solid"
|
border = vim.g.border_style
|
||||||
},
|
},
|
||||||
-- Configuration for the floating SSH window
|
-- Configuration for the floating SSH window
|
||||||
ssh = {
|
ssh = {
|
||||||
border = "solid"
|
border = vim.g.border_style
|
||||||
},
|
},
|
||||||
-- Configuration for the floating keymaps help window
|
-- Configuration for the floating keymaps help window
|
||||||
keymaps_help = {
|
keymaps_help = {
|
||||||
border = "solid"
|
border = vim.g.border_style
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
map('n', '-', '<cmd>Oil<CR>')
|
map("n", "-", "<cmd>Oil<CR>")
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
return { 'ahmedkhalf/project.nvim',
|
|
||||||
disable = true,
|
|
||||||
-- disable = vim.fn.has("nvim-0.5.0"),
|
|
||||||
function()
|
|
||||||
require('project_nvim').setup {
|
|
||||||
patterns = {
|
|
||||||
".git",
|
|
||||||
"Makefile",
|
|
||||||
"_darcs",
|
|
||||||
".hg",
|
|
||||||
".bzr",
|
|
||||||
".svn",
|
|
||||||
"package.json",
|
|
||||||
"README.md"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
@ -1,55 +1,48 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'nvim-telescope/telescope.nvim',
|
return { "nvim-telescope/telescope.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.9.0"),
|
disable = not vim.fn.has("nvim-0.9.0"),
|
||||||
requires = {
|
requires = {
|
||||||
'nvim-lua/plenary.nvim',
|
"nvim-lua/plenary.nvim",
|
||||||
{ 'nvim-telescope/telescope-fzf-native.nvim',
|
{ "nvim-telescope/telescope-fzf-native.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd("make")
|
vim.cmd("make")
|
||||||
end
|
end
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
"mollerhoj/telescope-recent-files.nvim",
|
||||||
|
"nvim-telescope/telescope-ui-select.nvim"
|
||||||
|
},
|
||||||
|
|
||||||
function()
|
function()
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
local actions = require('telescope.actions')
|
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 {
|
telescope.setup {
|
||||||
defaults = {
|
defaults = {
|
||||||
borderchars = {
|
borderchars = {
|
||||||
prompt = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
|
prompt = { " ", " ", " ", " ", " ", " ", " ", " " },
|
||||||
results = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
|
results = { " ", " ", " ", " ", " ", " ", " ", " " },
|
||||||
preview = { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' },
|
preview = { " ", " ", " ", " ", " ", " ", " ", " " },
|
||||||
},
|
},
|
||||||
winblend = 0,
|
winblend = 0,
|
||||||
layout_strategy = 'horizontal',
|
layout_strategy = "horizontal",
|
||||||
sorting_strategy = 'descending',
|
sorting_strategy = "descending",
|
||||||
scroll_strategy = 'limit',
|
scroll_strategy = "limit",
|
||||||
layout_config = {
|
layout_config = {
|
||||||
horizontal = {
|
horizontal = {
|
||||||
width = telescopew(),
|
|
||||||
height = 20,
|
height = 20,
|
||||||
prompt_position = 'bottom',
|
prompt_position = "bottom",
|
||||||
anchor = 'N',
|
anchor = "N",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<esc>"] = actions.close,
|
["<esc>"] = actions.close,
|
||||||
['<C-j>'] = actions.move_selection_next,
|
["<C-j>"] = actions.move_selection_next,
|
||||||
['<C-k>'] = actions.move_selection_previous,
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
['<C-u>'] = actions.preview_scrolling_up,
|
["<C-u>"] = actions.preview_scrolling_up,
|
||||||
['<C-d>'] = actions.preview_scrolling_down,
|
["<C-d>"] = actions.preview_scrolling_down,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -59,29 +52,31 @@ return { 'nvim-telescope/telescope.nvim',
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- load in the fzf extension
|
-- load in the fzf extension
|
||||||
telescope.load_extension('fzf')
|
telescope.load_extension("fzf")
|
||||||
|
telescope.load_extension("recent-files")
|
||||||
|
telescope.load_extension("ui-select")
|
||||||
|
|
||||||
-- keymaps
|
-- keymaps
|
||||||
local telebuilt = require('telescope.builtin')
|
local telebuilt = require("telescope.builtin")
|
||||||
map('n', '<leader>f', function()
|
map("n", "<leader>f", function()
|
||||||
telebuilt.fd { follow = true }
|
telescope.extensions["recent-files"].recent_files { follow = true }
|
||||||
end, { desc = 'Find files.' })
|
end, { desc = "Find files." })
|
||||||
map('n', '<leader>s', telebuilt.live_grep, { desc = 'Find string in project.' })
|
map("n", "<leader>s", telebuilt.live_grep, { desc = "Find string in project." })
|
||||||
map('n', '<leader>b', telebuilt.current_buffer_fuzzy_find, {
|
map("n", "<leader>b", telebuilt.current_buffer_fuzzy_find, {
|
||||||
desc = 'Find string in current buffer.',
|
desc = "Find string in current buffer.",
|
||||||
})
|
})
|
||||||
map('n', '<leader>i', telebuilt.help_tags, {
|
map("n", "<leader>i", telebuilt.help_tags, {
|
||||||
desc = 'find help tags.',
|
desc = "find help tags.",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- find over specific directories
|
-- find over specific directories
|
||||||
map('n', '<leader>tc', function()
|
map("n", "<leader>tc", function()
|
||||||
require('telescope.builtin').find_files {
|
require("telescope.builtin").find_files {
|
||||||
cwd = vim.fn.stdpath("config")
|
cwd = vim.fn.stdpath("config")
|
||||||
}
|
}
|
||||||
end, { desc = "find config files" })
|
end, { desc = "find config files" })
|
||||||
map('n', '<leader>tp', function()
|
map("n", "<leader>tp", function()
|
||||||
require('telescope.builtin').find_files {
|
require("telescope.builtin").find_files {
|
||||||
cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site/pack/deps/opt")
|
cwd = vim.fs.joinpath(vim.fn.stdpath("data"), "site/pack/deps/opt")
|
||||||
}
|
}
|
||||||
end, { desc = "find files in plugin directory" })
|
end, { desc = "find files in plugin directory" })
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
return { 'folke/todo-comments.nvim',
|
return { "folke/todo-comments.nvim",
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = "nvim-lua/plenary.nvim",
|
||||||
disable = not vim.fn.has("nvim-0.8.0"),
|
disable = not vim.fn.has("nvim-0.8.0"),
|
||||||
function()
|
function()
|
||||||
require('todo-comments').setup {
|
require("todo-comments").setup {
|
||||||
keywords = {
|
keywords = {
|
||||||
FIX = {
|
FIX = {
|
||||||
icon = "# ",
|
icon = "# ",
|
||||||
|
@ -7,13 +7,13 @@ table.contains = function(self, string)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return { 'nvim-treesitter/nvim-treesitter',
|
return { "nvim-treesitter/nvim-treesitter",
|
||||||
disable = not vim.fn.has("nvim-0.10.0"),
|
disable = not vim.fn.has("nvim-0.10.0"),
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd("TSUpdate")
|
vim.cmd("TSUpdate")
|
||||||
end,
|
end,
|
||||||
function()
|
function()
|
||||||
require('nvim-treesitter.configs').setup {
|
require("nvim-treesitter.configs").setup {
|
||||||
-- good default parsers
|
-- good default parsers
|
||||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
|
ensure_installed = { "c", "lua", "vim", "vimdoc", "markdown",
|
||||||
"markdown_inline", "java", "bash", "css", "html", "luadoc",
|
"markdown_inline", "java", "bash", "css", "html", "luadoc",
|
||||||
@ -25,7 +25,7 @@ return { 'nvim-treesitter/nvim-treesitter',
|
|||||||
enable = true,
|
enable = true,
|
||||||
|
|
||||||
disable = function(lang, _)
|
disable = function(lang, _)
|
||||||
-- disable indenting in php (it's more broken with than without)
|
-- disable indenting in php (it"s more broken with than without)
|
||||||
return table.contains(({
|
return table.contains(({
|
||||||
"php"
|
"php"
|
||||||
}), lang)
|
}), lang)
|
||||||
@ -39,7 +39,7 @@ return { 'nvim-treesitter/nvim-treesitter',
|
|||||||
additional_vim_regex_highlighting = true,
|
additional_vim_regex_highlighting = true,
|
||||||
|
|
||||||
disable = function(lang, buf)
|
disable = function(lang, buf)
|
||||||
-- disable in some files where vim's builtin highlighting is better
|
-- disable in some files where vim"s builtin highlighting is better
|
||||||
if table.contains(({
|
if table.contains(({
|
||||||
"diff", "tex"
|
"diff", "tex"
|
||||||
}), lang) then
|
}), lang) then
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'Wansmer/treesj',
|
return { "Wansmer/treesj",
|
||||||
disable = not vim.fn.has("nvim-0.9.0"),
|
disable = not vim.fn.has("nvim-0.9.0"),
|
||||||
requires = 'nvim-treesitter/nvim-treesitter',
|
requires = "nvim-treesitter/nvim-treesitter",
|
||||||
function()
|
function()
|
||||||
require('treesj').setup {
|
require("treesj").setup {
|
||||||
use_default_keymaps = false,
|
use_default_keymaps = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
map('n', '<leader>j', require('treesj').toggle, { desc = 'fold code' })
|
map("n", "<leader>j", require("treesj").toggle, { desc = "fold code" })
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
return { 'windwp/nvim-ts-autotag',
|
return { "windwp/nvim-ts-autotag",
|
||||||
requires = {
|
requires = "nvim-treesitter/nvim-treesitter",
|
||||||
'nvim-telescope/telescope.nvim',
|
|
||||||
'nvim-treesitter/nvim-treesitter'
|
|
||||||
},
|
|
||||||
disable = not vim.fn.has("nvim-0.9.5"),
|
disable = not vim.fn.has("nvim-0.9.5"),
|
||||||
|
|
||||||
function()
|
function()
|
||||||
require('nvim-ts-autotag').setup {}
|
require("nvim-ts-autotag").setup {}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map = misc.map
|
local map = misc.map
|
||||||
|
|
||||||
return { 'mbbill/undotree',
|
return { "mbbill/undotree",
|
||||||
function()
|
function()
|
||||||
if vim.g.loaded_undotree then
|
if vim.g.loaded_undotree then
|
||||||
vim.g.undotree_DiffAutoOpen = 0
|
vim.g.undotree_DiffAutoOpen = 0
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
return { 'lervag/vimtex',
|
return { "lervag/vimtex",
|
||||||
setup = function()
|
setup = function()
|
||||||
vim.g.vimtex_view_method = "zathura"
|
vim.g.vimtex_view_method = "zathura"
|
||||||
end
|
end
|
||||||
|
@ -1,24 +1,38 @@
|
|||||||
local misc = require('core.misc')
|
local misc = require("core.misc")
|
||||||
local map, include = misc.map, misc.include
|
local map, include = misc.map, misc.include
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local function on_list(options)
|
-- TODO: find a way to make the qflist current item be the one closest to the
|
||||||
vim.fn.setqflist({}, 'r', options)
|
-- cursor whenever we open it
|
||||||
if #options.items > 1 then
|
local function on_list(opts)
|
||||||
|
vim.fn.setqflist({}, "r", opts)
|
||||||
|
if #opts.items > 1 then
|
||||||
vim.cmd.copen()
|
vim.cmd.copen()
|
||||||
end
|
end
|
||||||
vim.cmd("cc! 1")
|
vim.cmd(".cc! 1")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function _w(func)
|
---@type vim.lsp.util.open_floating_preview.Opts
|
||||||
return function()
|
local popup_opts = {
|
||||||
func({
|
border = vim.g.border_style
|
||||||
border = "solid",
|
}
|
||||||
max_width = math.floor(vim.o.columns * 0.7),
|
---@type vim.lsp.buf.hover.Opts
|
||||||
}, { on_list = on_list })
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
end
|
local hover_opts = vim.tbl_deep_extend("force", popup_opts, {})
|
||||||
end
|
|
||||||
|
---@type vim.lsp.buf.signature_help.Opts
|
||||||
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
|
local signature_opts = vim.tbl_deep_extend("force", popup_opts, {})
|
||||||
|
|
||||||
|
---@type vim.lsp.ListOpts
|
||||||
|
local list_opts = {
|
||||||
|
on_list = on_list
|
||||||
|
}
|
||||||
|
|
||||||
|
---@type vim.lsp.LocationOpts
|
||||||
|
---@diagnostic disable-next-line: assign-type-mismatch
|
||||||
|
local location_opts = vim.tbl_deep_extend("force", list_opts, {})
|
||||||
|
|
||||||
--- setup basic options on lsp attach
|
--- setup basic options on lsp attach
|
||||||
---@param bufnr number buffer number
|
---@param bufnr number buffer number
|
||||||
@ -26,39 +40,35 @@ local function attach(bufnr)
|
|||||||
local opts = { buffer = bufnr, nowait = true }
|
local opts = { buffer = bufnr, nowait = true }
|
||||||
|
|
||||||
-- LSP actions
|
-- LSP actions
|
||||||
map('n', 'K', _w(vim.lsp.buf.hover), opts)
|
map("n", "K", function() vim.lsp.buf.hover(hover_opts) end, opts)
|
||||||
map('n', 'gd', _w(vim.lsp.buf.definition), opts)
|
map("n", "gd", function() vim.lsp.buf.definition(location_opts) end, opts)
|
||||||
map('n', 'gD', _w(vim.lsp.buf.declaration), opts)
|
map("n", "gD", function() vim.lsp.buf.declaration(location_opts) end, opts)
|
||||||
map('n', 'gi', _w(vim.lsp.buf.implementation), opts)
|
map("n", "gi", function() vim.lsp.buf.implementation(location_opts) end, opts)
|
||||||
map('n', 'gy', _w(vim.lsp.buf.type_definition), opts)
|
map("n", "gy", function() vim.lsp.buf.type_definition(location_opts) end, opts)
|
||||||
map('n', 'gr', _w(vim.lsp.buf.references), opts)
|
map("n", "gr", function() vim.lsp.buf.references(nil, list_opts) end, opts)
|
||||||
map('n', '<S-Tab>', _w(vim.lsp.buf.signature_help), opts)
|
map("n", "<S-Tab>", function() vim.lsp.buf.signature_help(signature_opts) end, opts)
|
||||||
map('n', { '<leader>r', '<F2>' }, _w(vim.lsp.buf.rename), opts)
|
map("n", { "<leader>r", "<F2>" }, vim.lsp.buf.rename, opts)
|
||||||
map('n', 'gA', _w(vim.lsp.buf.code_action), {
|
map("n", { "gA", "<F4>" }, vim.lsp.buf.code_action, {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
desc = 'check code actions',
|
desc = "check code actions",
|
||||||
})
|
|
||||||
map('n', '<F4>', _w(vim.lsp.buf.code_action), {
|
|
||||||
buffer = bufnr,
|
|
||||||
desc = 'check code actions'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Diagnostics
|
-- Diagnostics
|
||||||
map('n', '[d', function()
|
map("n", "[d", function()
|
||||||
if not vim.fn.has("nvim-0.11") then
|
if not vim.fn.has("nvim-0.11") then
|
||||||
vim.diagnostic.goto_prev()
|
vim.diagnostic.goto_prev()
|
||||||
else
|
else
|
||||||
vim.diagnostic.jump({ count = -1 })
|
vim.diagnostic.jump({ count = -1 })
|
||||||
end
|
end
|
||||||
end, opts)
|
end, opts)
|
||||||
map('n', ']d', function()
|
map("n", "]d", function()
|
||||||
if not vim.fn.has("nvim-0.11") then
|
if not vim.fn.has("nvim-0.11") then
|
||||||
vim.diagnostic.goto_next()
|
vim.diagnostic.goto_next()
|
||||||
else
|
else
|
||||||
vim.diagnostic.jump({ count = 1 })
|
vim.diagnostic.jump({ count = 1 })
|
||||||
end
|
end
|
||||||
end, opts)
|
end, opts)
|
||||||
-- map('n', 'qD', vim.diagnostic.setqflist, opts)
|
-- map("n", "qD", vim.diagnostic.setqflist, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
@ -81,18 +91,18 @@ function M.setup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if not vim.fn.has("nvim-0.11") then
|
if not vim.fn.has("nvim-0.11") then
|
||||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||||
vim.lsp.handlers.hover, { border = 'solid' })
|
vim.lsp.handlers.hover, { border = vim.g.border_style })
|
||||||
|
|
||||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
||||||
vim.lsp.handlers.signature_help, { border = 'solid' })
|
vim.lsp.handlers.signature_help, { border = vim.g.border_style })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- set default capabilities
|
-- set default capabilities
|
||||||
include('lspconfig.util').default_config.capabilities = M.capabilities
|
include("lspconfig.util").default_config.capabilities = M.capabilities
|
||||||
|
|
||||||
-- run whenever a client attaches
|
-- run whenever a client attaches
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
callback = function(event)
|
callback = function(event)
|
||||||
-- map keybinds
|
-- map keybinds
|
||||||
attach(event.buf)
|
attach(event.buf)
|
||||||
@ -100,6 +110,8 @@ function M.setup()
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- FIXME: I don"t like this way of doing things, there has to be a better way
|
||||||
|
|
||||||
--- capabilities that are to be used in lsp servers, for those setup through
|
--- capabilities that are to be used in lsp servers, for those setup through
|
||||||
--- lspconfig, this is already set as the default. Incase there is a server
|
--- lspconfig, this is already set as the default. Incase there is a server
|
||||||
--- not setup through lspconfig this function may be called to receive the
|
--- not setup through lspconfig this function may be called to receive the
|
||||||
@ -109,7 +121,7 @@ M.capabilities = vim.lsp.protocol.make_client_capabilities()
|
|||||||
--- add capabilities to the default capabilities string
|
--- add capabilities to the default capabilities string
|
||||||
---@param new_capabilities lsp.ClientCapabilities
|
---@param new_capabilities lsp.ClientCapabilities
|
||||||
function M.add_capabilities(new_capabilities)
|
function M.add_capabilities(new_capabilities)
|
||||||
vim.tbl_deep_extend('force', M.capabilities, new_capabilities)
|
vim.tbl_deep_extend("force", M.capabilities, new_capabilities)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -9,7 +9,7 @@ M.appid = "Nvim Config"
|
|||||||
function M.include(fn)
|
function M.include(fn)
|
||||||
local ok, r = pcall(require, fn)
|
local ok, r = pcall(require, fn)
|
||||||
if not ok then
|
if not ok then
|
||||||
vim.notify('Could not find "'..fn..'": '..r, vim.log.levels.WARN, { title = M.appid })
|
vim.notify("Could not find '"..fn.."': "..r, vim.log.levels.WARN, { title = M.appid })
|
||||||
return ok
|
return ok
|
||||||
end
|
end
|
||||||
return r
|
return r
|
||||||
@ -26,26 +26,6 @@ function M.loopf(path, body, ext)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- set colorscheme
|
|
||||||
---@param name string name of colorscheme
|
|
||||||
function M.colorscheme(name)
|
|
||||||
-- only set the colorscheme if it exists
|
|
||||||
for _, v in pairs(vim.fn.getcompletion('', 'color')) do
|
|
||||||
if v == name then
|
|
||||||
vim.cmd("colorscheme "..name)
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- override with any addons
|
|
||||||
for _, v in pairs(vim.fn.getcompletion('', 'color')) do
|
|
||||||
if v == name..'.ext' then
|
|
||||||
vim.cmd("colorscheme"..name..'.ext')
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- extend vim.kemap.set
|
--- extend vim.kemap.set
|
||||||
---@param mode string|table mode for the keymap
|
---@param mode string|table mode for the keymap
|
||||||
---@param bind string|table keymap
|
---@param bind string|table keymap
|
||||||
@ -53,26 +33,26 @@ end
|
|||||||
---@param opts vim.keymap.set.Opts? keymap options
|
---@param opts vim.keymap.set.Opts? keymap options
|
||||||
function M.map(mode, bind, cmd, opts)
|
function M.map(mode, bind, cmd, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts['noremap'] = true
|
opts["noremap"] = true
|
||||||
opts['silent'] = true
|
opts["silent"] = true
|
||||||
|
|
||||||
-- attempt to autogenerate a basic description
|
-- attempt to autogenerate a basic description
|
||||||
if not opts['desc'] then
|
if not opts["desc"] then
|
||||||
if type(cmd) == "string" then
|
if type(cmd) == "string" then
|
||||||
opts['desc'] = cmd:gsub("<%a+>", "")
|
opts["desc"] = cmd:gsub("<%a+>", "")
|
||||||
elseif type(cmd) == "function" then
|
elseif type(cmd) == "function" then
|
||||||
-- TODO: find a way to generate a better name
|
-- TODO: find a way to generate a better name
|
||||||
local file_name = vim.fn.fnamemodify(debug.getinfo(cmd, "S").short_src, ":t")
|
local file_name = vim.fn.fnamemodify(debug.getinfo(cmd, "S").short_src, ":t")
|
||||||
opts['desc'] = "origin@"..file_name
|
opts["desc"] = "origin@"..file_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- define the keybinds
|
-- define the keybinds
|
||||||
if type(bind) == 'table' then
|
if type(bind) == "table" then
|
||||||
for i in pairs(bind) do
|
for i in pairs(bind) do
|
||||||
vim.keymap.set(mode, bind[i], cmd, opts)
|
vim.keymap.set(mode, bind[i], cmd, opts)
|
||||||
end
|
end
|
||||||
elseif type(bind) == 'string' then
|
elseif type(bind) == "string" then
|
||||||
vim.keymap.set(mode, bind, cmd, opts)
|
vim.keymap.set(mode, bind, cmd, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -110,11 +90,11 @@ end
|
|||||||
function M.highlight(group, opts, namespace)
|
function M.highlight(group, opts, namespace)
|
||||||
namespace = namespace or 0
|
namespace = namespace or 0
|
||||||
|
|
||||||
if type(group) == 'table' then
|
if type(group) == "table" then
|
||||||
for i in pairs(group) do
|
for i in pairs(group) do
|
||||||
vim.api.nvim_set_hl(namespace, group[i], opts)
|
vim.api.nvim_set_hl(namespace, group[i], opts)
|
||||||
end
|
end
|
||||||
elseif type(group) == 'string' then
|
elseif type(group) == "string" then
|
||||||
vim.api.nvim_set_hl(namespace, group, opts)
|
vim.api.nvim_set_hl(namespace, group, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
ls = require('luasnip')
|
ls = require("luasnip")
|
||||||
s = ls.snippet
|
s = ls.snippet
|
||||||
sn = ls.snippet_node
|
sn = ls.snippet_node
|
||||||
t = ls.text_node
|
t = ls.text_node
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
local map = require('core.misc').map
|
|
||||||
|
|
||||||
return function(server_name, attach, capabilities)
|
|
||||||
require('lspconfig')[server_name].setup {
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
attach(client, bufnr)
|
|
||||||
|
|
||||||
-- add some clangd specific mappings
|
|
||||||
local opts = { buffer = bufnr }
|
|
||||||
map("n", "<leader>o", "<cmd>ClangdSwitchSourceHeader<CR>", opts)
|
|
||||||
end,
|
|
||||||
capabilities = capabilities,
|
|
||||||
|
|
||||||
cmd = {
|
|
||||||
"clangd",
|
|
||||||
"--background-index",
|
|
||||||
"--clang-tidy",
|
|
||||||
"--header-insertion=iwyu",
|
|
||||||
"--completion-style=detailed",
|
|
||||||
"--function-arg-placeholders",
|
|
||||||
"--fallback-style=llvm"
|
|
||||||
},
|
|
||||||
init_options = {
|
|
||||||
usePlaceholders = true,
|
|
||||||
clangdFileStatus = true,
|
|
||||||
fallback_flags = {
|
|
||||||
"-xc" -- makes clangd think we're using c instead of c++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
@ -1,4 +1,4 @@
|
|||||||
require('core.snippets.shorthands')
|
require("core.snippets.shorthands")
|
||||||
|
|
||||||
--- create a decleration of a function from it's definition using treesitter
|
--- create a decleration of a function from it's definition using treesitter
|
||||||
---@param func string
|
---@param func string
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require('core.snippets.shorthands')
|
require("core.snippets.shorthands")
|
||||||
require('core.snippets.functions')
|
require("core.snippets.functions")
|
||||||
|
|
||||||
--- shortcut to choose between java access modifiers
|
--- shortcut to choose between java access modifiers
|
||||||
---@param idx number index of the node
|
---@param idx number index of the node
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
require('core.snippets.shorthands')
|
|
||||||
|
|
||||||
return {
|
|
||||||
-- basic make template snippet
|
|
||||||
s("make", {
|
|
||||||
t({ "PKG_CONFIG = pkg-config", "CC = cc", "VERSION = " }),
|
|
||||||
i(1, "0.1"),
|
|
||||||
t({ "", "", "# flags and incs", "PKGS = " }),
|
|
||||||
i(2),
|
|
||||||
t({ "", "CFLAGS = -DVERSION=\\\"$(VERSION)\\\" -Wall" }),
|
|
||||||
i(3),
|
|
||||||
t({ "", "LIBS = `$(PKG_CONFIG) --libs --cflags $(PKGS)`" }),
|
|
||||||
i(4),
|
|
||||||
t({ "", "", "PREFIX = " }),
|
|
||||||
i(5, "/usr/local"),
|
|
||||||
t({ "", "MANDIR = $(PREFIX)/share/man" }),
|
|
||||||
t({ "", "", "all: " }),
|
|
||||||
i(6, "main"),
|
|
||||||
t({ "", "" }),
|
|
||||||
rep(6),
|
|
||||||
t(": "),
|
|
||||||
rep(6),
|
|
||||||
t({ ".o", "\t$(CC) *.o $(CFLAGS) $(LIBS) -o $@", "" }),
|
|
||||||
rep(6),
|
|
||||||
t(".o: "),
|
|
||||||
rep(6),
|
|
||||||
t({ ".c", "", "clean:", "\trm -f " }),
|
|
||||||
rep(6),
|
|
||||||
t({ " *.o", "", "install: " }),
|
|
||||||
rep(6),
|
|
||||||
t({ "", "\tmkdir -p $(PREFIX)/bin", "\tcp -f " }),
|
|
||||||
rep(6),
|
|
||||||
t({ " $(PREFIX)/bin", "\tchmod 755 $(PREFIX)/bin/" }),
|
|
||||||
rep(6),
|
|
||||||
t({ "", "\tmkdir -p $(MANDIR)/man1", "\tcp -f " }),
|
|
||||||
rep(6),
|
|
||||||
t({ ".1 $(MANDIR)/man1", "\tchmod 644 $(MANDIR)/man1/" }),
|
|
||||||
rep(6),
|
|
||||||
t({ ".1", "", "uninstall: " }),
|
|
||||||
rep(6),
|
|
||||||
t({ "", "\trm -f $(PREFIX)/bin/" }),
|
|
||||||
rep(6),
|
|
||||||
t(" $(MANDIR)/man1/"),
|
|
||||||
rep(6),
|
|
||||||
t(".1")
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
require('core.snippets.shorthands')
|
require("core.snippets.shorthands")
|
||||||
require('core.snippets.functions')
|
require("core.snippets.functions")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- header level 1, usually this has the same name as the file
|
-- header level 1, usually this has the same name as the file
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
require('core.snippets.shorthands')
|
require("core.snippets.shorthands")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- translate snippet
|
-- translate snippet
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
require('core.snippets.shorthands')
|
require("core.snippets.shorthands")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
s("php", {
|
s("php", {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require('core.snippets.shorthands')
|
require("core.snippets.shorthands")
|
||||||
require('core.snippets.functions')
|
require("core.snippets.functions")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- document snippet
|
-- document snippet
|
||||||
|
Reference in New Issue
Block a user