require('buildcmd') local tbuiltin = require('telescope.builtin') vim.g.mapleader = ' ' --space local function project_files() local opts = {} local ok = pcall(tbuiltin.git_files, opts) if not ok then tbuiltin.find_files(opts) end end -- Mappings, mostly taken from nvim-lspconfig local opts = { noremap=true, silent=true } vim.keymap.set('n', 'q', vim.diagnostic.open_float, opts) vim.keymap.set('n', 'e', 'Ex', opts) vim.keymap.set('n', 'ff', project_files, opts) vim.keymap.set('n', 'fb', 'Telescope buffers', opts) vim.keymap.set('n', 'bb', save_all_and_build, opts) -- TODO: get fancy and read the commentstring and user -- Would love to have this be alt but that doesn't work... vim.keymap.set('i', '', '// TODO(twig): ', opts) vim.keymap.set('i', '', '// NOTE(twig): ', opts) local on_attach = function(client, bufnr) vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings local bufopts = { noremap=true, silent=true, buffer=bufnr } -- Replace these with telescope equivalent vim.keymap.set('n', 'rb', vim.lsp.buf.declaration, bufopts) vim.keymap.set('n', 'rd', vim.lsp.buf.definition, bufopts) vim.keymap.set('n', 'rf', tbuiltin.lsp_references, bufopts) vim.keymap.set('n', 'rs', tbuiltin.lsp_document_symbols, bufopts) vim.keymap.set('n', 'rr', vim.lsp.buf.rename, bufopts) end local lsp_flags = { debounce_text_changes = 150, --wtf is this } require('lspconfig')['zls'].setup { on_attach = on_attach, flags = lsp_flags } --TODO: other languages I care about.