go.nvim/playground/init_packer.lua

73 lines
2.0 KiB
Lua
Raw Normal View History

2022-03-23 02:27:58 +00:00
vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
2022-08-04 00:35:28 +00:00
local package_root = '/tmp/nvim/site/pack'
local install_path = package_root .. '/packer/start/packer.nvim'
2022-04-30 02:38:24 +00:00
local plugin_folder = function()
2022-08-04 00:35:28 +00:00
local host = os.getenv('HOST_NAME')
if host and (host:find('Ray') or host:find('ray')) then
2022-04-30 02:38:24 +00:00
return [[~/github/]] -- vim.fn.expand("$HOME") .. '/github/'
else
2022-08-04 00:35:28 +00:00
return ''
2022-04-30 02:38:24 +00:00
end
end
2022-03-23 02:27:58 +00:00
local function load_plugins()
2022-08-04 00:35:28 +00:00
require('packer').startup({
2022-03-23 02:27:58 +00:00
function(use)
2022-08-04 00:35:28 +00:00
use({ 'wbthomason/packer.nvim' })
2022-03-23 02:27:58 +00:00
use({
2022-08-04 00:35:28 +00:00
'nvim-treesitter/nvim-treesitter',
2022-03-23 02:27:58 +00:00
config = function()
2022-08-04 00:35:28 +00:00
require('nvim-treesitter.configs').setup({
ensure_installed = { 'go' },
2022-03-23 02:27:58 +00:00
highlight = { enable = true },
})
end,
2022-08-04 00:35:28 +00:00
run = ':TSUpdate',
2022-03-23 02:27:58 +00:00
})
2022-08-04 00:35:28 +00:00
use({ 'neovim/nvim-lspconfig' })
2022-03-23 02:27:58 +00:00
use({
2022-08-04 00:35:28 +00:00
plugin_folder() .. 'ray-x/go.nvim',
requires = {
2022-08-04 00:35:28 +00:00
'mfussenegger/nvim-dap', -- Debug Adapter Protocol
'rcarriga/nvim-dap-ui',
'theHamsta/nvim-dap-virtual-text',
'ray-x/guihua.lua',
},
2022-03-23 02:27:58 +00:00
config = function()
2022-08-04 00:35:28 +00:00
require('go').setup({
2022-04-30 02:38:24 +00:00
verbose = true,
goimports = 'gopls',
2022-08-04 00:35:28 +00:00
lsp_cfg = {
handlers = {
['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = 'double' }),
['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = 'round' }),
},
}, -- false: do nothing
2022-03-23 02:27:58 +00:00
run_in_floaterm = true,
})
end,
})
end,
config = {
package_root = package_root,
2022-08-04 00:35:28 +00:00
compile_path = install_path .. '/plugin/packer_compiled.lua',
2022-03-23 02:27:58 +00:00
},
})
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({
2022-08-04 00:35:28 +00:00
'git',
'clone',
'https://github.com/wbthomason/packer.nvim',
2022-03-23 02:27:58 +00:00
install_path,
})
load_plugins()
2022-08-04 00:35:28 +00:00
require('packer').sync()
2022-03-23 02:27:58 +00:00
else
load_plugins()
end
2022-08-04 00:35:28 +00:00
vim.cmd('colorscheme murphy')