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_toggle"] = false,
["save_on_change"] = true, ["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 -- There was this issue where the vim.loop.cwd() didn't have marks or term, but had
-- an object for vim.loop.cwd() -- an object for vim.loop.cwd()

View File

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

View File

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