mirror of
https://github.com/ThePrimeagen/harpoon
synced 2024-09-16 13:34:03 +02:00
chore: style lua
This commit is contained in:
parent
7489811289
commit
61dbe8830f
5 changed files with 41 additions and 36 deletions
|
@ -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,
|
||||
})
|
||||
--[[
|
||||
{
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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 == ""
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue