harpoon and stuff

This commit is contained in:
Christian Nieves
2024-04-22 22:39:05 +00:00
parent 934a73ec88
commit 1fb4a36781
6 changed files with 135 additions and 34 deletions

View File

@ -51,7 +51,7 @@ function M.setup(capabilities)
"go",
"python",
"bzl",
"markdown",
-- "markdown",
"typescript",
"javascript",
},

View File

@ -253,7 +253,8 @@ return {
},
{
name = "cmp-nvim-ciderlsp",
url = "sso://googler@user/piloto/cmp-nvim-ciderlsp",
url = "sso://googler@user/sakal/cmp-nvim-ciderlsp",
-- url = "sso://googler@user/piloto/cmp-nvim-ciderlsp",
event = "VimEnter",
dependencies = {
"hrsh7th/nvim-cmp",

View File

@ -0,0 +1,80 @@
return {
"theprimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
config = function()
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
vim.keymap.set("n", "<leader>m", function()
harpoon:list():add()
end)
vim.keymap.set("n", "<leader>M", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)
vim.keymap.set("n", "<leader>1", function()
harpoon:list():select(1)
end)
vim.keymap.set("n", "<leader>2", function()
harpoon:list():select(2)
end)
vim.keymap.set("n", "<leader>3", function()
harpoon:list():select(3)
end)
vim.keymap.set("n", "<leader>4", function()
harpoon:list():select(4)
end)
-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set("n", "<C-S-P>", function()
harpoon:list():prev()
end)
vim.keymap.set("n", "<C-S-N>", function()
harpoon:list():next()
end)
-- basic telescope configuration
local conf = require("telescope.config").values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end
require("telescope.pickers")
.new({}, {
prompt_title = "Harpoon",
finder = require("telescope.finders").new_table({
results = file_paths,
}),
previewer = conf.file_previewer({}),
sorter = conf.generic_sorter({}),
})
:find()
end
vim.keymap.set("n", "<leader>th", function()
toggle_telescope(harpoon:list())
end, { desc = "Open harpoon window" })
end,
-- keys = {
-- -- Mark current file
-- { "<leader>m", ":lua require('harpoon').mark_file()<CR>" },
--
-- -- Go to marks tracker (editable, use `gf` to go to file under cursor)
-- { "<leader>M", "lua require('lasso').open_marks_tracker()<CR>" },
--
-- -- Jump to n-th marked file (n-th line of marks tracker)
-- { "<leader>1", "lua require('lasso').open_marked_file(1)<CR>" },
-- { "<leader>2", "lua require('lasso').open_marked_file(2)<CR>" },
-- { "<leader>3", "lua require('lasso').open_marked_file(3)<CR>" },
-- { "<leader>4", "lua require('lasso').open_marked_file(4)<CR>" },
-- },
}

View File

@ -1,9 +1,12 @@
local use_google = require("utils").use_google
local function setup_mercurial(hg_args)
local function setup_mercurial(hg_revision)
local git_cmd = "git diff --no-color --no-ext-diff -U0 -- %f"
local rcs_cmd = "rcsdiff -U0 %f 2>%n"
local svn_cmd = "svn diff --diff-cmd %d -x -U0 -- %f"
local hg_diff = hg_revision .. " --color=never config aliases.diff= --nodates -U0 -- %f"
local hg_cat = hg_revision .. " -- %f"
vim.cmd(string.format(
[[
let g:signify_vcs_cmds = {
@ -19,28 +22,32 @@ let g:signify_vcs_cmds_diffmode = {
git_cmd,
rcs_cmd,
svn_cmd,
hg_args,
hg_args
hg_diff,
hg_cat
))
end
_G.signify_dtup = function()
setup_mercurial('-r ".^" %f')
setup_mercurial('-r ".^"')
vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]])
end
_G.signify_normal = function()
setup_mercurial("--color=never config aliases.diff= --nodates -U0 -- %f")
setup_mercurial("-r .")
vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]])
end
_G.signify_dtp4 = function()
setup_mercurial('-r "p4base" %f')
setup_mercurial("-r p4head")
vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]])
end
_G.signify_dtex = function()
setup_mercurial('-r "exported(.)" %f')
setup_mercurial("-r exported(.)")
vim.cmd([[:SignifyEnable]])
vim.cmd([[:SignifyRefresh]])
end
return {
@ -60,6 +67,7 @@ return {
local one_eighth = ""
local one_quarter = ""
local three_eighths = ""
vim.g.signify_disable_by_default = 0
vim.g.signify_sign_add = one_quarter
vim.g.signify_sign_delete = one_quarter
vim.g.signify_sign_change = one_quarter