Skip to content

Instantly share code, notes, and snippets.

@mjlbach
Created January 26, 2021 20:13
Show Gist options
  • Save mjlbach/70bb5a2924754f25608e9a00e8d0723f to your computer and use it in GitHub Desktop.
Save mjlbach/70bb5a2924754f25608e9a00e8d0723f to your computer and use it in GitHub Desktop.
Issue #272 Repro
local execute = vim.api.nvim_command
local fn = vim.fn
local install_path = "/tmp/site/pack/packer/opt/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
execute("!git clone https://github.com/wbthomason/packer.nvim " .. install_path)
end
execute "packadd packer.nvim"
vim.cmd [[packadd packer.nvim]]
vim.cmd [[autocmd BufWritePost minimal_init.lua PackerCompile]]
vim.cmd [[autocmd BufWritePost minimal_init.lua PackerInstall]]
local use = require('packer').use
require("packer").startup(
{
function()
use "neovim/nvim-lspconfig"
end,
config = {package_root = "/tmp/site/pack"}
}
)
-- LSP settings
-- log file location: $HOME/.local/share/nvim/lsp.log
vim.lsp.set_log_level("debug")
local nvim_lsp = require('lspconfig')
local on_attach = function(_, 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
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings.
local opts = { noremap=true, silent=true }
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('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
end
-- Add the server that troubles you here
local name = "pyright"
local cmd = { "pyright-langserver", "--stdio"} -- needed for elixirls, omnisharp, sumneko_lua
nvim_lsp[name].setup {
cmd = cmd,
on_attach = on_attach,
}
vim.api.nvim_set_keymap('n', '<space>cr', "<cmd>luafile ~/.config/nvim/minimal_init.lua<CR>", { noremap=true, silent = true})
print("Reloaded")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment