mirror of
https://github.com/ThePrimeagen/harpoon
synced 2024-09-08 01:25:41 +02:00
chore(lint): ... so much of it
This commit is contained in:
parent
1605603235
commit
2374c696d3
5 changed files with 53 additions and 32 deletions
|
@ -1,4 +1,4 @@
|
|||
column_width = 120
|
||||
column_width = 80
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 4
|
||||
|
|
|
@ -59,7 +59,10 @@ local function ensure_correct_config(config)
|
|||
log.trace("_ensure_correct_config()")
|
||||
local projects = config.projects
|
||||
if projects[vim.loop.cwd()] == nil then
|
||||
log.debug("ensure_correct_config(): No config found for:", vim.loop.cwd())
|
||||
log.debug(
|
||||
"ensure_correct_config(): No config found for:",
|
||||
vim.loop.cwd()
|
||||
)
|
||||
projects[vim.loop.cwd()] = {
|
||||
mark = {
|
||||
marks = {},
|
||||
|
@ -77,7 +80,10 @@ local function ensure_correct_config(config)
|
|||
end
|
||||
|
||||
if proj.term == nil then
|
||||
log.debug("ensure_correct_config(): No terminal commands found for", vim.loop.cwd())
|
||||
log.debug(
|
||||
"ensure_correct_config(): No terminal commands found for",
|
||||
vim.loop.cwd()
|
||||
)
|
||||
proj.term = { cmds = {} }
|
||||
end
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@ 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
|
||||
|
@ -208,7 +211,11 @@ M.store_offset = function()
|
|||
end
|
||||
|
||||
local cursor_pos = vim.fn.getcurpos()
|
||||
log.debug(string.format("store_offset(): Stored row: %d, col: %d", cursor_pos[2], cursor_pos[3]))
|
||||
log.debug(string.format(
|
||||
"store_offset(): Stored row: %d, col: %d",
|
||||
cursor_pos[2],
|
||||
cursor_pos[3]
|
||||
))
|
||||
harpoon.get_mark_config().marks[idx].row = cursor_pos[2]
|
||||
harpoon.get_mark_config().marks[idx].col = cursor_pos[3]
|
||||
end)
|
||||
|
|
|
@ -27,25 +27,6 @@ local function create_terminal()
|
|||
return buf_id, term_id
|
||||
end
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
M.getCmd = function(idx)
|
||||
log.trace("getCmd()")
|
||||
local cmd
|
||||
if type(idx) == "number" then
|
||||
cmd = harpoon.get_term_config().cmds[idx]
|
||||
else
|
||||
log.error("getCmd(): Index is expected to be a number.")
|
||||
end
|
||||
|
||||
if cmd then
|
||||
return cmd
|
||||
else
|
||||
error("Command does not exist for that id.")
|
||||
end
|
||||
end
|
||||
|
||||
>>>>>>> 2d37262466380a38ba9d54bdf6754d005d801030
|
||||
local function find_terminal(idx)
|
||||
log.trace("_find_terminal(): Terminal:", idx)
|
||||
local term_handle = terminals[idx]
|
||||
|
|
|
@ -29,7 +29,8 @@ local function create_window()
|
|||
local config = harpoon.get_menu_config()
|
||||
local width = config.width or 60
|
||||
local height = config.height or 10
|
||||
local borderchars = config.borderchars or { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }
|
||||
local borderchars = config.borderchars
|
||||
or { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }
|
||||
local bufnr = vim.api.nvim_create_buf(false, false)
|
||||
|
||||
local Harpoon_win_id, win = popup.create(bufnr, {
|
||||
|
@ -42,7 +43,11 @@ local function create_window()
|
|||
borderchars = borderchars,
|
||||
})
|
||||
|
||||
vim.api.nvim_win_set_option(win.border.win_id, "winhl", "Normal:HarpoonBorder")
|
||||
vim.api.nvim_win_set_option(
|
||||
win.border.win_id,
|
||||
"winhl",
|
||||
"Normal:HarpoonBorder"
|
||||
)
|
||||
|
||||
return {
|
||||
bufnr = bufnr,
|
||||
|
@ -93,13 +98,25 @@ M.toggle_quick_menu = function()
|
|||
vim.api.nvim_buf_set_option(Harpoon_bufh, "filetype", "harpoon")
|
||||
vim.api.nvim_buf_set_option(Harpoon_bufh, "buftype", "acwrite")
|
||||
vim.api.nvim_buf_set_option(Harpoon_bufh, "bufhidden", "delete")
|
||||
vim.api.nvim_buf_set_keymap(Harpoon_bufh, "n", "<CR>", ":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.api.nvim_buf_set_keymap(
|
||||
Harpoon_bufh,
|
||||
"n",
|
||||
"<CR>",
|
||||
":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
|
||||
))
|
||||
end
|
||||
|
||||
M.select_menu_item = function()
|
||||
local idx = vim.fn.line('.')
|
||||
local idx = vim.fn.line(".")
|
||||
close_menu(true)
|
||||
M.nav_file(idx)
|
||||
end
|
||||
|
@ -124,7 +141,11 @@ M.nav_file = function(id)
|
|||
vim.api.nvim_set_current_buf(buf_id)
|
||||
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
|
||||
|
||||
|
@ -161,7 +182,13 @@ function M.notification(text)
|
|||
col = win_width - 21,
|
||||
})
|
||||
|
||||
vim.api.nvim_buf_set_lines(info.bufnr, 0, 5, false, { "!!! Notification", text })
|
||||
vim.api.nvim_buf_set_lines(
|
||||
info.bufnr,
|
||||
0,
|
||||
5,
|
||||
false,
|
||||
{ "!!! Notification", text }
|
||||
)
|
||||
vim.api.nvim_set_current_win(prev_win)
|
||||
|
||||
return {
|
||||
|
|
Loading…
Reference in a new issue