Skip to content

Commit bc390ba

Browse files
committed
some improvnment
1 parent f158b62 commit bc390ba

11 files changed

Lines changed: 152 additions & 126 deletions

File tree

Brewfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ brew "atuin"
1515
brew "bat"
1616
brew "carapace"
1717
brew "cdebug"
18+
brew "cloud-sql-proxy"
1819
brew "crane"
1920
brew "direnv"
2021
brew "dive"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ touch ~/.hushlogin
2424
./zen-browser/install.sh
2525
```
2626

27+
### Setup Atuin
28+
29+
```bash
30+
atuin setup
31+
```
32+
2733
### Setup SSH and Git Authentication
2834

2935
```bash

atuin/config.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
## which search mode to use
4646
## possible values: prefix, fulltext, fuzzy, skim
47-
# search_mode = "fuzzy"
47+
search_mode = "daemon-fuzzy"
4848

4949
## which filter mode to use by default
5050
## possible values: "global", "host", "session", "session-preload", "directory", "workspace"
@@ -260,7 +260,8 @@ records = true
260260

261261
[daemon]
262262
## Enables using the daemon to sync. Requires the daemon to be running in the background. Start it with `atuin daemon`
263-
# enabled = false
263+
enabled = true
264+
autostart = true
264265

265266
## How often the daemon should sync in seconds
266267
# sync_frequency = 300
@@ -356,3 +357,6 @@ enabled = false
356357
##
357358
## Make directory expand instead of command:
358359
# columns = ["duration", "time", { type = "directory", expand = true }, { type = "command", expand = false }]
360+
361+
[ai]
362+
enabled = true

nvim/lua/custom/opencode.lua

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ local function discover_instances()
8484
if env.code == 0 and env.stdout:match('TMUX=' .. tmux_env) then
8585
local port = find_port_for_pid(pid)
8686
if port then
87-
local window = find_tmux_window(pid) or '?'
87+
local window = find_tmux_window(pid)
8888
table.insert(instances, { pid = pid, port = port, window = window })
8989
end
9090
end
@@ -96,22 +96,24 @@ local function discover_instances()
9696
end
9797

9898
--- Resolve the port to use. Only prompts when there are multiple instances.
99-
---@param callback fun(port: string?, single_instance: boolean, window: string?)
99+
--- Caches the choice only when multiple instances exist.
100+
---@param callback fun(port: string?, window: string?)
100101
local function resolve_port(callback)
101102
if cache and (vim.uv.now() - cache.timestamp) < CACHE_TTL_MS then
102-
callback(cache.port, true, cache.window)
103+
callback(cache.port, cache.window)
103104
return
104105
end
105106

106107
local instances, err = discover_instances()
107108
if #instances == 0 then
108109
notify(err or 'No OpenCode instance found', vim.log.levels.ERROR)
109-
callback(nil, false, nil)
110+
callback(nil, nil)
110111
return
111112
end
112113

113114
if #instances == 1 then
114-
callback(instances[1].port, true, instances[1].window)
115+
-- Single instance: no cache needed, always resolve fresh
116+
callback(instances[1].port, instances[1].window)
115117
return
116118
end
117119

@@ -121,21 +123,22 @@ local function resolve_port(callback)
121123
format_item = function(item) return string.format('window %s', item.window) end,
122124
}, function(choice)
123125
if not choice then
124-
callback(nil, false, nil)
126+
callback(nil, nil)
125127
return
126128
end
127-
callback(choice.port, false, choice.window)
129+
-- Multiple instances: cache the picked port so we don't prompt again
130+
cache = { port = choice.port, session_id = '', window = choice.window, timestamp = vim.uv.now() }
131+
callback(choice.port, choice.window)
128132
end)
129133
end)
130134
end
131135

132-
--- Fetch sessions. Auto-picks the top session when `auto` is true, otherwise prompts. Caches the choice.
136+
--- Fetch sessions. Always auto-picks the top session (session ambiguity is per-instance, not surfaced).
133137
---@param port string
134-
---@param auto boolean
135138
---@param window string?
136139
---@param callback fun(session_id: string?)
137-
local function resolve_session(port, auto, window, callback)
138-
if cache and cache.port == port and (vim.uv.now() - cache.timestamp) < CACHE_TTL_MS then
140+
local function resolve_session(port, window, callback)
141+
if cache and cache.port == port and cache.session_id ~= '' and (vim.uv.now() - cache.timestamp) < CACHE_TTL_MS then
139142
callback(cache.session_id)
140143
return
141144
end
@@ -156,34 +159,20 @@ local function resolve_session(port, auto, window, callback)
156159
return
157160
end
158161

159-
if auto or #sessions == 1 then
162+
-- Always auto-pick the top session; update cache if we're in multi-instance mode
163+
if cache and cache.port == port then
160164
cache = { port = port, session_id = sessions[1].id, window = window, timestamp = vim.uv.now() }
161-
callback(sessions[1].id)
162-
return
163165
end
164-
165-
vim.schedule(function()
166-
vim.ui.select(sessions, {
167-
prompt = 'Pick session:',
168-
format_item = function(s) return s.title or s.slug or s.id end,
169-
}, function(choice)
170-
if not choice then
171-
callback(nil)
172-
return
173-
end
174-
cache = { port = port, session_id = choice.id, window = window, timestamp = vim.uv.now() }
175-
callback(choice.id)
176-
end)
177-
end)
166+
callback(sessions[1].id)
178167
end)
179168
end
180169

181170
--- Resolve port + session, then call back with both.
182171
---@param callback fun(port: string, session_id: string, window: string?)
183172
local function resolve(callback)
184-
resolve_port(function(port, single_instance, window)
173+
resolve_port(function(port, window)
185174
if not port then return end
186-
resolve_session(port, single_instance, window, function(session_id)
175+
resolve_session(port, window, function(session_id)
187176
if not session_id then return end
188177
callback(port, session_id, window)
189178
end)

nvim/lua/custom/plugins/misc.lua

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
return {
2+
-- Navigation & Motion
23
{
34
'christoomey/vim-tmux-navigator',
45
cmd = {
@@ -14,33 +15,23 @@ return {
1415
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
1516
},
1617
},
17-
{ 'ekalinin/Dockerfile.vim' },
1818
{
1919
'folke/flash.nvim',
2020
event = 'VeryLazy',
2121
opts = {},
22-
-- stylua: ignore
23-
keys = {
24-
{ "s", mode = { "n" }, function() require("flash").jump() end, desc = "Flash" },
25-
{ "S", mode = { "n" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
26-
},
27-
},
28-
{
29-
'folke/which-key.nvim',
30-
event = 'VimEnter',
31-
opts = {
32-
delay = 200,
33-
spec = {
34-
{ '<leader><leader>', group = 'OpenCode Ask' },
35-
{ '<leader>b', group = 'De[B]ug' },
36-
{ '<leader>g', group = '[G]it' },
37-
{ '<leader>m', group = 'Split/Join' },
38-
{ '<leader>s', group = '[S]earch' },
39-
{ '<leader>t', group = '[T]oggle' },
40-
{ 'g', group = 'LSP Actions', mode = { 'n' } },
41-
},
22+
-- stylua: ignore
23+
keys = {
24+
{ "s", mode = { "n" }, function() require("flash").jump() end, desc = "Flash" },
25+
{ "S", mode = { "n" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
4226
},
4327
},
28+
29+
-- Coding & Editing Support
30+
{ 'windwp/nvim-autopairs', event = 'InsertEnter', opts = {} },
31+
{ 'NMAC427/guess-indent.nvim', opts = {} },
32+
{ 'ekalinin/Dockerfile.vim' },
33+
34+
-- Version Control (Git)
4435
{
4536
'lewis6991/gitsigns.nvim',
4637
event = { 'BufReadPre', 'BufNewFile' },
@@ -54,19 +45,8 @@ return {
5445
},
5546
},
5647
},
57-
{ 'NMAC427/guess-indent.nvim', opts = {} },
5848
{
5949
'sindrets/diffview.nvim',
6050
cmd = { 'DiffviewOpen', 'DiffviewClose', 'DiffviewToggleFiles', 'DiffviewFocusFiles' },
6151
},
62-
{
63-
'stevearc/quicker.nvim',
64-
ft = 'qf',
65-
opts = {},
66-
},
67-
{
68-
'windwp/nvim-autopairs',
69-
event = 'InsertEnter',
70-
opts = {},
71-
},
7252
}

nvim/lua/custom/plugins/snacks.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ return {
2626
},
2727
},
2828
},
29+
gitbrowse = {
30+
remote_patterns = {
31+
{ "^git@github%.com%-[^:]+:(.+)%.git$", "https://github.com/%1" },
32+
{ "^git@github%.com%-[^:]+:(.+)$", "https://github.com/%1" },
33+
{ "^(https?://.*)%.git$", "%1" },
34+
{ "^git@(.+):(.+)%.git$", "https://%1/%2" },
35+
{ "%.git$", "" },
36+
},
37+
},
2938
styles = {
3039
lazygit = { width = 0.99, height = 0.99 },
3140
},

nvim/lua/custom/plugins/style.lua

Lines changed: 0 additions & 36 deletions
This file was deleted.

nvim/lua/custom/plugins/ui.lua

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
return {
2+
{
3+
'catppuccin/nvim',
4+
priority = 1000,
5+
config = function()
6+
require('catppuccin').setup {
7+
transparent_background = true,
8+
custom_highlights = function()
9+
return {
10+
-- Gruvbox-style popup backgrounds
11+
NormalFloat = { bg = '#282828' },
12+
FloatBorder = { bg = '#282828', fg = '#fabd2f' },
13+
}
14+
end,
15+
}
16+
end,
17+
init = function()
18+
vim.cmd.colorscheme 'catppuccin-mocha'
19+
vim.cmd.hi 'Comment gui=none' -- Remove italic from comments
20+
end,
21+
},
22+
{
23+
'folke/todo-comments.nvim',
24+
event = 'VimEnter',
25+
dependencies = { 'nvim-lua/plenary.nvim' },
26+
opts = { signs = false },
27+
},
28+
{
29+
'wurli/visimatch.nvim',
30+
opts = {},
31+
},
32+
{
33+
'MeanderingProgrammer/render-markdown.nvim',
34+
ft = { 'markdown', 'codecompanion' },
35+
},
36+
-- UI & Experience
37+
{
38+
'folke/which-key.nvim',
39+
event = 'VimEnter',
40+
opts = {
41+
delay = 200,
42+
spec = {
43+
{ '<leader><leader>', group = 'OpenCode Ask' },
44+
{ '<leader>b', group = 'De[B]ug' },
45+
{ '<leader>g', group = '[G]it' },
46+
{ '<leader>m', group = 'Split/Join' },
47+
{ '<leader>s', group = '[S]earch' },
48+
{ '<leader>t', group = '[T]oggle' },
49+
{ 'g', group = 'LSP Actions', mode = { 'n' } },
50+
},
51+
},
52+
},
53+
{
54+
'folke/noice.nvim',
55+
event = 'VeryLazy',
56+
dependencies = {
57+
'MunifTanjim/nui.nvim',
58+
},
59+
opts = {
60+
presets = {
61+
bottom_search = true,
62+
},
63+
cmdline = {
64+
enabled = true,
65+
view = 'cmdline_popup',
66+
},
67+
views = {
68+
cmdline_popup = {
69+
position = { row = 3, col = '50%' },
70+
},
71+
},
72+
-- Disable everything else to prevent behavior changes
73+
messages = { enabled = false },
74+
popupmenu = { enabled = false },
75+
notify = { enabled = false },
76+
lsp = {
77+
progress = { enabled = false },
78+
hover = { enabled = false },
79+
signature = { enabled = false },
80+
message = { enabled = false },
81+
},
82+
},
83+
},
84+
{
85+
'stevearc/quicker.nvim',
86+
ft = 'qf',
87+
opts = {},
88+
},
89+
}

opencode/opencode.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"extensions": [".py"]
77
}
88
},
9+
"plugin": ["opencode-gemini-auth@latest"],
910
"lsp": {
1011
"cue": {
1112
"command": ["cue", "lsp", "serve"],

tmux/tmux.conf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ set -g mouse on
2525
set -g renumber-windows on
2626
set -g set-clipboard on
2727
set -g window-size largest
28-
set -g allow-passthrough on
2928

3029
# Enable extended keys for proper modifier key support
3130
set -g extended-keys on

0 commit comments

Comments
 (0)