Merge remote-tracking branch 'nieves/main'

This commit is contained in:
Christian Nieves
2023-10-21 17:57:48 -05:00
9 changed files with 70 additions and 68 deletions

View File

@ -14,7 +14,6 @@
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
"cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" }, "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" },
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" }, "cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" },
"cmp-treesitter": { "branch": "master", "commit": "389eadd48c27aa6dc0e6b992644704f026802a2e" }, "cmp-treesitter": { "branch": "master", "commit": "389eadd48c27aa6dc0e6b992644704f026802a2e" },
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
@ -67,6 +66,7 @@
"registers.nvim": { "branch": "main", "commit": "2ab8372bb837f05fae6b43091f10a0b725d113ca" }, "registers.nvim": { "branch": "main", "commit": "2ab8372bb837f05fae6b43091f10a0b725d113ca" },
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
"scss-syntax.vim": { "branch": "master", "commit": "bda22a93d1dcfcb8ee13be1988560d9bb5bd0fef" }, "scss-syntax.vim": { "branch": "master", "commit": "bda22a93d1dcfcb8ee13be1988560d9bb5bd0fef" },
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"telekasten.nvim": { "branch": "main", "commit": "4a5e57eee9c5154ed77423bb7fa6619fdb0784cd" }, "telekasten.nvim": { "branch": "main", "commit": "4a5e57eee9c5154ed77423bb7fa6619fdb0784cd" },
"telescope.nvim": { "branch": "master", "commit": "47c755d737702df7a39b640c8d9c473a728be1df" }, "telescope.nvim": { "branch": "master", "commit": "47c755d737702df7a39b640c8d9c473a728be1df" },
"trouble.nvim": { "branch": "main", "commit": "20d1b30d6925213abece21d35858a16e11d1e9fc" }, "trouble.nvim": { "branch": "main", "commit": "20d1b30d6925213abece21d35858a16e11d1e9fc" },

View File

@ -72,6 +72,8 @@ function AsyncBlazeTest() abort
call <SID>AsyncBlaze("blaze test", blaze#GetTargets()) call <SID>AsyncBlaze("blaze test", blaze#GetTargets())
endfunction endfunction
autocmd bufreadpre *.sh setlocal textwidth=80
augroup autoformat_settings augroup autoformat_settings
autocmd FileType borg,gcl,patchpanel AutoFormatBuffer gclfmt autocmd FileType borg,gcl,patchpanel AutoFormatBuffer gclfmt
autocmd FileType bzl AutoFormatBuffer buildifier autocmd FileType bzl AutoFormatBuffer buildifier

View File

@ -1,11 +0,0 @@
vim.cmd([[
Glaive imp Suggest[default]=buffer,csearch,prompt Pick[default]=fzf
]])
-- To search for imports in the file's parent directory before using Code Search across all of google3, install ripgrep and try
vim.cmd([[
Glaive imp Suggest[gcl]=buffer,ripgrep,csearch,prompt
\ Location[gcl]=parent Location[borg]=parent
\ Suggest[borg]=buffer,ripgrep,csearch,prompt
\ Suggest[aidl]=buffer,ripgrep,csearch,prompt
]])

View File

@ -6,6 +6,7 @@ return {
"nvim-tree/nvim-web-devicons", "nvim-tree/nvim-web-devicons",
lazy = false, lazy = false,
}, },
"godlygeek/tabular",
"ldelossa/litee.nvim", "ldelossa/litee.nvim",
"cakebaker/scss-syntax.vim", "cakebaker/scss-syntax.vim",
"ldelossa/litee-calltree.nvim", "ldelossa/litee-calltree.nvim",

View File

@ -41,7 +41,7 @@ return {
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lsp-document-symbol", "hrsh7th/cmp-nvim-lsp-document-symbol",
"hrsh7th/cmp-nvim-lsp-signature-help", "hrsh7th/cmp-nvim-lsp-signature-help",
"hrsh7th/cmp-nvim-lua", -- "hrsh7th/cmp-nvim-lua",
"FelipeLema/cmp-async-path", "FelipeLema/cmp-async-path",
"lukas-reineke/cmp-under-comparator", "lukas-reineke/cmp-under-comparator",
"ray-x/cmp-treesitter", "ray-x/cmp-treesitter",
@ -56,10 +56,10 @@ return {
{ name = "nvim_lsp", priority = 8 }, { name = "nvim_lsp", priority = 8 },
{ name = "treesitter", priority = 7 }, { name = "treesitter", priority = 7 },
{ name = "nvim_lsp_signature_help" }, { name = "nvim_lsp_signature_help" },
{ name = "luasnip" }, -- { name = "luasnip" },
{ name = "calc" }, { name = "calc" },
{ name = "crates" }, { name = "crates" },
{ name = "nvim_lua" }, -- { name = "nvim_lua" },
{ name = "emoji" }, { name = "emoji" },
{ name = "async_path" }, { name = "async_path" },
{ name = "spell" }, { name = "spell" },

View File

@ -81,14 +81,13 @@ return {
{ {
name = "imp-google", name = "imp-google",
dir = "/usr/share/vim/google/imp-google", dir = "/usr/share/vim/google/imp-google",
dependencies = { "vim-imp", "glaive" }, dependencies = { "flwyd/vim-imp", "glaive" },
config = function() config = function()
require("config.imp-google") require("config.imp-google")
end, end,
}, },
{ {
"flwyd/vim-imp", "flwyd/vim-imp",
dependencies = { "imp-google" },
keys = { keys = {
{ "<leader>i", ":ImpSuggest <C-r><C-w><cr>" }, { "<leader>i", ":ImpSuggest <C-r><C-w><cr>" },
}, },
@ -113,10 +112,10 @@ return {
"hrsh7th/nvim-cmp", "hrsh7th/nvim-cmp",
}, },
}, },
{ -- {
name = "nvim_figtree", -- name = "nvim_figtree",
url = "sso://googler@user/jackcogdill/nvim-figtree", -- url = "sso://googler@user/jackcogdill/nvim-figtree",
}, -- },
{ {
name = "telescope_codesearch", name = "telescope_codesearch",
url = "sso://googler@user/vintharas/telescope-codesearch.nvim", url = "sso://googler@user/vintharas/telescope-codesearch.nvim",

View File

@ -8,7 +8,7 @@ return {
local use_google = require("utils").use_google local use_google = require("utils").use_google
local lsps = { local lsps = {
"lua_ls", "lua-language-server",
"rust_analyzer", "rust_analyzer",
} }
@ -21,6 +21,7 @@ return {
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup({ require("mason-lspconfig").setup({
automatic_installation = true,
ensure_installed = lsps, ensure_installed = lsps,
}) })

View File

@ -10,6 +10,7 @@ return {
-- Install parsers synchronously (only applied to `ensure_installed`) -- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false, sync_install = false,
disable = {"lua"},
highlight = { highlight = {
-- `false` will disable the whole extension -- `false` will disable the whole extension
enable = true, enable = true,

View File

@ -8,32 +8,48 @@ _G.find_files = function()
search_dirs = scopes.get_current_dirs(), search_dirs = scopes.get_current_dirs(),
}) })
end end
_G.search_cwd = function()
local builtin = require("telescope.builtin")
local utils = require("telescope.utils")
builtin.find_files({ cwd = utils.buffer_dir() })
end
_G.live_grep = function() _G.live_grep = function()
require("telescope.builtin").live_grep({ require("telescope.builtin").live_grep({
search_dirs = scopes.get_current_dirs(), search_dirs = scopes.get_current_dirs(),
}) })
end end
local function get_visual_selection()
-- Yank current visual selection into the 'v' register
--
-- Note that this makes no effort to preserve this register
vim.cmd('noau normal! "vy"')
return vim.fn.getreg("v")
end
local keys = { local keys = {
{ "<leader>ts", [[<cmd>lua require("neoscopes").select()<CR>]], desc = "NeoScopes" }, { "<leader>ts", [[<cmd>lua require("neoscopes").select()<CR>]], desc = "NeoScopes" },
{ "<leader>tf", ":lua find_files()<CR>", desc = "[T]elescope [F]ind Files" }, { "<leader>ts", "<cmd>lua search_cwd()<CR>", desc = "[T]elescope [S]earch Directory" },
{ "<leader>tl", ":lua live_grep()<CR>", desc = "[T]elescope [L]ive Grep" }, { "<leader>tl", "<cmd>lua live_grep()<CR>", desc = "[T]elescope [L]ive Grep" },
{ "<leader>ff", ":Telescope current_buffer_fuzzy_find<CR>", desc = "[T]elescope [F]uzzy [F]ind" }, { "<leader>ff", ":Telescope current_buffer_fuzzy_find<CR>", desc = "[T]elescope [F]uzzy [F]ind" },
{ "<leader>tg", ":Telescope git_files<CR>", desc = "[T]elescope [G]it Files" }, { "<leader>tg", ":Telescope git_files<CR>", desc = "[T]elescope [G]it Files" },
{ "<leader>t*", ":lua require('telescope.builtin').grep_string{}<CR>", desc = "[T]elescope current [W]ord" }, { "<leader>t*", "<cmd>lua require('telescope.builtin').grep_string{}<CR>", desc = "[T]elescope current [W]ord" },
{ "<leader>th", ":lua require('telescope.builtin').help_tags{}<CR>", desc = "[T]elescope [H]elp" }, { "<leader>th", "<cmd>lua require('telescope.builtin').help_tags{}<CR>", desc = "[T]elescope [H]elp" },
} }
if use_google() then if use_google() then
TableConcat(keys, { TableConcat(keys, {
{ "<C-P>", [[:lua require('telescope').extensions.codesearch.find_files{}<CR>]], "n" }, { "<C-P>", [[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]], "n" },
{ "<C-Space>", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]] }, { "<C-Space>", [[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
{ "<leader>cs", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]] }, { "<leader>cs", [[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
{ "<leader>cs", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]], mode = "v" }, { "<leader>cs", [[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]], mode = "v" },
{ {
"<leader>CS", "<leader>CS",
[[:lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]], [[<cmd>lua require('telescope').extensions.codesearch.find_query{default_text_expand='<cword>'}<CR>]],
}, },
}) })
end end
@ -43,44 +59,37 @@ return {
dependencies = {}, dependencies = {},
config = function() config = function()
require("telescope").setup({ require("telescope").setup({
defaults = { experimental = true,
-- The vertical layout strategy is good to handle long paths like those in -- The vertical layout strategy is good to handle long paths like those in
-- google3 repos because you have nearly the full screen to display a file path. -- google3 repos because you have nearly the full screen to display a file path.
-- The caveat is that the preview area is smaller. -- The caveat is that the preview area is smaller.
layout_strategy = "vertical", layout_strategy = "vertical",
-- Common paths in google3 repos are collapsed following the example of Cider -- Common paths in google3 repos are collapsed following the example of Cider
-- It is nice to keep this as a user config rather than part of -- It is nice to keep this as a user config rather than part of
-- telescope-codesearch because it can be reused by other telescope pickers. -- telescope-codesearch because it can be reused by other telescope pickers.
path_display = function(opts, path) path_display = function(opts, path)
-- Do common substitutions -- Do common substitutions
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1) path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
path = path:gsub("^google3/java/com/google/", "g3/j/c/g/", 1) path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1)
path = path:gsub("^google3/javatests/com/google/", "g3/jt/c/g/", 1) path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1)
path = path:gsub("^google3/third_party/", "g3/3rdp/", 1) path = path:gsub("^google3/third_party/", "//3p/", 1)
path = path:gsub("^google3/", "g3/", 1) path = path:gsub("^google3/", "//", 1)
-- Do truncation. This allows us to combine our custom display formatter -- Do truncation. This allows us to combine our custom display formatter
-- with the built-in truncation. -- with the built-in truncation.
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length. -- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
-- Here we are manually propagating this value between new_opts and opts. -- Here we are manually propagating this value between new_opts and opts.
-- We can make this cleaner and more complicated using metatables :) -- We can make this cleaner and more complicated using metatables :)
local new_opts = { local new_opts = {
path_display = { path_display = {
truncate = true, truncate = true,
}, },
__length = opts.__length, __length = opts.__length,
} }
path = require("telescope.utils").transform_path(new_opts, path) path = require("telescope.utils").transform_path(new_opts, path)
opts.__length = new_opts.__length opts.__length = new_opts.__length
return path return path
end, end,
},
extensions = {
-- this block is optional, and if omitted, defaults will be used
codesearch = {
experimental = true, -- enable results from google3/experimental
},
},
}) })
end, end,
keys = keys, keys = keys,