Tmux sessionizer

This commit is contained in:
2026-10-01 13:46:29 -04:00
parent ecb6f9329a
commit 11f21ffaab
12 changed files with 109 additions and 67 deletions
Vendored
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
@@ -1,10 +1,12 @@
require('kanso').setup({
foreground = {
dark = "saturated", -- Use default colors in dark mode
},
transparent = true,
-- foreground = {
-- dark = "saturated", -- Use default colors in dark mode
-- },
overrides = function(colors)
local theme = colors.theme
return {
Normal = { bg = "none" },
NormalFloat = { bg = "none" },
FloatBorder = { bg = "none" },
FloatTitle = { bg = "none" },
@@ -19,22 +21,5 @@ require('kanso').setup({
}
end,
})
--
vim.cmd.colorscheme('kanso-zen')
vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' })
-- vim.api.nvim_set_hl(0, 'NormalFloat', { link = 'Normal' })
-- vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none" })
vim.api.nvim_set_hl(0, 'StatusLine', { link = 'Normal' })
vim.api.nvim_set_hl(0, 'StatusLineTerm', { link = 'Normal' })
vim.api.nvim_set_hl(0, 'StatusLineNC', { link = 'Normal' })
vim.api.nvim_set_hl(0, 'SignColumn', { link = 'Normal' })
vim.api.nvim_set_hl(0, 'LineNrAbove', { link = 'NonText', bold = true })
vim.api.nvim_set_hl(0, 'LineNrBelow', { link = 'NonText', bold = true })
vim.api.nvim_set_hl(0, 'LineNr', { link = 'Normal' })
vim.api.nvim_set_hl(0, 'FoldColumn', { link = 'Normal' })
vim.api.nvim_set_hl(
0,
'CursorLineNr',
{ bg = 'none', link = 'MatchParen', bold = true }
)
vim.cmd.colorscheme('kanso-zen')
@@ -61,6 +61,7 @@ vim.keymap.set('n', '<C-j>', ':NvimTmuxNavigateDown<CR>', { silent = true })
vim.keymap.set('n', '<C-k>', ':NvimTmuxNavigateUp<CR>', { silent = true })
vim.keymap.set('n', '<C-l>', ':NvimTmuxNavigateRight<CR>', { silent = true })
vim.keymap.set('n', '<leader>xx', ':Trouble diagnostics toggle<cr>')
vim.keymap.set('n', '<leader>zz', ':ZenMode<cr>')
local dropbar_api = require("dropbar.api")
vim.keymap.set("n", "<Leader>;", dropbar_api.pick, { desc = "Pick symbols in winbar" })
vim.keymap.set("n", "[;", dropbar_api.goto_context_start, { desc = "Go to start of current context" })
@@ -9,9 +9,6 @@ vim.opt.expandtab = true -- Use spaces instead of tabs
vim.api.nvim_create_autocmd('FileType', {
callback = function(ev)
local map = {
-- c = { ts = 8, sw = 8, sts = 8, et = false },
-- cpp = { ts = 8, sw = 8, sts = 8, et = false },
-- go = { ts = 8, sw = 8, sts = 8, et = false },
rust = { ts = 4, sw = 4, sts = 4 },
lua = { ts = 4, sw = 4, sts = 4 },
python = { ts = 4, sw = 4, sts = 4 },
@@ -49,7 +46,7 @@ vim.opt.foldmethod = 'indent'
vim.opt.foldcolumn = '1'
vim.opt.foldenable = false
vim.opt.shortmess = 'aF' -- abbreviates messages and prevents file name being echoed when opened
vim.opt.ignorecase = true -- ignore cases when searching
vim.opt.ignorecase = false -- ignore cases when searching
vim.opt.smartcase = true -- However if we use a capital in search string we then consider case-sensitivity, ignorecase is disabled
vim.opt.smartindent = false -- smarter indentation
vim.opt.smarttab = true -- make tab behaviour smarter
@@ -37,5 +37,7 @@ vim.pack.add({
{ src = 'https://github.com/rcarriga/nvim-notify' },
{ src = 'https://github.com/folke/trouble.nvim' },
{ src = 'https://github.com/brianhuster/live-preview.nvim' },
{ src = 'https://github.com/m4xshen/hardtime.nvim' },
{ src = 'https://github.com/Bekaboo/dropbar.nvim' },
{ src = 'https://github.com/folke/zen-mode.nvim' },
})
@@ -28,6 +28,9 @@ require('nvim-tmux-navigation').setup({
disable_when_zoomed = true, -- defaults to false
})
-- require("zen-mode").toggle({
-- })
require('blink.cmp').setup({
completion = {
documentation = {
@@ -62,7 +65,6 @@ require('nvim-ts-autotag').setup({
})
require('trouble').setup({})
-- require('dropbar').setup({})
require("telescope").setup({
defaults = {
prompt_prefix = "", -- Changes the search icon/prompt prefix
@@ -82,3 +84,4 @@ require("telescope").setup({
},
},
})
require("hardtime").setup()
@@ -307,47 +307,9 @@ require('incline').setup({
local icon, color = require("nvim-web-devicons").get_icon_color(filename)
return { { icon, guifg = color }, { " " }, { filename } }
end,
-- window = {
-- padding = 0,
-- margin = { horizontal = 0 },
-- options = {
-- -- Reset winhl so it doesn't force total transparency
-- winhl = 'Normal:InclineNormal',
-- },
-- },
-- render = function(props)
-- local filename =
-- vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
-- if filename == '' then
-- filename = '[No Name]'
-- end
-- local ft_icon, ft_color =
-- require('nvim-web-devicons').get_icon_color(filename)
-- local modified = vim.bo[props.buf].modified
--
-- return {
-- ft_icon and {
-- ' ',
-- ft_icon,
-- ' ',
-- guibg = ft_color,
-- guifg = require('incline.helpers').contrast_color(ft_color),
-- -- guibg = ft_color,
-- -- guifg = require('incline.helpers').contrast_color(ft_color),
-- } or '',
-- -- Wrap the text and padding inside a structural block linked to 'CursorLine'
-- {
-- ' ',
-- { filename, gui = modified and 'bold,italic' or 'bold' },
-- ' ',
-- group = 'CursorLine',
-- },
-- }
-- end,
})
require('noice').setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
+8
View File
@@ -13,6 +13,10 @@
"rev": "808ba31cde89aec8833e9789f5e04557cd31c9e1",
"src": "https://github.com/Bekaboo/dropbar.nvim"
},
"hardtime.nvim": {
"rev": "5165840fe680eab46de1fc6dbff48f148fdcf018",
"src": "https://github.com/m4xshen/hardtime.nvim"
},
"incline.nvim": {
"rev": "debd628e9395f7a9da57bdc31ce75ca6b40a880b",
"src": "https://github.com/b0o/incline.nvim"
@@ -94,6 +98,10 @@
"undotree": {
"rev": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d",
"src": "https://github.com/mbbill/undotree"
},
"zen-mode.nvim": {
"rev": "8564ce6d29ec7554eb9df578efa882d33b3c23a7",
"src": "https://github.com/folke/zen-mode.nvim"
}
}
}
BIN
View File
Binary file not shown.
+25 -3
View File
@@ -12,12 +12,34 @@ set -g status-justify left
set -g status-style 'bg=default' # Completely transparent container
set -g status-left-length 100
set -g status-left "#[fg=#090E13,bg=colour14,bold] #S "
set -g status-left "#[fg=#090E13,bg=colour6,bold] #S "
# palette = 0=#090E13
# palette = 1=#c4746e
# palette = 2=#8a9a7b
# palette = 3=#c4b28a
# palette = 4=#8ba4b0
# palette = 5=#a292a3
# palette = 6=#8ea4a2
# palette = 7=#a4a7a4
# palette = 8=#5C6066
# palette = 9=#e46876
# palette = 10=#87a987
# palette = 11=#e6c384
# palette = 12=#7fb4ca
# palette = 13=#938aa9
# palette = 14=#7aa89f
# palette = 15=#c5c9c7
#
# background = #090E13
# foreground = #c5c9c7
# cursor-color = #c5c9c7
# selection-background = #22262D
# selection-foreground = #c5c9c7
set -g status-right ""
set -g window-status-current-format "#[fg=colour1,bg=default] #F#I:#W"
set -g window-status-format "#[fg=colour7,bg=default] #I:#W"
set -g window-status-current-format "#[fg=colour1,bg=default] #F#I:#W "
set -g window-status-format "#[fg=colour7,bg=default] #I:#W "
set -g message-style 'fg=colour3 bg=default bold'
+62
View File
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
# 1. Get active tmux sessions
sessions=$(tmux list-sessions -F "#S" 2>/dev/null)
# 2. Get directories from key work paths
dirs=$(find ~ ~/.config ~/Projects ~/dotfiles ~/personal \
-mindepth 1 -maxdepth 4 \
\( -name ".git" -o -name "node_modules" -o -name ".cache" -o -name "Library" \) -prune \
-o -type d -print 2>/dev/null)
# 3. Dynamic Previewer (Tree view for folders, Window list for sessions)
preview_cmd='
if [ -d {} ]; then
if command -v eza &>/dev/null; then
eza --tree --level=2 --icons --color=always {}
elif command -v tree &>/dev/null; then
tree -C -L 2 {}
else
ls -la --color=always {}
fi
else
tmux list-windows -t {} 2>/dev/null
fi'
# 4. Kanagawa Wave Themed FZF Selector
selected=$(printf "%s\n%s" "$sessions" "$dirs" | grep -v '^$' | fzf \
--layout=reverse \
--border=rounded \
--margin=1 \
--padding=1 \
--height=100% \
--prompt="󱇗 " \
--color="bg:#1F1F28,bg+:#223249,fg:#DCD7BA,fg+:#DCD7BA" \
--color="hl:#2D4F67,hl+:#7E9CD8,prompt:#957FB8,pointer:#7E9CD8" \
--color="info:#98BB6C,spinner:#957FB8,header:#7AA89F,border:#54546D" \
--color="marker:#98BB6C" \
--preview="$preview_cmd" \
--preview-window="right:55%:border-left")
# Exit if fzf was cancelled
[[ -z "$selected" ]] && exit 0
# 5. Handle Session Creation / Switching
if [[ -d "$selected" ]]; then
# Selection is a DIRECTORY -> Create session named after folder
session_name=$(basename "$selected" | tr '.: ' '_')
if ! tmux has-session -t "=$session_name" 2>/dev/null; then
tmux new-session -d -s "$session_name" -c "$selected"
fi
else
# Selection is an EXISTING SESSION -> Connect directly
session_name="$selected"
fi
# 6. Attach or Switch
if [[ -z "$TMUX" ]]; then
exec tmux attach-session -t "$session_name"
else
tmux switch-client -t "$session_name"
fi