Compare commits
5 Commits
f164ec976d
...
b83696c4cd
Author | SHA1 | Date | |
---|---|---|---|
b83696c4cd | |||
eb1168ffe3 | |||
7f70ffda16 | |||
768cd312a7 | |||
4063d58e4d |
@ -1,3 +1,4 @@
|
|||||||
private
|
private
|
||||||
handlePackageIntent
|
handlePackageIntent
|
||||||
for/!
|
for/!
|
||||||
|
tooling/!
|
||||||
|
Binary file not shown.
@ -3,7 +3,6 @@ name: dev
|
|||||||
|
|
||||||
windows:
|
windows:
|
||||||
- gmscore:
|
- gmscore:
|
||||||
# layout: 02a8,363x89,0,0[363x74,0,0,14,363x14,0,75{181x14,0,75,15,181x14,182,75,17}]
|
|
||||||
layout: main-vertical
|
layout: main-vertical
|
||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
@ -13,7 +12,6 @@ windows:
|
|||||||
- hgd gmscore
|
- hgd gmscore
|
||||||
|
|
||||||
- experimental:
|
- experimental:
|
||||||
# layout: 02a8,363x89,0,0[363x74,0,0,14,363x14,0,75{181x14,0,75,15,181x14,182,75,17}]
|
|
||||||
layout: main-vertical
|
layout: main-vertical
|
||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
@ -21,24 +19,18 @@ windows:
|
|||||||
- vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- hgd experimental
|
- hgd experimental
|
||||||
|
|
||||||
- notes:
|
- notes:
|
||||||
# layout: 02a8,363x89,0,0[363x74,0,0,14,363x14,0,75{181x14,0,75,15,181x14,182,75,17}]
|
|
||||||
layout: main-vertical
|
|
||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- hgd notes
|
|
||||||
- cd ../company/users/cnieves/
|
|
||||||
- vim ~/zettelkasten/
|
|
||||||
- other:
|
|
||||||
- hgd notes
|
- hgd notes
|
||||||
- cd ../company/users/cnieves/
|
- cd ../company/users/cnieves/
|
||||||
- vim ~/zettelkasten/Todo.md
|
- vim ~/zettelkasten/Todo.md
|
||||||
- vim:
|
- dotfiles:
|
||||||
# layout: 02a8,363x89,0,0[363x74,0,0,14,363x14,0,75{181x14,0,75,15,181x14,182,75,17}]
|
|
||||||
layout: main-vertical
|
layout: main-vertical
|
||||||
panes:
|
panes:
|
||||||
- main:
|
- main:
|
||||||
- cd ~/.vim/prefs
|
- cd ~/dotfiles
|
||||||
- vim
|
- vim
|
||||||
- other:
|
- other:
|
||||||
- cd ~/.vim/prefs
|
- cd ~/dotfiles
|
||||||
|
@ -18,7 +18,7 @@ if use_google() then
|
|||||||
configs.ciderlsp = {
|
configs.ciderlsp = {
|
||||||
default_config = {
|
default_config = {
|
||||||
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses" },
|
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses" },
|
||||||
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl" },
|
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl", "typescript"},
|
||||||
-- root_dir = lspconfig.util.root_pattern("BUILD"),
|
-- root_dir = lspconfig.util.root_pattern("BUILD"),
|
||||||
root_dir = function(fname)
|
root_dir = function(fname)
|
||||||
return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
|
return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
|
||||||
@ -30,7 +30,7 @@ if use_google() then
|
|||||||
configs.analysislsp = {
|
configs.analysislsp = {
|
||||||
default_config = {
|
default_config = {
|
||||||
cmd = { '/google/bin/users/lerm/glint-ale/analysis_lsp/server', '--lint_on_save=false', '--max_qps=10' },
|
cmd = { '/google/bin/users/lerm/glint-ale/analysis_lsp/server', '--lint_on_save=false', '--max_qps=10' },
|
||||||
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl" },
|
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl", "markdown","typescript", "javascript"},
|
||||||
-- root_dir = lspconfig.util.root_pattern('BUILD'),
|
-- root_dir = lspconfig.util.root_pattern('BUILD'),
|
||||||
root_dir = function(fname)
|
root_dir = function(fname)
|
||||||
return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
|
return string.match(fname, '(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$')
|
||||||
@ -40,46 +40,6 @@ if use_google() then
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local cider_lsp_handlers = {
|
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
|
||||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
||||||
underline = true,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
|
||||||
-- is_cider_lsp_attached has been setup via on_init, but hasn't received
|
|
||||||
-- sync response yet.
|
|
||||||
local first_fire = vim.b['is_cider_lsp_attached'] == 'no'
|
|
||||||
vim.b['is_cider_lsp_attached'] = 'yes'
|
|
||||||
if first_fire then
|
|
||||||
notify('CiderLSP attached', 'info', {timeout=500})
|
|
||||||
require('lualine').refresh()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
cider_lsp_handlers["workspace/diagnostic/refresh"] = function(_, result, ctx)
|
|
||||||
notify('result:'..result, 'info', {timeout=900})
|
|
||||||
notify('ctx:'..ctx, 'info', {timeout=900})
|
|
||||||
end
|
|
||||||
|
|
||||||
cider_lsp_handlers['window/showMessage'] = function(_, result, ctx)
|
|
||||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
|
||||||
local lvl = ({
|
|
||||||
'ERROR',
|
|
||||||
'WARN',
|
|
||||||
'INFO',
|
|
||||||
'DEBUG',
|
|
||||||
})[result.type]
|
|
||||||
notify({ result.message }, lvl, {
|
|
||||||
title = 'LSP | ' .. client.name,
|
|
||||||
timeout = 1000,
|
|
||||||
keep = function()
|
|
||||||
return lvl == 'ERROR' or lvl == 'WARN'
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 3. Set up CiderLSP
|
-- 3. Set up CiderLSP
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
vim.b['is_cider_lsp_attached'] = 'no'
|
vim.b['is_cider_lsp_attached'] = 'no'
|
||||||
@ -111,6 +71,7 @@ local on_attach = function(client, bufnr)
|
|||||||
vim.api.nvim_set_keymap("n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
|
vim.api.nvim_set_keymap("n", "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>", opts)
|
||||||
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
|
vim.api.nvim_set_keymap("n", "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
vim.api.nvim_set_keymap("n", "grf", "<cmd>lua vim.lsp.buf.references()<CR>", opts) -- diagnostics controls references
|
||||||
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
vim.api.nvim_set_keymap("n", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
vim.api.nvim_set_keymap("i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
vim.api.nvim_set_keymap("i", "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||||
@ -169,21 +130,6 @@ lspconfig.sumneko_lua.setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
if use_google() then
|
|
||||||
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
|
|
||||||
capabilities.workspace.codeLens = {refreshSupport=true}
|
|
||||||
capabilities.workspace.diagnostics = {refreshSupport=true}
|
|
||||||
lspconfig.ciderlsp.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
handlers = cider_lsp_handlers,
|
|
||||||
})
|
|
||||||
lspconfig.analysislsp.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local lspkind = require("lspkind")
|
local lspkind = require("lspkind")
|
||||||
lspkind.init()
|
lspkind.init()
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
@ -220,12 +166,12 @@ cmp.setup.cmdline(':', {
|
|||||||
local conditionalSources = {
|
local conditionalSources = {
|
||||||
{ name = "nvim_lua" },
|
{ name = "nvim_lua" },
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = 'nvim_lsp_signature_help', priority = 5 },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
{ name = "treesitter" },
|
{ name = "treesitter" },
|
||||||
{ name = "crates" },
|
{ name = "crates" },
|
||||||
{ name = "vim_vsnip" },
|
{ name = "vim_vsnip" },
|
||||||
{ name = 'nvim_lsp_signature_help' },
|
{ name = "buffer", keyword_length = 5, group_index = 2 },
|
||||||
{ name = "buffer", keyword_length = 5 },
|
|
||||||
{
|
{
|
||||||
name = 'spell',
|
name = 'spell',
|
||||||
option = {
|
option = {
|
||||||
@ -238,59 +184,62 @@ local conditionalSources = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if use_google() then
|
if use_google() then
|
||||||
|
local cider_lsp_handlers = {
|
||||||
|
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||||
|
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
|
underline = true,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
||||||
|
-- is_cider_lsp_attached has been setup via on_init, but hasn't received
|
||||||
|
-- sync response yet.
|
||||||
|
local first_fire = vim.b['is_cider_lsp_attached'] == 'no'
|
||||||
|
vim.b['is_cider_lsp_attached'] = 'yes'
|
||||||
|
if first_fire then
|
||||||
|
notify('CiderLSP attached', 'info', {timeout=500})
|
||||||
|
require('lualine').refresh()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
cider_lsp_handlers["workspace/diagnostic/refresh"] = function(_, result, ctx)
|
||||||
|
notify('result:'..result, 'info', {timeout=900})
|
||||||
|
notify('ctx:'..ctx, 'info', {timeout=900})
|
||||||
|
end
|
||||||
|
|
||||||
|
cider_lsp_handlers['window/showMessage'] = function(_, result, ctx)
|
||||||
|
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||||
|
local lvl = ({
|
||||||
|
'ERROR',
|
||||||
|
'WARN',
|
||||||
|
'INFO',
|
||||||
|
'DEBUG',
|
||||||
|
})[result.type]
|
||||||
|
notify({ result.message }, lvl, {
|
||||||
|
title = 'LSP | ' .. client.name,
|
||||||
|
timeout = 1000,
|
||||||
|
keep = function()
|
||||||
|
return lvl == 'ERROR' or lvl == 'WARN'
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
|
||||||
|
capabilities.workspace.codeLens = {refreshSupport=true}
|
||||||
|
capabilities.workspace.diagnostics = {refreshSupport=true}
|
||||||
|
lspconfig.ciderlsp.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
handlers = cider_lsp_handlers,
|
||||||
|
})
|
||||||
|
lspconfig.analysislsp.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
})
|
||||||
table.insert(conditionalSources, { name = 'nvim_ciderlsp', priority = 9 })
|
table.insert(conditionalSources, { name = 'nvim_ciderlsp', priority = 9 })
|
||||||
table.insert(conditionalSources, { name = 'analysislsp', priority = 9 })
|
table.insert(conditionalSources, { name = 'analysislsp' })
|
||||||
else
|
else
|
||||||
table.insert(conditionalSources, {name = 'cmp_tabnine'})
|
table.insert(conditionalSources, {name = 'cmp_tabnine'})
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local i = 0
|
|
||||||
|
|
||||||
function cmp_format(opts)
|
|
||||||
if opts == nil then
|
|
||||||
opts = {}
|
|
||||||
end
|
|
||||||
if opts.preset or opts.symbol_map then
|
|
||||||
lspkind.init(opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
return function(entry, vim_item)
|
|
||||||
if opts.before then
|
|
||||||
vim_item = opts.before(entry, vim_item)
|
|
||||||
end
|
|
||||||
|
|
||||||
vim_item.kind = lspkind.symbolic(vim_item.kind, opts)
|
|
||||||
if i == 0 then
|
|
||||||
if entry.source.name == "nvim_lsp" then
|
|
||||||
log(vim.json.encode(entry.source))
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.menu ~= nil then
|
|
||||||
vim_item.menu = opts.menu[entry.source.name]
|
|
||||||
-- if entry.source.client ~= nil then
|
|
||||||
-- if entry.source.client.name ~= nil then
|
|
||||||
-- log(entry.source.client.name)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- vim_item.menu = opts.menu[entry.source.name+":"+entry.source.client.name]
|
|
||||||
end
|
|
||||||
|
|
||||||
if opts.maxwidth ~= nil then
|
|
||||||
if opts.ellipsis_char == nil then
|
|
||||||
vim_item.abbr = string.sub(vim_item.abbr, 1, opts.maxwidth)
|
|
||||||
else
|
|
||||||
local label = vim_item.abbr
|
|
||||||
local truncated_label = vim.fn.strcharpart(label, 0, opts.maxwidth)
|
|
||||||
if truncated_label ~= label then
|
|
||||||
vim_item.abbr = truncated_label .. opts.ellipsis_char
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
@ -344,6 +293,7 @@ cmp.setup({
|
|||||||
|
|
||||||
sources = conditionalSources,
|
sources = conditionalSources,
|
||||||
|
|
||||||
|
|
||||||
sorting = {
|
sorting = {
|
||||||
comparators = {
|
comparators = {
|
||||||
cmp.config.compare.offset,
|
cmp.config.compare.offset,
|
||||||
@ -364,7 +314,6 @@ cmp.setup({
|
|||||||
},
|
},
|
||||||
|
|
||||||
formatting = {
|
formatting = {
|
||||||
-- format = cmp_format({
|
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
with_text = true,
|
with_text = true,
|
||||||
maxwidth = 40, -- half max width
|
maxwidth = 40, -- half max width
|
||||||
@ -388,37 +337,4 @@ cmp.setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
local lsp = require('lsp-zero')
|
vim.cmd([[ augroup CmpZsh au! autocmd Filetype zsh lua require'cmp'.setup.buffer { sources = { { name = "zsh" }, } } augroup END ]])
|
||||||
-- lsp.preset('lsp-compe')
|
|
||||||
lsp.set_preferences({
|
|
||||||
suggest_lsp_servers = true,
|
|
||||||
setup_servers_on_start = true,
|
|
||||||
set_lsp_keymaps = false,
|
|
||||||
configure_diagnostics = true,
|
|
||||||
cmp_capabilities = true,
|
|
||||||
manage_nvim_cmp = true,
|
|
||||||
call_servers = 'local',
|
|
||||||
sign_icons = {
|
|
||||||
error = '✘',
|
|
||||||
warn = '▲',
|
|
||||||
hint = '⚑',
|
|
||||||
info = ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
lsp.nvim_workspace()
|
|
||||||
lsp.on_attach(on_attach)
|
|
||||||
lsp.setup()
|
|
||||||
|
|
||||||
-- Initialize rust_analyzer with rust-tools
|
|
||||||
local rust_lsp = lsp.build_options('rust_analyzer', {})
|
|
||||||
require('rust-tools').setup({ server = rust_lsp, })
|
|
||||||
|
|
||||||
|
|
||||||
vim.cmd([[
|
|
||||||
augroup CmpZsh
|
|
||||||
au!
|
|
||||||
autocmd Filetype zsh lua require'cmp'.setup.buffer { sources = { { name = "zsh" }, } }
|
|
||||||
augroup END
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
28
vim/.vim/lua/config/lspzero.lua
Normal file
28
vim/.vim/lua/config/lspzero.lua
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
-- local lspzero = require('lsp-zero')
|
||||||
|
-- -- lsp.preset('lsp-compe')
|
||||||
|
-- lspzero.set_preferences({
|
||||||
|
-- suggest_lsp_servers = true,
|
||||||
|
-- setup_servers_on_start = true,
|
||||||
|
-- set_lsp_keymaps = false,
|
||||||
|
-- configure_diagnostics = true,
|
||||||
|
-- cmp_capabilities = true,
|
||||||
|
-- manage_nvim_cmp = false,
|
||||||
|
-- call_servers = 'local',
|
||||||
|
-- sign_icons = {
|
||||||
|
-- error = '✘',
|
||||||
|
-- warn = '▲',
|
||||||
|
-- hint = '⚑',
|
||||||
|
-- info = ''
|
||||||
|
-- }
|
||||||
|
-- })
|
||||||
|
--
|
||||||
|
-- lspzero.nvim_workspace()
|
||||||
|
-- lspzero.on_attach(on_attach)
|
||||||
|
-- lspzero.setup()
|
||||||
|
--
|
||||||
|
-- Initialize rust_analyzer with rust-tools
|
||||||
|
-- local rust_lsp = lspzero.build_options('rust_analyzer', {})
|
||||||
|
-- require('rust-tools').setup({ server = rust_lsp, })
|
||||||
|
|
||||||
|
|
14
vim/.vim/lua/config/refactoring.lua
Normal file
14
vim/.vim/lua/config/refactoring.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
require('refactoring').setup({})
|
||||||
|
|
||||||
|
-- Remaps for the refactoring operations currently offered by the plugin
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>re", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function')<CR>]], {noremap = true, silent = true, expr = false})
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>rf", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Function To File')<CR>]], {noremap = true, silent = true, expr = false})
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>rv", [[ <Esc><Cmd>lua require('refactoring').refactor('Extract Variable')<CR>]], {noremap = true, silent = true, expr = false})
|
||||||
|
vim.api.nvim_set_keymap("v", "<leader>ri", [[ <Esc><Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
|
||||||
|
|
||||||
|
-- Extract block doesn't need visual mode
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<leader>rb", [[ <Cmd>lua require('refactoring').refactor('Extract Block')<CR>]], {noremap = true, silent = true, expr = false})
|
||||||
|
-- vim.api.nvim_set_keymap("n", "<leader>rbf", [[ <Cmd>lua require('refactoring').refactor('Extract Block To File')<CR>]], {noremap = true, silent = true, expr = false})
|
||||||
|
|
||||||
|
-- Inline variable can also pick up the identifier currently under the cursor without visual mode
|
||||||
|
vim.api.nvim_set_keymap("n", "<leader>ri", [[ <Cmd>lua require('refactoring').refactor('Inline Variable')<CR>]], {noremap = true, silent = true, expr = false})
|
@ -1,104 +1,93 @@
|
|||||||
require('telescope').setup {
|
local use_google = require("utils").use_google
|
||||||
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)
|
|
||||||
|
|
||||||
-- Do truncation. This allows us to combine our custom display formatter
|
require('telescope').setup {
|
||||||
-- with the built-in truncation.
|
defaults = {
|
||||||
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
|
-- The vertical layout strategy is good to handle long paths like those in
|
||||||
-- Here we are manually propagating this value between new_opts and opts.
|
-- google3 repos because you have nearly the full screen to display a file path.
|
||||||
-- We can make this cleaner and more complicated using metatables :)
|
-- The caveat is that the preview area is smaller.
|
||||||
local new_opts = {
|
layout_strategy = 'vertical',
|
||||||
path_display = {
|
-- Common paths in google3 repos are collapsed following the example of Cider
|
||||||
truncate = true,
|
-- 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.
|
||||||
__length = opts.__length,
|
path_display = function(opts, path)
|
||||||
}
|
-- Do common substitutions
|
||||||
path = require('telescope.utils').transform_path(new_opts, path)
|
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
|
||||||
opts.__length = new_opts.__length
|
path = path:gsub("^google3/java/com/google/", "g3/j/c/g/", 1)
|
||||||
return path
|
path = path:gsub("^google3/javatests/com/google/", "g3/jt/c/g/", 1)
|
||||||
end,
|
path = path:gsub("^google3/third_party/", "g3/3rdp/", 1)
|
||||||
},
|
path = path:gsub("^google3/", "g3/", 1)
|
||||||
extensions = { -- this block is optional, and if omitted, defaults will be used
|
|
||||||
|
-- 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 = {
|
codesearch = {
|
||||||
experimental = true -- enable results from google3/experimental
|
experimental = true -- enable results from google3/experimental
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
local map = require("utils").map
|
local map = require("utils").map
|
||||||
|
|
||||||
-- These custom mappings let you open telescope-codesearch quickly:
|
if use_google() then
|
||||||
map('n', '<C-P>',
|
-- These custom mappings let you open telescope-codesearch quickly:
|
||||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
map('n', '<C-P>',
|
||||||
{ noremap = true, silent=true }
|
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
||||||
)
|
{ noremap = true, silent=true }
|
||||||
|
)
|
||||||
|
|
||||||
-- Search using codesearch queries.
|
-- Search using codesearch queries.
|
||||||
map(
|
map(
|
||||||
"n",
|
"n",
|
||||||
"<leader>cs",
|
"<leader>cs",
|
||||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||||
{ noremap = true, silent = true }
|
{ noremap = true, silent = true }
|
||||||
)
|
)
|
||||||
--
|
|
||||||
-- Search for files using codesearch queries.
|
|
||||||
map(
|
|
||||||
"n",
|
|
||||||
"<leader>cf",
|
|
||||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Search for the word under cursor.
|
-- Search for the word under cursor.
|
||||||
map(
|
map(
|
||||||
"n",
|
"n",
|
||||||
"<leader>CS",
|
"<leader>CS",
|
||||||
[[<cmd>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>]],
|
||||||
{ noremap = true, silent = true }
|
{ noremap = true, silent = true }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Search for a file having word under cursor in its name.
|
-- Search for text selected in Visual mode.
|
||||||
map(
|
map(
|
||||||
"n",
|
"v",
|
||||||
"<leader>CF",
|
"<leader>cs",
|
||||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{default_text_expand='<cword>'}<CR>]],
|
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
||||||
{ noremap = true, silent = true }
|
{ noremap = true, silent = true }
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Search for text selected in Visual mode.
|
-- map("n",
|
||||||
map(
|
-- "<leader>ps",
|
||||||
"v",
|
-- [[:Telescope find_files find_command=hg,pstatus,-ma,-n,--template=<CR>]])
|
||||||
"<leader>cs",
|
|
||||||
[[<cmd>lua require('telescope').extensions.codesearch.find_query{}<CR>]],
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Search for file having text selected in Visual mode.
|
map("n", "<leader>tw", ":Telescope citc workspaces<CR>")
|
||||||
map(
|
map("n", "<leader>tm", ":Telescope citc modified<CR>")
|
||||||
"v",
|
map("n", "<leader>tb", ":Telescope file_browser<CR>")
|
||||||
"<leader>cf",
|
|
||||||
[[<cmd>lua require('telescope').extensions.codesearch.find_files{}<CR>]],
|
|
||||||
{ noremap = true, silent = true }
|
|
||||||
)
|
|
||||||
|
|
||||||
map("n",
|
-- [F]ig [S]tatus
|
||||||
"<leader>ps",
|
map('n', '<leader>fs', [[<cmd>lua require('telescope').extensions.fig.status{}<CR>]])
|
||||||
[[:Telescope find_files find_command=hg,pstatus,-ma,-n,--template=<CR>]])
|
|
||||||
|
|
||||||
map( "n", "<space>tb", ":Telescope file_browser")
|
-- [F]ig [X]l
|
||||||
map( "n", "<space>fb", ":Telescope file_browser")
|
map('n', '<leader>fx', [[<cmd>lua require('telescope').extensions.fig.xl{}<CR>]])
|
||||||
map("n", "<leader><leader>", "<Cmd>lua require('telescope').extensions.frecency.frecency({ workspace = 'CWD' })<CR>", {noremap = true, silent = true})
|
|
||||||
|
|
||||||
|
-- [F]ig [W]hatsout
|
||||||
|
map('n', '<leader>fw', [[<cmd>lua require('telescope').extensions.fig.status{whatsout=true}<CR>]])
|
||||||
|
|
||||||
|
end
|
||||||
|
@ -98,6 +98,12 @@ require('packer').startup(function(use)
|
|||||||
config = [[ require("config.trouble")]]
|
config = [[ require("config.trouble")]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
'ThePrimeagen/refactoring.nvim',
|
||||||
|
config = [[ require("config.refactoring")]]
|
||||||
|
}
|
||||||
|
use 'apalmer1377/factorus'
|
||||||
|
|
||||||
use 'hrsh7th/vim-vsnip'
|
use 'hrsh7th/vim-vsnip'
|
||||||
use 'kosayoda/nvim-lightbulb'
|
use 'kosayoda/nvim-lightbulb'
|
||||||
use {'andymass/vim-matchup', event = 'VimEnter'}
|
use {'andymass/vim-matchup', event = 'VimEnter'}
|
||||||
@ -113,14 +119,6 @@ require('packer').startup(function(use)
|
|||||||
}
|
}
|
||||||
use 'nvim-telescope/telescope-file-browser.nvim'
|
use 'nvim-telescope/telescope-file-browser.nvim'
|
||||||
|
|
||||||
use {
|
|
||||||
"nvim-telescope/telescope-frecency.nvim",
|
|
||||||
config = function()
|
|
||||||
require"telescope".load_extension("frecency")
|
|
||||||
end,
|
|
||||||
requires = {"kkharji/sqlite.lua"}
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'rmagatti/auto-session',
|
'rmagatti/auto-session',
|
||||||
config = function()
|
config = function()
|
||||||
@ -131,15 +129,13 @@ require('packer').startup(function(use)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
use {
|
|
||||||
'sso://googler@user/vintharas/telescope-codesearch.nvim',
|
|
||||||
disable = not use_google(),
|
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
'sso://googler@user/piloto/cmp-nvim-ciderlsp',
|
'sso://googler@user/piloto/cmp-nvim-ciderlsp',
|
||||||
'sso://googler@user/kdark/ciderlsp-nvim',
|
'sso://googler@user/kdark/ciderlsp-nvim',
|
||||||
|
'sso://googler@user/vintharas/telescope-codesearch.nvim',
|
||||||
|
'sso://googler@user/aktau/telescope-citc.nvim',
|
||||||
|
'sso://googler@user/tylersaunders/telescope-fig.nvim',
|
||||||
|
|
||||||
disable = not use_google(),
|
disable = not use_google(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,3 +183,5 @@ nnoremap <leader>ws :CorpWebCs <cword> <CR>
|
|||||||
nnoremap <leader>wf :CorpWebCsFile<CR>
|
nnoremap <leader>wf :CorpWebCsFile<CR>
|
||||||
|
|
||||||
nmap <leader>rbs ss <leader>rb
|
nmap <leader>rbs ss <leader>rb
|
||||||
|
|
||||||
|
nmap <leader>yb :let @" = join(blaze#GetTargets(), ' ')<cr>
|
||||||
|
Reference in New Issue
Block a user