added jdtls, need to play with it some more to add missing keymaps and
dap (need to properly configure dap anyway) remove nvim-tree remove goyo and limelight commands and keymaps
This commit is contained in:
parent
11763243dc
commit
4f2c968b33
2
init.lua
2
init.lua
@ -29,7 +29,7 @@ vim.opt.incsearch = true
|
||||
vim.opt.scrolloff = 12
|
||||
vim.opt.sidescrolloff = 8
|
||||
vim.opt.mouse = 'a'
|
||||
vim.opt.autochdir = true
|
||||
vim.opt.autochdir = false
|
||||
vim.opt.clipboard = 'unnamed,unnamedplus'
|
||||
vim.opt.number = true
|
||||
vim.opt.wrap = false
|
||||
|
@ -23,10 +23,10 @@
|
||||
"nvim-dap": { "branch": "master", "commit": "2b428ff2632e73295e9decbcf1c40d8e26213305" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "a5606bc5958db86f8d92803bea7400ee26a8d7e4" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "484995d573c0f0563f6a66ebdd6c67b649489615" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ff97d376b1d22b2eaf9274605531babf0cd0cf21" },
|
||||
"nvim-jdtls": { "branch": "master", "commit": "99e4b2081de1d9162666cc7b563cbeb01c26b66b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a67bc39aaa4f1e13212c5022a561120846eaef27" },
|
||||
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "ad0b95dee55955817af635fa121f6e2486b10583" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "e5a05ba5e298cc1e1dad8eb8095b8d4d89a7f793" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "047ce49ccf9a2dce22e1cf3843bef3b5682a8144" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "3722e3d1fb5fe1896a104eb489e8f8651260b520" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
|
@ -1,8 +1,5 @@
|
||||
-- commands.lua
|
||||
|
||||
vim.cmd 'autocmd! User GoyoEnter Limelight'
|
||||
vim.cmd 'autocmd! User GoyoLeave Limelight!'
|
||||
|
||||
vim.cmd 'autocmd BufRead,BufNewFile *.wiki,*.md,*.tex set wrap'
|
||||
|
||||
vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
|
||||
@ -10,3 +7,31 @@ vim.cmd 'au BufRead,BufNewFile *.kdl set filetype=kdl'
|
||||
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.format()]]
|
||||
|
||||
vim.cmd 'command W :execute \':silent w !sudo tee % > /dev/null\' | :edit!'
|
||||
|
||||
-- Array of file names indicating root directory. Modify to your liking.
|
||||
local root_names = { '.git', 'Makefile' }
|
||||
|
||||
-- Cache to use for speed up (at cost of possibly outdated results)
|
||||
local root_cache = {}
|
||||
|
||||
local set_root = function()
|
||||
-- Get directory path to start search from
|
||||
local path = vim.api.nvim_buf_get_name(0)
|
||||
if path == '' then return end
|
||||
path = vim.fs.dirname(path)
|
||||
|
||||
-- Try cache and resort to searching upward for root directory
|
||||
local root = root_cache[path]
|
||||
if root == nil then
|
||||
local root_file = vim.fs.find(root_names, { path = path, upward = true })[1]
|
||||
if root_file == nil then return end
|
||||
root = vim.fs.dirname(root_file)
|
||||
root_cache[path] = root
|
||||
end
|
||||
|
||||
-- Set current directory
|
||||
vim.fn.chdir(root)
|
||||
end
|
||||
|
||||
local root_augroup = vim.api.nvim_create_augroup('MyAutoRoot', {})
|
||||
vim.api.nvim_create_autocmd('BufEnter', { group = root_augroup, callback = set_root })
|
||||
|
@ -8,10 +8,6 @@ local function map(mode, lhs, rhs, opts)
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function maps.toggleGoyo()
|
||||
map('n', '<C-g>', ':Goyo<Enter>', { noremap = false })
|
||||
end
|
||||
|
||||
function maps.term()
|
||||
-- Open and move to resized terminal
|
||||
map('n', '<leader>t', '<C-w>s<C-w>j :terminal<CR>:res 5<CR>i', { noremap = false })
|
||||
@ -45,10 +41,10 @@ end
|
||||
function maps.init()
|
||||
vim.g.mapleader = " "
|
||||
|
||||
map('n', '<leader>b', '<cmd>NvimTreeToggle<CR>')
|
||||
-- map('n', '<leader>b', '<cmd>NvimTreeToggle<CR>')
|
||||
map('n', '<leader>b', '<cmd>Lexplore | vert res 30<CR>')
|
||||
map('n', '<leader>cc', '<cmd>Telescope colorscheme<CR>')
|
||||
|
||||
maps.toggleGoyo()
|
||||
maps.term()
|
||||
maps.telescope()
|
||||
maps.fixIndent()
|
||||
|
@ -152,6 +152,135 @@ return {
|
||||
}
|
||||
end
|
||||
},
|
||||
{
|
||||
'mfussenegger/nvim-jdtls',
|
||||
ft = { "java" },
|
||||
config = function()
|
||||
local home = os.getenv('HOME')
|
||||
local jdtls = require('jdtls')
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local root_markers = { 'gradlew', 'mvnw', 'git' }
|
||||
local root_dir = require('jdtls.setup').find_root(root_markers)
|
||||
local workspace_folder = home .. "/.local/share/eclipse/" .. vim.fn.fnamemodify(root_dir, ":p:h:t")
|
||||
local config = {
|
||||
flags = {
|
||||
debounce_text_changes = 80,
|
||||
},
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach, -- We pass our on_attach keybindings to the configuration map
|
||||
root_dir = root_dir, -- Set the root directory to our found root_marker
|
||||
-- here you can configure eclipse.jdt.ls specific settings
|
||||
-- these are defined by the eclipse.jdt.ls project and will be passed to eclipse when starting.
|
||||
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
|
||||
-- for a list of options
|
||||
settings = {
|
||||
java = {
|
||||
format = {
|
||||
settings = {
|
||||
-- use google java style guidelines for formatting
|
||||
-- to use, make sure to download the file from https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style.xml
|
||||
-- and place it in the ~/.local/share/eclipse directory
|
||||
-- url = "/.local/share/eclipse/eclipse-java-google-style.xml",
|
||||
-- profile = "googlestyle",
|
||||
},
|
||||
},
|
||||
signaturehelp = { enabled = true },
|
||||
contentprovider = { preferred = 'fernflower' }, -- use fernflower to decompile library code
|
||||
-- specify any completion options
|
||||
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.*"
|
||||
},
|
||||
filteredtypes = {
|
||||
-- "com.sun.*",
|
||||
-- "io.micrometer.shaded.*",
|
||||
-- "java.awt.*",
|
||||
-- "jdk.*", "sun.*",
|
||||
},
|
||||
},
|
||||
-- specify any options for organizing imports
|
||||
sources = {
|
||||
organizeimports = {
|
||||
starthreshold = 9999,
|
||||
staticstarthreshold = 9999,
|
||||
},
|
||||
},
|
||||
-- how code generation should act
|
||||
codegeneration = {
|
||||
tostring = {
|
||||
template = "${object.classname}{${member.name()}=${member.value}, ${othermembers}}"
|
||||
},
|
||||
hashcodeequals = {
|
||||
usejava7objects = true,
|
||||
},
|
||||
useblocks = true,
|
||||
},
|
||||
-- if you are developing in projects with different java versions, you need
|
||||
-- to tell eclipse.jdt.ls to use the location of the jdk for your java version
|
||||
-- see https://github.com/eclipse/eclipse.jdt.ls/wiki/running-the-java-ls-server-from-the-command-line#initialize-request
|
||||
-- and search for `interface runtimeoption`
|
||||
-- the `name` is not arbitrary, but must match one of the elements from `enum executionenvironment` in the link above
|
||||
configuration = {
|
||||
runtimes = {
|
||||
{
|
||||
name = "JavaSE-17",
|
||||
path = home .. "/.local/share/asdf/installs/java/oracle-17.0.11/",
|
||||
},
|
||||
{
|
||||
name = "JavaSE-21",
|
||||
path = home .. "/.local/share/asdf/installs/java/oracle-21.0.2/",
|
||||
},
|
||||
{
|
||||
name = "JavaSE-1.8",
|
||||
path = home .. "/.local/share/asdf/installs/java/adoptopenjdk-8.0.412+8/"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
-- cmd is the command that starts the language server. whatever is placed
|
||||
-- here is what is passed to the command line to execute jdtls.
|
||||
-- note that eclipse.jdt.ls must be started with a java version of 17 or higher
|
||||
-- see: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
|
||||
-- for the full list of options
|
||||
cmd = {
|
||||
home .. "/.local/share/asdf/installs/java/oracle-21.0.2/bin/java",
|
||||
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
'-Dosgi.bundles.defaultstartlevel=4',
|
||||
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
'-Dlog.protocol=true',
|
||||
'-Dlog.level=all',
|
||||
'-Xmx4G',
|
||||
'--add-modules=ALL-SYSTEM',
|
||||
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
|
||||
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
|
||||
-- if you use lombok, download the lombok jar and place it in ~/.local/share/eclipse
|
||||
'-javaagent:' .. home .. '/.local/share/nvim/mason/packages/jdtls/lombok.jar',
|
||||
|
||||
-- the jar file is located where jdtls was installed. this will need to be updated
|
||||
-- to the location where you installed jdtls
|
||||
'-jar', vim.fn.glob(
|
||||
home ..
|
||||
'/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_*.jar'),
|
||||
|
||||
-- the configuration for jdtls is also placed where jdtls was installed. this will
|
||||
-- need to be updated depending on your environment
|
||||
'-configuration', home .. '/.local/share/nvim/mason/packages/jdtls/config_linux',
|
||||
|
||||
-- use the workspace_folder defined above to store data for this project
|
||||
'-data', workspace_folder,
|
||||
},
|
||||
}
|
||||
|
||||
jdtls.start_or_attach(config)
|
||||
end
|
||||
},
|
||||
{ 'onsails/lspkind-nvim' }, -- pictograms replace (?) with lspsaga
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
|
@ -4,16 +4,17 @@ return {
|
||||
version = '0.1.*',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
{
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
config = function()
|
||||
require('nvim-tree').setup {
|
||||
view = {
|
||||
width = 30,
|
||||
side = 'left',
|
||||
},
|
||||
}
|
||||
end,
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
}
|
||||
-- Don't really need it. Nicer than the default but that's it
|
||||
-- {
|
||||
-- 'nvim-tree/nvim-tree.lua',
|
||||
-- config = function()
|
||||
-- require('nvim-tree').setup {
|
||||
-- view = {
|
||||
-- width = 30,
|
||||
-- side = 'left',
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
-- dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
-- }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user