nvim: harpoon, tmux: session manager

This commit is contained in:
thek4n 2024-03-21 19:54:42 +03:00
parent f7f7f2bda5
commit 4a9f0c303d
4 changed files with 70 additions and 2 deletions

View File

@ -0,0 +1,58 @@
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim"
},
config = function()
local harpoon = require("harpoon")
harpoon:setup()
vim.keymap.set("n", "<leader>a", function() harpoon:list():append() end)
vim.keymap.set("n", "<leader>fh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<A-1>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<A-2>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<A-3>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<A-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)
vim.keymap.set("n", "<C-x>",
function()
vim.ui.input({ prompt = "Harpoon mark index: " }, function(input)
local num = tonumber(input)
if num then
require("harpoon"):list():select(num)
end
end)
end
)
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>fh", function() toggle_telescope(harpoon:list()) end,
{ desc = "Open harpoon window" })
end
}

View File

@ -60,4 +60,11 @@ set -g set-titles on
set -g set-titles-string '#S:#I.#P #W'
setw -g clock-mode-colour green
setw -g clock-mode-style 24
setw -g clock-mode-style 24
bind 1 source-file ~/.tmux/01.conf
bind 2 source-file ~/.tmux/02.conf
bind 3 source-file ~/.tmux/03.conf
bind 4 source-file ~/.tmux/04.conf
bind 5 source-file ~/.tmux/05.conf

3
home/user/.tmux/01.conf Normal file
View File

@ -0,0 +1,3 @@
new -s s01 -A -n main -c "$WORKING_PROJECT" "$EDITOR"
send-keys M-1
splitw -d -h -l 40% -c '#{pane_current_path}'

View File

@ -12,7 +12,7 @@ declare -r -A TARGETS=(
["colors"]=".config/terminal-colors.d"
["bash"]=".config/bash .bashrc .profile %colors"
["zsh"]="%bash .config/zsh .zshenv .inputrc"
["tmux"]=".tmux.conf"
["tmux"]=".tmux.conf .tmux"
["alacritty"]=".config/alacritty"
["nvim"]=".config/nvim .editorconfig .local/bin/vim_askpass_helper"
["ssh"]=""