This commit is contained in:
Christian Nieves
2022-11-14 18:24:34 +00:00
parent b4e5d6a60a
commit 9028ccc503
18 changed files with 152 additions and 237 deletions

View File

@ -2,7 +2,7 @@ vim.g.catppuccin_flavour = "macchiato" -- latte, frappe, macchiato, mocha
local colors = require("catppuccin.palettes").get_palette()
require("catppuccin").setup({
flavour = vim.g.catppuccin_flavour, --"macchiato",
flavour = "macchiato",
integrations = {
cmp = true,
-- coc_nvim = false,

View File

@ -1,40 +1,36 @@
-- Here are all the options and their default values:
require('google.comments').setup {
-- The command for fetching comments, refer to `get_comments.par --help` to
-- see all the options.
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"},
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--json', '--full', '--noresolved', '--cl_comments', '--file_comments', '--unreplied_only', ' -x ""'},
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
-- See :help sign_define
-- The sign property passed to setup should be the 'ICON_NAME' in the define
-- example above.
sign = 'COMMENT_ICON',
-- Fetch the comments after calling `setup`.
auto_fetch = true,
display = {
-- The width of the comment display window.
width = 50,
-- When showing file paths, use relative paths or not.
relative_path = true,
},
--- Enable viewing comments through floating window
floating = true,
--- Options used when creating the floating window.
floating_window_options = require('google.comments.options')
.default_floating_window_options,
-- The command for fetching comments, refer to `get_comments.par --help` to
-- see all the options.
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"},
stubby = true,
--
command = {'/google/bin/releases/editor-devtools/get_comments.par', '--json', '--full', '--resolved', '--cl_comments', '--file_comments'},
-- command = {'stubby --output_json call blade:codereview-rpc CodereviewRpcService.GetComments "changelist_number: $(/google/data/ro/teams/fig/bin/vcstool pending-change-number)"'},
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
-- See :help sign_define
-- The sign property passed to setup should be the 'ICON_NAME' in the define
-- example above.
sign = 'COMMENT_ICON',
-- Fetch the comments after calling `setup`.
auto_fetch = true,
display = {
-- The width of the comment display window.
width = 50,
-- When showing file paths, use relative paths or not.
relative_path = true,
},
--- Enable viewing comments through floating window
floating = true,
--- Options used when creating the floating window.
floating_window_options = require('google.comments.options').default_floating_window_options,
}
local map = require("utils").map
-- here are some mappings you might want:
vim.api.nvim_set_keymap('n', '<Leader>nc',
[[<Cmd>lua require('google.comments').goto_next_comment()<CR>]],
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>pc',
[[<Cmd>lua require('google.comments').goto_prev_comment()<CR>]],
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>lc',
[[<Cmd>lua require('google.comments').toggle_line_comments()<CR>]],
{ noremap = true, silent = true })
vim.api.nvim_set_keymap('n', '<Leader>ac',
[[<Cmd>lua require('google.comments').toggle_all_comments()<CR>]],
{ noremap = true, silent = true })
map('n', '<Leader>nc', [[<Cmd>lua require('google.comments').goto_next_comment()<CR>]])
map('n', '<Leader>pc', [[<Cmd>lua require('google.comments').goto_prev_comment()<CR>]])
map('n', '<Leader>lc', [[<Cmd>lua require('google.comments').toggle_line_comments()<CR>]])
map('n', '<Leader>ac', [[<Cmd>lua require('google.comments').toggle_all_comments()<CR>]])
vim.fn.sign_define('COMMENT_ICON', {text = ''})

View File

@ -30,6 +30,19 @@ local function getLightbulb()
return require('nvim-lightbulb').get_status_text()
end
local comments = require("google.comments")
local tracker = require("google.comments.tracker")
local dump = require("utils").dump
local function getLGTMs()
print(dump(tracker.get_all_comments()))
local lgtm = comments.get_lgtms()
local appr = comments.get_approvals()
print("lgtms"..dump(lgtm))
print("approvals"..dump(appr))
return "LGTM:"..table.concat(lgtm, ",").." Approval:"..table.concat(appr, ",")
end
require('lualine').setup {
options = {
theme = 'auto',
@ -58,7 +71,8 @@ require('lualine').setup {
-- lualine_c = {'filename'},
lualine_x = {
{ 'diagnostics', sources = {"nvim_lsp", "nvim_workspace_diagnostic"}, symbols = {error = '', warn = '', info = '', hint = ''} },
}
},
-- lualine_y = { getLGTMs }
},
-- default
-- sections = {

View File

@ -2,3 +2,4 @@ local colors = require("catppuccin.palettes").get_palette()
require("notify").setup({
background_colour = colors.base,
})
vim.notify = require("notify")

View File

@ -6,12 +6,15 @@ if fn.empty(fn.glob(install_path)) > 0 then
end
vim.cmd([[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]])
local file_exists = require("utils").file_exists
require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
@ -41,6 +44,7 @@ require('packer').startup(function(use)
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-buffer',
'lukas-reineke/cmp-under-comparator',
'williamboman/nvim-lsp-installer',
'hrsh7th/cmp-cmdline',
'f3fora/cmp-spell',
'hrsh7th/cmp-nvim-lsp-document-symbol',
@ -78,12 +82,34 @@ require('packer').startup(function(use)
}
end
}
use 'sso://googler@user/vintharas/telescope-codesearch.nvim'
use {
'sso://googler@user/vintharas/telescope-codesearch.nvim',
cond = file_exists(os.getenv("HOME").."/use_google"),
}
use {
-- 'sso://googler@user/chmnchiang/google-comments',
-- '/google/src/head/depot/google3/experimental/users/chmnchiang/neovim/google-comments',
'/google/src/cloud/cnieves/google-comments/google3/experimental/users/chmnchiang/neovim/google-comments',
cond = file_exists(os.getenv("HOME").."/use_google"),
requires = {'rcarriga/nvim-notify', 'nvim-lua/plenary.nvim'},
config = [[ require("google_comments") ]]
}
use {
'/google/src/cloud/cnieves/google-comments/google3/experimental/users/cnieves/neovim/critique',
config = [[ require("critique").setup() ]]
}
use {
'nvim-lualine/lualine.nvim',
config = [[ require("lualine_config") ]]
}
use 'rcarriga/nvim-notify'
use {
'rcarriga/nvim-notify',
config = [[ require("notify_config") ]]
}
-- Git
use {
@ -158,7 +184,6 @@ require("lsp")
require("diagnostics")
require("treesitter")
require("telescope_config")
require("notify_config")
require("symbols-outline-config")
require("spell_config")

View File

@ -8,4 +8,22 @@ function M.map(mode, lhs, rhs, opts)
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
function M.file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
function M.dump(o)
if type(o) == 'table' then
local s = '{ '
for k,v in pairs(o) do
if type(k) ~= 'number' then k = '"'..k..'"' end
s = s .. '['..k..'] = ' .. dump(v) .. ','
end
return s .. '} '
else
return tostring(o)
end
end
return M