Move lua files for automatic loading
This commit is contained in:
parent
3aeea26b73
commit
5feb871a98
|
@ -27,6 +27,7 @@ cmp.setup({
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'vsnip' },
|
{ name = 'vsnip' },
|
||||||
|
{ name = "copilot"},
|
||||||
},{
|
},{
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
--{ name = 'path' },
|
--{ name = 'path' },
|
6
init.vim
6
init.vim
|
@ -187,13 +187,7 @@ let g:signify_vcs_list = [ 'git', 'hg' ]
|
||||||
let g:localvimrc_whitelist='/home/crater2150/work/.*'
|
let g:localvimrc_whitelist='/home/crater2150/work/.*'
|
||||||
let g:localvimrc_sandbox=0
|
let g:localvimrc_sandbox=0
|
||||||
|
|
||||||
lua require("my-lsp")
|
|
||||||
lua require("conf.cmp")
|
|
||||||
lua require("conf.trouble")
|
|
||||||
lua require("conf.treesitter")
|
|
||||||
set foldmethod=expr
|
set foldmethod=expr
|
||||||
set foldexpr=nvim_treesitter#foldexpr()
|
set foldexpr=nvim_treesitter#foldexpr()
|
||||||
set nofoldenable " Disable folding at startup.
|
set nofoldenable " Disable folding at startup.
|
||||||
lua require("conf.telescope")
|
|
||||||
lua require("conf.indent-blankline")
|
|
||||||
" vi:foldmethod=marker sw=2
|
" vi:foldmethod=marker sw=2
|
||||||
|
|
|
@ -1,137 +0,0 @@
|
||||||
<<<<<<< Updated upstream
|
|
||||||
local lspconfig = require('lspconfig')
|
|
||||||
local configs = require('lspconfig.configs')
|
|
||||||
=======
|
|
||||||
local lsp_status = require('lsp-status')
|
|
||||||
|
|
||||||
lsp_status.register_progress()
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
-- enable snippet support
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
|
||||||
capabilities.textDocument.completion.completionItem.resolveSupport = {
|
|
||||||
properties = {
|
|
||||||
'documentation',
|
|
||||||
'detail',
|
|
||||||
'additionalTextEdits',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
capabilities = vim.tbl_extend('keep', capabilities or {}, lsp_status.capabilities)
|
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
|
||||||
-- after the language server attaches to the current buffer
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
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
|
|
||||||
|
|
||||||
--Enable completion triggered by <c-x><c-o>
|
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
|
||||||
|
|
||||||
-- Mappings.
|
|
||||||
local opts = { noremap=true, silent=true }
|
|
||||||
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
|
||||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('v', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<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', '<M-a>', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<M-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', '<M-q>', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
|
||||||
buf_set_keymap("n", "<Leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
|
||||||
|
|
||||||
lsp_status.on_attach(client)
|
|
||||||
|
|
||||||
--require'completion'.on_attach(client, bufnr)
|
|
||||||
end
|
|
||||||
|
|
||||||
local lsp_installer = require("nvim-lsp-installer")
|
|
||||||
lsp_installer.on_server_ready(function(server)
|
|
||||||
local opts = {}
|
|
||||||
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
-- (optional) Customize the options passed to the server
|
|
||||||
-- if server.name == "tsserver" then
|
|
||||||
-- opts.root_dir = function() ... end
|
|
||||||
-- end
|
|
||||||
=======
|
|
||||||
require'lspinstall'.setup() -- important
|
|
||||||
|
|
||||||
local servers = require'lspinstall'.installed_servers()
|
|
||||||
for _, server in pairs(servers) do
|
|
||||||
require'lspconfig'[server].setup{
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
-- This setup() function is exactly the same as lspconfig's setup function.
|
|
||||||
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
|
||||||
server:setup(opts)
|
|
||||||
end)
|
|
||||||
|
|
||||||
metals_config = require("metals").bare_config()
|
|
||||||
metals_config.init_options.statusBarProvider = "on"
|
|
||||||
metals_config.settings = { showImplicitArguments = true }
|
|
||||||
metals_config.on_attach = on_attach
|
|
||||||
metals_config.capabilities = capabilities
|
|
||||||
|
|
||||||
vim.cmd [[augroup lsp]]
|
|
||||||
vim.cmd [[au!]]
|
|
||||||
vim.cmd [[au FileType scala,sbt lua require("metals").initialize_or_attach(metals_config)]]
|
|
||||||
vim.cmd [[augroup end]]
|
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
|
||||||
-- map buffer local keybindings when the language server attaches
|
|
||||||
<<<<<<< Updated upstream
|
|
||||||
local servers = { "lemminx" }
|
|
||||||
for _, lsp in ipairs(servers) do
|
|
||||||
lspconfig[lsp].setup {
|
|
||||||
on_attach = on_attach,
|
|
||||||
capabilities = capabilities,
|
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 150,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
=======
|
|
||||||
--local nvim_lsp = require('lspconfig')
|
|
||||||
--local servers = { "lemminx" }
|
|
||||||
--for _, lsp in ipairs(servers) do
|
|
||||||
-- nvim_lsp[lsp].setup {
|
|
||||||
-- on_attach = on_attach,
|
|
||||||
-- capabilities = capabilities,
|
|
||||||
-- flags = {
|
|
||||||
-- debounce_text_changes = 150,
|
|
||||||
-- }
|
|
||||||
-- }
|
|
||||||
--end
|
|
||||||
>>>>>>> Stashed changes
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
virtual_text = false,
|
|
||||||
underline = true,
|
|
||||||
signs = true,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
|
|
||||||
vim.lsp.handlers.signature_help, {
|
|
||||||
silent = true, focusable = false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- vim.cmd [[autocmd CursorMoved * lua vim.lsp.diagnostic.show_line_diagnostics()]]
|
|
||||||
-- vim.cmd [[autocmd CursorMoved * lua vim.lsp.diagnostic.show_line_diagnostics()]]
|
|
||||||
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
|
|
||||||
vim.cmd [[autocmd CursorHold * lua vim.lsp.diagnostic.show_line_diagnostics({max_width = 100, focusable = false})]]
|
|
Loading…
Reference in a new issue