stying via stylua

This commit is contained in:
anott03 2021-06-17 14:44:03 -04:00
parent 1384fabdd5
commit 750ac2d9d5
3 changed files with 57 additions and 32 deletions

View File

@ -157,7 +157,13 @@ M.setup = function(config)
["save_on_toggle"] = false,
["save_on_change"] = true,
},
}, expand_dir(c_config), expand_dir(u_config), expand_dir(config))
}, expand_dir(
c_config
), expand_dir(
u_config
), expand_dir(
config
))
-- There was this issue where the vim.loop.cwd() didn't have marks or term, but had
-- an object for vim.loop.cwd()

View File

@ -21,10 +21,12 @@ local function emit_changed()
end
for idx, cb in pairs(callbacks["changed"]) do
log.trace(string.format(
"_emit_changed(): Running callback #%d for 'changed'",
idx
))
log.trace(
string.format(
"_emit_changed(): Running callback #%d for 'changed'",
idx
)
)
cb()
end
end
@ -73,12 +75,14 @@ end
local function create_mark(filename)
local cursor_pos = vim.api.nvim_win_get_cursor(0)
log.trace(string.format(
"_create_mark(): Creating mark at row: %d, col: %d for %s",
cursor_pos[1],
cursor_pos[2],
filename
))
log.trace(
string.format(
"_create_mark(): Creating mark at row: %d, col: %d for %s",
cursor_pos[1],
cursor_pos[2],
filename
)
)
return {
filename = filename,
row = cursor_pos[1],
@ -102,7 +106,10 @@ end
local function validate_buf_name(buf_name)
log.trace("_validate_buf_name():", buf_name)
if buf_name == "" or buf_name == nil then
log.error("_validate_buf_name(): Not a valid name for a mark,", buf_name)
log.error(
"_validate_buf_name(): Not a valid name for a mark,",
buf_name
)
error("Couldn't find a valid file name to mark, sorry.")
return
end
@ -111,8 +118,12 @@ end
M.get_index_of = function(item)
log.trace("get_index_of():", item)
if item == nil then
log.error("get_index_of(): Function has been supplied with a nil value.")
error("You have provided a nil value to Harpoon, please provide a string rep of the file or the file idx.")
log.error(
"get_index_of(): Function has been supplied with a nil value."
)
error(
"You have provided a nil value to Harpoon, please provide a string rep of the file or the file idx."
)
return
end
@ -219,11 +230,13 @@ M.store_offset = function()
end
local cursor_pos = vim.api.nvim_win_get_cursor(0)
log.debug(string.format(
"store_offset(): Stored row: %d, col: %d",
cursor_pos[1],
cursor_pos[2]
))
log.debug(
string.format(
"store_offset(): Stored row: %d, col: %d",
cursor_pos[1],
cursor_pos[2]
)
)
harpoon.get_mark_config().marks[idx].row = cursor_pos[1]
harpoon.get_mark_config().marks[idx].col = cursor_pos[2]
end)

View File

@ -105,14 +105,18 @@ M.toggle_quick_menu = function()
":lua require('harpoon.ui').select_menu_item()<CR>",
{}
)
vim.cmd(string.format(
"autocmd BufWriteCmd <buffer=%s> :lua require('harpoon.ui').on_menu_save()",
Harpoon_bufh
))
vim.cmd(string.format(
"autocmd BufModifiedSet <buffer=%s> set nomodified",
Harpoon_bufh
))
vim.cmd(
string.format(
"autocmd BufWriteCmd <buffer=%s> :lua require('harpoon.ui').on_menu_save()",
Harpoon_bufh
)
)
vim.cmd(
string.format(
"autocmd BufModifiedSet <buffer=%s> set nomodified",
Harpoon_bufh
)
)
end
M.select_menu_item = function()
@ -142,11 +146,13 @@ M.nav_file = function(id)
vim.api.nvim_buf_set_option(buf_id, "buflisted", true)
if set_row and mark.row and mark.col then
vim.cmd(string.format(":call cursor(%d, %d)", mark.row, mark.col))
log.debug(string.format(
"nav_file(): Setting cursor to row: %d, col: %d",
mark.row,
mark.col
))
log.debug(
string.format(
"nav_file(): Setting cursor to row: %d, col: %d",
mark.row,
mark.col
)
)
end
end