2022-01-09 11:31:43 +00:00
|
|
|
vim.cmd([[set runtimepath=$VIMRUNTIME]])
|
|
|
|
vim.cmd([[set packpath=/tmp/nvim/site]])
|
|
|
|
|
|
|
|
local package_root = '/tmp/nvim/site/pack'
|
|
|
|
local install_path = package_root .. '/packer/start/packer.nvim'
|
|
|
|
|
2022-01-13 04:00:54 +00:00
|
|
|
-- IMPORTANT: update the sumneko setup if you need lua language server
|
|
|
|
-- I installed it in '/github/sumneko/lua-language-server'
|
|
|
|
local sumneko_root_path = vim.fn.expand('$HOME') .. '/github/sumneko/lua-language-server'
|
|
|
|
local sumneko_binary = vim.fn.expand('$HOME') .. '/github/sumneko/lua-language-server/bin/macOS/lua-language-server'
|
|
|
|
|
|
|
|
local lua_cfg = {
|
2022-02-19 16:35:40 +00:00
|
|
|
-- cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' },
|
2022-01-13 04:00:54 +00:00
|
|
|
settings = {
|
|
|
|
Lua = {
|
|
|
|
runtime = { version = 'LuaJIT', path = vim.split(package.path, ';') },
|
|
|
|
diagnostics = { enable = true },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2022-02-19 16:35:40 +00:00
|
|
|
if vim.fn.executable('lua-language-server') == 0 then
|
|
|
|
lua_cfg.cmd = { sumneko_binary, '-E', sumneko_root_path .. '/main.lua' }
|
|
|
|
end
|
|
|
|
|
2022-01-09 11:31:43 +00:00
|
|
|
local function load_plugins()
|
|
|
|
require('packer').startup({
|
|
|
|
function(use)
|
|
|
|
use({ 'wbthomason/packer.nvim' })
|
|
|
|
use({
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
config = function()
|
|
|
|
require('nvim-treesitter.configs').setup({
|
|
|
|
ensure_installed = { 'python', 'go', 'javascript' },
|
|
|
|
highlight = { enable = true },
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
run = ':TSUpdate',
|
|
|
|
})
|
|
|
|
use({ 'neovim/nvim-lspconfig' })
|
|
|
|
use({ 'ray-x/lsp_signature.nvim' })
|
|
|
|
use({ 'ray-x/aurora' })
|
|
|
|
use({
|
|
|
|
'ray-x/navigator.lua',
|
2022-07-03 01:37:56 +00:00
|
|
|
-- '~/github/ray-x/navigator.lua',
|
2022-01-09 11:31:43 +00:00
|
|
|
requires = { 'ray-x/guihua.lua', run = 'cd lua/fzy && make' },
|
|
|
|
config = function()
|
|
|
|
require('navigator').setup({
|
|
|
|
lsp_signature_help = true,
|
2022-07-03 14:13:19 +00:00
|
|
|
debug = true,
|
|
|
|
keymaps = { { key = 'gK', func = vim.lsp.buf.definition, doc = 'definition' } },
|
2022-01-09 11:31:43 +00:00
|
|
|
})
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
use({ 'L3MON4D3/LuaSnip' })
|
|
|
|
use({
|
|
|
|
'hrsh7th/nvim-cmp',
|
|
|
|
requires = {
|
|
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
|
|
'saadparwaiz1/cmp_luasnip',
|
|
|
|
},
|
|
|
|
config = function()
|
|
|
|
local cmp = require('cmp')
|
|
|
|
local luasnip = require('luasnip')
|
|
|
|
cmp.setup({
|
|
|
|
snippet = {
|
|
|
|
expand = function(args)
|
|
|
|
require('luasnip').lsp_expand(args.body)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
|
|
|
|
mapping = {
|
|
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
|
|
['<Tab>'] = cmp.mapping(function(fallback)
|
|
|
|
if cmp.visible() then
|
|
|
|
cmp.confirm({ select = true })
|
|
|
|
elseif luasnip.expand_or_locally_jumpable() then
|
|
|
|
luasnip.expand_or_jump()
|
|
|
|
else
|
|
|
|
fallback()
|
|
|
|
end
|
|
|
|
end, { 'i', 's' }),
|
|
|
|
},
|
|
|
|
|
|
|
|
sources = {
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
{ name = 'buffer' },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require('cmp').setup.cmdline(':', {
|
|
|
|
sources = {
|
|
|
|
{ name = 'cmdline' },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
require('cmp').setup.cmdline('/', {
|
|
|
|
sources = {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end,
|
|
|
|
config = {
|
|
|
|
package_root = package_root,
|
|
|
|
compile_path = install_path .. '/plugin/packer_compiled.lua',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
if vim.fn.isdirectory(install_path) == 0 then
|
|
|
|
vim.fn.system({
|
|
|
|
'git',
|
|
|
|
'clone',
|
|
|
|
'https://github.com/wbthomason/packer.nvim',
|
|
|
|
install_path,
|
|
|
|
})
|
|
|
|
load_plugins()
|
|
|
|
require('packer').sync()
|
2022-01-13 01:38:16 +00:00
|
|
|
vim.cmd('colorscheme aurora')
|
2022-01-09 11:31:43 +00:00
|
|
|
else
|
|
|
|
load_plugins()
|
2022-01-13 01:38:16 +00:00
|
|
|
vim.cmd('colorscheme aurora')
|
2022-01-09 11:31:43 +00:00
|
|
|
end
|