set runtimepath^=~/.vim runtimepath+=~/.vim/after set termguicolors " True Color support let &packpath = &runtimepath source ~/.vimrc inoremap inoremap map n NERDTreeTabsToggle lua << EOF vim.g.markdown_fenced_languages = { "ts=typescript" } local nvim_lsp = require('lspconfig') local function goto_definition(split_cmd) local util = vim.lsp.util local log = require("vim.lsp.log") local api = vim.api -- note, this handler style is for neovim 0.5.1/0.6, if on 0.5, call with function(_, method, result) local handler = function(_, result, ctx) if result == nil or vim.tbl_isempty(result) then local _ = log.info() and log.info(ctx.method, "No location found") return nil end if split_cmd then vim.cmd(split_cmd) end if vim.tbl_islist(result) then util.jump_to_location(result[1]) if #result > 1 then util.set_qflist(util.locations_to_items(result)) api.nvim_command("copen") api.nvim_command("wincmd p") end else util.jump_to_location(result) end end return handler end vim.lsp.handlers["textDocument/definition"] = goto_definition('vsplit') -- 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 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', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) buf_set_keymap('n', '', 'lua vim.lsp.buf.signature_help()', opts) buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) buf_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) buf_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) end nvim_lsp.denols.setup{ on_attach = on_attach, flags = { debounce_text_changes = 150, } } EOF