This commit is contained in:
turtlebasket
2026-03-05 13:25:51 -08:00
parent 7ca47853f9
commit 26e442f8f0
5 changed files with 157 additions and 32 deletions

View File

@@ -11,7 +11,12 @@ window-height = 50
term = xterm-256color
# reduce dimming for unfocused split panes (1.0 disables dimming)
unfocused-split-opacity = 0.88
unfocused-split-opacity = 0.77
split-divider-color = #666666
window-inherit-working-directory = false
tab-inherit-working-directory = true
# USE PRERELEASE
# > While you can set this setting back to `stable` at any time, this will only take effect when a later stable
@@ -19,13 +24,12 @@ unfocused-split-opacity = 0.88
auto-update-channel = tip
auto-update = off
# window-inherit-working-directory = false
# binds
keybind = cmd+,=open_config
keybind = cmd+b>shift+'=new_split:down
keybind = cmd+b>shift+5=new_split:right
keybind = cmd+b>cmd+b=goto_split:next
keybind = cmd+b>right=goto_split:right
keybind = cmd+b>left=goto_split:left

View File

@@ -14,34 +14,97 @@ opt.termguicolors = true
opt.mouse = 'a'
opt.smartindent = true
opt.wrap = false
opt.relativenumber = true
opt.number = true
opt.relativenumber = false
opt.tabstop = 4
opt.shiftwidth = 4
opt.expandtab = true
vim.o.sessionoptions = 'blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions'
vim.hl.priorities.semantic_tokens = 140
vim.hl.priorities.treesitter = 100
vim.filetype.add({ extension = { svelte = 'svelte' } })
vim.api.nvim_create_autocmd('FileType', { pattern = 'markdown', command = 'setlocal wrap' })
vim.filetype.add({
extension = {
svelte = 'svelte',
svx = 'markdown',
},
})
vim.api.nvim_create_autocmd('FileType', { pattern = { 'markdown', 'svx' }, command = 'setlocal wrap' })
local function map(mode, lhs, rhs)
vim.keymap.set(mode, lhs, rhs, { silent = true })
end
local function confirm_clear_buffers()
local choice = vim.fn.confirm('Clear all buffers?', '&Yes\n&No', 2)
if choice ~= 1 then
return
end
local listed_buffers = {}
for _, buf in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_valid(buf) and vim.bo[buf].buflisted then
listed_buffers[#listed_buffers + 1] = buf
end
end
local ok, err = pcall(vim.cmd, 'enew')
if not ok then
vim.notify(err, vim.log.levels.WARN)
return
end
local scratch = vim.api.nvim_get_current_buf()
vim.bo[scratch].buftype = 'nofile'
vim.bo[scratch].bufhidden = 'wipe'
vim.bo[scratch].buflisted = false
vim.bo[scratch].swapfile = false
local failed = false
for _, buf in ipairs(listed_buffers) do
if buf ~= scratch and vim.api.nvim_buf_is_valid(buf) then
local deleted = pcall(vim.api.nvim_buf_delete, buf, {})
failed = failed or not deleted
end
end
if failed then
vim.notify('Some buffers could not be deleted', vim.log.levels.WARN)
end
end
local function telescope_workspace_symbols()
local bufnr = vim.api.nvim_get_current_buf()
for _, client in ipairs(vim.lsp.get_clients({ bufnr = bufnr })) do
if client:supports_method('workspace/symbol', bufnr) then
require('telescope.builtin').lsp_dynamic_workspace_symbols()
return
end
end
vim.notify('No attached LSP client supports workspace/symbol for this buffer', vim.log.levels.WARN)
end
for _, m in ipairs({
{ 'n', '<c-b>', '<cmd>NvimTreeToggle<cr>' },
{ 'n', '<c-b>', '<cmd>NvimTreeFindFileToggle<cr>' },
{ 'n', '<c-`>', '<cmd>ToggleTerm direction="float"<cr>' },
{ 't', '<c-`>', '<cmd>ToggleTerm<cr>' },
{ 'n', '<leader>gs', '<cmd>Telescope git_status<cr>' },
{ 'n', '<leader>gc', '<cmd>Telescope git_commits<cr>' },
{ 'n', '<leader>:', '<cmd>Telescope commands<cr>' },
{ 'n', '<leader><leader>', '<cmd>Telescope find_files<cr>' },
{ 'n', '<leader>f', '<cmd>Telescope grep_string<cr>' },
{ 'n', '<leader>ff', '<cmd>Telescope live_grep<cr>' },
{ 'n', '<leader>fz', '<cmd>Telescope grep_string<cr>' },
{ 'n', '<leader>t', telescope_workspace_symbols },
{ 'n', '<leader>b', '<cmd>Telescope buffers<cr>' },
{ 'n', '<leader>dB', confirm_clear_buffers },
{ 'n', 'B', '<cmd>Telescope buffers<cr>' },
{ 'n', '<leader>e', vim.diagnostic.open_float },
{ 'n', '\\', vim.lsp.buf.hover },
{ 'n', '<F12>', vim.lsp.buf.definition },
{ 'n', '<F2>', vim.lsp.buf.rename },
{ 'n', '<a-k>', '<cmd>GitGutterPrevHunk<cr>' },
{ 'n', '<a-j>', '<cmd>GitGutterNextHunk<cr>' },
{ 'n', '<c-h>', '<cmd>bp<cr>' },
@@ -72,21 +135,47 @@ require('lazy').setup({
config = function() require('vscode').setup({ transparent = true }) end,
},
{ 'airblade/vim-gitgutter' },
{
'numToStr/Comment.nvim',
config = function()
require('Comment').setup()
vim.keymap.set('n', '<leader>/', function()
return vim.v.count == 0 and '<Plug>(comment_toggle_linewise_current)'
or '<Plug>(comment_toggle_linewise_count)'
end, { expr = true, silent = true, desc = 'Toggle line comment' })
vim.keymap.set('x', '<leader>/', '<Plug>(comment_toggle_blockwise_visual)', {
silent = true,
desc = 'Toggle block comment',
})
end,
},
{
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function() require('lualine').setup({ options = { theme = 'vscode', globalstatus = true } }) end,
config = function()
require('lualine').setup({
options = { theme = 'vscode', globalstatus = true },
sections = {
lualine_z = {
'location',
function() return 'L:' .. vim.api.nvim_buf_line_count(0) end,
},
},
})
end,
},
{
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
config = function()
local wanted = { 'svelte', 'javascript', 'typescript', 'html', 'css' }
local wanted = { 'svelte', 'javascript', 'typescript', 'html', 'css', 'markdown', 'svx' }
local ts_runtime = vim.fn.stdpath('data') .. '/lazy/nvim-treesitter/runtime'
if vim.loop.fs_stat(ts_runtime) then
vim.opt.rtp:append(ts_runtime)
end
require('nvim-treesitter').setup({ install_dir = vim.fn.stdpath('data') .. '/site' })
vim.treesitter.language.register('markdown', 'svx')
vim.api.nvim_create_autocmd('FileType', {
pattern = wanted,
@@ -161,7 +250,27 @@ require('lazy').setup({
{
'nvim-tree/nvim-tree.lua',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function() require('nvim-tree').setup({ view = { width = 42 } }) end,
config = function()
vim.api.nvim_set_hl(0, 'NvimTreeNormal', { bg = '#0f0f12' })
vim.api.nvim_set_hl(0, 'NvimTreeEndOfBuffer', { bg = '#0f0f12' })
vim.api.nvim_set_hl(0, 'NvimTreeWinSeparator', { bg = '#0f0f12', fg = '#0f0f12' })
require('nvim-tree').setup({
view = { width = 42 },
update_focused_file = {
enable = true,
update_root = false,
},
})
end,
},
{
'rmagatti/auto-session',
lazy = false,
opts = {
suppressed_dirs = { '~/', '~/Downloads', '/' },
close_filetypes_on_save = { 'checkhealth', 'NvimTree' },
auto_delete_empty_sessions = false,
},
},
{
'nvim-telescope/telescope.nvim',

View File

@@ -1,11 +1,13 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"auto-session": { "branch": "main", "commit": "62437532b38495551410b3f377bcf4aaac574ebe" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" },
"nvim-cmp": { "branch": "main", "commit": "da88697d7f45d16852c6b2769dc52387d1ddc45f" },
"nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" },
"nvim-tree.lua": { "branch": "master", "commit": "e11ce83ed9a00f065bf676ae4e6c261c766989ba" },
"nvim-treesitter": { "branch": "main", "commit": "3edb01f912867603c2aef9079f208f0244c0885b" },
"nvim-lspconfig": { "branch": "master", "commit": "b7dcde3e6195b43476ae799720b177aedc16d44c" },
"nvim-tree.lua": { "branch": "master", "commit": "e49b0d9bfa70989cf8b5abf5557f51e6e57f68d6" },
"nvim-treesitter": { "branch": "main", "commit": "d660b7c002f3922b6bb3da47206645488a698426" },
"nvim-web-devicons": { "branch": "master", "commit": "746ffbb17975ebd6c40142362eee1b0249969c5c" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },

24
config/tmux/tmux.conf Normal file
View File

@@ -0,0 +1,24 @@
# ~/.tmux.conf
set -g monitor-bell on
# Ctrl+a instead of Ctrl+b for command prefix (like Screen)
# set -g prefix C-a
# unbind C-b
# bind C-a send-prefix
# ctrl+b C creates a new window to the right (NOTE: capital C)
# NOTE: this doesn't work for some reason!!
# unbind -T prefix C
# bind -T prefix C new-window -a .
unbind l
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# ntfy-bell - run a command, forwarding OSC 9 notifications and BEL to ntfy
# ntfy-bell - run a command, forwarding OSC 9 notifications to ntfy
#
# Usage:
# ntfy-bell <command> [args...]
@@ -102,9 +102,9 @@ def _copy_winsize(src_fd: int, dst_fd: int) -> None:
def main() -> int:
topic = os.environ.get("BELL2NTFY_TOPIC")
topic = os.environ.get("NTFY_ME_TOPIC")
if not topic:
print("Error: environment variable BELL2NTFY_TOPIC not set", file=sys.stderr)
print("Error: environment variable NTFY_ME_TOPIC not set", file=sys.stderr)
return 2
if len(sys.argv) < 2:
@@ -155,7 +155,6 @@ def main() -> int:
signal.signal(signal.SIGWINCH, _on_winch)
osc_last_sent = 0.0
bel_last_sent = 0.0
cooldown_s = 1.5
parse_buf = bytearray()
stdin_eof_sent = False
@@ -224,19 +223,6 @@ def main() -> int:
except Exception:
pass
if bytes([BEL]) in data and parse_buf.find(OSC9_PREFIX) == -1:
now = time.time()
if now - bel_last_sent >= cooldown_s:
bel_last_sent = now
try:
notify_ntfy(
topic=topic,
title="Terminal bell",
message=f"BEL from: {' '.join(cmd)}",
)
except Exception:
pass
finally:
if stdin_fd is not None and stdin_is_tty and old_tty_attrs is not None:
try: