Update init.lua
This commit is contained in:
parent
967641f214
commit
31e6909cf1
1 changed files with 44 additions and 21 deletions
|
@ -26,6 +26,8 @@ plug('tree-sitter/tree-sitter')
|
||||||
plug('tpope/vim-surround')
|
plug('tpope/vim-surround')
|
||||||
plug('neovim/nvim-lsp')
|
plug('neovim/nvim-lsp')
|
||||||
plug('neovim/nvim-lspconfig')
|
plug('neovim/nvim-lspconfig')
|
||||||
|
plug('williamboman/nvim-lsp-installer')
|
||||||
|
plug('mfussenegger/nvim-jdtls')
|
||||||
plug('junegunn/goyo.vim', {['for'] = 'markdown'})
|
plug('junegunn/goyo.vim', {['for'] = 'markdown'})
|
||||||
plug('junegunn/fzf', {['dir'] = '~/.fzf', ['do'] = './install --all'})
|
plug('junegunn/fzf', {['dir'] = '~/.fzf', ['do'] = './install --all'})
|
||||||
plug('junegunn/fzf.vim')
|
plug('junegunn/fzf.vim')
|
||||||
|
@ -95,10 +97,10 @@ vim.cmd('colo gruvbox')
|
||||||
vim.o.background = 'light'
|
vim.o.background = 'light'
|
||||||
-- Rainbow Parens for Clojure, and Lisp
|
-- Rainbow Parens for Clojure, and Lisp
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
filetype on
|
filetype on
|
||||||
filetype plugin on
|
filetype plugin on
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
autocmd Filetype clojure,clj,lisp,lsp,cl,l :RainbowToggle
|
autocmd Filetype clojure,clj,lisp,lsp,cl,l :RainbowToggle
|
||||||
]])
|
]])
|
||||||
-- Auto complete
|
-- Auto complete
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap=true, silent=true }
|
||||||
|
@ -107,20 +109,20 @@ map('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||||
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
map('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||||
map('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
map('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
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')
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||||
end
|
end
|
||||||
local cmp_capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local cmp_capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
local servers = { 'clojure_lsp', 'gopls', 'clangd', 'tsserver' }
|
local servers = { 'clojure_lsp', 'gopls', 'clangd', 'tsserver' }
|
||||||
|
@ -133,8 +135,29 @@ for _, lsp in pairs(servers) do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
-- Java auto complete/LSP
|
||||||
|
local jdtls_cfg = {
|
||||||
|
cmd = {
|
||||||
|
'java',
|
||||||
|
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||||
|
'-Dosgi.bundles.defaultStartLevel=4',
|
||||||
|
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||||
|
'-Dlog.protocol=true',
|
||||||
|
'-Dlog.level=ALL',
|
||||||
|
'-Xms1g',
|
||||||
|
'--add-modules=ALL-SYSTEM',
|
||||||
|
'--add-opens', 'java.base/java.util=ALL-UNNAMED',
|
||||||
|
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
|
||||||
|
'-jar', '~/.local/share/nvim/lsp_servers/jdtls/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.2.400.v20211117-0650.jar',
|
||||||
|
'-configuration', '~/.local/share/nvim/lsp_servers/jdtls/config_mac'
|
||||||
|
},
|
||||||
|
root_dir = require('jdtls.setup').find_root({'.git', 'mvnw', 'gradlew'})
|
||||||
|
}
|
||||||
|
if vim.bo.filetype == 'java' then
|
||||||
|
require('jdtls').start_or_attach(jdtls_cfg)
|
||||||
|
end
|
||||||
-- 2 Tab space standard languages
|
-- 2 Tab space standard languages
|
||||||
-- Clojure and Common Lisp style is 2 space indent
|
-- Clojure and Common Lisp style is 2 space indent
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
autocmd Filetype clojure,clj,lisp,lsp,cl,l,javascript,js,typescript,ts setlocal tabstop=2 shiftwidth=2
|
autocmd Filetype clojure,clj,lisp,lsp,cl,l,javascript,js,typescript,ts setlocal tabstop=2 shiftwidth=2
|
||||||
]])
|
]])
|
||||||
|
|
Loading…
Reference in a new issue