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

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,32 +8,48 @@ _G.find_files = function()
search_dirs = scopes.get_current_dirs(),
})
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()
require("telescope.builtin").live_grep({
search_dirs = scopes.get_current_dirs(),
})
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 = {
{ "<leader>ts", [[<cmd>lua require("neoscopes").select()<CR>]], desc = "NeoScopes" },
{ "<leader>tf", ":lua find_files()<CR>", desc = "[T]elescope [F]ind Files" },
{ "<leader>tl", ":lua live_grep()<CR>", desc = "[T]elescope [L]ive Grep" },
{ "<leader>ts", "<cmd>lua search_cwd()<CR>", desc = "[T]elescope [S]earch Directory" },
{ "<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>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>th", ":lua require('telescope.builtin').help_tags{}<CR>", desc = "[T]elescope [H]elp" },
{ "<leader>t*", "<cmd>lua require('telescope.builtin').grep_string{}<CR>", desc = "[T]elescope current [W]ord" },
{ "<leader>th", "<cmd>lua require('telescope.builtin').help_tags{}<CR>", desc = "[T]elescope [H]elp" },
}
if use_google() then
TableConcat(keys, {
{ "<C-P>", [[:lua require('telescope').extensions.codesearch.find_files{}<CR>]], "n" },
{ "<C-Space>", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
{ "<leader>cs", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
{ "<leader>cs", [[:lua require('telescope').extensions.codesearch.find_query{}<CR>]], mode = "v" },
{ "<C-P>", [[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]], "n" },
{ "<C-Space>", [[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
{ "<leader>cs", [[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]] },
{ "<leader>cs", [[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]], mode = "v" },
{
"<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
@ -43,44 +59,37 @@ return {
dependencies = {},
config = function()
require("telescope").setup({
defaults = {
-- 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.
-- The caveat is that the preview area is smaller.
layout_strategy = "vertical",
-- 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
-- telescope-codesearch because it can be reused by other telescope pickers.
path_display = function(opts, path)
-- Do common substitutions
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/javatests/com/google/", "g3/jt/c/g/", 1)
path = path:gsub("^google3/third_party/", "g3/3rdp/", 1)
path = path:gsub("^google3/", "g3/", 1)
experimental = true,
-- 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.
-- The caveat is that the preview area is smaller.
layout_strategy = "vertical",
-- 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
-- telescope-codesearch because it can be reused by other telescope pickers.
path_display = function(opts, path)
-- Do common substitutions
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1)
path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1)
path = path:gsub("^google3/third_party/", "//3p/", 1)
path = path:gsub("^google3/", "//", 1)
-- Do truncation. This allows us to combine our custom display formatter
-- with the built-in truncation.
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
-- Here we are manually propagating this value between new_opts and opts.
-- We can make this cleaner and more complicated using metatables :)
local new_opts = {
path_display = {
truncate = true,
},
__length = opts.__length,
}
path = require("telescope.utils").transform_path(new_opts, path)
opts.__length = new_opts.__length
return path
end,
},
extensions = {
-- this block is optional, and if omitted, defaults will be used
codesearch = {
experimental = true, -- enable results from google3/experimental
},
},
-- Do truncation. This allows us to combine our custom display formatter
-- with the built-in truncation.
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
-- Here we are manually propagating this value between new_opts and opts.
-- We can make this cleaner and more complicated using metatables :)
local new_opts = {
path_display = {
truncate = true,
},
__length = opts.__length,
}
path = require("telescope.utils").transform_path(new_opts, path)
opts.__length = new_opts.__length
return path
end,
})
end,
keys = keys,