This commit is contained in:
Christian Nieves
2023-06-26 17:48:16 -05:00
parent 925f79f9d4
commit 9458aa0d58
6 changed files with 227 additions and 185 deletions

View File

@ -10,9 +10,16 @@ return {
"will133/vim-dirdiff",
"renerocksai/calendar-vim",
"google/vim-searchindex",
"hrsh7th/vim-vsnip",
"kosayoda/nvim-lightbulb",
"tpope/vim-surround",
{
"L3MON4D3/LuaSnip",
build = "make install_jsregexp",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
dependencies = { "rafamadriz/friendly-snippets" },
},
"ntpeters/vim-better-whitespace",
"junegunn/fzf.vim",
"nathanaelkane/vim-indent-guides",

View File

@ -1,4 +1,7 @@
local use_google = require("utils").use_google
local tprint = require("utils").tprint
local dump = require("utils").dump
local log = require("utils").log
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
@ -20,38 +23,55 @@ return {
"hrsh7th/nvim-cmp",
},
},
{
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
local autopairs = require("nvim-autopairs")
autopairs.setup({
check_ts = true, -- treesitter integration
disable_filetype = { "TelescopePrompt" },
})
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
local cmp_status_ok, cmp = pcall(require, "cmp")
if not cmp_status_ok then
return
end
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done({}))
end,
},
{
"hrsh7th/nvim-cmp",
event = "VimEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"lukas-reineke/cmp-under-comparator",
"hrsh7th/cmp-cmdline",
"f3fora/cmp-spell",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lsp-document-symbol",
"hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path",
"hrsh7th/cmp-vsnip",
"lukas-reineke/cmp-under-comparator",
"ray-x/cmp-treesitter",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-calc",
},
config = function()
local cmp = require("cmp")
local conditionalSources = cmp.config.sources({
{ name = "buffer", max_item_count = 5, keyword_length = 5, group_index = 2 },
{ name = "nvim_lsp", priority = 6 },
{ name = "nvim_lsp_signature_help", priority = 7 },
{ name = "luasnip", priority = 8 },
{ name = "calc" },
{ name = "crates" },
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help", priority = 5 },
{ name = "nvim_lua" },
{ name = "emoji" },
{ name = "path" },
{ name = "treesitter" },
{ name = "vsnip" },
{ name = "emoji" },
{
name = "spell",
option = {
@ -61,9 +81,11 @@ return {
end,
},
},
{ name = "buffer", max_item_count = 5, keyword_length = 5 },
})
if use_google() then
require("cmp_nvim_ciderlsp").setup()
table.insert(conditionalSources, { name = "analysislsp" })
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 9 })
else
@ -103,8 +125,6 @@ return {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
elseif has_words_before() then
cmp.complete()
else
@ -115,16 +135,12 @@ return {
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
end
end, { "i", "s" }),
["<Up>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-jump-prev)", "")
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
@ -133,8 +149,6 @@ return {
["<Down>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(vsnip-expand-or-jump)", "")
else
fallback() -- The fallback function sends a already mapped key. In this case, it's probably `<Tab>`.
end
@ -153,41 +167,49 @@ return {
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
cmp.config.compare.priority,
},
},
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
require("luasnip").lsp_expand(args.body)
end,
},
formatting = {
format = lspkind.cmp_format({
with_text = true,
mode = "symbol_text",
-- before = function(entry, vim_item)
-- if entry.source.name == "nvim_ciderlsp" then
-- if entry.completion_item.is_multiline then
-- -- multi-line specific formatting here
-- vim_item.menu = "  "
-- else
-- vim_item.menu = ""
-- end
-- end
-- return vim_item
-- end,
maxwidth = 40, -- half max width
menu = {
nvim_ciderlsp = "",
buffer = "",
crates = "",
nvim_lsp = "",
nvim_lsp = "[LSP]",
nvim_lua = "",
luasnip = "[LuaSnip]",
cmp_tabnine = "[TabNine]",
path = "[path]",
tmux = "[TMUX]",
vim_vsnip = "[snip]",
},
}),
},
experimental = {
ghost_text = false,
ghost_text = true,
},
})
vim.cmd(
[[ augroup CmpZsh au! autocmd Filetype zsh lua require'cmp'.setup.buffer { sources = { { name = "zsh" }, } } augroup END ]]
)
end,
},
}

View File

@ -1,133 +1,140 @@
local use_google = require("utils").use_google
local function goog(plugin, config)
return {
name = plugin,
dir = "/usr/share/vim/google/" .. plugin,
dependencies = { "maktaba" },
config = config,
}
return {
name = plugin,
dir = "/usr/share/vim/google/" .. plugin,
dependencies = { "maktaba" },
config = config,
}
end
if use_google() then
return {
{
name = "maktaba",
dir = "/usr/share/vim/google/maktaba",
init = function ()
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
end,
},
goog("core"),
goog("glaive"),
goog("alert"),
goog("csearch"),
goog("codefmt-google"),
goog("languages"),
goog("googlestyle"),
goog("googlespell"),
goog("googlepaths"),
goog("google-filetypes"),
goog("ft-java"),
goog("ft-kotlin"),
goog("ft-proto"),
goog("critique"),
goog("piper"),
goog("gtimporter"),
goog("blaze"),
goog("buganizer"),
goog("g4"),
goog("outline-window"),
goog("fzf-query"),
{
name = "relatedfiles",
dir = "/usr/share/vim/google/relatedfiles",
dependencies = { "maktaba", "glaive" },
config = function()
vim.cmd([[ Glaive relatedfiles plugin[mappings] ]])
end
},
{
name = "codefmt",
dir = "/usr/share/vim/google/codefmt",
dependencies = { "maktaba", "glaive" },
config = function()
vim.cmd([[Glaive codefmt ktfmt_executable=`["/google/bin/releases/kotlin-google-eng/ktfmt/ktfmt_deploy.jar", "--google-style"]`]])
end
},
{
name = "imp-google",
dir = "/usr/share/vim/google/imp-google",
dependencies = { "maktaba", "vim-imp", "glaive" },
config = function()
require("config.imp-google")
end,
},
{
"flwyd/vim-imp",
dependencies = {"imp-google"},
keys = {
{ "<leader>ii", ":ImpSuggest <C-r><C-w><cr>" },
}
},
{
name = "ai.nvim",
url = 'sso://googler@user/vvvv/ai.nvim',
},
{
name = "cmp_nvim_ciderlsp",
url = 'sso://googler@user/piloto/cmp-nvim-ciderlsp',
lazy = false;
dependencies = {
'hrsh7th/nvim-cmp',
}
},
{
name = "ciderlsp_nvim",
url = 'sso://googler@user/kdark/ciderlsp-nvim',
lazy = false;
dependencies = {
'hrsh7th/nvim-cmp',
}
},
{
name = "nvim_figtree",
url = "sso://googler@user/jackcogdill/nvim-figtree",
},
{
name = "telescope_codesearch",
url = 'sso://googler@user/vintharas/telescope-codesearch.nvim',
dependencies = { 'nvim-telescope/telescope.nvim' },
},
{
name = "telescope_citc",
url = 'sso://googler@user/aktau/telescope-citc.nvim',
dependencies = { 'nvim-telescope/telescope.nvim' }
},
{
name = "telescope_fig",
url = 'sso://googler@user/tylersaunders/telescope-fig.nvim',
dependencies = { 'nvim-telescope/telescope.nvim' }
},
{
name = "google_comments",
url = 'sso://googler@user/chmnchiang/google-comments',
dependencies = {'rcarriga/nvim-notify', 'nvim-lua/plenary.nvim'},
config = function()
require("config.google-comments")
end,
},
{
name = "hg",
url = "sso://googler@user/smwang/hg.nvim",
dependencies = { "ipod825/libp.nvim" },
config = function()
require("config.fig")
require("hg").setup()
end,
}
}
else
return {}
if not use_google() then
return {}
end
return {
{
name = "maktaba",
dir = "/usr/share/vim/google/maktaba",
init = function()
vim.cmd("source /usr/share/vim/google/glug/bootstrap.vim")
end,
},
goog("core"),
goog("glaive"),
goog("alert"),
goog("csearch"),
goog("codefmt-google"),
goog("languages"),
goog("googlestyle"),
goog("googlespell"),
goog("googlepaths"),
goog("google-filetypes"),
goog("ft-java"),
goog("ft-kotlin"),
goog("ft-proto"),
goog("critique"),
goog("piper"),
goog("gtimporter"),
goog("blaze"),
goog("buganizer"),
goog("g4"),
goog("outline-window"),
goog("fzf-query"),
{
name = "relatedfiles",
dir = "/usr/share/vim/google/relatedfiles",
dependencies = { "maktaba", "glaive" },
config = function()
vim.cmd([[ Glaive relatedfiles plugin[mappings] ]])
end,
},
{
name = "codefmt",
dir = "/usr/share/vim/google/codefmt",
dependencies = { "maktaba", "glaive" },
config = function()
vim.cmd(
[[Glaive codefmt ktfmt_executable=`["/google/bin/releases/kotlin-google-eng/ktfmt/ktfmt_deploy.jar", "--google-style"]`]]
)
end,
},
{
name = "imp-google",
dir = "/usr/share/vim/google/imp-google",
dependencies = { "maktaba", "vim-imp", "glaive" },
config = function()
require("config.imp-google")
end,
},
{
"flwyd/vim-imp",
dependencies = { "imp-google" },
keys = {
{ "<leader>ii", ":ImpSuggest <C-r><C-w><cr>" },
},
},
{
name = "ai.nvim",
url = "sso://googler@user/vvvv/ai.nvim",
},
{
name = "cmp-nvim-ciderlsp",
url = "sso://googler@user/piloto/cmp-nvim-ciderlsp",
event = "VimEnter",
dependencies = {
"hrsh7th/nvim-cmp",
},
},
{
name = "ciderlsp-nvim",
url = "sso://googler@user/kdark/ciderlsp-nvim",
event = "VimEnter",
dependencies = {
"hrsh7th/nvim-cmp",
},
},
{
name = "nvim_figtree",
url = "sso://googler@user/jackcogdill/nvim-figtree",
},
{
name = "telescope_codesearch",
url = "sso://googler@user/vintharas/telescope-codesearch.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
},
{
name = "telescope_citc",
url = "sso://googler@user/aktau/telescope-citc.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
},
{
name = "telescope_fig",
url = "sso://googler@user/tylersaunders/telescope-fig.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
},
{
name = "google_comments",
url = "sso://googler@user/chmnchiang/google-comments",
dependencies = { "rcarriga/nvim-notify", "nvim-lua/plenary.nvim" },
config = function()
require("config.google-comments")
end,
},
{
url = "sso://googler@user/mccloskeybr/luasnip-google.nvim",
config = function()
require("luasnip-google").load_snippets()
end,
},
{
name = "hg",
url = "sso://googler@user/smwang/hg.nvim",
dependencies = { "ipod825/libp.nvim" },
config = function()
require("config.fig")
require("hg").setup()
end,
},
}

View File

@ -1,14 +1,15 @@
return {
{
"neovim/nvim-lspconfig",
-- event = "VimEnter",
dependencies = {
"hrsh7th/nvim-cmp",
"nvim-lua/lsp-status.nvim",
"VonHeikemen/lsp-zero.nvim",
"rcarriga/nvim-notify",
},
config = function()
local use_google = require("utils").use_google
local log = require("utils").log
local notify = require("notify")
local lspconfig = require("lspconfig")
@ -82,10 +83,10 @@ return {
"bzl",
"typescript",
},
root_dir = lspconfig.util.root_pattern("BUILD"),
-- root_dir = function(fname)
-- return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
-- end;
-- required for proto generated files jump
root_dir = function(fname)
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
end,
settings = {},
},
}
@ -112,10 +113,9 @@ return {
"typescript",
"javascript",
},
root_dir = lspconfig.util.root_pattern("BUILD"),
-- root_dir = function(fname)
-- return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
-- end;
root_dir = function(fname)
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
end,
settings = {},
},
}
@ -140,10 +140,6 @@ return {
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
local my_on_attach = function(client, bufnr)
require("lualine").refresh()
@ -180,9 +176,6 @@ return {
end
if use_google() then
require("cmp_nvim_ciderlsp").setup()
-- 3. Set up CiderLSP
local cider_on_attach = function(client, bufnr)
my_on_attach(client, bufnr)
vim.b["is_cider_lsp_attached"] = "no"

View File

@ -0,0 +1,10 @@
return {
{
"L3MON4D3/LuaSnip",
-- follow latest release.
version = "<CurrentMajor>.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
-- install jsregexp (optional!).
build = "make install_jsregexp",
},
{ "saadparwaiz1/cmp_luasnip" },
}