diff --git a/config/.config/nvim/lazy-lock.json b/config/.config/nvim/lazy-lock.json index 96476e9..5de421d 100644 --- a/config/.config/nvim/lazy-lock.json +++ b/config/.config/nvim/lazy-lock.json @@ -14,7 +14,6 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f0f53f704c08ea501f9d222b23491b0d354644b0" }, "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-spell": { "branch": "master", "commit": "60584cb75e5e8bba5a0c9e4c3ab0791e0698bffa" }, "cmp-treesitter": { "branch": "master", "commit": "389eadd48c27aa6dc0e6b992644704f026802a2e" }, "cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" }, @@ -67,6 +66,7 @@ "registers.nvim": { "branch": "main", "commit": "2ab8372bb837f05fae6b43091f10a0b725d113ca" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "scss-syntax.vim": { "branch": "master", "commit": "bda22a93d1dcfcb8ee13be1988560d9bb5bd0fef" }, + "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "telekasten.nvim": { "branch": "main", "commit": "4a5e57eee9c5154ed77423bb7fa6619fdb0784cd" }, "telescope.nvim": { "branch": "master", "commit": "47c755d737702df7a39b640c8d9c473a728be1df" }, "trouble.nvim": { "branch": "main", "commit": "20d1b30d6925213abece21d35858a16e11d1e9fc" }, diff --git a/vim/.vim/lua/config/google.lua b/vim/.vim/lua/config/google.lua index dd0c831..65b8834 100644 --- a/vim/.vim/lua/config/google.lua +++ b/vim/.vim/lua/config/google.lua @@ -72,6 +72,8 @@ function AsyncBlazeTest() abort call AsyncBlaze("blaze test", blaze#GetTargets()) endfunction +autocmd bufreadpre *.sh setlocal textwidth=80 + augroup autoformat_settings autocmd FileType borg,gcl,patchpanel AutoFormatBuffer gclfmt autocmd FileType bzl AutoFormatBuffer buildifier diff --git a/vim/.vim/lua/config/imp-google.lua b/vim/.vim/lua/config/imp-google.lua deleted file mode 100644 index 035eac2..0000000 --- a/vim/.vim/lua/config/imp-google.lua +++ /dev/null @@ -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 -]]) diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index cd71ba1..01b610a 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -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", diff --git a/vim/.vim/lua/plugins/cmp.lua b/vim/.vim/lua/plugins/cmp.lua index fe4aa04..7c435af 100644 --- a/vim/.vim/lua/plugins/cmp.lua +++ b/vim/.vim/lua/plugins/cmp.lua @@ -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" }, diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index a789044..fb03bd2 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -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 = { { "i", ":ImpSuggest " }, }, @@ -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", diff --git a/vim/.vim/lua/plugins/mason.lua b/vim/.vim/lua/plugins/mason.lua index f8a4a56..a91a725 100644 --- a/vim/.vim/lua/plugins/mason.lua +++ b/vim/.vim/lua/plugins/mason.lua @@ -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, }) diff --git a/vim/.vim/lua/plugins/nvim-treesitter.lua b/vim/.vim/lua/plugins/nvim-treesitter.lua index 373297d..abd6934 100644 --- a/vim/.vim/lua/plugins/nvim-treesitter.lua +++ b/vim/.vim/lua/plugins/nvim-treesitter.lua @@ -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, diff --git a/vim/.vim/lua/plugins/telescope.lua b/vim/.vim/lua/plugins/telescope.lua index 2ad9b70..8bf89ee 100644 --- a/vim/.vim/lua/plugins/telescope.lua +++ b/vim/.vim/lua/plugins/telescope.lua @@ -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 = { { "ts", [[lua require("neoscopes").select()]], desc = "NeoScopes" }, - { "tf", ":lua find_files()", desc = "[T]elescope [F]ind Files" }, - { "tl", ":lua live_grep()", desc = "[T]elescope [L]ive Grep" }, + { "ts", "lua search_cwd()", desc = "[T]elescope [S]earch Directory" }, + { "tl", "lua live_grep()", desc = "[T]elescope [L]ive Grep" }, { "ff", ":Telescope current_buffer_fuzzy_find", desc = "[T]elescope [F]uzzy [F]ind" }, { "tg", ":Telescope git_files", desc = "[T]elescope [G]it Files" }, - { "t*", ":lua require('telescope.builtin').grep_string{}", desc = "[T]elescope current [W]ord" }, - { "th", ":lua require('telescope.builtin').help_tags{}", desc = "[T]elescope [H]elp" }, + { "t*", "lua require('telescope.builtin').grep_string{}", desc = "[T]elescope current [W]ord" }, + { "th", "lua require('telescope.builtin').help_tags{}", desc = "[T]elescope [H]elp" }, } if use_google() then TableConcat(keys, { - { "", [[:lua require('telescope').extensions.codesearch.find_files{}]], "n" }, - { "", [[:lua require('telescope').extensions.codesearch.find_query{}]] }, - { "cs", [[:lua require('telescope').extensions.codesearch.find_query{}]] }, - { "cs", [[:lua require('telescope').extensions.codesearch.find_query{}]], mode = "v" }, + { "", [[lua require('telescope').extensions.codesearch.find_files{}]], "n" }, + { "", [[lua require('telescope').extensions.codesearch.find_query{}]] }, + { "cs", [[lua require('telescope').extensions.codesearch.find_query{}]] }, + { "cs", [[lua require('telescope').extensions.codesearch.find_query{}]], mode = "v" }, { "CS", - [[:lua require('telescope').extensions.codesearch.find_query{default_text_expand=''}]], + [[lua require('telescope').extensions.codesearch.find_query{default_text_expand=''}]], }, }) 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,