merge
commit
227e6d7116
@ -0,0 +1,45 @@
|
|||||||
|
vim.cmd [[packadd nvim-lspconfig]]
|
||||||
|
vim.cmd [[packadd nvim-compe]]
|
||||||
|
|
||||||
|
local nvim_lsp = require("lspconfig")
|
||||||
|
|
||||||
|
function on_attach(client)
|
||||||
|
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.declaration()<CR>", opts)
|
||||||
|
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", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||||
|
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||||
|
|
||||||
|
-- Set some keybinds conditional on server capabilities
|
||||||
|
if client.resolved_capabilities.document_formatting then
|
||||||
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||||
|
elseif client.resolved_capabilities.document_range_formatting then
|
||||||
|
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local servers = {"tsserver", "cssls", "html" , "pyls"}
|
||||||
|
for _, lsp in ipairs(servers) do
|
||||||
|
nvim_lsp[lsp].setup {on_attach = on_attach}
|
||||||
|
end
|
@ -1,42 +0,0 @@
|
|||||||
vim.cmd [[packadd nvim-lspconfig]]
|
|
||||||
vim.cmd [[packadd nvim-compe]]
|
|
||||||
local nvim_lsp = require('lspconfig')
|
|
||||||
function on_attach(client)
|
|
||||||
|
|
||||||
|
|
||||||
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.declaration()<CR>', opts)
|
|
||||||
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', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
|
||||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '[d', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
|
||||||
buf_set_keymap('n', ']d', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
|
||||||
buf_set_keymap('n', '<space>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
|
||||||
if client.resolved_capabilities.document_formatting then
|
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
|
||||||
elseif client.resolved_capabilities.document_range_formatting then
|
|
||||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local servers = { "tsserver", "cssls", "pyls", "html" }
|
|
||||||
for _, lsp in ipairs(servers) do
|
|
||||||
nvim_lsp[lsp].setup { on_attach = on_attach }
|
|
||||||
end
|
|
@ -1,141 +0,0 @@
|
|||||||
" Automatically generated packer.nvim plugin loader code
|
|
||||||
|
|
||||||
if !has('nvim-0.5')
|
|
||||||
echohl WarningMsg
|
|
||||||
echom "Invalid Neovim version for packer.nvim!"
|
|
||||||
echohl None
|
|
||||||
finish
|
|
||||||
endif
|
|
||||||
|
|
||||||
packadd packer.nvim
|
|
||||||
|
|
||||||
try
|
|
||||||
|
|
||||||
lua << END
|
|
||||||
local package_path_str = "/home/sid/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/sid/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/sid/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/sid/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
|
||||||
local install_cpath_pattern = "/home/sid/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
|
||||||
if not string.find(package.path, package_path_str, 1, true) then
|
|
||||||
package.path = package.path .. ';' .. package_path_str
|
|
||||||
end
|
|
||||||
|
|
||||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
|
||||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
|
||||||
end
|
|
||||||
|
|
||||||
local function try_loadstring(s, component, name)
|
|
||||||
local success, result = pcall(loadstring(s))
|
|
||||||
if not success then
|
|
||||||
print('Error running ' .. component .. ' for ' .. name)
|
|
||||||
error(result)
|
|
||||||
end
|
|
||||||
return result
|
|
||||||
end
|
|
||||||
|
|
||||||
_G.packer_plugins = {
|
|
||||||
["base16-vim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/base16-vim"
|
|
||||||
},
|
|
||||||
["galaxyline.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/galaxyline.nvim"
|
|
||||||
},
|
|
||||||
["gitsigns.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/gitsigns.nvim"
|
|
||||||
},
|
|
||||||
["indent-blankline.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim"
|
|
||||||
},
|
|
||||||
indentLine = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/indentLine"
|
|
||||||
},
|
|
||||||
["lspkind-nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/lspkind-nvim"
|
|
||||||
},
|
|
||||||
neoformat = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/neoformat"
|
|
||||||
},
|
|
||||||
["nvim-autopairs"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-autopairs"
|
|
||||||
},
|
|
||||||
["nvim-bufferline.lua"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-bufferline.lua"
|
|
||||||
},
|
|
||||||
["nvim-colorizer.lua"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua"
|
|
||||||
},
|
|
||||||
["nvim-compe"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-compe"
|
|
||||||
},
|
|
||||||
["nvim-lspconfig"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-lspconfig"
|
|
||||||
},
|
|
||||||
["nvim-tree.lua"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-tree.lua"
|
|
||||||
},
|
|
||||||
["nvim-treesitter"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-treesitter"
|
|
||||||
},
|
|
||||||
["nvim-web-devicons"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/nvim-web-devicons"
|
|
||||||
},
|
|
||||||
["packer.nvim"] = {
|
|
||||||
loaded = false,
|
|
||||||
needs_bufread = false,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/opt/packer.nvim"
|
|
||||||
},
|
|
||||||
["plenary.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/plenary.nvim"
|
|
||||||
},
|
|
||||||
["popup.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/popup.nvim"
|
|
||||||
},
|
|
||||||
["startuptime.vim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/startuptime.vim"
|
|
||||||
},
|
|
||||||
["telescope-media-files.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/telescope-media-files.nvim"
|
|
||||||
},
|
|
||||||
["telescope.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/telescope.nvim"
|
|
||||||
},
|
|
||||||
["vim-auto-save"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/vim-auto-save"
|
|
||||||
},
|
|
||||||
["vim-closetag"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/vim-closetag"
|
|
||||||
},
|
|
||||||
["vim-devicons"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/home/sid/.local/share/nvim/site/pack/packer/start/vim-devicons"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
END
|
|
||||||
|
|
||||||
catch
|
|
||||||
echohl ErrorMsg
|
|
||||||
echom "Error in packer_compiled: " .. v:exception
|
|
||||||
echom "Please check your config for correctness"
|
|
||||||
echohl None
|
|
||||||
endtry
|
|
Loading…
Reference in New Issue