nvim
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
local config = {
|
||||||
|
cmd = {'/usr/bin/jdtls'},
|
||||||
|
root_dir = vim.fs.dirname(vim.fs.find({'gradlew', '.git', 'mvnw'}, { upward = true })[1]),
|
||||||
|
}
|
||||||
|
require('jdtls').start_or_attach(config)
|
||||||
@@ -2,6 +2,7 @@ require("globals")
|
|||||||
require("options")
|
require("options")
|
||||||
require("config.lazy")
|
require("config.lazy")
|
||||||
require("mappings")
|
require("mappings")
|
||||||
|
require("autocmd")
|
||||||
vim.cmd("source ~/.config/nvim/suda.vim")
|
vim.cmd("source ~/.config/nvim/suda.vim")
|
||||||
local time = tonumber( os.date "%H" )
|
local time = tonumber( os.date "%H" )
|
||||||
|
|
||||||
@@ -25,3 +26,6 @@ local bg_color = vim.api.nvim_get_hl_by_name('Normal', true).background
|
|||||||
vim.api.nvim_set_hl(0, 'WinSeparator', { fg = vim.api.nvim_get_hl_by_name('NvimTreeEndOfBuffer', true).foreground, bg = 'NONE' })
|
vim.api.nvim_set_hl(0, 'WinSeparator', { fg = vim.api.nvim_get_hl_by_name('NvimTreeEndOfBuffer', true).foreground, bg = 'NONE' })
|
||||||
vim.api.nvim_set_hl(0, 'NvimTreeWinSeparator', { fg = bg_color, bg = 'NONE' })
|
vim.api.nvim_set_hl(0, 'NvimTreeWinSeparator', { fg = bg_color, bg = 'NONE' })
|
||||||
vim.api.nvim_set_hl(0, 'NvimTreeCursorLine', { bg = vim.api.nvim_get_hl_by_name('CursorLine', true).background })
|
vim.api.nvim_set_hl(0, 'NvimTreeCursorLine', { bg = vim.api.nvim_get_hl_by_name('CursorLine', true).background })
|
||||||
|
vim.api.nvim_set_hl(0, 'LspReferenceWrite', { bg = vim.api.nvim_get_hl_by_name('CursorLine', true).background })
|
||||||
|
vim.api.nvim_set_hl(0, 'LspReferenceText', { bg = vim.api.nvim_get_hl_by_name('CursorLine', true).background })
|
||||||
|
vim.api.nvim_set_hl(0, 'LspReferenceRead', { bg = vim.api.nvim_get_hl_by_name('CursorLine', true).background })
|
||||||
|
|||||||
+8
-6
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"CopilotChat.nvim": { "branch": "main", "commit": "7e6583c75f1231ea1eac70e06995dd3f97a58478" },
|
"CopilotChat.nvim": { "branch": "main", "commit": "07bcd20f408d9e43bdfab0e96c3f4d3aa860ef6a" },
|
||||||
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
"LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" },
|
||||||
"auto-session": { "branch": "main", "commit": "9c3f977aafb56bd73ba0d082c4dcbdba5666faf3" },
|
"auto-session": { "branch": "main", "commit": "9c3f977aafb56bd73ba0d082c4dcbdba5666faf3" },
|
||||||
"base46-colors": { "branch": "main", "commit": "131ca742f6e8d1eb4c938a2519a94840ba129c2f" },
|
"base46-colors": { "branch": "main", "commit": "131ca742f6e8d1eb4c938a2519a94840ba129c2f" },
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
"command-completion.nvim": { "branch": "main", "commit": "56c98f8d59a88ed96a80d43abca74a60ba31ea3a" },
|
"command-completion.nvim": { "branch": "main", "commit": "56c98f8d59a88ed96a80d43abca74a60ba31ea3a" },
|
||||||
"copilot.lua": { "branch": "master", "commit": "30321e33b03cb924fdcd6a806a0dc6fa0b0eafb9" },
|
"copilot.lua": { "branch": "master", "commit": "30321e33b03cb924fdcd6a806a0dc6fa0b0eafb9" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||||
|
"focus.nvim": { "branch": "master", "commit": "d76338e58e49f844e8f6a7aff16a74a2a55a80ef" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" },
|
"lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" },
|
||||||
"lightline-gruvbox.vim": { "branch": "master", "commit": "d233416d566e61f879bd19d9d498b01b1b7e336c" },
|
"lightline-gruvbox.vim": { "branch": "master", "commit": "d233416d566e61f879bd19d9d498b01b1b7e336c" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
|
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
|
||||||
@@ -20,18 +21,19 @@
|
|||||||
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
|
"nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
"nvim-cmp": { "branch": "main", "commit": "12509903a5723a876abd65953109f926f4634c30" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
"nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "7af2c37192deae28d1305ae9e68544f7fb5408e1" },
|
"nvim-jdtls": { "branch": "master", "commit": "2f7bff9b8d2ee1918b36ca55f19547d9d335a268" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "1110787f1b464888c59a044c48c5119d14078044" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
"nvim-notify": { "branch": "master", "commit": "22f29093eae7785773ee9d543f8750348b1a195c" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "80523101f0ae48b7f1990e907b685a3d79776c01" },
|
"nvim-tree.lua": { "branch": "master", "commit": "80523101f0ae48b7f1990e907b685a3d79776c01" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "00a513f87ee3c339c2024b08db3eb63ba7736ed6" },
|
"nvim-treesitter": { "branch": "master", "commit": "d2ff4006418750aa8b91f280e66bdb623c891c95" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
|
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
|
||||||
"onedarkpro.nvim": { "branch": "main", "commit": "992780fb5b28abcef125271c8c2c41e302c2df26" },
|
"onedarkpro.nvim": { "branch": "main", "commit": "b2712b3163f2b531cc26d1af07f49f683460e5a3" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "011d98eaa3a73b5a51d82ce5bc6b1397dde95562" },
|
"rainbow-delimiters.nvim": { "branch": "master", "commit": "011d98eaa3a73b5a51d82ce5bc6b1397dde95562" },
|
||||||
"snacks.nvim": { "branch": "main", "commit": "b02cb5e8826179b385b870edbda1631213391cf1" },
|
"snacks.nvim": { "branch": "main", "commit": "a4e2c3e4fc54af78c7d351fe84399305119f59fa" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "78857db9e8d819d3cc1a9a7bdc1d39d127a36495" },
|
"telescope.nvim": { "branch": "master", "commit": "78857db9e8d819d3cc1a9a7bdc1d39d127a36495" },
|
||||||
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
|
"undotree": { "branch": "main", "commit": "eab459ab87dd249617b5f7187bb69e614a083047" },
|
||||||
"vim-fugitive": { "branch": "master", "commit": "b068eaf1e6cbe35d1ac100d435cd7f7b74a5c87d" },
|
"vim-fugitive": { "branch": "master", "commit": "4a745ea72fa93bb15dd077109afbb3d1809383f2" },
|
||||||
"vim-suda": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }
|
"vim-suda": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
vim.api.nvim_create_autocmd({'BufEnter', 'QuitPre'}, {
|
||||||
|
nested = false,
|
||||||
|
callback = function(e)
|
||||||
|
local tree = require('nvim-tree.api').tree
|
||||||
|
|
||||||
|
-- Nothing to do if tree is not opened
|
||||||
|
if not tree.is_visible() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- How many focusable windows do we have? (excluding e.g. incline status window)
|
||||||
|
local winCount = 0
|
||||||
|
for _,winId in ipairs(vim.api.nvim_list_wins()) do
|
||||||
|
if vim.api.nvim_win_get_config(winId).focusable then
|
||||||
|
winCount = winCount + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We want to quit and only one window besides tree is left
|
||||||
|
if e.event == 'QuitPre' and winCount == 2 then
|
||||||
|
vim.api.nvim_cmd({cmd = 'qall'}, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- :bd was probably issued an only tree window is left
|
||||||
|
-- Behave as if tree was closed (see `:h :bd`)
|
||||||
|
if e.event == 'BufEnter' and winCount == 1 then
|
||||||
|
-- Required to avoid "Vim:E444: Cannot close last window"
|
||||||
|
vim.defer_fn(function()
|
||||||
|
-- close nvim-tree: will go to the last buffer used before closing
|
||||||
|
tree.toggle({find_file = true, focus = true})
|
||||||
|
-- re-open nivm-tree
|
||||||
|
tree.toggle({find_file = true, focus = false})
|
||||||
|
end, 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
require("focus").setup({
|
||||||
|
enable = true,
|
||||||
|
commands = true,
|
||||||
|
autoresize = {
|
||||||
|
enable = true,
|
||||||
|
width = 0,
|
||||||
|
height = 0,
|
||||||
|
minwidth = 0,
|
||||||
|
minheight = 0,
|
||||||
|
height_quickfix = 10,
|
||||||
|
},
|
||||||
|
split = {
|
||||||
|
bufnew = false,
|
||||||
|
tmux = false,
|
||||||
|
},
|
||||||
|
ui = {
|
||||||
|
number = false,
|
||||||
|
relativenumber = false,
|
||||||
|
hybridnumber = false,
|
||||||
|
absolutenumber_unfocussed = false,
|
||||||
|
|
||||||
|
cursorline = true,
|
||||||
|
cursorcolumn = false,
|
||||||
|
colorcolumn = {
|
||||||
|
enable = false,
|
||||||
|
list = '+1',
|
||||||
|
},
|
||||||
|
signcolumn = false,
|
||||||
|
winhighlight = false,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
local ignore_filetypes = {"NvimTree"}
|
||||||
|
local ignore_buftypes = {"prompt", "popup"}
|
||||||
|
|
||||||
|
local augroup =
|
||||||
|
vim.api.nvim_create_augroup("FocusDisable", { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("WinEnter", {
|
||||||
|
group = augroup,
|
||||||
|
callback = function(_)
|
||||||
|
if vim.tbl_contains(ignore_buftypes, vim.bo.buftype)
|
||||||
|
then
|
||||||
|
vim.w.focus_disable = true
|
||||||
|
else
|
||||||
|
vim.w.focus_disable = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Disable focus autoresize for BufType",
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
group = augroup,
|
||||||
|
callback = function(_)
|
||||||
|
if vim.tbl_contains(ignore_filetypes, vim.bo.filetype) then
|
||||||
|
vim.b.focus_disable = true
|
||||||
|
else
|
||||||
|
vim.b.focus_disable = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
desc = "Disable focus autoresize for FileType",
|
||||||
|
})
|
||||||
@@ -125,7 +125,7 @@ local servers = {
|
|||||||
"texlab",
|
"texlab",
|
||||||
"pyright",
|
"pyright",
|
||||||
"ts_ls",
|
"ts_ls",
|
||||||
"jdtls",
|
-- "jdtls",
|
||||||
"sourcekit",
|
"sourcekit",
|
||||||
"zls",
|
"zls",
|
||||||
}
|
}
|
||||||
@@ -134,3 +134,12 @@ for _, server in ipairs(servers) do
|
|||||||
lspconfig[server].setup {
|
lspconfig[server].setup {
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- lspconfig.jdtls.setup {
|
||||||
|
-- cmd = { "jdtls", "-Dfile.encoding=UTF-8" },
|
||||||
|
-- }
|
||||||
|
|
||||||
|
-- lspconfig.java_language_server.setup {
|
||||||
|
-- filetypes = { "java" },
|
||||||
|
-- cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" },
|
||||||
|
-- }
|
||||||
|
|||||||
+82
-82
@@ -67,85 +67,85 @@ local function format_message(message, percentage)
|
|||||||
return (percentage and percentage .. "%\t" or "") .. (message or "")
|
return (percentage and percentage .. "%\t" or "") .. (message or "")
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
-- vim.lsp.handlers["$/progress"] = function(_, result, ctx)
|
||||||
local client_id = ctx.client_id
|
-- local client_id = ctx.client_id
|
||||||
|
--
|
||||||
local val = result.value
|
-- local val = result.value
|
||||||
|
--
|
||||||
if not val.kind then
|
-- if not val.kind then
|
||||||
return
|
-- return
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
local notif_data = get_notif_data(client_id, result.token)
|
-- local notif_data = get_notif_data(client_id, result.token)
|
||||||
|
--
|
||||||
if val.kind == "begin" then
|
-- if val.kind == "begin" then
|
||||||
local message = format_message(val.message, val.percentage)
|
-- local message = format_message(val.message, val.percentage)
|
||||||
|
--
|
||||||
notif_data.notification = vim.notify(message, "info", {
|
-- notif_data.notification = vim.notify(message, "info", {
|
||||||
title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
|
-- title = format_title(val.title, vim.lsp.get_client_by_id(client_id).name),
|
||||||
icon = spinner_frames[1],
|
-- icon = spinner_frames[1],
|
||||||
timeout = false,
|
-- timeout = false,
|
||||||
hide_from_history = false,
|
-- hide_from_history = false,
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
notif_data.spinner = 1
|
-- notif_data.spinner = 1
|
||||||
update_spinner(client_id, result.token)
|
-- update_spinner(client_id, result.token)
|
||||||
elseif val.kind == "report" and notif_data then
|
-- elseif val.kind == "report" and notif_data then
|
||||||
notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
|
-- notif_data.notification = vim.notify(format_message(val.message, val.percentage), "info", {
|
||||||
replace = notif_data.notification,
|
-- replace = notif_data.notification,
|
||||||
hide_from_history = false,
|
-- hide_from_history = false,
|
||||||
})
|
-- })
|
||||||
elseif val.kind == "end" and notif_data then
|
-- elseif val.kind == "end" and notif_data then
|
||||||
notif_data.notification =
|
-- notif_data.notification =
|
||||||
vim.notify(val.message and format_message(val.message) or "Complete", "info", {
|
-- vim.notify(val.message and format_message(val.message) or "Complete", "info", {
|
||||||
icon = "",
|
-- icon = "",
|
||||||
replace = notif_data.notification,
|
-- replace = notif_data.notification,
|
||||||
timeout = 6000,
|
-- timeout = 6000,
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
notif_data.spinner = nil
|
-- notif_data.spinner = nil
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
local severity = {
|
-- local severity = {
|
||||||
"error",
|
-- "error",
|
||||||
"warn",
|
-- "warn",
|
||||||
"info",
|
-- "info",
|
||||||
"info", -- map both hint and info to info?
|
-- "info", -- map both hint and info to info?
|
||||||
}
|
-- }
|
||||||
vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
|
-- vim.lsp.handlers["window/showMessage"] = function(err, method, params, client_id)
|
||||||
vim.notify(method.message, severity[params.type])
|
-- vim.notify(method.message, severity[params.type])
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
dap.listeners.before['event_progressStart']['progress-notifications'] = function(session, body)
|
-- dap.listeners.before['event_progressStart']['progress-notifications'] = function(session, body)
|
||||||
local notif_data = get_notif_data("dap", body.progressId)
|
-- local notif_data = get_notif_data("dap", body.progressId)
|
||||||
|
--
|
||||||
local message = format_message(body.message, body.percentage)
|
-- local message = format_message(body.message, body.percentage)
|
||||||
notif_data.notification = vim.notify(message, "info", {
|
-- notif_data.notification = vim.notify(message, "info", {
|
||||||
title = format_title(body.title, session.config.type),
|
-- title = format_title(body.title, session.config.type),
|
||||||
icon = spinner_frames[1],
|
-- icon = spinner_frames[1],
|
||||||
timeout = false,
|
-- timeout = false,
|
||||||
hide_from_history = false,
|
-- hide_from_history = false,
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
notif_data.notification.spinner = 1,
|
-- notif_data.notification.spinner = 1,
|
||||||
update_spinner("dap", body.progressId)
|
-- update_spinner("dap", body.progressId)
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
dap.listeners.before['event_progressUpdate']['progress-notifications'] = function(session, body)
|
-- dap.listeners.before['event_progressUpdate']['progress-notifications'] = function(session, body)
|
||||||
local notif_data = get_notif_data("dap", body.progressId)
|
-- local notif_data = get_notif_data("dap", body.progressId)
|
||||||
notif_data.notification = vim.notify(format_message(body.message, body.percentage), "info", {
|
-- notif_data.notification = vim.notify(format_message(body.message, body.percentage), "info", {
|
||||||
replace = notif_data.notification,
|
-- replace = notif_data.notification,
|
||||||
hide_from_history = false,
|
-- hide_from_history = false,
|
||||||
})
|
-- })
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
dap.listeners.before['event_progressEnd']['progress-notifications'] = function(session, body)
|
-- dap.listeners.before['event_progressEnd']['progress-notifications'] = function(session, body)
|
||||||
local notif_data = client_notifs["dap"][body.progressId]
|
-- local notif_data = client_notifs["dap"][body.progressId]
|
||||||
notif_data.notification = vim.notify(body.message and format_message(body.message) or "Complete", "info", {
|
-- notif_data.notification = vim.notify(body.message and format_message(body.message) or "Complete", "info", {
|
||||||
icon = "",
|
-- icon = "",
|
||||||
replace = notif_data.notification,
|
-- replace = notif_data.notification,
|
||||||
timeout = 6000
|
-- timeout = 6000
|
||||||
})
|
-- })
|
||||||
notif_data.spinner = nil
|
-- notif_data.spinner = nil
|
||||||
end
|
-- end
|
||||||
|
|||||||
@@ -182,4 +182,13 @@ return {
|
|||||||
{
|
{
|
||||||
"andweeb/presence.nvim",
|
"andweeb/presence.nvim",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"nvim-focus/focus.nvim",
|
||||||
|
config = function()
|
||||||
|
require("config.focus")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"mfussenegger/nvim-jdtls",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user