Compare commits

..
5 Commits
28 changed files with 693 additions and 664 deletions
Vendored
BIN
View File
Binary file not shown.
+1
View File
@@ -26,3 +26,4 @@ brew "go"
brew "wget"
brew "jq"
brew "ruby"
brew "opencode"
+5 -1
View File
@@ -26,7 +26,6 @@ DOTFILES_DIR="$HOME/dotfiles"
if [ ! -d "$DOTFILES_DIR" ]; then
echo "Cloning dotfiles..."
git clone https://git@moo:dmm/dotfiles.git
cd dotfiles
fi
cd "$DOTFILES_DIR"
brew bundle --file=.Brewfile
@@ -34,6 +33,11 @@ brew bundle --file=.Brewfile
stow .
cd ~/
TPM_DIR="$HOME/.config/tmux/plugins/tpm/"
if [ ! -d "$TPM_DIR" ]; then
echo "Cloning tpm..."
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm
fi
# Enable Touch ID for sudo
BIN
View File
Binary file not shown.
+1 -24
View File
@@ -1,28 +1,5 @@
--- Options
require('DarthMooMancer.plugins')
require('DarthMooMancer.opts')
require('DarthMooMancer.colors')
require('DarthMooMancer.plugins')
require('DarthMooMancer.keymaps')
require('DarthMooMancer.ui')
require('DarthMooMancer.lsp')
require('DarthMooMancer.tools')
vim.api.nvim_create_autocmd('FileType', {
pattern = {
'c',
'cpp',
'rust',
'lua',
'typescript',
'javascript',
'css',
'html',
'python',
'go',
'yaml',
},
callback = function()
vim.treesitter.start()
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})
@@ -1,25 +0,0 @@
require('kanso').setup({
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" },
TelescopeBorder = { fg = theme.ui.special, bg = "none" },
TelescopePromptBorder = { fg = theme.ui.special, bg = "none" },
TelescopeResultsBorder = { fg = theme.ui.special, bg = "none" },
TelescopePreviewBorder = { fg = theme.ui.special, bg = "none" },
NotifyBackground = { bg = "none" },
NotifyBorder = { fg = theme.ui.special, bg = "none" },
NotifyBody = { fg = theme.ui.fg, bg = "none" },
NotifyTitle = { fg = theme.ui.special, bg = "none" },
}
end,
})
vim.cmd.colorscheme('kanso-zen')
@@ -11,36 +11,36 @@ vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', 'n', 'nzzzv')
vim.keymap.set('n', 'N', 'Nzzzv')
vim.keymap.set('x', '<leader>p', [["_dP]])
local builtin = require('telescope.builtin')
vim.keymap.set(
'n',
'<leader><leader>',
builtin.find_files,
{ desc = 'Telescope find files' }
function() Snacks.picker.files() end
)
vim.keymap.set(
'n',
'<leader>fh',
builtin.help_tags,
{ desc = 'Telescope help tags' }
function() Snacks.picker.help() end
)
vim.keymap.set(
'n',
'<leader>fg',
builtin.live_grep,
{ desc = 'Telescope live grep' }
function() Snacks.picker.grep() end
)
vim.keymap.set(
'n',
'<leader>fm',
builtin.man_pages,
{ desc = 'Telescope man_pages' }
function() Snacks.picker.man() end
)
vim.keymap.set(
'n',
'<leader>xn',
':Telescope notify<CR>',
{ desc = 'Telescope notify' }
function() Snacks.picker.notifications() end
)
vim.keymap.set(
'n',
'<leader>uu',
function() Snacks.picker.undo() end
)
vim.keymap.set('n', '<leader>fs', vim.lsp.buf.document_symbol)
@@ -48,7 +48,6 @@ vim.keymap.set('n', '<leader>gd', vim.lsp.buf.definition)
vim.keymap.set('n', '<leader>gr', vim.lsp.buf.references)
vim.keymap.set('n', '<leader>gR', vim.lsp.buf.rename)
vim.keymap.set('n', '<leader>gc', vim.lsp.buf.code_action)
vim.keymap.set('n', '<leader>uu', ':UndotreeToggle<CR>')
vim.keymap.set('n', '<leader>[', '<c-w>H', { silent = true, noremap = true })
vim.keymap.set('n', '<leader>]', '<c-w>K', { silent = true, noremap = true })
vim.keymap.set('n', '[q', ':cprev<CR>zz', { desc = 'Previous Quickfix Item' })
@@ -61,8 +60,4 @@ 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" })
vim.keymap.set("n", "];", dropbar_api.select_next_context, { desc = "Select next context" })
vim.keymap.set('n', '<leader>zz', function() Snacks.zen() end)
@@ -1,53 +1,3 @@
require('mason').setup()
require('mason-lspconfig').setup({
ensure_installed = {
'vtsls',
'lua_ls',
'pylsp',
'gopls',
'html',
'cssls',
'bashls',
},
automatic_enable = false,
})
require('nvim-treesitter').install({
'rust',
'c',
'cpp',
'lua',
'javascript',
'go',
'typescript',
'css',
'html',
'python',
'yaml',
})
require('conform').setup({
formatters_by_ft = {
rust = { 'rustfmt', lsp_format = 'fallback' },
lua = { 'stylua', lsp_format = 'fallback' },
javascript = { 'prettier', stop_after_first = true },
typescript = { 'prettier', stop_after_first = true },
json = { 'prettier' },
html = { 'prettier' },
go = { 'goimports' },
c = { 'clang-format' },
cpp = { 'clang-format' },
css = { 'csskit' },
dart = { 'dart_format', lsp_format = 'fallback' },
python = { 'autopep8' },
['_'] = { 'trim_whitespace' },
},
format_on_save = {
timeout_ms = 2000,
lsp_format = 'fallback',
},
})
local capabilities = require('blink.cmp').get_lsp_capabilities()
vim.lsp.config('lua_ls', {
capabilities = capabilities,
+14 -1
View File
@@ -62,4 +62,17 @@ vim.diagnostic.config({
update_in_insert = false, -- Don't clutter the screen while typing
severity_sort = true,
})
vim.o.winborder = "rounded"
vim.o.winborder = 'rounded'
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'text', 'plaintex' },
callback = function()
-- Enable visual soft-wrapping
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.breakindent = true
-- Remap j/k to visual lines only inside this buffer
vim.keymap.set('n', 'j', 'gj', { buffer = true })
vim.keymap.set('n', 'k', 'gk', { buffer = true })
end,
})
@@ -1,43 +1,12 @@
vim.pack.add({
-- Themes
{ src = 'https://github.com/webhooked/kanso.nvim' },
-- The rest
{ src = 'https://github.com/mbbill/undotree' },
{
src = 'https://github.com/nvim-mini/mini.pairs',
version = vim.version.range('*'),
},
{
src = 'https://github.com/nvim-mini/mini.hipatterns',
version = vim.version.range('*'),
},
{ src = 'https://github.com/nvim-tree/nvim-web-devicons' },
{ src = 'https://github.com/nvim-telescope/telescope.nvim' },
{
src = 'https://github.com/saghen/blink.cmp',
version = vim.version.range('*'),
},
{ src = 'https://git.moomancer.xyz/DarthMooMancer/polydev.git' },
{
src = 'https://github.com/nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
},
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
{ src = 'https://github.com/mason-org/mason.nvim' },
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
{ src = 'https://github.com/neovim/nvim-lspconfig' },
{ src = 'https://github.com/stevearc/conform.nvim' },
{ src = 'https://github.com/b0o/incline.nvim' },
{ src = 'https://github.com/windwp/nvim-ts-autotag' },
{ src = 'https://github.com/MunifTanjim/nui.nvim' },
{ src = 'https://github.com/nvim-lua/plenary.nvim' },
{ src = 'https://github.com/folke/noice.nvim' },
-- { src = 'https://github.com/stevearc/dressing.nvim' },
{ 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' },
})
require('DarthMooMancer.plugins.utils')
require('DarthMooMancer.plugins.blink-cmp')
require('DarthMooMancer.plugins.kanso')
require('DarthMooMancer.plugins.mini-nvim')
require('DarthMooMancer.plugins.polydev')
require('DarthMooMancer.plugins.treesitter')
require('DarthMooMancer.plugins.incline')
require('DarthMooMancer.plugins.mason')
require('DarthMooMancer.plugins.noice')
require('DarthMooMancer.plugins.snacks')
require('DarthMooMancer.plugins.trouble')
require('DarthMooMancer.plugins.conform')
@@ -0,0 +1,30 @@
vim.pack.add({
{
src = 'https://github.com/saghen/blink.cmp',
version = vim.version.range('*'),
}
})
require('blink.cmp').setup({
completion = {
documentation = {
auto_show = true,
auto_show_delay_ms = 100,
window = {
winhighlight = 'Normal:NormalFloat,FloatBorder:SnacksPickerBorder,CursorLine:Visual,Search:None',
},
},
menu = {
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind", gap = 1 },
{ "source_name", gap = 1 },
},
},
scrollbar = false,
winhighlight =
'Pmenu:NormalFloat,FloatBorder:SnacksPickerBorder,PmenuSel:Visual,CursorLine:Visual,Search:None',
},
},
})
@@ -0,0 +1,23 @@
vim.pack.add({ 'https://github.com/stevearc/conform.nvim' })
require('conform').setup({
formatters_by_ft = {
rust = { 'rustfmt', lsp_format = 'fallback' },
lua = { 'stylua', lsp_format = 'fallback' },
javascript = { 'prettier', stop_after_first = true },
typescript = { 'prettier', stop_after_first = true },
json = { 'prettier' },
html = { 'prettier' },
go = { 'goimports' },
c = { 'clang-format' },
cpp = { 'clang-format' },
css = { 'csskit' },
dart = { 'dart_format', lsp_format = 'fallback' },
python = { 'autopep8' },
['_'] = { 'trim_whitespace' },
},
format_on_save = {
timeout_ms = 2000,
lsp_format = 'fallback',
},
})
@@ -0,0 +1,50 @@
vim.pack.add({
{ src = 'https://github.com/b0o/incline.nvim' },
{ src = 'https://github.com/SmiteshP/nvim-navic' },
})
local helpers = require('incline.helpers')
local navic = require('nvim-navic')
local devicons = require('nvim-web-devicons')
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('UserNavicAttach', { clear = true }),
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and client.server_capabilities.documentSymbolProvider then
navic.attach(client, args.buf)
end
end,
})
require('incline').setup({
window = {
padding = 0,
margin = { horizontal = 0, vertical = 0 },
},
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 = devicons.get_icon_color(filename)
local modified = vim.bo[props.buf].modified
local res = {
ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or '',
' ',
{ filename, gui = modified and 'bold,italic' or 'bold' },
guibg = "none",
}
if props.focused then
for _, item in ipairs(navic.get_data(props.buf) or {}) do
table.insert(res, {
{ ' > ', group = 'NavicSeparator' },
{ item.icon, group = 'NavicIcons' .. item.type },
{ item.name, group = 'NavicText' },
})
end
end
table.insert(res, ' ')
return res
end,
})
@@ -0,0 +1,19 @@
vim.pack.add({'https://github.com/webhooked/kanso.nvim' })
require('kanso').setup({
transparent = true,
overrides = function(colors)
local theme = colors.theme
return {
Normal = { bg = "none" },
NormalFloat = { bg = "none" },
FloatBorder = { bg = "none" },
FloatTitle = { bg = "none" },
SnacksPickerBorder = { fg = theme.ui.special, bg = "none" },
SnacksPickerTitle = { fg = theme.ui.special, bg = "none" },
SnacksInputBorder = { fg = theme.ui.special, bg = "none" },
}
end,
})
vim.cmd.colorscheme('kanso-zen')
@@ -0,0 +1,19 @@
vim.pack.add({
{ src = 'https://github.com/mason-org/mason.nvim' },
{ src = 'https://github.com/mason-org/mason-lspconfig.nvim' },
{ src = 'https://github.com/neovim/nvim-lspconfig' },
})
require('mason').setup()
require('mason-lspconfig').setup({
ensure_installed = {
'vtsls',
'lua_ls',
'pylsp',
'gopls',
'html',
'cssls',
'bashls',
},
automatic_enable = false,
})
@@ -0,0 +1,34 @@
vim.pack.add({
{
src = 'https://github.com/nvim-mini/mini.nvim.git',
version = vim.version.range('*')
}
})
local hipatterns = require('mini.hipatterns')
hipatterns.setup({
highlighters = {
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
fixme = {
pattern = '%f[%w]()FIXME()%f[%W]',
group = 'MiniHipatternsFixme',
},
hack = {
pattern = '%f[%w]()HACK()%f[%W]',
group = 'MiniHipatternsHack',
},
todo = {
pattern = '%f[%w]()TODO()%f[%W]',
group = 'MiniHipatternsTodo',
},
note = {
pattern = '%f[%w]()NOTE()%f[%W]',
group = 'MiniHipatternsNote',
},
hex_color = hipatterns.gen_highlighter.hex_color(),
},
})
require('mini.pairs').setup()
-- require('mini.icons').setup()
@@ -0,0 +1,20 @@
vim.pack.add({
{ src = 'https://github.com/folke/noice.nvim' },
{ src = 'https://github.com/MunifTanjim/nui.nvim' },
})
require('noice').setup({
lsp = {
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
},
},
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})
@@ -0,0 +1,3 @@
vim.pack.add({'https://git.moomancer.xyz/DarthMooMancer/polydev.git' })
require('Polydev').setup()
@@ -0,0 +1,31 @@
vim.pack.add({ 'https://github.com/folke/snacks.nvim' })
require('snacks').setup({
notifier = {
enabled = true,
},
animate = { enabled = true },
input = { enabled = true },
picker = {
enabled = true,
prompt = '',
icons = {
ui = {
selected = '',
},
},
layout = {
preview = false,
},
},
zen = {
enabled = true,
toggles = {
dim = false,
diagnostics = true,
inlay_hints = true,
},
},
})
@@ -0,0 +1,49 @@
vim.pack.add({
{
src = 'https://github.com/nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
},
{ src = 'https://github.com/windwp/nvim-ts-autotag' },
})
require('nvim-treesitter').install({
'rust',
'c',
'cpp',
'lua',
'javascript',
'go',
'typescript',
'css',
'html',
'python',
'yaml',
})
require('nvim-ts-autotag').setup({
opts = {
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false, -- Auto close on trailing </
},
})
vim.api.nvim_create_autocmd('FileType', {
pattern = {
'c',
'cpp',
'rust',
'lua',
'typescript',
'javascript',
'css',
'html',
'python',
'go',
'yaml',
},
callback = function()
vim.treesitter.start()
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})
@@ -0,0 +1,2 @@
vim.pack.add({ 'https://github.com/folke/trouble.nvim' })
require('trouble').setup({})
@@ -0,0 +1,13 @@
vim.pack.add({
{ src = 'https://github.com/nvim-tree/nvim-web-devicons' },
{ src = 'https://github.com/alexghergh/nvim-tmux-navigation' },
{ src = 'https://github.com/brianhuster/live-preview.nvim' },
{ src = 'https://github.com/m4xshen/hardtime.nvim' },
})
require('nvim-tmux-navigation').setup({
disable_when_zoomed = true, -- defaults to false
})
require("hardtime").setup()
@@ -1,87 +0,0 @@
local hipatterns = require('mini.hipatterns')
hipatterns.setup({
highlighters = {
-- Highlight standalone 'FIXME', 'HACK', 'TODO', 'NOTE'
fixme = {
pattern = '%f[%w]()FIXME()%f[%W]',
group = 'MiniHipatternsFixme',
},
hack = {
pattern = '%f[%w]()HACK()%f[%W]',
group = 'MiniHipatternsHack',
},
todo = {
pattern = '%f[%w]()TODO()%f[%W]',
group = 'MiniHipatternsTodo',
},
note = {
pattern = '%f[%w]()NOTE()%f[%W]',
group = 'MiniHipatternsNote',
},
hex_color = hipatterns.gen_highlighter.hex_color(),
},
})
require('mini.pairs').setup()
require('nvim-tmux-navigation').setup({
disable_when_zoomed = true, -- defaults to false
})
-- require("zen-mode").toggle({
-- })
require('blink.cmp').setup({
completion = {
documentation = {
auto_show = true,
auto_show_delay_ms = 100,
window = {
winhighlight = 'Normal:NormalFloat,FloatBorder:TelescopeBorder,CursorLine:Visual,Search:None',
},
},
menu = {
draw = {
columns = {
{ "label", "label_description", gap = 1 },
{ "kind_icon", "kind", gap = 1 },
{ "source_name", gap = 1 },
},
},
scrollbar = false,
winhighlight =
'Pmenu:NormalFloat,FloatBorder:TelescopeBorder,PmenuSel:TelescopeSelection,CursorLine:TelescopeSelection,Search:None',
},
},
})
require('Polydev').setup()
require('nvim-ts-autotag').setup({
opts = {
enable_close = true, -- Auto close tags
enable_rename = true, -- Auto rename pairs of tags
enable_close_on_slash = false, -- Auto close on trailing </
},
})
require('trouble').setup({})
require("telescope").setup({
defaults = {
prompt_prefix = "", -- Changes the search icon/prompt prefix
selection_caret = "", -- Changes the arrow/caret next to the selected item
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = 'top',
prompt_min_width = 40,
prompt_max_width = 80,
preview_width = 80,
},
},
sorting_strategy = "ascending",
preview = {
hide_on_startup = true,
},
},
})
require("hardtime").setup()
+249 -240
View File
@@ -1,4 +1,3 @@
--- Derive a highlight from an existing scheme group.
local function derive_hl(name, opts)
local base = opts.base and vim.api.nvim_get_hl(0, { name = opts.base })
or {}
@@ -10,7 +9,7 @@ local function derive_hl(name, opts)
bold = opts.bold,
})
end
--- Derive a mode highlight where bg comes from a syntax group and fg contrasts.
local function derive_mode_hl(name, color_group)
local color = vim.api.nvim_get_hl(0, { name = color_group })
local status_bg = vim.api.nvim_get_hl(0, { name = 'StatusLine' })
@@ -21,7 +20,6 @@ local function derive_mode_hl(name, color_group)
})
end
--- (Re)build all statusline highlight groups from current scheme.
local function setup_statusline_highlights()
derive_mode_hl('StatusModeNormal', 'Type')
derive_mode_hl('StatusModeInsert', 'String')
@@ -29,9 +27,13 @@ local function setup_statusline_highlights()
derive_mode_hl('StatusModeCommand', 'PreProc')
derive_mode_hl('StatusModeReplace', 'WarningMsg')
derive_mode_hl('StatusModeTerminal', 'Special')
derive_hl('StatusGit', { base = 'CursorLine', fg = 'LineNr' })
derive_hl('StatusLsp', { base = 'StatusLine', fg = 'DiagnosticInfo' })
derive_hl('StatusLspSpinner', { base = 'StatusLine', fg = 'Constant' })
derive_hl('StatusGit', { base = 'CursorLine', fg = 'Normal' })
derive_hl(
'StatusLspWorking',
{ base = 'StatusLine', fg = 'DiagnosticInfo' }
)
derive_hl('StatusLspReady', { base = 'StatusLine', fg = 'Constant' })
derive_hl('StatusLspNone', { base = 'StatusLine', fg = 'NonText' })
derive_hl(
'StatusDiagError',
{ base = 'StatusLine', fg = 'DiagnosticError' }
@@ -39,8 +41,7 @@ local function setup_statusline_highlights()
derive_hl('StatusDiagWarn', { base = 'StatusLine', fg = 'DiagnosticWarn' })
derive_hl('StatusDiagHint', { base = 'StatusLine', fg = 'DiagnosticHint' })
derive_hl('StatusCursor', { base = 'CursorLine', fg = 'Normal' })
-- derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'OkMsg' })
derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'MoreMsg' })
derive_hl('StatusGitAdded', { base = 'StatusLine', fg = 'DiagnosticOk' })
derive_hl(
'StatusGitRemoved',
{ base = 'StatusLine', fg = 'DiagnosticError' }
@@ -52,277 +53,285 @@ vim.api.nvim_create_autocmd('ColorScheme', {
})
setup_statusline_highlights()
--- Mode text mapping.
local mode_map = {
['n'] = ' NORM ',
['i'] = ' INS ',
['v'] = ' VIS ',
['V'] = ' V-LINE ',
[''] = ' V-BLK ',
['R'] = ' REPL ',
['c'] = ' CMD ',
['t'] = ' TERM ',
}
local mode_hl_map = {
['n'] = 'StatusModeNormal',
['i'] = 'StatusModeInsert',
['v'] = 'StatusModeVisual',
['V'] = 'StatusModeVisual',
[''] = 'StatusModeVisual',
['R'] = 'StatusModeReplace',
['c'] = 'StatusModeCommand',
['t'] = 'StatusModeTerminal',
n = ' NORM ',
i = ' INS ',
v = ' VIS ',
V = ' V-LINE ',
['\22'] = ' V-BLK ',
['\19'] = ' V-BLK ',
s = ' VIS ',
S = ' V-LINE ',
R = ' REPL ',
c = ' CMD ',
r = ' PROMPT ',
t = ' TERM ',
['!'] = ' SHELL ',
}
--- Git branch (async, cached per buffer, refreshed every 5s)
local function update_git_branch()
if vim.bo.buftype ~= '' then
return
local mode_hl_map = {
n = 'StatusModeNormal',
i = 'StatusModeInsert',
v = 'StatusModeVisual',
V = 'StatusModeVisual',
['^V'] = 'StatusModeVisual',
s = 'StatusModeVisual',
S = 'StatusModeVisual',
['^S'] = 'StatusModeVisual',
R = 'StatusModeReplace',
c = 'StatusModeCommand',
r = 'StatusModeCommand',
['!'] = 'StatusModeCommand',
t = 'StatusModeTerminal',
}
local function refresh_status(buf)
local b = vim.b[buf]
local left, right = {}, {}
if b.git_branch and b.git_branch ~= '' then
left[#left + 1] = '%#StatusGit# ' .. b.git_branch .. ' %*'
end
vim.system(
{ 'git', 'branch', '--show-current' },
{ text = true },
function(out)
vim.b.git_branch = (out.code == 0 and out.stdout or ''):gsub(
'%s+',
''
)
local diff = b.git_diff
if diff then
if diff.added > 0 then
left[#left + 1] = '%#StatusGitAdded# +' .. diff.added .. '%*'
end
)
if diff.removed > 0 then
left[#left + 1] = '%#StatusGitRemoved# -' .. diff.removed .. '%*'
end
end
if b.recording then
right[#right + 1] = '%#StatusRecording# ' .. b.recording .. ' %*'
end
if b.diag_str then
right[#right + 1] = b.diag_str
end
if b.lsp_icon and b.lsp_icon ~= '' then
right[#right + 1] = '%#'
.. b.lsp_hl
.. '#'
.. b.lsp_icon
.. (b.lsp_name or '')
.. ' %*'
end
b.status_left = #left > 0 and table.concat(left) or ''
b.status_right = #right > 0 and table.concat(right) or ''
end
vim.uv.new_timer():start(5000, 5000, vim.schedule_wrap(update_git_branch))
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained' }, {
callback = function()
update_git_branch()
local lsp_icon = {
none = '',
starting = '',
working = ' 󰄬 ',
ready = ' 󰄭 ',
}
local lsp_hl = {
none = 'StatusLspNone',
starting = 'StatusLspNone',
working = 'StatusLspWorking',
ready = 'StatusLspReady',
}
local active_progress = {}
local function refresh_lsp(buf)
local state = 'ready'
local clients = vim.lsp.get_clients({ bufnr = buf })
if #clients == 0 then
state = 'none'
vim.b[buf].lsp_name = ''
else
local names = {}
for _, client in ipairs(clients) do
names[#names + 1] = client.name
local prog = active_progress[client.id]
if prog == 'working' then
state = 'working'
elseif prog == 'starting' and state ~= 'working' then
state = 'starting'
end
vim.b[buf].lsp_name = table.concat(names, '/')
end
end
vim.b[buf].lsp_icon = lsp_icon[state]
vim.b[buf].lsp_hl = lsp_hl[state]
refresh_status(buf)
end
vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, {
callback = function(ev)
if ev.event == 'LspAttach' then
local cid = ev.data.client_id
if not active_progress[cid] then
active_progress[cid] = 'starting'
vim.defer_fn(function()
if active_progress[cid] == 'starting' then
active_progress[cid] = nil
if vim.api.nvim_buf_is_valid(ev.buf) then
refresh_lsp(ev.buf)
end
end
end, 500) -- 500ms grace period to wait for LspProgress
end
elseif ev.event == 'LspDetach' then
active_progress[ev.data.client_id] = nil
end
refresh_lsp(ev.buf)
end,
})
--- LSP progress (Neovim 0.10+ built-in handler)
local progress = {}
local spinner_frames =
{ '⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷' }
local frame = 0
--- Clean stale progress messages periodically
local progress_timer = vim.uv.new_timer()
local function start_progress_timer()
if not progress_timer:is_active() then
progress_timer:start(0, 200, function()
local now = vim.loop.now()
for k, v in pairs(progress) do
local ttl = v.done and 2000 or 10000
if now - v.t > ttl then
progress[k] = nil
end
end
if next(progress) then
frame = (frame % #spinner_frames) + 1
vim.schedule(function()
vim.cmd('redrawstatus')
end)
else
progress_timer:stop()
vim.schedule(function()
vim.cmd('redrawstatus')
end)
end
end)
end
end
vim.api.nvim_create_autocmd('LspProgress', {
callback = function(ev)
local d = ev.data
if not d then
local kind = ev.data.params.value and ev.data.params.value.kind
if kind == 'begin' or kind == 'report' then
active_progress[ev.data.client_id] = 'working'
elseif kind == 'end' then
active_progress[ev.data.client_id] = nil
else
return
end
local params = d.params
if not params or not params.token then
return
local client = vim.lsp.get_client_by_id(ev.data.client_id)
if client then
for buf in pairs(client.attached_buffers) do
refresh_lsp(buf)
end
local key = d.client_id .. ':' .. tostring(params.token)
local value = params.value or {}
if value.kind == 'begin' then
progress[key] = {
msg = (value.message or 'working...'):gsub('%%', '%%%%'),
t = vim.loop.now(),
}
start_progress_timer()
elseif value.kind == 'report' then
local msg_parts = {}
if value.message then
msg_parts[#msg_parts + 1] = value.message
end
if value.percentage ~= nil then
msg_parts[#msg_parts + 1] = '(' .. value.percentage .. '%%)'
end
progress[key] = {
msg = table.concat(msg_parts, ' '),
t = vim.loop.now(),
}
elseif value.kind == 'end' then
if progress[key] then
progress[key].done = true
end
vim.cmd('redrawstatus')
end
end,
})
vim.api.nvim_create_autocmd({ 'LspAttach', 'LspDetach' }, {
callback = function(args)
local names = {}
for _, c in ipairs(vim.lsp.get_clients({ bufnr = args.buf })) do
table.insert(names, c.name)
local BRANCH_ICON = ''
local function refresh_branch(buf)
local file = vim.api.nvim_buf_get_name(buf)
if file == '' or vim.bo[buf].buftype ~= '' then
vim.b[buf].git_branch = ''
return
end
vim.b[args.buf].lsp_names = #names > 0
and (' ● ' .. table.concat(names, ', ') .. ' ')
local cwd = vim.fs.root(buf, '.git') or vim.fs.dirname(file)
vim.system(
{ 'git', 'branch', '--show-current' },
{ text = true, cwd = cwd },
vim.schedule_wrap(function(out)
if not vim.api.nvim_buf_is_valid(buf) then
return
end
local branch = (out.code == 0 and out.stdout or ''):gsub('%s+', '')
vim.b[buf].git_branch = branch ~= '' and (BRANCH_ICON .. branch)
or ''
end,
})
local function lsp_section()
local client_ids = {}
for _, c in
ipairs(vim.lsp.get_clients({ bufnr = vim.api.nvim_get_current_buf() }))
do
client_ids[c.id] = true
end
local latest = nil
for key, p in pairs(progress) do
local cid = tonumber(key:match('^(%d+):'))
if cid and client_ids[cid] then
if not latest or p.t > latest.t then
latest = p
end
end
end
if latest and (not latest.done or (vim.loop.now() - latest.t < 2000)) then
return '%#StatusLspSpinner# ○ ' .. latest.msg .. ' %*'
end
return '%#StatusLsp#' .. (vim.b.lsp_names or '') .. '%*'
refresh_status(buf)
end)
)
end
local diag_cache = {}
local function build_diag_string(counts)
local parts = {}
if counts[1] and counts[1] > 0 then
table.insert(parts, '%#StatusDiagError# E' .. counts[1] .. ' %*')
end
if counts[2] and counts[2] > 0 then
table.insert(parts, '%#StatusDiagWarn# W' .. counts[2] .. ' %*')
end
if counts[4] and counts[4] > 0 then
table.insert(parts, '%#StatusDiagHint# H' .. counts[4] .. ' %*')
end
return table.concat(parts)
end
local function update_diag_cache(ev)
diag_cache[ev.buf] = build_diag_string(vim.diagnostic.count(ev.buf))
end
vim.api.nvim_create_autocmd(
'DiagnosticChanged',
{ callback = update_diag_cache }
)
local function update_git_diff()
if vim.bo.buftype ~= '' then
return
end
local file = vim.fn.expand('%:p')
if file == '' then
local function refresh_diff(buf)
local file = vim.api.nvim_buf_get_name(buf)
if file == '' or vim.bo[buf].buftype ~= '' then
vim.b[buf].git_diff = nil
return
end
local cwd = vim.fs.root(buf, '.git') or vim.fs.dirname(file)
vim.system(
{ 'git', 'diff', '--numstat', 'HEAD', '--', file },
{ text = true },
function(out)
if out.code ~= 0 or out.stdout == '' then
vim.b.git_diff = nil
{ text = true, cwd = cwd },
vim.schedule_wrap(function(out)
if not vim.api.nvim_buf_is_valid(buf) then
return
end
if out.code ~= 0 or out.stdout == '' then
vim.b[buf].git_diff = nil
else
local added, removed = out.stdout:match('(%d+)%s+(%d+)')
vim.b.git_diff = {
if added and removed then
vim.b[buf].git_diff = {
added = tonumber(added) or 0,
removed = tonumber(removed) or 0,
}
else
vim.b[buf].git_diff = nil
end
end
refresh_status(buf)
end)
)
end
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'BufWritePost' }, {
callback = update_git_diff,
local function refresh_diag(buf)
local count = vim.diagnostic.count(buf)
local sev = vim.diagnostic.severity
local parts = {}
if (count[sev.ERROR] or 0) > 0 then
parts[#parts + 1] = '%#StatusDiagError# E' .. count[sev.ERROR] .. ' %*'
end
if (count[sev.WARN] or 0) > 0 then
parts[#parts + 1] = '%#StatusDiagWarn# W' .. count[sev.WARN] .. ' %*'
end
if (count[sev.HINT] or 0) > 0 then
parts[#parts + 1] = '%#StatusDiagHint# H' .. count[sev.HINT] .. ' %*'
end
vim.b[buf].diag_str = #parts > 0 and table.concat(parts) or ''
refresh_status(buf)
end
vim.api.nvim_create_autocmd('DiagnosticChanged', {
callback = function(ev)
refresh_diag(ev.buf)
end,
})
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufNewFile' }, {
callback = function(ev)
if vim.bo[ev.buf].buftype == '' then
refresh_branch(ev.buf)
refresh_diff(ev.buf)
end
refresh_lsp(ev.buf)
refresh_diag(ev.buf)
end,
})
vim.api.nvim_create_autocmd('FocusGained', {
callback = function()
local buf = vim.api.nvim_get_current_buf()
if vim.bo[buf].buftype == '' then
refresh_branch(buf)
end
end,
})
vim.api.nvim_create_autocmd('BufWritePost', {
callback = function(ev)
refresh_diff(ev.buf)
end,
})
vim.api.nvim_create_autocmd('RecordingEnter', {
pattern = '*',
callback = function(ev)
vim.b[ev.buf].recording = 'Rec @' .. vim.fn.reg_recording()
refresh_status(ev.buf)
end,
})
vim.api.nvim_create_autocmd('RecordingLeave', {
pattern = '*',
callback = function(ev)
vim.b[ev.buf].recording = nil
refresh_status(ev.buf)
end,
})
function _G.__statusline()
local m = vim.fn.mode()
local mode_hl = mode_hl_map[m] or 'StatusModeNormal'
local git = vim.b.git_branch or ''
local cur_buf = vim.api.nvim_get_current_buf()
local parts = {
'%#' .. mode_hl .. '#' .. (mode_map[m] or ' ?? ') .. '%*',
git ~= '' and ('%#StatusGit#  ' .. git .. ' %*') or '',
}
local diff = vim.b.git_diff
if diff and (diff.added > 0 or diff.removed > 0) then
if diff.added > 0 then
table.insert(parts, '%#StatusGitAdded# +' .. diff.added .. ' %*')
end
if diff.removed > 0 then
table.insert(
parts,
'%#StatusGitRemoved# -' .. diff.removed .. ' %*'
)
end
end
table.insert(parts, lsp_section())
table.insert(parts, '%=')
local recording = vim.fn.reg_recording()
if recording ~= '' then
table.insert(
parts,
'%#StatusRecording# ● Rec @' .. recording .. ' %*'
)
end
table.insert(
parts,
diag_cache[cur_buf] or build_diag_string(vim.diagnostic.count(cur_buf))
)
table.insert(parts, '%#StatusCursor# %l:%-2c %*')
table.insert(parts, '%#' .. mode_hl .. '# %p%% %*')
return table.concat(parts)
local key = (m == '\22' or m == '\19') and m or m:sub(1, 1)
local hl = mode_hl_map[key] or 'StatusModeNormal'
local b = vim.b
return table.concat({
'%#' .. hl .. '#' .. (mode_map[key] or ' ?? ') .. '%*',
b.status_left or '',
'%=',
b.status_right or '',
'%#StatusCursor# %l:%c ',
'%#' .. hl .. '# %p%% %*',
})
end
vim.o.statusline = '%!v:lua.__statusline()'
require('incline').setup({
window = { margin = { vertical = 0, horizontal = 1 } },
hide = { cursorline = true },
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if vim.bo[props.buf].modified then
filename = "[+] " .. filename
end
local icon, color = require("nvim-web-devicons").get_icon_color(filename)
return { { icon, guifg = color }, { " " }, { filename } }
end,
})
require('noice').setup({
lsp = {
override = {
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
['vim.lsp.util.stylize_markdown'] = true,
},
},
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})
require('notify').setup({
background_colour = '#000000',
})
+15 -36
View File
@@ -9,12 +9,8 @@
"rev": "016802de402556da54c36bd7359b441266b01cdd",
"src": "https://github.com/stevearc/conform.nvim"
},
"dropbar.nvim": {
"rev": "808ba31cde89aec8833e9789f5e04557cd31c9e1",
"src": "https://github.com/Bekaboo/dropbar.nvim"
},
"hardtime.nvim": {
"rev": "5165840fe680eab46de1fc6dbff48f148fdcf018",
"rev": "721a75b9a0c2eb1fb811d34507708ee315cb04eb",
"src": "https://github.com/m4xshen/hardtime.nvim"
},
"incline.nvim": {
@@ -30,21 +26,16 @@
"src": "https://github.com/brianhuster/live-preview.nvim"
},
"mason-lspconfig.nvim": {
"rev": "b5576cd62899a1a478d0e67ef3d378ee55dba82d",
"rev": "b3298993d55fa194279b5eb9dbfb3a43da65cadf",
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
},
"mason.nvim": {
"rev": "2a6940af80375532e5e9e7c1f2fc6319a1b7a69d",
"src": "https://github.com/mason-org/mason.nvim"
},
"mini.hipatterns": {
"rev": "607d604e650cdf21d71f863d040c496a1d0cb320",
"src": "https://github.com/nvim-mini/mini.hipatterns",
"version": ">=0.0.0"
},
"mini.pairs": {
"rev": "4a014143fcb4e9df26198ccb3ecff3b9e77a048c",
"src": "https://github.com/nvim-mini/mini.pairs",
"mini.nvim": {
"rev": "1345d191bb3da9c7b0e977f4387c5761f9bff68d",
"src": "https://github.com/nvim-mini/mini.nvim.git",
"version": ">=0.0.0"
},
"noice.nvim": {
@@ -56,52 +47,40 @@
"src": "https://github.com/MunifTanjim/nui.nvim"
},
"nvim-lspconfig": {
"rev": "84b6b6c3f13cb34a6c8a0354b0da4c67d8ccf867",
"rev": "3e8d598d3b5f8338a41699c436e5fa11d2666cf0",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-notify": {
"rev": "8701bece920b38ea289b457f902e2ad184131a5d",
"src": "https://github.com/rcarriga/nvim-notify"
"nvim-navic": {
"rev": "455808fd0fae06e6d70fadfd61432275db8f34ce",
"src": "https://github.com/SmiteshP/nvim-navic"
},
"nvim-tmux-navigation": {
"rev": "4898c98702954439233fdaf764c39636681e2861",
"src": "https://github.com/alexghergh/nvim-tmux-navigation"
},
"nvim-treesitter": {
"rev": "5cb0114e6242625db56dd6440e945ed1ece10bc7",
"rev": "910fdf6f49e9dee7e7257c7d11a76b040fdfb9de",
"src": "https://github.com/nvim-treesitter/nvim-treesitter"
},
"nvim-ts-autotag": {
"rev": "88c1453db4ba7dd24131086fe51fdf74e587d275",
"rev": "d7220b55e16ed3c04e88086256def5d282429493",
"src": "https://github.com/windwp/nvim-ts-autotag"
},
"nvim-web-devicons": {
"rev": "5f032a85be210cd1c6ac98861eb3b187ff3bd5eb",
"rev": "58447c1fca354bbf184425e4a8d01deecbd6f3c4",
"src": "https://github.com/nvim-tree/nvim-web-devicons"
},
"plenary.nvim": {
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
"src": "https://github.com/nvim-lua/plenary.nvim"
},
"polydev": {
"rev": "2b30e36fade3272081f7166bc0ec614b0b7da1c9",
"src": "https://git.moomancer.xyz/DarthMooMancer/polydev.git"
},
"telescope.nvim": {
"rev": "40aedd8a68c78a656a10a8d62d80c54af59420fb",
"src": "https://github.com/nvim-telescope/telescope.nvim"
"snacks.nvim": {
"rev": "882c996cf28183f4d63640de0b4c02ec886d01f2",
"src": "https://github.com/folke/snacks.nvim"
},
"trouble.nvim": {
"rev": "bd67efe408d4816e25e8491cc5ad4088e708a69a",
"src": "https://github.com/folke/trouble.nvim"
},
"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.
-22
View File
@@ -13,28 +13,6 @@ set -g status-style 'bg=default' # Completely transparent container
set -g status-left-length 100
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 ""
+7 -34
View File
@@ -1,14 +1,3 @@
if [[ $(uname) != "Darwin" ]]; then
if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
XDG_CURRENT_DESKTOP=sway dbus-run-session sway
fi
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[3~" delete-char
bindkey "^[[5~" up-line
bindkey "^[[6~" down-line
fi
HISTFILE=~/.zsh_history
HISTSIZE=100
SAVEHIST=200
@@ -17,9 +6,7 @@ source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
zinit light zsh-users/zsh-autosuggestions
zinit light zdharma-continuum/fast-syntax-highlighting
if [[ $(uname) == "Darwin" ]]; then
zinit light junegunn/fzf
fi
zinit light junegunn/fzf
eval "$(starship init zsh)"
eval "$(zoxide init --cmd cd zsh)"
@@ -30,32 +17,18 @@ autoload -Uz _zinit
export PATH="$HOME/.local/bin:$PATH"
alias cat="bat"
alias rebuild="sudo darwin-rebuild switch --flake /etc/nix-darwin/#Andrews-MacBook-Air";
alias enix="nvim /etc/nix-darwin/flake.nix"
alias v="nvim"
alias ls="eza -a"
alias brew-update="brew update && brew upgrade && brew bundle --cleanup --zap --file=~/.Brewfile"
alias cmake-update="sudo rm -rd build && cmake -S . -B build && cmake --build build"
alias oasis="ssh oasis"
# alias grep="rg"
#
if [[ $(uname) != "Darwin" ]]; then
alias update_world='doas emerge --ask --update --newuse --deep @world'
alias env="sh /home/andrew/personal/dotfiles/env_linux.sh"
else
alias env='sh ~/personal/dotfiles/env_mac.sh'
export MANPAGER="sh -c 'sed -u -e \"s/\\x1B\\[[0-9;]*m//g; s/.\\x08//g\" | bat -p -l man'"
# export PATH="$HOME/.flutter/bin/:$PATH"
export GOOGLE_CLOUD_PROJECT="development-477121"
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_DISPLAY_INSTALL_TIMES=0
export HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=1
export HOMEBREW_NO_EMOJI=1
fi
### End of Zinit's installer chunk
export MANPAGER="sh -c 'sed -u -e \"s/\\x1B\\[[0-9;]*m//g; s/.\\x08//g\" | bat -p -l man'"
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_DISPLAY_INSTALL_TIMES=0
export HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS=1
export HOMEBREW_NO_EMOJI=1
# bun completions
[ -s "/Users/andrew/.bun/_bun" ] && source "/Users/andrew/.bun/_bun"