set tgc color darcula set ff=unix ffs=unix,dos set sw=4 ts=4 noet tw=160 cc=160 set spr sb set pb=12 winbl=12 set fcs=eob:\ list lcs=tab:\│\ ,trail:⎵ let g:mapleader = " " set mouse=a set number autocmd FileType yaml setlocal ts=2 sw=2 autocmd FileType yaml.ansible setlocal ts=2 sw=2 autocmd FileType ps1 LspStart " enable Escape key to return to normal mode in terminal window tnoremap function s:InitLSP() lua <'] = cmp.mapping.complete(), [''] = cmp.mapping.confirm({ select = true }), }) } local caps = vim.lsp.protocol.make_client_capabilities() caps = cmp_lsp.update_capabilities(caps) local opts = {noremap = true, silent = true} local function nn(from, to) vim.api.nvim_set_keymap("n", from, to, opts) end nn("e", "lua vim.diagnostic.open_float()") nn("p", "lua vim.diagnostic.goto_prev()") nn("n", "lua vim.diagnostic.goto_next()") nn("", "tabp") nn("", "tabn") local function onattach(client, buf) local function nn(from, to) vim.api.nvim_buf_set_keymap(buf, "n", from, to, opts) end nn("gD", "lua vim.lsp.buf.declaration()") nn("gd", "lua vim.lsp.buf.definition()") nn("K", "lua vim.lsp.buf.hover()") nn("gi", "lua vim.lsp.buf.implementation()") nn("", "lua vim.lsp.buf.signature_help()") nn("D", "lua vim.lsp.buf.type_definition()") nn("r", "lua vim.lsp.buf.rename()") nn("A", "lua vim.lsp.buf.code_action()") nn("R", "lua vim.lsp.buf.references()") nn("f", "lua vim.lsp.buf.formatting()") end local servers = {"clangd", "ansiblels"} -- add others here if you use them! for _, lsp in pairs(servers) do lspconfig[lsp].setup { capabilities = caps, on_attach = onattach, flags = {debounce_text_changes = 500} } end lspconfig['powershell_es'].setup { bundle_path = 'C:/Powershell_ES/PowerShellEditorServices', capabilities = caps, on_attach = onattach, flags = {debounce_text_changes = 500} } EOF endfunction au VimEnter * call s:InitLSP()