tangled
alpha
login
or
join now
selman.me
/
rc.d
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
.config/nvim/.../fzflua: update go test mappings
Selman Kayrancioglu
5 months ago
c618beb5
9a242630
+30
-1
1 changed file
expand all
collapse all
unified
split
private_dot_config
nvim
lua
seruman
plugins
fzflua.lua
+30
-1
private_dot_config/nvim/lua/seruman/plugins/fzflua.lua
···
146
146
})
147
147
end
148
148
149
149
-
vim.keymap.set("n", "<leader>fut", search_go_tests, { buffer = true, desc = "Fuzzy Unit Tests" })
149
149
+
local function search_go_tests_in_current_file()
150
150
+
local current_file = vim.fn.expand("%:p")
151
151
+
if current_file == "" then
152
152
+
print("No file is currently open.")
153
153
+
return
154
154
+
end
155
155
+
return require("fzf-lua").fzf_exec("listests --vimgrep " .. current_file, {
156
156
+
prompt = "Go Tests in Current File> ",
157
157
+
file_icons = true,
158
158
+
color_icons = true,
159
159
+
actions = require("fzf-lua").defaults.actions.files,
160
160
+
previewer = "builtin",
161
161
+
})
162
162
+
end
163
163
+
164
164
+
-- register user commands
165
165
+
vim.api.nvim_create_user_command("FzfGoTests", search_go_tests, { desc = "Fuzzy Go Tests" })
166
166
+
vim.api.nvim_create_user_command(
167
167
+
"FzfGoTestsCurrentFile",
168
168
+
search_go_tests_in_current_file,
169
169
+
{ desc = "Fuzzy Go Tests in Current File" }
170
170
+
)
171
171
+
172
172
+
vim.keymap.set("n", "<leader>fut", search_go_tests, { desc = "Fuzzy Unit Tests" })
173
173
+
vim.keymap.set(
174
174
+
"n",
175
175
+
"<leader>fuc",
176
176
+
search_go_tests_in_current_file,
177
177
+
{ desc = "Fuzzy Unit Tests in Current File" }
178
178
+
)
150
179
end,
151
180
},
152
181
}