Created
September 7, 2023 07:36
-
-
Save kke/5d6253b292713e943ee953ba404e774a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vim.cmd([[set runtimepath=$VIMRUNTIME]]) | |
vim.cmd([[set packpath=/tmp/nvim/lazy]]) | |
local package_root = '/tmp/nvim/lazy' | |
local plugin_folder = function() | |
local host = os.getenv('HOST_NAME') | |
if host and (host:find('Ray') or host:find('ray')) then | |
return [[~/github/ray-x]] -- vim.fn.expand("$HOME") .. '/github/' | |
else | |
return '' | |
end | |
end | |
local lazypath = package_root .. '/lazy.nvim' | |
if not vim.loop.fs_stat(lazypath) then | |
vim.fn.system({ | |
'git', | |
'clone', | |
'--filter=blob:none', | |
'https://github.com/folke/lazy.nvim.git', | |
-- '--branch=stable', -- latest stable release | |
lazypath, | |
}) | |
end | |
vim.opt.rtp:prepend(lazypath) | |
local function load_plugins() | |
return { | |
{ | |
'nvim-treesitter/nvim-treesitter', | |
config = function() | |
require('nvim-treesitter.configs').setup({ | |
ensure_installed = { 'go' }, | |
highlight = { enable = true }, | |
}) | |
end, | |
build = ':TSUpdate', | |
}, | |
{ 'neovim/nvim-lspconfig' }, | |
{ | |
'ray-x/navigator.lua', | |
dependencies = { | |
'ray-x/guihua.lua', | |
'ray-x/lsp_signature.nvim', | |
'neovim/nvim-lspconfig', | |
'nvim-treesitter/nvim-treesitter', | |
} | |
}, | |
{ | |
'ray-x/go.nvim', | |
dev = (plugin_folder() ~= ''), | |
-- dev = true, | |
ft = 'go', | |
dependencies = { | |
"ray-x/guihua.lua", | |
"neovim/nvim-lspconfig", | |
"nvim-treesitter/nvim-treesitter", | |
}, | |
config = function() | |
require("go").setup() | |
end, | |
event = {"CmdlineEnter"}, | |
ft = {"go", 'gomod'}, | |
build = ':lua require("go.install").update_all_sync()' -- if you need to install/update all binaries | |
}, | |
} | |
end | |
local opts = { | |
root = package_root, -- directory where plugins will be installed | |
default = { lazy = true }, | |
dev = { | |
-- directory where you store your local plugin projects | |
path = plugin_folder(), | |
}, | |
} | |
vim.cmd('colorscheme murphy') | |
vim.opt.cindent = true | |
vim.opt.smartindent = true | |
vim.opt.autoindent = true | |
vim.opt.tabstop = 2 | |
vim.opt.shiftwidth = 2 | |
vim.opt.expandtab = true | |
vim.cmd('syntax enable') | |
require('lazy').setup(load_plugins(), opts) | |
local lspconfig = require 'lspconfig' | |
lspconfig.gopls.setup({}) | |
local format_sync_grp = vim.api.nvim_create_augroup("GoFormat", {}) | |
vim.api.nvim_create_autocmd("BufWritePre", { | |
pattern = "*.go", | |
callback = function() | |
require('go.format').goimport() | |
end, | |
group = format_sync_grp, | |
}) | |
require('navigator').setup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment