From 55546ec7924de2312d0d762053aff80350031458 Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Fri, 19 Jan 2024 22:55:08 +0000 Subject: [PATCH] mapping for auto blaze query entire package --- vim/.vim/lua/config/blaze.lua | 35 +-------------------------- vim/.vim/lua/plugins/base.lua | 2 +- vim/.vim/lua/plugins/google.lua | 38 +++++++++++++++--------------- vim/.vim/lua/plugins/telescope.lua | 4 ++-- vim/.vim/prefs/leader.vim | 2 +- 5 files changed, 24 insertions(+), 57 deletions(-) diff --git a/vim/.vim/lua/config/blaze.lua b/vim/.vim/lua/config/blaze.lua index 4c6ee6a..3af4b56 100644 --- a/vim/.vim/lua/config/blaze.lua +++ b/vim/.vim/lua/config/blaze.lua @@ -1,40 +1,7 @@ vim.cmd([[ -function s:blazeExec(cmd, targets) - if len(a:targets) == 0 - exe VimuxRunCommand("build_target.py " . expand('%:p') . " " . a:cmd) - else - exe VimuxRunCommand(a:cmd . " " . join(a:targets, ' ')) - endif -endfunction - -function BlazeRun() abort - call blazeExec("blaze run", blaze#GetTargets()) -endfunction - -function BlazeBuild() abort - call blazeExec("blaze build", blaze#GetTargets()) -endfunction - -function BlazeTest() abort - call blazeExec("blaze test", blaze#GetTargets()) -endfunction - -function BlazeTestDebug() abort - call blazeExec("blaze test --java_debug", blaze#GetTargets()) -endfunction - -function BuildCleanerFile() abort - exe VimuxRunCommand("build_cleaner " . expand('%')) -endfunction - function UnusedDeps() abort exe VimuxRunCommand("unused_deps --nouse_build_api --blaze_options='--config=gmscore_tap' " . join(blaze#GetTargets(), ' ')) endfunction -function BuildCleanerTarget() abort - exe VimuxRunCommand("build_cleaner " . join(blaze#GetTargets(), ' ')) -endfunction - -nnoremap bc :call BuildCleanerFile() -nnoremap ud :call UnusedDeps() +nnoremap ud :call UnusedDeps() ]]) diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index 989e765..66ee9f8 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -35,7 +35,7 @@ return { "rafcamlet/nvim-luapad", config = function() require("luapad").setup({ - eval_on_change = false, + -- eval_on_change = false, }) end, }, diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index e0e0b69..778e4e9 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -203,36 +203,36 @@ return { require("config.blaze") end, keys = function() - local function runCmd(cmd) + local function runCommandWithTarget(cmd) return function() - vim.g._calling_blaze_cmd = 1 + local targets = vim.fn["blaze#GetTargets"]() + local bloooooo = "VimuxRunCommand('" .. cmd .. " " .. targets:gsub(":.+", "") .. "')" + print(vim.inspect(bloooooo)) vim.cmd(cmd) - -- Clear the "blaze: SUCCESS" that blaze.vim will print - if vim.g._call_blaze_query then - print("") - end - vim.g._calling_blaze_cmd = 0 end end return { { "b", desc = "Blaze" }, - { "bt", ":call BlazeTest()", desc = "Blaze Test" }, - { "bb", ":call BlazeBuild()", desc = "Blaze Build" }, - { "br", ":call BlazeRun()", desc = "Blaze Run" }, + { "bb", runCommandWithTarget("blaze build"), desc = "Blaze Build" }, + { "br", runCommandWithTarget("blaze run"), desc = "Blaze Run" }, + { "bt", runCommandWithTarget("blaze test"), desc = "Blaze Test" }, + { "bc", runCommandWithTarget("build_cleaner"), desc = "Blaze Run" }, { "yb", ":let t = join(blaze#GetTargets(), ' ') | echo t | let @+ = t | let @\" = t", desc = "Yank Blaze Target", }, - { "bf", runCmd("call blaze#TestCurrentFile()"), desc = "Blaze test current file" }, - { "bm", runCmd("call blaze#TestCurrentMethod()"), desc = "Blaze test current method" }, - { "bd", desc = "Blaze debug" }, - { "bdf", runCmd("BlazeDebugCurrentFileTest"), desc = "Blaze debug current file" }, - { "bdm", runCmd("BlazeDebugCurrentTestMethod"), desc = "Blaze debug current method" }, - { "bda", runCmd("BlazeDebugAddBreakpoint"), desc = "Blaze debug add breakpoint" }, - { "bdc", runCmd("BlazeDebugClearBreakpoint"), desc = "Blaze debug clear breakpoint" }, - { "bdf", runCmd("BlazeDebugFinish"), desc = "Blaze debug finish" }, - { "bu", runCmd("BlazeDepsUpdate"), desc = "Blaze update dependencies" }, + { + "bq", + function() + local targets = vim.fn["blaze#GetTargets"]() + for _, t in ipairs(targets) do + print(vim.inspect(t)) + vim.cmd("VimuxRunCommand('blaze query " .. t:gsub(":.+", "") .. ":\\*" .. "')") + end + end, + desc = "Blaze query the current package", + }, } end, }), diff --git a/vim/.vim/lua/plugins/telescope.lua b/vim/.vim/lua/plugins/telescope.lua index 9680afc..11cbafd 100644 --- a/vim/.vim/lua/plugins/telescope.lua +++ b/vim/.vim/lua/plugins/telescope.lua @@ -46,8 +46,8 @@ local keys = { { "tf.", "lua vim.error('use e')", desc = "Find Files in Buffer Directory" }, { "e", "lua search_cwd()", desc = "Find Files in Buffer Directory" }, { "tg", ":Telescope git_files", desc = "Git Files" }, - { "tl", ":Telescope resume", desc = "Last Query" }, - { "tr", ":Telescope oldfiles", desc = "Recent Files" }, + { "tr", ":Telescope resume", desc = "Telescope Resume" }, + { "to", ":Telescope oldfiles", desc = "Recent(oldfiles) Files" }, { "th", "lua require('telescope.builtin').help_tags{}", desc = "[T]elescope [H]elp" }, { "tns", [[lua require("neoscopes").select()]], desc = "NeoScopes" }, } diff --git a/vim/.vim/prefs/leader.vim b/vim/.vim/prefs/leader.vim index 1abf334..4f8bda4 100644 --- a/vim/.vim/prefs/leader.vim +++ b/vim/.vim/prefs/leader.vim @@ -42,7 +42,7 @@ nnoremap x- :exe "resize " . (winheight(0) * 2/3) " --------- FORMATTING MAPPINGS --------- " indent file map = gg=G `` -nmap yf :let @+ = expand("%") | let @" = expand("%") +nmap yf :let @+ = expand("%") \| let @" = expand("%") " replace currently selected text with default register " without yanking it vnoremap p "_dP