mirror of
https://github.com/ThePrimeagen/harpoon.git
synced 2025-07-13 17:40:25 +00:00
revert nonfunctional changes
This commit is contained in:
parent
d8e2fcedf3
commit
c245041e21
@ -6,7 +6,7 @@
|
||||
local M = {}
|
||||
|
||||
M.reload = function()
|
||||
require("plenary.reload").reload_module("harpoon")
|
||||
require("plenary.reload").reload_module("harpoon");
|
||||
end
|
||||
|
||||
local function set_log_level()
|
||||
|
@ -28,7 +28,6 @@ local M = {}
|
||||
... high level settings
|
||||
}
|
||||
--]]
|
||||
|
||||
HarpoonConfig = HarpoonConfig or {}
|
||||
|
||||
-- tbl_deep_extend does not work the way you would think
|
||||
@ -48,7 +47,7 @@ end
|
||||
|
||||
local function merge_tables(...)
|
||||
local out = {}
|
||||
for i = 1, select("#", ...) do
|
||||
for i = 1, select("#",...) do
|
||||
merge_table_impl(out, select(i, ...))
|
||||
end
|
||||
log.trace("_merge_tables(): Output", out)
|
||||
@ -62,10 +61,10 @@ local function ensure_correct_config(config)
|
||||
log.trace("ensure_correct_config(): No config found for:", vim.loop.cwd())
|
||||
projects[vim.loop.cwd()] = {
|
||||
mark = {
|
||||
marks = {},
|
||||
marks = {}
|
||||
},
|
||||
term = {
|
||||
cmds = {},
|
||||
cmds = {}
|
||||
},
|
||||
}
|
||||
end
|
||||
@ -86,7 +85,7 @@ local function ensure_correct_config(config)
|
||||
local mark = marks[idx]
|
||||
if type(mark) == "string" then
|
||||
mark = {
|
||||
filename = mark,
|
||||
filename = mark
|
||||
}
|
||||
marks[idx] = mark
|
||||
end
|
||||
@ -145,13 +144,17 @@ M.setup = function(config)
|
||||
c_config = {}
|
||||
end
|
||||
|
||||
local complete_config = merge_tables({
|
||||
projects = {},
|
||||
global_settings = {
|
||||
["save_on_toggle"] = false,
|
||||
["save_on_change"] = true,
|
||||
local complete_config =
|
||||
merge_tables({
|
||||
projects = {},
|
||||
global_settings = {
|
||||
["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()
|
||||
|
@ -111,10 +111,10 @@ M.get_index_of = function(item)
|
||||
return
|
||||
end
|
||||
|
||||
if type(item) == "string" then
|
||||
if type(item) == 'string' then
|
||||
local relative_item = utils.normalize_path(item)
|
||||
for idx = 1, M.get_length() do
|
||||
if M.get_marked_file_name(idx) == relative_item then
|
||||
if M.get_marked_file_name(idx) == relative_item then
|
||||
return idx
|
||||
end
|
||||
end
|
||||
@ -169,7 +169,7 @@ M.add_file = function(file_name_or_buf_id)
|
||||
local found_idx = get_first_empty_slot()
|
||||
harpoon.get_mark_config().marks[found_idx] = create_mark(buf_name)
|
||||
M.remove_empty_tail(false)
|
||||
emit_changed()
|
||||
emit_changed();
|
||||
end
|
||||
|
||||
-- _emit_on_changed == false should only be used internally
|
||||
@ -201,7 +201,6 @@ M.store_offset = function()
|
||||
local ok, res = pcall(function()
|
||||
local buf_name = get_buf_name()
|
||||
local idx = M.get_index_of(buf_name)
|
||||
|
||||
if not M.valid_index(idx) then
|
||||
return
|
||||
end
|
||||
@ -356,3 +355,5 @@ M.on = function(event, cb)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
local harpoon = require("harpoon")
|
||||
local popup = require("popup")
|
||||
local Marked = require("harpoon.mark")
|
||||
local harpoon = require('harpoon')
|
||||
local popup = require('popup')
|
||||
local Marked = require('harpoon.mark')
|
||||
local log = require("harpoon.dev").log
|
||||
|
||||
local M = {}
|
||||
@ -13,12 +13,12 @@ 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, {
|
||||
title = "Harpoon",
|
||||
highlight = "HarpoonWindow",
|
||||
title = 'Harpoon',
|
||||
highlight = 'HarpoonWindow',
|
||||
line = math.floor(((vim.o.lines - height) / 2) - 1),
|
||||
col = math.floor((vim.o.columns - width) / 2),
|
||||
minwidth = width,
|
||||
@ -26,7 +26,7 @@ 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,
|
||||
@ -40,7 +40,7 @@ local function get_menu_items()
|
||||
local indices = {}
|
||||
|
||||
for idx = 1, #lines do
|
||||
local space_location = string.find(lines[idx], " ")
|
||||
local space_location = string.find(lines[idx], ' ')
|
||||
log.trace("_get_menu_items():", idx, space_location)
|
||||
|
||||
if space_location ~= nil then
|
||||
@ -51,13 +51,15 @@ local function get_menu_items()
|
||||
return indices
|
||||
end
|
||||
|
||||
|
||||
|
||||
M.toggle_quick_menu = function()
|
||||
log.info("toggle_quick_menu()")
|
||||
if Harpoon_win_id ~= nil and vim.api.nvim_win_is_valid(Harpoon_win_id) then
|
||||
local global_config = harpoon.get_global_settings()
|
||||
|
||||
if global_config.save_on_toggle then
|
||||
require("harpoon.ui").on_menu_save()
|
||||
require('harpoon.ui').on_menu_save()
|
||||
end
|
||||
|
||||
vim.api.nvim_win_close(Harpoon_win_id, true)
|
||||
@ -122,14 +124,14 @@ end
|
||||
|
||||
function M.location_window(options)
|
||||
local default_options = {
|
||||
relative = "editor",
|
||||
style = "minimal",
|
||||
relative = 'editor',
|
||||
style = 'minimal',
|
||||
width = 30,
|
||||
height = 15,
|
||||
row = 2,
|
||||
col = 2,
|
||||
}
|
||||
options = vim.tbl_extend("keep", options, default_options)
|
||||
options = vim.tbl_extend('keep', options, default_options)
|
||||
|
||||
local bufnr = options.bufnr or vim.fn.nvim_create_buf(false, true)
|
||||
local win_id = vim.fn.nvim_open_win(bufnr, true, options)
|
||||
@ -150,15 +152,15 @@ function M.notification(text)
|
||||
width = 20,
|
||||
height = 2,
|
||||
row = 1,
|
||||
col = win_width - 21,
|
||||
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 {
|
||||
bufnr = info.bufnr,
|
||||
win_id = info.win_id,
|
||||
win_id = info.win_id
|
||||
}
|
||||
end
|
||||
|
||||
@ -171,13 +173,13 @@ M.nav_next = function()
|
||||
local current_index = Marked.get_current_index()
|
||||
local number_of_items = Marked.get_length()
|
||||
|
||||
if current_index == nil then
|
||||
if current_index == nil then
|
||||
current_index = 1
|
||||
else
|
||||
current_index = current_index + 1
|
||||
end
|
||||
|
||||
if (current_index > number_of_items) then
|
||||
if (current_index > number_of_items) then
|
||||
current_index = 1
|
||||
end
|
||||
M.nav_file(current_index)
|
||||
@ -188,13 +190,13 @@ M.nav_prev = function()
|
||||
local current_index = Marked.get_current_index()
|
||||
local number_of_items = Marked.get_length()
|
||||
|
||||
if current_index == nil then
|
||||
if current_index == nil then
|
||||
current_index = number_of_items
|
||||
else
|
||||
current_index = current_index - 1
|
||||
end
|
||||
|
||||
if (current_index < 1) then
|
||||
if (current_index < 1) then
|
||||
current_index = number_of_items
|
||||
end
|
||||
|
||||
@ -202,3 +204,4 @@ M.nav_prev = function()
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user