chore: style lua

This commit is contained in:
mpaulson 2023-02-22 19:58:53 -07:00
parent 7489811289
commit 61dbe8830f
5 changed files with 41 additions and 36 deletions

View file

@ -10,8 +10,10 @@ local cache_config = string.format("%s/harpoon.json", data_path)
local M = {}
local the_primeagen_harpoon =
vim.api.nvim_create_augroup("THE_PRIMEAGEN_HARPOON", { clear = true })
local the_primeagen_harpoon = vim.api.nvim_create_augroup(
"THE_PRIMEAGEN_HARPOON",
{ clear = true }
)
vim.api.nvim_create_autocmd({ "BufLeave, VimLeave" }, {
callback = function()
@ -33,7 +35,7 @@ vim.api.nvim_create_autocmd("FileType", {
local working_directory = vim.fn.getcwd() .. "/"
vim.cmd("vs")
vim.cmd("e " .. working_directory .. curline)
end, { buffer=true, noremap = true, silent = true })
end, { buffer = true, noremap = true, silent = true })
-- horizontal split (control+x)
vim.keymap.set("n", "<C-x>", function()
@ -41,7 +43,7 @@ vim.api.nvim_create_autocmd("FileType", {
local working_directory = vim.fn.getcwd() .. "/"
vim.cmd("sp")
vim.cmd("e " .. working_directory .. curline)
end, { buffer=true, noremap = true, silent = true })
end, { buffer = true, noremap = true, silent = true })
-- new tab (control+t)
vim.keymap.set("n", "<C-t>", function()
@ -49,8 +51,8 @@ vim.api.nvim_create_autocmd("FileType", {
local working_directory = vim.fn.getcwd() .. "/"
vim.cmd("tabnew")
vim.cmd("e " .. working_directory .. curline)
end, { buffer=true, noremap = true, silent = true })
end
end, { buffer = true, noremap = true, silent = true })
end,
})
--[[
{

View file

@ -7,8 +7,10 @@ local M = {}
local tmux_windows = {}
if global_config.tmux_autoclose_windows then
local harpoon_tmux_group =
vim.api.nvim_create_augroup("HARPOON_TMUX", { clear = true })
local harpoon_tmux_group = vim.api.nvim_create_augroup(
"HARPOON_TMUX",
{ clear = true }
)
vim.api.nvim_create_autocmd("VimLeave", {
callback = function()

View file

@ -205,7 +205,7 @@ function M.nav_file(id)
)
end
local old_bufinfo = vim.fn.getbufinfo(old_bufnr);
local old_bufinfo = vim.fn.getbufinfo(old_bufnr)
if type(old_bufinfo) == "table" and #old_bufinfo >= 1 then
old_bufinfo = old_bufinfo[1]
local no_name = old_bufinfo.name == ""

View file

@ -38,14 +38,16 @@ function M.get_os_command_output(cmd, cwd)
end
local command = table.remove(cmd, 1)
local stderr = {}
local stdout, ret = Job:new({
command = command,
args = cmd,
cwd = cwd,
on_stderr = function(_, data)
table.insert(stderr, data)
end,
}):sync()
local stdout, ret = Job
:new({
command = command,
args = cmd,
cwd = cwd,
on_stderr = function(_, data)
table.insert(stderr, data)
end,
})
:sync()
return stdout, ret, stderr
end

View file

@ -51,8 +51,9 @@ local generate_new_finder = function()
end
local delete_harpoon_mark = function(prompt_bufnr)
local confirmation =
vim.fn.input(string.format("Delete current mark(s)? [y/n]: "))
local confirmation = vim.fn.input(
string.format("Delete current mark(s)? [y/n]: ")
)
if
string.len(confirmation) == 0
or string.sub(string.lower(confirmation), 0, 1) ~= "y"
@ -113,23 +114,21 @@ end
return function(opts)
opts = opts or {}
pickers
.new(opts, {
prompt_title = "harpoon marks",
finder = generate_new_finder(),
sorter = conf.generic_sorter(opts),
previewer = conf.grep_previewer(opts),
attach_mappings = function(_, map)
map("i", "<c-d>", delete_harpoon_mark)
map("n", "<c-d>", delete_harpoon_mark)
pickers.new(opts, {
prompt_title = "harpoon marks",
finder = generate_new_finder(),
sorter = conf.generic_sorter(opts),
previewer = conf.grep_previewer(opts),
attach_mappings = function(_, map)
map("i", "<c-d>", delete_harpoon_mark)
map("n", "<c-d>", delete_harpoon_mark)
map("i", "<c-p>", move_mark_up)
map("n", "<c-p>", move_mark_up)
map("i", "<c-p>", move_mark_up)
map("n", "<c-p>", move_mark_up)
map("i", "<c-n>", move_mark_down)
map("n", "<c-n>", move_mark_down)
return true
end,
})
:find()
map("i", "<c-n>", move_mark_down)
map("n", "<c-n>", move_mark_down)
return true
end,
}):find()
end