stuf
This commit is contained in:
@ -11,20 +11,21 @@ windows:
|
|||||||
- other:
|
- other:
|
||||||
- hgd gmscore
|
- hgd gmscore
|
||||||
|
|
||||||
- experimental:
|
- experiments:
|
||||||
layout: main-horizontal
|
layout: main-horizontal
|
||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- hgd experimental
|
- hgd experiments
|
||||||
- vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- hgd experimental
|
- hgd experiments
|
||||||
|
|
||||||
- notes:
|
- notes:
|
||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- cd ~/zettelkasten
|
- cd ~/zettelkasten
|
||||||
- vim ~/zettelkasten/Todo.md
|
- vim ~/zettelkasten/Todo.md
|
||||||
|
|
||||||
- dotfiles:
|
- dotfiles:
|
||||||
layout: main-horizontal
|
layout: main-horizontal
|
||||||
panes:
|
panes:
|
||||||
|
@ -1,206 +0,0 @@
|
|||||||
local map = require("utils").map
|
|
||||||
|
|
||||||
map("n", "<leader>db", ":lua require'dap'.toggle_breakpoint()<CR>")
|
|
||||||
map("n", "<leader>dsi", ":lua require'dap'.step_into()<CR>")
|
|
||||||
map("n", "<leader>dso", ":lua require'dap'.step_over()<CR>")
|
|
||||||
map("n", "<leader>di", ":lua require'dap'.repl.open()<CR>")
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
require("jdtls.setup").add_commands()
|
|
||||||
require("jdtls").setup_dap()
|
|
||||||
require("lsp-status").register_progress()
|
|
||||||
-- require'lspkind'.init()
|
|
||||||
-- require'lspsaga'.init_lsp_saga()
|
|
||||||
|
|
||||||
-- Kommentary
|
|
||||||
vim.api.nvim_set_keymap("n", "<leader>/", "<plug>kommentary_line_default", {})
|
|
||||||
vim.api.nvim_set_keymap("v", "<leader>/", "<plug>kommentary_visual_default", {})
|
|
||||||
|
|
||||||
vim.api.nvim_exec(
|
|
||||||
[[
|
|
||||||
augroup FormatAutogroup
|
|
||||||
autocmd!
|
|
||||||
autocmd BufWritePost *.java FormatWrite
|
|
||||||
augroup end
|
|
||||||
]],
|
|
||||||
true
|
|
||||||
)
|
|
||||||
|
|
||||||
local function buf_set_keymap(...)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
|
||||||
end
|
|
||||||
local function buf_set_option(...)
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
||||||
|
|
||||||
-- Mappings.
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
-- buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references() && vim.cmd("copen")<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
|
||||||
-- buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
|
||||||
-- Java specific
|
|
||||||
-- buf_set_keymap("n", "<leader>di", "<Cmd>lua require'jdtls'.organize_imports()<CR>", opts)
|
|
||||||
-- buf_set_keymap("n", "<leader>dt", "<Cmd>lua require'jdtls'.test_class()<CR>", opts)
|
|
||||||
-- buf_set_keymap("n", "<leader>dn", "<Cmd>lua require'jdtls'.test_nearest_method()<CR>", opts)
|
|
||||||
buf_set_keymap("v", "<leader>de", "<Esc><Cmd>lua require('jdtls').extract_variable(true)<CR>", opts)
|
|
||||||
buf_set_keymap("n", "<leader>de", "<Cmd>lua require('jdtls').extract_variable()<CR>", opts)
|
|
||||||
buf_set_keymap("v", "<leader>dm", "<Esc><Cmd>lua require('jdtls').extract_method(true)<CR>", opts)
|
|
||||||
|
|
||||||
vim.api.nvim_exec(
|
|
||||||
[[
|
|
||||||
hi LspReferenceRead cterm=bold ctermbg=red guibg=LightYellow
|
|
||||||
hi LspReferenceText cterm=bold ctermbg=red guibg=LightYellow
|
|
||||||
hi LspReferenceWrite cterm=bold ctermbg=red guibg=LightYellow
|
|
||||||
augroup lsp_document_highlight
|
|
||||||
autocmd!
|
|
||||||
autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()
|
|
||||||
autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()
|
|
||||||
augroup END
|
|
||||||
]],
|
|
||||||
false
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
local root_markers = { "gradlew", "pom.xml", "BUILD" }
|
|
||||||
local root_dir = require("jdtls.setup").find_root(root_markers)
|
|
||||||
local home = os.getenv("HOME")
|
|
||||||
|
|
||||||
local capabilities = {
|
|
||||||
workspace = {
|
|
||||||
configuration = true,
|
|
||||||
},
|
|
||||||
textDocument = {
|
|
||||||
completion = {
|
|
||||||
completionItem = {
|
|
||||||
snippetSupport = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
local workspace_folder = home .. "/.workspace" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
|
|
||||||
local config = {
|
|
||||||
flags = {
|
|
||||||
allow_incremental_sync = true,
|
|
||||||
},
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
}
|
|
||||||
|
|
||||||
config.settings = {
|
|
||||||
["java.format.settings.url"] = home .. "/.config/nvim/language-servers/java-google-formatter.xml",
|
|
||||||
["java.format.settings.profile"] = "GoogleStyle",
|
|
||||||
java = {
|
|
||||||
signatureHelp = { enabled = true },
|
|
||||||
contentProvider = { preferred = "fernflower" },
|
|
||||||
completion = {
|
|
||||||
favoriteStaticMembers = {
|
|
||||||
"org.hamcrest.MatcherAssert.assertThat",
|
|
||||||
"org.hamcrest.Matchers.*",
|
|
||||||
"org.hamcrest.CoreMatchers.*",
|
|
||||||
"org.junit.jupiter.api.Assertions.*",
|
|
||||||
"java.util.Objects.requireNonNull",
|
|
||||||
"java.util.Objects.requireNonNullElse",
|
|
||||||
"org.mockito.Mockito.*",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sources = {
|
|
||||||
organizeImports = {
|
|
||||||
starThreshold = 9999,
|
|
||||||
staticStarThreshold = 9999,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
codeGeneration = {
|
|
||||||
toString = {
|
|
||||||
template = "${object.className}{${member.name()}=${member.value}, ${otherMembers}}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
configuration = {
|
|
||||||
runtimes = {
|
|
||||||
{
|
|
||||||
name = "JavaSE-11",
|
|
||||||
path = home .. "/.sdkman/candidates/java/11.0.10-open/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "JavaSE-14",
|
|
||||||
path = home .. "/.sdkman/candidates/java/14.0.2-open/",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name = "JavaSE-15",
|
|
||||||
path = home .. "/.sdkman/candidates/java/15.0.1-open/",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
config.cmd = { "javalsp", workspace_folder }
|
|
||||||
config.on_attach = on_attach
|
|
||||||
config.on_init = function(client, _)
|
|
||||||
client.notify("workspace/didChangeConfiguration", { settings = config.settings })
|
|
||||||
end
|
|
||||||
|
|
||||||
local extendedClientCapabilities = require("jdtls").extendedClientCapabilities
|
|
||||||
extendedClientCapabilities.resolveAdditionalTextEditsSupport = true
|
|
||||||
config.init_options = {
|
|
||||||
-- bundles = bundles;
|
|
||||||
extendedClientCapabilities = extendedClientCapabilities,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- UI
|
|
||||||
local finders = require("telescope.finders")
|
|
||||||
local sorters = require("telescope.sorters")
|
|
||||||
local actions = require("telescope.actions")
|
|
||||||
local pickers = require("telescope.pickers")
|
|
||||||
require("jdtls.ui").pick_one_async = function(items, prompt, label_fn, cb)
|
|
||||||
local opts = {}
|
|
||||||
pickers
|
|
||||||
.new(opts, {
|
|
||||||
prompt_title = prompt,
|
|
||||||
finder = finders.new_table({
|
|
||||||
results = items,
|
|
||||||
entry_maker = function(entry)
|
|
||||||
return {
|
|
||||||
value = entry,
|
|
||||||
display = label_fn(entry),
|
|
||||||
ordinal = label_fn(entry),
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}),
|
|
||||||
sorter = sorters.get_generic_fuzzy_sorter(),
|
|
||||||
attach_mappings = function(prompt_bufnr)
|
|
||||||
actions.goto_file_selection_edit:replace(function()
|
|
||||||
local selection = actions.get_selected_entry(prompt_bufnr)
|
|
||||||
actions.close(prompt_bufnr)
|
|
||||||
|
|
||||||
cb(selection.value)
|
|
||||||
end)
|
|
||||||
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
:find()
|
|
||||||
end
|
|
||||||
|
|
||||||
local dap = require("dap")
|
|
||||||
dap.configurations.java = {
|
|
||||||
{
|
|
||||||
type = "java",
|
|
||||||
request = "attach",
|
|
||||||
name = "Debug (Attach) - Remote",
|
|
||||||
hostName = "127.0.0.1",
|
|
||||||
port = 5005,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Server
|
|
||||||
require("jdtls").start_or_attach(config)
|
|
@ -46,8 +46,8 @@ return {
|
|||||||
|
|
||||||
local conditionalSources = cmp.config.sources({
|
local conditionalSources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp", priority = 6 },
|
{ name = "nvim_lsp", priority = 6 },
|
||||||
{ name = "nvim_lsp_signature_help", priority = 7 },
|
{ name = "nvim_lsp_signature_help", priority = 6 },
|
||||||
{ name = "luasnip", priority = 8 },
|
{ name = "luasnip", priority = 7 },
|
||||||
{ name = "calc" },
|
{ name = "calc" },
|
||||||
{ name = "crates" },
|
{ name = "crates" },
|
||||||
{ name = "nvim_lua" },
|
{ name = "nvim_lua" },
|
||||||
@ -69,7 +69,7 @@ return {
|
|||||||
if use_google() then
|
if use_google() then
|
||||||
require("cmp_nvim_ciderlsp").setup()
|
require("cmp_nvim_ciderlsp").setup()
|
||||||
table.insert(conditionalSources, { name = "analysislsp" })
|
table.insert(conditionalSources, { name = "analysislsp" })
|
||||||
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 9 })
|
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 8 })
|
||||||
else
|
else
|
||||||
table.insert(conditionalSources, { name = "cmp_tabnine" })
|
table.insert(conditionalSources, { name = "cmp_tabnine" })
|
||||||
end
|
end
|
||||||
@ -140,7 +140,7 @@ return {
|
|||||||
|
|
||||||
sorting = {
|
sorting = {
|
||||||
comparators = {
|
comparators = {
|
||||||
cmp.config.compare.priority,
|
-- cmp.config.compare.priority,
|
||||||
cmp.config.compare.offset,
|
cmp.config.compare.offset,
|
||||||
cmp.config.compare.exact,
|
cmp.config.compare.exact,
|
||||||
cmp.config.compare.score,
|
cmp.config.compare.score,
|
||||||
@ -160,6 +160,8 @@ return {
|
|||||||
|
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
|
with_text = true,
|
||||||
|
|
||||||
-- mode = "symbol_text",
|
-- mode = "symbol_text",
|
||||||
-- before = function(entry, vim_item)
|
-- before = function(entry, vim_item)
|
||||||
-- if entry.source.name == "nvim_ciderlsp" then
|
-- if entry.source.name == "nvim_ciderlsp" then
|
||||||
@ -172,7 +174,7 @@ return {
|
|||||||
-- end
|
-- end
|
||||||
-- return vim_item
|
-- return vim_item
|
||||||
-- end,
|
-- end,
|
||||||
maxwidth = 40, -- half max width
|
maxwidth = 50, -- half max width
|
||||||
menu = {
|
menu = {
|
||||||
nvim_ciderlsp = "",
|
nvim_ciderlsp = "",
|
||||||
buffer = "",
|
buffer = "",
|
||||||
|
@ -162,10 +162,6 @@ return {
|
|||||||
local my_on_attach = function(client, bufnr)
|
local my_on_attach = function(client, bufnr)
|
||||||
require("lualine").refresh()
|
require("lualine").refresh()
|
||||||
|
|
||||||
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
|
|
||||||
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
|
|
||||||
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
|
|
||||||
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
|
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
|
||||||
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
||||||
|
Reference in New Issue
Block a user