My current neovim config
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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', '<leader>q', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '<leader>e', '<cmd>Ex<CR>', opts)
|
||||
vim.keymap.set('n', '<leader>ff', project_files, opts)
|
||||
vim.keymap.set('n', '<leader>fb', '<cmd>Telescope buffers<cr>', opts)
|
||||
vim.keymap.set('n', '<leader>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', '<A-t>', '// TODO(twig): ', opts)
|
||||
vim.keymap.set('i', '<A-y>', '// 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', '<leader>rb', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', '<leader>rd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', '<leader>rf', tbuiltin.lsp_references, bufopts)
|
||||
vim.keymap.set('n', '<leader>rs', tbuiltin.lsp_document_symbols, bufopts)
|
||||
vim.keymap.set('n', '<leader>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.
|
||||
Reference in New Issue
Block a user