mirror of
https://github.com/kristoferssolo/SoloVim.git
synced 2026-02-04 14:52:04 +00:00
Update 2025-05-31
Update 2025-05-03 Update 2025-05-05 Update 2025-05-07 Update 2025-05-09 chore: use mini.nvim Update 2025-05-12 Update 2025-05-14 Update 2025-05-16 Update 2025-05-17 Update 2025-05-20 Update 2025-05-21 Update 2025-05-23 Update 2025-05-25 Update 2025-05-30
This commit is contained in:
@@ -34,7 +34,7 @@ nmap("<C-Down>", "<cmd>resize +2<cr>", "Resize window down")
|
||||
nmap("<C-Left>", "<cmd>vertical resize -2<cr>", "Resize window left")
|
||||
nmap("<C-Right>", "<cmd>vertical resize +2<cr>", "Resize window right")
|
||||
|
||||
nmap("<C-f>", "<cmd>!tmux neww tmux-sessionizer<cr>", "Open tmux sessionizer")
|
||||
-- nmap("<C-f>", "<cmd>!tmux neww tmux-sessionizer<cr>", "Open tmux sessionizer")
|
||||
|
||||
nmap("<A-k>", "<cmd>m .-2<cr>==", "Move line up")
|
||||
nmap("<A-j>", "<cmd>m .+1<cr>==", "Move line down")
|
||||
@@ -69,3 +69,47 @@ vmap("<A-j>", ":m '>+1<cr>gv=gv", "Move lines down")
|
||||
-- tmap("t", "<C-j>", "<C-\\><C-N><C-w>j")
|
||||
-- tmap("t", "<C-k>", "<C-\\><C-N><C-w>k")
|
||||
-- tmap("t", "<C-l>", "<C-\\><C-N><C-w>l")
|
||||
|
||||
local function fzf_sesh_connect()
|
||||
-- build the fzf-tmux command exactly as in your zsh widget
|
||||
local fzf_cmd = [[
|
||||
sesh list --icons | fzf-tmux -p 80%,70% \
|
||||
--no-sort --ansi \
|
||||
--border-label ' sesh ' \
|
||||
--prompt '⚡ ' \
|
||||
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
|
||||
--bind 'tab:down,btab:up' \
|
||||
--bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list --icons)' \
|
||||
--bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t --icons)' \
|
||||
--bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c --icons)' \
|
||||
--bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z --icons)' \
|
||||
--bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
|
||||
--bind 'ctrl-d:execute(tmux kill-session -t {2..})+change-prompt(⚡ )+reload(sesh list --icons)' \
|
||||
--preview-window 'right:55%' \
|
||||
--preview 'sesh preview {}'
|
||||
]]
|
||||
|
||||
-- spawn fzf-tmux, read its output
|
||||
local handle = io.popen(fzf_cmd)
|
||||
if not handle then
|
||||
vim.notify("Failed to launch fzf-tmux", vim.log.levels.ERROR)
|
||||
return
|
||||
end
|
||||
local session = handle:read("*a")
|
||||
handle:close()
|
||||
|
||||
-- trim trailing newline/whitespace
|
||||
session = session:gsub("%s+$", "")
|
||||
|
||||
if session == "" then
|
||||
-- user cancelled or no selection
|
||||
return
|
||||
end
|
||||
|
||||
-- execute the tmux connect command
|
||||
-- opens a shell command in the current Neovim window
|
||||
vim.cmd('!sesh connect "' .. session .. '"')
|
||||
end
|
||||
|
||||
-- bind <C-f> in Normal mode to our function
|
||||
nmap("<C-f>", fzf_sesh_connect)
|
||||
|
||||
Reference in New Issue
Block a user