Move lua files for automatic loading

This commit is contained in:
Alexander Gehrke 2023-03-08 18:25:14 +01:00
parent 3aeea26b73
commit 5feb871a98
8 changed files with 1 additions and 143 deletions

View file

@ -1,49 +0,0 @@
local cmp = require('cmp')
cmp.setup({
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-y>'] = cmp.mapping.confirm({ select = true }),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end
},
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
},{
{ name = 'buffer' },
--{ name = 'path' },
}),
})
--cmp.setup.cmdline({ '/', '?' }, {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = {
-- { name = 'buffer' }
-- }
--})
--
---- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
--cmp.setup.cmdline(':', {
-- mapping = cmp.mapping.preset.cmdline(),
-- sources = cmp.config.sources({ }, {
-- { name = 'cmdline' }
-- })
--})

View file

@ -1,17 +0,0 @@
vim.cmd [[highlight IndentBlanklineIndent1 guibg=#333333 gui=nocombine]]
vim.cmd [[highlight IndentBlanklineIndent2 guibg=#000000 gui=nocombine]]
require("indent_blankline").setup {
char = "",
char_highlight_list = {
"IndentBlanklineIndent1",
"IndentBlanklineIndent2",
},
space_char_highlight_list = {
"IndentBlanklineIndent1",
"IndentBlanklineIndent2",
},
show_trailing_blankline_indent = false,
show_current_context = true,
show_current_context_start = true,
}

View file

@ -1,35 +0,0 @@
local map = vim.keymap.set
telescope = require('telescope')
telescope.builtin = require('telescope.builtin')
telescope.setup {
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
},
["ui-select"] = {
require("telescope.themes").get_dropdown {
-- even more opts
}
}
}
}
telescope.load_extension('fzf')
telescope.load_extension("ui-select")
--telescope.load_extension('lsp_handlers')
--
map('n', 'gff', telescope.builtin.fd)
map('n', 'gfg', telescope.builtin.git_files)
map('n', 'gfs', telescope.builtin.git_status)
map('n', 'gs', telescope.builtin.git_status)
map('n', 'gs', telescope.builtin.lsp_dynamic_workspace_symbols)
map('n', 'g/', telescope.builtin.live_grep)
map('n', '<C-/>', telescope.builtin.current_buffer_fuzzy_find)
map('n', '<leader>*', telescope.builtin.grep_string)
map('n', 'gb', telescope.builtin.buffers)

View file

@ -1,16 +0,0 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "typescript" },
sync_install = true,
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true
},
}

View file

@ -1,11 +0,0 @@
require("trouble").setup {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
vim.api.nvim_set_keymap("n", "<leader>xx", "<cmd>Trouble<cr>", {silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "<leader>xw", "<cmd>Trouble workspace_diagnostics<cr>", {silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "<leader>xd", "<cmd>Trouble document_diagnostics<cr>", {silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "<leader>xl", "<cmd>Trouble loclist<cr>", {silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "<leader>xq", "<cmd>Trouble quickfix<cr>", {silent = true, noremap = true})
vim.api.nvim_set_keymap("n", "gR", "<cmd>Trouble lsp_references<cr>", {silent = true, noremap = true})

View file

@ -1,76 +0,0 @@
--local lsp_status = require('lsp-status')
--lsp_status.register_progress()
local map = vim.keymap.set
map("n", "<leader>dr", function() require("dap").repl.toggle() end, { silent = true })
-- 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_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
--Enable completion triggered by <c-x><c-o>
vim.bo[bufnr].omnifunc = 'v:lua.vim.lsp.omnifunc'
-- Mappings.
local opts = { silent = true, buffer = bufnr }
local loud = { buffer = bufnr }
-- See `:help vim.lsp.*` for documentation on any of the below functions
map('n', 'gD', vim.lsp.buf.declaration, opts)
map('n', 'gd', vim.lsp.buf.definition, opts)
map('n', 'K', vim.lsp.buf.hover, opts)
map('v', 'K', vim.lsp.buf.hover, opts)
map('n', 'gi', vim.lsp.buf.implementation, opts)
map('n', '<C-k>', vim.lsp.buf.signature_help, opts)
map('n', '<Leader>D', vim.lsp.buf.type_definition, opts)
map('n', '<Leader>rn', vim.lsp.buf.rename, opts)
map('n', '<M-x>', vim.lsp.buf.code_action, loud)
map('n', '<M-s>', vim.lsp.codelens.run, loud)
map('n', 'gr', vim.lsp.buf.references, opts)
map('n', '<M-e>', vim.diagnostic.open_float, opts)
map('n', '[d', vim.diagnostic.goto_prev, opts)
map('n', ']d', vim.diagnostic.goto_next, opts)
map('n', '<M-q>', vim.diagnostic.setloclist, opts)
map("n", "<Leader>f", function() vim.lsp.buf.format { async = true } end, opts)
map("n", "<leader>dc", function() require("dap").continue() end, opts)
map("n", "<leader>dK", function() require("dap.ui.widgets").hover() end, opts)
map("n", "<leader>dt", function() require("dap").toggle_breakpoint() end, opts)
map("n", "<leader>dso", function() require("dap").step_over() end, opts)
map("n", "<leader>dsi", function() require("dap").step_into() end, opts)
map("n", "<leader>dl", function() require("dap").run_last() end, opts)
map("n", "<leader>aa", vim.diagnostic.setqflist, opts)
map("n", "<leader>aw", function() vim.diagnostic.setqflist({ severity = "W" }) end, opts)
map("n", "<leader>ae", function() vim.diagnostic.setqflist({ severity = "E" }) end, opts)
vim.cmd [[autocmd BufEnter,BufWrite <buffer> lua vim.lsp.codelens.refresh()]]
vim.cmd [[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]]
vim.cmd [[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]]
vim.lsp.codelens.refresh()
end
require("lsp.installer")(on_attach)
require("lsp.metals")(on_attach)
require("lsp.typescript")(on_attach)
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
}
)
local signature_help_cfg = {}
require "lsp_signature".setup(signature_help_cfg)
return { on_attach = on_attach }

View file

@ -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})]]