This commit is contained in:
Christian Nieves
2023-07-12 15:41:07 -05:00
parent 3c5764912d
commit 59dd0ac598
21 changed files with 294 additions and 139 deletions

View File

@ -1,59 +0,0 @@
-- Here are all the options and their default values:
require("google.comments").setup({
-- 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",
"--noresolved",
"--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 = floating_window_options,
},
})
function floating_window_options(parent_win_id)
local parent_width = vim.api.nvim_win_get_width(parent_win_id)
local parent_height = vim.api.nvim_win_get_height(parent_win_id)
return {
relative = "win",
anchor = "NW",
width = math.floor(parent_width * 0.5),
height = math.floor(parent_height * 0.3),
row = vim.api.nvim_win_get_cursor(parent_win_id)[1],
col = math.floor(parent_width * 0.25),
border = "rounded",
}
end
local map = require("utils").map
-- here are some mappings you might want:
map("n", "]c", [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map("n", "[c", [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map("n", "<Leader>nc", [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map("n", "<Leader>pc", [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map("n", "<Leader>lc", [[<Cmd>GoogleCommentsToggleLineComments<CR>]])
map("n", "<Leader>ac", [[<Cmd>GoogleCommentsToggleAllComments<CR>]])
map("n", "<Leader>fc", [[<Cmd>GoogleCommentsFetchComments<CR>]])
vim.fn.sign_define("COMMENT_ICON", { text = "" })

View File

@ -23,25 +23,6 @@ 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",
@ -49,6 +30,7 @@ return {
"f3fora/cmp-spell",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-calc",
"onsails/lspkind.nvim",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-nvim-lsp",
@ -108,8 +90,7 @@ return {
cmp.setup.cmdline(":", {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = "nvim_lsp_document_symbol" },
{ name = "path" },
{ name = "path", priority = 9 },
{ name = "cmdline" },
}),
})
@ -159,6 +140,7 @@ return {
sorting = {
comparators = {
cmp.config.compare.priority,
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
@ -167,7 +149,6 @@ return {
cmp.config.compare.sort_text,
cmp.config.compare.length,
cmp.config.compare.order,
cmp.config.compare.priority,
},
},
@ -179,7 +160,7 @@ return {
formatting = {
format = lspkind.cmp_format({
mode = "symbol_text",
-- mode = "symbol_text",
-- before = function(entry, vim_item)
-- if entry.source.name == "nvim_ciderlsp" then
-- if entry.completion_item.is_multiline then

View File

@ -17,7 +17,49 @@ return {
lua = {
-- "formatter.filetypes.lua" defines default configurations for the
-- "lua" filetype
require("formatter.filetypes.lua").stylua,
-- require("formatter.filetypes.lua").stylua,
-- You can also define your own configuration
function()
-- Supports conditional formatting
if util.get_current_buffer_file_name() == "special.lua" then
return nil
end
-- Full specification of configurations is down below and in Vim help
-- files
return {
exe = "stylua",
args = {
"--search-parent-directories",
"--stdin-filepath",
util.escape_path(util.get_current_buffer_file_path()),
"--",
"-",
},
stdin = true,
}
end,
},
html = {
require("formatter.defaults").prettier,
},
xml = {
function()
return {
exe = "tidy",
args = {
"-quiet",
"-xml",
"--indent auto",
"--indent-spaces 2",
"--verical-space yes",
"--tidy-mark no",
},
stdin = true,
try_node_modules = true,
}
end,
},
-- Use the special "*" filetype for defining formatter configurations on

View File

@ -115,10 +115,71 @@ return {
},
{
name = "google_comments",
url = "sso://googler@user/chmnchiang/google-comments",
-- url = "sso://googler@user/chmnchiang/google-comments",
dir = "/google/src/cloud/cnieves/google-comments/google3/experimental/users/chmnchiang/neovim/google-comments/",
dependencies = { "rcarriga/nvim-notify", "nvim-lua/plenary.nvim" },
config = function()
require("config.google-comments")
-- Here are all the options and their default values:
require("google.comments").setup({
-- 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",
"--noresolved",
"--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 = {
-- CTN
virtual_text = true,
-- 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 = floating_window_options,
},
})
function floating_window_options(parent_win_id)
local parent_width = vim.api.nvim_win_get_width(parent_win_id)
local parent_height = vim.api.nvim_win_get_height(parent_win_id)
return {
relative = "win",
anchor = "NW",
width = math.floor(parent_width * 0.5),
height = math.floor(parent_height * 0.3),
row = vim.api.nvim_win_get_cursor(parent_win_id)[1],
col = math.floor(parent_width * 0.25),
border = "rounded",
}
end
local map = require("utils").map
-- here are some mappings you might want:
map("n", "]c", [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map("n", "[c", [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map("n", "<Leader>nc", [[<Cmd>GoogleCommentsGotoNextComment<CR>]])
map("n", "<Leader>pc", [[<Cmd>GoogleCommentsGotoPrevComment<CR>]])
map("n", "<Leader>lc", [[<Cmd>GoogleCommentsToggleLineComments<CR>]])
map("n", "<Leader>ac", [[<Cmd>GoogleCommentsToggleAllComments<CR>]])
map("n", "<Leader>fc", [[<Cmd>GoogleCommentsFetchComments<CR>]])
vim.fn.sign_define("COMMENT_ICON", { text = "" })
end,
},
{

View File

@ -160,6 +160,7 @@ return {
local opts = { noremap = true, silent = true }
vim.api.nvim_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
vim.api.nvim_set_keymap("n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
vim.api.nvim_set_keymap("v", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
vim.api.nvim_set_keymap("n", "L", "<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_set_keymap("n", "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts)
vim.api.nvim_set_keymap("n", "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>", opts)

View File

@ -101,6 +101,13 @@ return {
},
},
-- lualine_y = { getLGTMs }
lualine_z = {
{
"filename",
file_status = false, -- displays file status (readonly status, modified status)
path = 2, -- 0 = just filename, 1 = relative path, 2 = absolute path
},
},
},
})
end,