godot and telescope ripgrep

This commit is contained in:
Christian Nieves
2025-03-16 16:38:34 -05:00
parent f595b1fcfa
commit 76686a0e87
9 changed files with 240 additions and 217 deletions

View File

@ -13,35 +13,37 @@ decorations = "None"
[colors] [colors]
draw_bold_text_with_bright_colors = true draw_bold_text_with_bright_colors = true
# Default colors
[colors.primary]
background = '#1e2024'
foreground = '#a1a3a8'
# Normal colors
[colors.normal]
black = '#27272a'
blue = '#5e7fdd'
cyan = '#97c3fa'
green = '#90b99f'
magenta = '#e29eca'
red = '#d45d9e'
white = '#c9c7cd'
yellow = '#f0ea2d'
# Bright colors
[colors.bright] [colors.bright]
black = "#949494" black = '#353539'
blue = "#74b2ff" blue = '#a7b3dd'
cyan = "#85dc85" cyan = '#6de6fc'
green = "#36c692" green = '#a8fc8d'
magenta = "#ae81ff" magenta = '#eb4cce'
red = "#ff5189" red = '#ca72de'
white = "#e4e4e4" white = '#c9c7cd'
yellow = "#c6c684" yellow = '#f7f48d'
[colors.cursor] [colors.cursor]
cursor = "#8e8e8e" cursor = "#8e8e8e"
text = "#080808" text = "#080808"
[colors.normal]
black = "#323437"
blue = "#80a0ff"
cyan = "#79dac8"
green = "#8cc85f"
magenta = "#cf87e8"
red = "#ff5454"
white = "#c6c6c6"
yellow = "#e3c78a"
[colors.primary]
background = "#080808"
bright_foreground = "#eeeeee"
foreground = "#bdbdbd"
[colors.selection] [colors.selection]
background = "#b2ceee" background = "#b2ceee"
text = "#080808" text = "#080808"

View File

@ -25,14 +25,6 @@ end
require("lazy").setup({ require("lazy").setup({
-- this entry tells lazy.nvim to load the list of of *.lua files from plugins/ -- this entry tells lazy.nvim to load the list of of *.lua files from plugins/
import = "plugins", import = "plugins",
-- Dev configuration
dev = {
-- Directory where you store your local plugin projects
path = "~/neovim-plugins/squk/",
-- @type string[] plugins that match these patterns will use your local versions instead of being fetched from GitHub
patterns = { "squk" },
fallback = false, -- Fallback to git when local plugin doesn't exist
},
}) })
vim.opt.undodir = vim.fn.expand("$HOME") .. "/.undo/" vim.opt.undodir = vim.fn.expand("$HOME") .. "/.undo/"

View File

@ -0,0 +1,9 @@
vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
pattern = "*.wgsl",
callback = function()
local lspconfig = require("lspconfig")
lspconfig.wgsl_analyzer.setup({})
vim.bo.filetype = "wgsl"
end,
})

View File

@ -1,17 +0,0 @@
local use_google = require("utils").use_google
return {
{
"Exafunction/codeium.nvim",
-- commit = "b1ff0d6c993e3d87a4362d2ccd6c660f7444599f",
event = "VeryLazy",
-- event = "InsertEnter",
cond = not use_google(),
dependencies = {
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp",
},
config = function()
require("codeium").setup({})
end,
},
}

View File

@ -61,12 +61,11 @@ return {
-- Conform will run multiple formatters sequentially -- Conform will run multiple formatters sequentially
-- go = { "goimports", "gofmt" }, -- go = { "goimports", "gofmt" },
-- Use a sub-list to run only the first available formatter -- Use a sub-list to run only the first available formatter
-- javascript = { { "prettierd", "prettier" } },
lua = { "stylua" }, lua = { "stylua" },
-- Conform will run multiple formatters sequentially -- Conform will run multiple formatters sequentially
python = { "isort", "black" }, python = { "isort" },
-- Use a sub-list to run only the first available formatter -- Use a sub-list to run only the first available formatter
javascript = { { "prettierd", "prettier" } }, javascript = { { "prettier" } },
gdscript = { "gdformat" }, gdscript = { "gdformat" },
ron = { "ronfmt" }, ron = { "ronfmt" },
dashboard = {}, dashboard = {},

View File

@ -83,7 +83,7 @@ return {
{ "<C-g>", ":lua vim.lsp.buf.signature_help()<CR>", mode = "i" }, { "<C-g>", ":lua vim.lsp.buf.signature_help()<CR>", mode = "i" },
}, },
config = function() config = function()
local nvim_lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local lsp_configs = require("lspconfig.configs") local lsp_configs = require("lspconfig.configs")
lsp_configs.ciderlsp = { lsp_configs.ciderlsp = {
@ -107,18 +107,20 @@ return {
"typescript", "typescript",
}, },
offset_encoding = "utf-8", offset_encoding = "utf-8",
root_dir = nvim_lspconfig.util.root_pattern(".citc"), root_dir = lspconfig.util.root_pattern(".citc"),
settings = {}, settings = {},
}, },
} }
if use_google() then if use_google() then
nvim_lspconfig.ciderlsp.setup({}) lspconfig.ciderlsp.setup({})
end end
nvim_lspconfig.wgsl_analyzer.setup({})
require("lspconfig").gdscript.setup({})
vim.cmd([[autocmd FileType gdscript setlocal commentstring=#\ %s]]) vim.cmd([[autocmd FileType gdscript setlocal commentstring=#\ %s]])
vim.cmd([[autocmd FileType gdscript setlocal autoindent noexpandtab tabstop=4 shiftwidth=4]]) vim.cmd([[autocmd FileType gdscript setlocal autoindent noexpandtab tabstop=4 shiftwidth=4]])
require("lspconfig").gdshader_lsp.setup({})
end, end,
}, },
} }

View File

@ -6,6 +6,16 @@ return {
ft = { "rust" }, ft = { "rust" },
config = function(_, opts) config = function(_, opts)
vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {}) vim.g.rustaceanvim = vim.tbl_deep_extend("keep", vim.g.rustaceanvim or {}, opts or {})
for _, method in ipairs({ "textDocument/diagnostic", "workspace/diagnostic" }) do
local default_diagnostic_handler = vim.lsp.handlers[method]
vim.lsp.handlers[method] = function(err, result, context, config)
if err ~= nil and err.code == -32802 then
return
end
return default_diagnostic_handler(err, result, context, config)
end
end
end, end,
opts = { opts = {
server = { server = {

View File

@ -3,45 +3,35 @@ local exec = require("utils").exec
local TableConcat = require("utils").TableConcat local TableConcat = require("utils").TableConcat
_G.find_files = function(search_dirs) _G.find_files = function(search_dirs)
require("telescope.builtin").find_files({ search_dirs = search_dirs }) require("telescope.builtin").find_files({ search_dirs = search_dirs })
end end
-- Helper functions to fetch the current scope and set `search_dirs` -- Helper functions to fetch the current scope and set `search_dirs`
_G.find_dotfiles = function() end _G.find_dotfiles = function() end
_G.search_cwd = function() _G.search_cwd = function()
local builtin = require("telescope.builtin") local builtin = require("telescope.builtin")
local utils = require("telescope.utils") local utils = require("telescope.utils")
builtin.find_files({ cwd = utils.buffer_dir() }) builtin.find_files({ cwd = utils.buffer_dir() })
end
_G.live_grep = function(search_dirs)
require("telescope.builtin").live_grep({
search_dirs = search_dirs,
})
end
_G.live_grep_cword = function(search_dirs)
require("telescope.builtin").live_grep({ search_dirs = search_dirs })
end end
local function exe(cmd) local function exe(cmd)
return vim.split(vim.fn.system(cmd), "\n") return vim.split(vim.fn.system(cmd), "\n")
end end
local function fig_modified() local function fig_modified()
return exe("chg pstatus -ma -n --no-status --template= | sort") return exe("chg pstatus -ma -n --no-status --template= | sort")
end end
local function fig_all_modified() local function fig_all_modified()
return exe("chg status -ma -n --rev p4base --no-status --template= | sort") return exe("chg status -ma -n --rev p4base --no-status --template= | sort")
end end
-- stylua: ignore -- stylua: ignore
local keys = { local keys = {
{ "<leader>e", ":lua search_cwd()<CR>", desc = "Find Files in Buffer Directory" }, { "<leader>e", ":lua search_cwd()<CR>", desc = "Find Files in Buffer Directory" },
{ "<leader>ts", require('telescope.builtin').live_grep },
{ "<leader>tb", ":Telescope buffers<CR>" }, { "<leader>tb", ":Telescope buffers<CR>" },
{ "<leader>TS", function() require('telescope.builtin').live_grep { default_text = vim.fn.expand("<cword>") } end, }, -- { "<leader>ts", require('telescope.builtin').live_grep },
-- { "<leader>TS", function() require('telescope.builtin').live_grep { default_text = vim.fn.expand("<cword>") } end, },
{ {
"<leader>t.", "<leader>t.",
function() function()
@ -61,8 +51,8 @@ local keys = {
} }
if use_google() then if use_google() then
local find_files = require("telescope.builtin").find_files local find_files = require("telescope.builtin").find_files
local cs_query = require("telescope").extensions.codesearch.find_query local cs_query = require("telescope").extensions.codesearch.find_query
-- stylua: ignore -- stylua: ignore
TableConcat(keys, { TableConcat(keys, {
{ "<leader>tm", function() find_files({ search_dirs = fig_modified() }) end, desc = "list modified Fig files." }, { "<leader>tm", function() find_files({ search_dirs = fig_modified() }) end, desc = "list modified Fig files." },
@ -77,144 +67,167 @@ if use_google() then
end end
return { return {
{ {
"aznhe21/actions-preview.nvim", "aznhe21/actions-preview.nvim",
config = function() config = function()
require("actions-preview").setup({ require("actions-preview").setup({
telescope = { telescope = {
sorting_strategy = "ascending", sorting_strategy = "ascending",
layout_strategy = "vertical", layout_strategy = "vertical",
layout_config = { layout_config = {
width = 0.8, width = 0.8,
height = 0.9, height = 0.9,
prompt_position = "top", prompt_position = "top",
preview_cutoff = 20, preview_cutoff = 20,
preview_height = function(_, _, max_lines) preview_height = function(_, _, max_lines)
return max_lines - 15 return max_lines - 15
end, end,
}, },
}, },
}) })
end, end,
keys = { keys = {
{ "?", "<cmd>lua require('actions-preview').code_actions()<cr>" }, { "?", "<cmd>lua require('actions-preview').code_actions()<cr>" },
}, },
}, },
{ {
"smartpde/telescope-recent-files", "smartpde/telescope-recent-files",
config = function() config = function()
require("telescope").load_extension("recent_files") require("telescope").load_extension("recent_files")
end, end,
keys = { keys = {
{ "<leader>to", [[<cmd>lua require('telescope').extensions.recent_files.pick()<CR>]] }, { "<leader>to", [[<cmd>lua require('telescope').extensions.recent_files.pick()<CR>]] },
}, },
}, },
{ {
"piersolenski/telescope-import.nvim", "piersolenski/telescope-import.nvim",
dependencies = "nvim-telescope/telescope.nvim", dependencies = "nvim-telescope/telescope.nvim",
config = function() config = function()
require("telescope").load_extension("import") require("telescope").load_extension("import")
end, end,
keys = function() keys = function()
if not use_google() then if not use_google() then
return { return {
{ "<leader>i", ":Telescope import<CR>" }, { "<leader>i", ":Telescope import<CR>" },
} }
end end
end, end,
}, },
{ {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope-live-grep-args.nvim",
dependencies = { keys = {
"mfussenegger/nvim-dap", {
"smartpde/telescope-recent-files", "<leader>ts",
"rcarriga/nvim-dap-ui", function()
}, require("telescope").extensions.live_grep_args.live_grep_args()
config = function() end,
require("telescope").setup({ },
defaults = { {
-- The vertical layout strategy is good to handle long paths like those in "<leader>TS",
-- google3 repos because you have nearly the full screen to display a file path. function()
-- The caveat is that the preview area is smaller. require("telescope").extensions.live_grep_args.live_grep_args({
layout_strategy = "vertical", default_text = vim.fn.expand("<cword>"),
-- 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 end,
-- telescope-codesearch because it can be reused by other telescope pickers. },
path_display = function(opts, path) },
-- Do common substitutions config = function()
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1) require("telescope").load_extension("live_grep_args")
path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1) end,
path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1) },
path = path:gsub("^google3/third_party/", "//3p/", 1) {
path = path:gsub("^google3/", "//", 1) "nvim-telescope/telescope.nvim",
dependencies = {
"nvim-telescope/telescope-live-grep-args.nvim",
"mfussenegger/nvim-dap",
"smartpde/telescope-recent-files",
"rcarriga/nvim-dap-ui",
},
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/", "//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 -- 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,
mappings = { mappings = {
n = { n = {
["<C-c>"] = "close", ["<C-c>"] = "close",
["<Esc>"] = "close", ["<Esc>"] = "close",
}, },
i = { i = {
-- ["<cr>"] = function(bufnr) -- ["<cr>"] = function(bufnr)
-- require("telescope.actions.set").edit(bufnr, "tab drop") -- require("telescope.actions.set").edit(bufnr, "tab drop")
-- end, -- end,
["<C-c>"] = "close", ["<C-c>"] = "close",
["<Esc>"] = "close", ["<Esc>"] = "close",
["<S-Down>"] = "cycle_history_next", ["<S-Down>"] = "cycle_history_next",
["<S-Up>"] = "cycle_history_prev", ["<S-Up>"] = "cycle_history_prev",
}, },
}, },
}, },
extensions = { extensions = {
codesearch = { codesearch = {
experimental = true, -- enable results from google3/experimental experimental = true, -- enable results from google3/experimental
}, },
recent_files = { recent_files = {
-- This function rewrites all file paths to the current workspace. -- This function rewrites all file paths to the current workspace.
-- For example, if w2 is the current workspace, then -- For example, if w2 is the current workspace, then
-- /google/.../w1/google3/my_file.cc becomes /google/.../w2/google3/my_file.cc, -- /google/.../w1/google3/my_file.cc becomes /google/.../w2/google3/my_file.cc,
transform_file_path = function(path) transform_file_path = function(path)
local neocitc = require("neocitc") local neocitc = require("neocitc")
local path_func = neocitc.path_in_current_workspace_or_head local path_func = neocitc.path_in_current_workspace_or_head
or neocitc.path_in_current_workspace or neocitc.path_in_current_workspace
return path_func(path) return path_func(path)
end, end,
-- This is a useful option to speed up Telescope by avoiding the check -- This is a useful option to speed up Telescope by avoiding the check
-- for file existence. -- for file existence.
stat_files = false, stat_files = false,
-- Ignore common patterns that can show up from other google plugins -- Ignore common patterns that can show up from other google plugins
ignore_patterns = { ignore_patterns = {
"/%.git/COMMIT_EDITING$", "/%.git/COMMIT_EDITING$",
"/%.git/COMMIT_EDITMSG$", "/%.git/COMMIT_EDITMSG$",
"/%.git/MERGE_MSG$", "/%.git/MERGE_MSG$",
"^/tmp/%.pipertmp-", "^/tmp/%.pipertmp-",
"/Related_Files$", "/Related_Files$",
"^term:", "^term:",
";#toggleterm#", ";#toggleterm#",
}, },
}, },
persisted = {}, persisted = {},
import = { import = {
-- Add imports to the top of the file keeping the cursor in place -- Add imports to the top of the file keeping the cursor in place
insert_at_top = true, insert_at_top = true,
}, },
}, },
}) })
end, end,
keys = keys, keys = keys,
}, },
} }

View File

@ -1,6 +1,19 @@
local use_google = require("utils").use_google local use_google = require("utils").use_google
return { return {
{
"squk/ableton.nvim",
lazy = false,
cond = not use_google(),
priority = 1000,
dir = "~/neovim-plugins/squk/ableton.nvim",
opts = {
variant = "cooler",
},
config = function()
vim.cmd("colorscheme ableton")
end,
},
{ {
"dgox16/oldworld.nvim", "dgox16/oldworld.nvim",
lazy = false, lazy = false,
@ -10,7 +23,7 @@ return {
variant = "cooler", variant = "cooler",
}, },
config = function() config = function()
vim.cmd("colorscheme oldworld") -- vim.cmd("colorscheme oldworld")
end, end,
}, },
{ {