From 9fefc102c91bb8eac9d21bc9dcf1f822b97affb0 Mon Sep 17 00:00:00 2001 From: Andrew Haynes Date: Sun, 10 May 2026 02:24:56 -0400 Subject: [PATCH] I completely refactored my neovim conf to be more organized and "cleaner". I also added {flutter, boring-notch} to my .Brewfile --- .DS_Store | Bin 10244 -> 10244 bytes brew/.Brewfile | 4 +- nvim/.DS_Store | Bin 6148 -> 6148 bytes nvim/.config/nvim/init.lua | 399 ++---------------- nvim/.config/nvim/init.lua-test | 65 --- nvim/.config/nvim/lsp/clangd.lua | 79 ---- nvim/.config/nvim/lsp/deno.lua | 162 ------- nvim/.config/nvim/lsp/lua_ls.lua | 21 - nvim/.config/nvim/lsp/rust-analyzer.lua | 17 - .../nvim/lua/DarthMooMancer/colors.lua | 16 + .../nvim/lua/DarthMooMancer/keymaps.lua | 73 ++++ nvim/.config/nvim/lua/DarthMooMancer/lsp.lua | 83 ++++ nvim/.config/nvim/lua/DarthMooMancer/opts.lua | 63 +++ .../nvim/lua/DarthMooMancer/plugins.lua | 41 ++ .../.config/nvim/lua/DarthMooMancer/tools.lua | 113 +++++ nvim/.config/nvim/lua/DarthMooMancer/ui.lua | 294 +++++++++++++ nvim/.config/nvim/nvim-pack-lock.json | 91 ++-- zshrc/.zshrc | 4 + 18 files changed, 762 insertions(+), 763 deletions(-) delete mode 100644 nvim/.config/nvim/init.lua-test delete mode 100644 nvim/.config/nvim/lsp/clangd.lua delete mode 100644 nvim/.config/nvim/lsp/deno.lua delete mode 100644 nvim/.config/nvim/lsp/lua_ls.lua delete mode 100644 nvim/.config/nvim/lsp/rust-analyzer.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/colors.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/lsp.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/opts.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/plugins.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/tools.lua create mode 100644 nvim/.config/nvim/lua/DarthMooMancer/ui.lua diff --git a/.DS_Store b/.DS_Store index 35c1baf9f6ec15b6fd9d99ac386cdc0f82c6d6c1..a899b68af9d3d3c5f1e17c6e5d2380055390fdd6 100644 GIT binary patch delta 262 zcmZn(XbIS$Do`J-d6I#FfrUYjA)O(Up(Hoo#U&{xKM5$tA-AJ(md>@~j;Qh}c;yQ+ z41<&Na|?ia81#+{fG8G*B!(h}REF}Lbc7rO15*b`Zt@ZV5w?TN8h{o}-X|ahWp2JF z5W~jQuQ}O9T!QV{I&6*e<*WE6J0TfigEwkX*$} Kz<|lq#d86JW>eY# delta 262 zcmZn(XbIS$Do`KwsFs0&frUYjA)O(Up(Hoo#U&{xKM5$tVZY<_r3I&tJEF>`;FT}P zFbq!4&n*DzVbDAB0YtGdBry~*q%xG}q$A`Q7?@N+a+8+`h_Kz^{&`t`-{gG)Qc&jR zdjc_ROlucRwh@QIh~0+8fNKSJMPH9z`)L+$B@jB&ydHE#*oR7o|~WIl9ZF5 V1eD=`sG4lauEh9Ya}4_m0RT8?7RUeq delta 70 zcmZoMXffFEmW^rZv&rw-ACqSE=f80 WNkAD6h^on!>`IIuHpj595C8zcHySqp diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index e34c841..b5ac45b 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,376 +1,29 @@ --- Options +require('DarthMooMancer.plugins') +require('DarthMooMancer.opts') +require('DarthMooMancer.colors') +require('DarthMooMancer.keymaps') +require('DarthMooMancer.ui') +require('DarthMooMancer.lsp') +require('DarthMooMancer.tools') -vim.opt.termguicolors = true -vim.g.mapleader = " " -vim.opt.number = true -vim.opt.relativenumber = true -vim.opt.tabstop = 8 -- Number of spaces a counts for -vim.opt.shiftwidth = 8 -- Number of spaces for autoindent (>>, <<, etc.) -vim.opt.expandtab = true -- Use spaces instead of tabs -vim.opt.autoindent = true -- Copy indent from current line when starting a new line -vim.opt.softtabstop = 8 -- Number of spaces for in insert mode (backspace deletes 4 spaces) -vim.opt.wrap = false -vim.opt.swapfile = false -vim.opt.signcolumn = "yes" -vim.opt.undofile = true -- Keeps undo history even after we close a file -vim.opt.scrolloff = 4 -vim.opt.sidescrolloff = 8 -vim.opt.hlsearch = false -vim.opt.completeopt = { "menuone", "noselect", "popup" } -vim.g.netrw_browse_split = 0 -vim.g.netrw_banner = 0 -vim.g.netrw_liststyle = 3 -vim.g.netrw_winsize = 25 -vim.opt.wrapscan = true -- begin search from top of the file when nothng is found -vim.opt.cursorline = true -- enable cursorline -vim.opt.cursorlineopt = { "screenline", "number" } -- cursorline look -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.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 -vim.opt.laststatus = 3 -vim.opt.showmode = false -vim.opt.cmdheight = 0 -vim.opt.smoothscroll = true -vim.diagnostic.config({ - virtual_text = true, -- This is the magic line - signs = true, -- Shows icons in the gutter - underline = true, - update_in_insert = false, -- Don't clutter the screen while typing - severity_sort = true, +vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'c', + 'cpp', + 'rust', + 'lua', + 'typescript', + 'javascript', + 'css', + 'html', + 'python', + 'go', + 'dart', + 'yaml', + }, + callback = function() + vim.treesitter.start() + vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" + end, }) - -vim.pack.add({ - { src = "https://github.com/rose-pine/neovim", name = "rose-pine" }, - { src = "https://github.com/brenoprata10/nvim-highlight-colors" }, - { src = "https://github.com/mbbill/undotree" }, - { src = "https://github.com/nvim-mini/mini.pairs", version = vim.version.range('*') }, - { src = "https://github.com/nvim-tree/nvim-web-devicons" }, - { src = "https://github.com/ibhagwan/fzf-lua" }, - { src = "https://github.com/saghen/blink.cmp", version = vim.version.range('*'), }, - { src = "git@moo:dmm/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/folke/which-key.nvim" }, - - --- XCode Plugins - { src = "https://github.com/MunifTanjim/nui.nvim" }, - { src = "https://github.com/mfussenegger/nvim-dap" }, - { src = "https://github.com/rcarriga/nvim-dap-ui" }, - { src = "https://github.com/nvim-lualine/lualine.nvim" }, - { src = "https://github.com/nvim-neo-tree/neo-tree.nvim" }, - { src = "https://github.com/wojciech-kulik/xcodebuild.nvim" }, - { src = "https://github.com/nvim-lua/plenary.nvim" }, - { src = "https://github.com/folke/noice.nvim" }, - { src = "https://github.com/folke/snacks.nvim" }, -}) - ---- COLORS - -vim.cmd.colorscheme("rose-pine") -vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) -vim.api.nvim_set_hl(0, "NormalFloat", { link = 'Normal' }) -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 }) - - -local function xcodebuild_device() - if not vim.g.xcodebuild_platform then return " macOS" end - - if vim.g.xcodebuild_platform == "macOS" then - return " macOS" - end - - local deviceIcon = "" - if vim.g.xcodebuild_platform:match("watch") then - deviceIcon = "􀟤" - elseif vim.g.xcodebuild_platform:match("tv") then - deviceIcon = "􀡴 " - elseif vim.g.xcodebuild_platform:match("vision") then - deviceIcon = "􁎖 " - end - - if vim.g.xcodebuild_os then - return deviceIcon .. " " .. vim.g.xcodebuild_device_name .. " (" .. vim.g.xcodebuild_os .. ")" - end - - return deviceIcon .. " " .. (vim.g.xcodebuild_device_name or "Unknown") -end - -require('lualine').setup({ - options = { - theme = 'auto', -- Or try 'catppuccin' if you use it - component_separators = '|', - section_separators = { left = '', right = '' }, - globalstatus = true, -- Crucial for clean look with cmdheight=0 - }, - sections = { - lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } }, - lualine_b = { 'filename', 'branch' }, - lualine_c = { 'diff', 'diagnostics' }, - lualine_x = { - { - function() return ' ' .. (vim.g.xcodebuild_last_status or "Idle") end, - color = { fg = "Gray" } - }, - { - function() return '󰙨 ' .. (vim.g.xcodebuild_test_plan or "No Plan") end, - color = { fg = "#a6e3a1" } - }, - { - xcodebuild_device, - color = { fg = "#f9e2af" } - }, - }, - lualine_y = { 'filetype', 'progress' }, - lualine_z = { { 'location', separator = { right = '' }, left_padding = 2 } }, - }, -}) -require("snacks").setup({ - image = { enabled = true }, -}) -require('which-key').setup({ - preset = "helix" -}) -vim.schedule(function() - -- Mason & LSP - require("mason").setup() - require("mason-lspconfig").setup({ - ensure_installed = { "vtsls", "lua_ls", "pylsp", "gopls", "html", "tailwindcss", "bashls", }, - automatic_enable = true, - }) - - -- Noice & Xcodebuild - require("xcodebuild").setup() - 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, - ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp - }, - }, - 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 - }, - }) - - -- Blink & Fzf - require("blink.cmp").setup({ - completion = { - menu = { - draw = { - columns = { { "label", gap = 1 }, { "kind_icon", gap = 1, "kind" } }, - } - } - } - }) - require("fzf-lua").setup({ - winopts = { - height = 0.50, - width = 0.45, - -- row = 0.35, - -- col = 0.50, - border = "rounded", - -- backdrop = 100, - -- fullscreen = false, - preview = { - hidden = true, - }, - }, - grep = { - rg_glob = true, - rg_glob_fn = function(query) - local regex, flags = query:match("^(.-)%s%-%-(.*)$") - return (regex or query), flags - end, - }, - defaults = { - formatter = "path.filename_first", - }, - }) - - -- Treesitter - require('nvim-treesitter').install { 'swift', 'rust', 'c', 'cpp', 'lua', 'javascript', 'go', 'typescript', 'css', 'html', 'python' } - vim.api.nvim_create_autocmd('FileType', { - pattern = { 'c', 'cpp', 'rust', 'lua', 'typescript', 'javascript', 'css', 'html', 'python', 'go', 'swift' }, - callback = function() - vim.treesitter.start() - vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" - end, - }) -end) - ---- Configurations -local helpers = require 'incline.helpers' -local devicons = require 'nvim-web-devicons' -require('incline').setup { - window = { - padding = 0, - margin = { horizontal = 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 - return { - ft_icon and { ' ', ft_icon, ' ', guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or - '', - ' ', - { filename, gui = modified and 'bold,italic' or 'bold' }, - ' ', - guibg = '#44406e', - } - end, -} -require 'nvim-tmux-navigation'.setup { - disable_when_zoomed = true -- defaults to false -} -require("conform").setup({ - formatters_by_ft = { - rust = { "rustfmt", lsp_format = "fallback" }, - lua = { "emmylua-codeformat", lsp_format = "fallback" }, - javascript = { "prettier", stop_after_first = true }, - typescript = { "prettier", stop_after_first = true }, - json = { "prettier" }, - html = { "prettier" }, - go = { "goimports" }, - c = { "lsp" }, - cpp = { "lsp" }, - ["_"] = { "trim_whitespace" }, - }, - format_on_save = { - timeout_ms = 500, - lsp_format = "fallback", - }, -}) - -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 +1gv=gv") -vim.keymap.set("v", "K", ":m '<-2gv=gv") -vim.keymap.set("n", "ff", vim.lsp.buf.format) --- vim.keymap.set("n", "ff", function() --- require("conform").format({ async = true, lsp_format = "never" }) --- end) -vim.keymap.set("n", "vs", ":vsplit") -vim.keymap.set("n", "ss", ":split") -vim.keymap.set("n", "E", ":Ex") -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "", "zz") -vim.keymap.set("n", "n", "nzzzv") -vim.keymap.set("n", "N", "Nzzzv") -vim.keymap.set("x", "p", [["_dP]]) -vim.keymap.set('n', '', ":FzfLua files") -vim.keymap.set('n', 'fh', ":FzfLua helptags") -vim.keymap.set('n', 'fg', ":FzfLua live_grep") -vim.keymap.set('n', 'fm', ":FzfLua manpages") -vim.keymap.set('n', 'xx', ":FzfLua diagnostics_workspace") -vim.keymap.set('n', 'fs', vim.lsp.buf.document_symbol) -vim.keymap.set('n', 'gd', vim.lsp.buf.definition) -vim.keymap.set("n", "gr", vim.lsp.buf.references) -vim.keymap.set("n", "gR", vim.lsp.buf.rename) -vim.keymap.set("n", "gc", vim.lsp.buf.code_action) -vim.keymap.set("n", "uu", ":UndotreeToggle") -vim.keymap.set("n", "[", "H", { silent = true, noremap = true, }) -vim.keymap.set("n", "]", "K", { silent = true, noremap = true, }) -vim.keymap.set("n", "[q", ":cprevzz", { desc = "Previous Quickfix Item" }) -vim.keymap.set("n", "]q", ":cnextzz", { desc = "Next Quickfix Item" }) -vim.keymap.set("n", "qo", ":copen", { desc = "Open Quickfix" }) -vim.keymap.set("n", "qc", ":cclose", { desc = "Close Quickfix" }) -vim.keymap.set("n", "", ":NvimTmuxNavigateLeft", { silent = true }) -vim.keymap.set("n", "", ":NvimTmuxNavigateDown", { silent = true }) -vim.keymap.set("n", "", ":NvimTmuxNavigateUp", { silent = true }) -vim.keymap.set("n", "", ":NvimTmuxNavigateRight", { silent = true }) -vim.keymap.set("n", "nn", ":Neotree toggle") -vim.keymap.set("n", "X", "XcodebuildPicker", { desc = "Show Xcodebuild Actions" }) -vim.keymap.set("n", "xf", "XcodebuildProjectManager", { desc = "Show Project Manager Actions" }) - -vim.keymap.set("n", "xb", "XcodebuildBuild", { desc = "Build Project" }) -vim.keymap.set("n", "xB", "XcodebuildBuildForTesting", { desc = "Build For Testing" }) -vim.keymap.set("n", "xr", "XcodebuildBuildRun", { desc = "Build & Run Project" }) - -vim.keymap.set("n", "xt", "XcodebuildTest", { desc = "Run Tests" }) -vim.keymap.set("v", "xt", "XcodebuildTestSelected", { desc = "Run Selected Tests" }) -vim.keymap.set("n", "xT", "XcodebuildTestClass", { desc = "Run Current Test Class" }) -vim.keymap.set("n", "x.", "XcodebuildTestRepeat", { desc = "Repeat Last Test Run" }) - -vim.keymap.set("n", "xl", "XcodebuildToggleLogs", { desc = "Toggle Xcodebuild Logs" }) -vim.keymap.set("n", "xc", "XcodebuildToggleCodeCoverage", { desc = "Toggle Code Coverage" }) -vim.keymap.set("n", "xC", "XcodebuildShowCodeCoverageReport", { desc = "Show Code Coverage Report" }) -vim.keymap.set("n", "xe", "XcodebuildTestExplorerToggle", { desc = "Toggle Test Explorer" }) -vim.keymap.set("n", "xs", "XcodebuildFailingSnapshots", { desc = "Show Failing Snapshots" }) - -vim.keymap.set("n", "xp", "XcodebuildPreviewGenerateAndShow", { desc = "Generate Preview" }) -vim.keymap.set("n", "x", "XcodebuildPreviewToggle", { desc = "Toggle Preview" }) - -vim.keymap.set("n", "xd", "XcodebuildSelectDevice", { desc = "Select Device" }) -vim.keymap.set("n", "xq", "Telescope quickfix", { desc = "Show QuickFix List" }) - -vim.keymap.set("n", "xx", "XcodebuildQuickfixLine", { desc = "Quickfix Line" }) -vim.keymap.set("n", "xa", "XcodebuildCodeActions", { desc = "Show Code Actions" }) diff --git a/nvim/.config/nvim/init.lua-test b/nvim/.config/nvim/init.lua-test deleted file mode 100644 index c447ea3..0000000 --- a/nvim/.config/nvim/init.lua-test +++ /dev/null @@ -1,65 +0,0 @@ -vim.g.mapleader = " " -vim.g.termguicolors = true - -vim.o.nu = true -vim.o.relativenumber = true -vim.o.cursorline = true -vim.o.expandtab = true -vim.o.tabstop = 4 -vim.o.shiftwidth = 4 -vim.o.hlsearch = false -vim.o.incsearch = true -vim.o.swapfile = false -vim.o.backup = false -vim.o.wrap = false -vim.o.undofile = true -vim.o.undodir = os.getenv("HOME") .. "/.cache/nvim/undodir" -vim.o.list = true ---vim.o.listchars = "tabs:> " -vim.o.path = "**" - -vim.cmd(":colorscheme retrobox") -vim.cmd(":command! -nargs=+ Grep execute 'silent grep! ' | copen") - -vim.treesitter.language.register("cpp", "c") -vim.api.nvim_create_autocmd("FileType", { - pattern = { - "c", "h", "cpp", - "lua" - }, - callback = function() vim.treesitter.start() end, -}) - -local map = vim.keymap.set -map("n", "", "") -map("n", "", "") -map("n", "", "") -map("n", "", "") - -map("n", "", "zz") -map("n", "", "zz") - -map({ "i", "n" }, "", "") -map({ "i", "n" }, "", "") - -map("n", "n", "nzzzv") -map("n", "N", "Nzzzv") -map("v", "J", ":m '>+1gv=gv") -map("v", "K", ":m '<-2gv=gv") -map("n", ";", "q:") -map("t", "", "") -map("n", "", ":below termi") - -map("n", "w", ":write") -map("n", "q", ":quit") -map("n", "Q", ":quit!") -map("n", "y", "\"+y") -map("n", "e", ":Ex") -map("n", "v", ":edit $MYVIMRC") -map("n", "ff", ":find ") -map("n", "fg", ":Grep ") -map("n", "r", ":make!") -map("n", "R", ":set makeprg=") -map("n", "x", ":copen") -map("n", "c", ":!ctags -R .") - diff --git a/nvim/.config/nvim/lsp/clangd.lua b/nvim/.config/nvim/lsp/clangd.lua deleted file mode 100644 index b7c26fa..0000000 --- a/nvim/.config/nvim/lsp/clangd.lua +++ /dev/null @@ -1,79 +0,0 @@ -local function switch_source_header(bufnr) - local method_name = 'textDocument/switchSourceHeader' - local client = vim.lsp.get_clients({ bufnr = bufnr, name = 'clangd' })[1] - if not client then - return vim.notify(('method %s is not supported by any servers active on the current buffer'):format(method_name)) - end - local params = vim.lsp.util.make_text_document_params(bufnr) - client.request(method_name, params, function(err, result) - if err then - error(tostring(err)) - end - if not result then - vim.notify('corresponding file cannot be determined') - return - end - vim.cmd.edit(vim.uri_to_fname(result)) - end, bufnr) -end - -local function symbol_info() - local bufnr = vim.api.nvim_get_current_buf() - local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = 'clangd' })[1] - if not clangd_client or not clangd_client.supports_method 'textDocument/symbolInfo' then - return vim.notify('Clangd client not found', vim.log.levels.ERROR) - end - local win = vim.api.nvim_get_current_win() - local params = vim.lsp.util.make_position_params(win, clangd_client.offset_encoding) - clangd_client.request('textDocument/symbolInfo', params, function(err, res) - if err or #res == 0 then - return - end - local container = string.format('container: %s', res[1].containerName) ---@type string - local name = string.format('name: %s', res[1].name) ---@type string - vim.lsp.util.open_floating_preview({ name, container }, '', { - height = 2, - width = math.max(string.len(name), string.len(container)), - focusable = false, - focus = false, - border = 'single', - title = 'Symbol Info', - }) - end, bufnr) -end - -return { - cmd = { 'clangd' }, - filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda' }, - root_markers = { - '.clangd', - '.clang-tidy', - '.clang-format', - 'compile_commands.json', - 'compile_flags.txt', - 'configure.ac', -- AutoTools - '.git', - }, - capabilities = { - textDocument = { - completion = { - editsNearCursor = true, - }, - }, - offsetEncoding = { 'utf-8', 'utf-16' }, - }, - on_init = function(client, init_result) - if init_result.offsetEncoding then - client.offset_encoding = init_result.offsetEncoding - end - end, - on_attach = function(_, bufnr) - vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdSwitchSourceHeader', function() - switch_source_header(bufnr) - end, { desc = 'Switch between source/header' }) - - vim.api.nvim_buf_create_user_command(bufnr, 'LspClangdShowSymbolInfo', function() - symbol_info() - end, { desc = 'Show symbol info' }) - end, -} diff --git a/nvim/.config/nvim/lsp/deno.lua b/nvim/.config/nvim/lsp/deno.lua deleted file mode 100644 index 39e65f4..0000000 --- a/nvim/.config/nvim/lsp/deno.lua +++ /dev/null @@ -1,162 +0,0 @@ ----@brief ---- ---- https://github.com/denoland/deno ---- ---- Deno's built-in language server ---- ---- To appropriately highlight codefences returned from denols, you will need to augment vim.g.markdown_fenced languages ---- in your init.lua. Example: ---- ---- ```lua ---- vim.g.markdown_fenced_languages = { ---- "ts=typescript" ---- } ---- ``` ---- ---- Some care must be taken here to correctly infer whether a file is part of a Deno program, or a TS program that ---- expects to run in Node or Web Browsers. This supports having a Deno module that is a part of a mostly-not-Deno ---- monorepo. We do this by finding the nearest package manager lock file, and the nearest deno.json or deno.jsonc. ---- Note that this means that without a deno.json, deno.jsonc, or deno.lock file, this LSP client will not attach. ---- ---- Example: ---- ---- ``` ---- project-root ---- +-- node_modules/... ---- +-- package-lock.json ---- +-- package.json ---- +-- packages ---- +-- deno-module ---- | +-- deno.json ---- | +-- package.json <-- It's normal for Deno projects to have package.json files! ---- | +-- src ---- | +-- index.ts <-- this is a Deno file ---- +-- node-module ---- +-- package.json ---- +-- src ---- +-- index.ts <-- a non-Deno file (ie, should use ts_ls or tsgo) ---- ``` ---- ---- From the file being edited, we walk up to find the nearest package manager lockfile. This is PROJECT ROOT. ---- From the file being edited, find the nearest deno.json or deno.jsonc. This is DENO ROOT. ---- From the file being edited, find the nearest deno.lock. This is DENO LOCK ROOT ---- If DENO LOCK ROOT is found, and PROJECT ROOT is missing or shorter, then this is a deno file, and we attach. ---- If DENO ROOT is found, and it's longer than or equal to PROJECT ROOT, then this is a Deno file, and we attach. ---- Otherwise, we abort, because this is a non-Deno TS file. - -local lsp = vim.lsp - -local function virtual_text_document_handler(uri, res, client) - if not res then - return nil - end - - local lines = vim.split(res.result, '\n') - local bufnr = vim.uri_to_bufnr(uri) - - local current_buf = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false) - if #current_buf ~= 0 then - return nil - end - - vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, lines) - vim.api.nvim_set_option_value('readonly', true, { buf = bufnr }) - vim.api.nvim_set_option_value('modified', false, { buf = bufnr }) - vim.api.nvim_set_option_value('modifiable', false, { buf = bufnr }) - lsp.buf_attach_client(bufnr, client.id) -end - -local function virtual_text_document(uri, client) - local params = { - textDocument = { - uri = uri, - }, - } - local result = client:request_sync('deno/virtualTextDocument', params) - virtual_text_document_handler(uri, result, client) -end - -local function denols_handler(err, result, ctx, config) - if not result or vim.tbl_isempty(result) then - return nil - end - - local client = vim.lsp.get_client_by_id(ctx.client_id) - for _, res in pairs(result) do - local uri = res.uri or res.targetUri - if uri:match '^deno:' then - virtual_text_document(uri, client) - res['uri'] = uri - res['targetUri'] = uri - end - end - - lsp.handlers[ctx.method](err, result, ctx, config) -end - ----@type vim.lsp.Config -return { - cmd = { 'deno', 'lsp' }, - cmd_env = { NO_COLOR = true }, - filetypes = { - 'javascript', - 'javascriptreact', - 'typescript', - 'typescriptreact', - }, - root_dir = function(bufnr, on_dir) - -- The project root is where the LSP can be started from - local root_markers = { 'deno.lock', 'deno.json', 'deno.jsonc' } - -- Give the root markers equal priority by wrapping them in a table - root_markers = vim.fn.has('nvim-0.11.3') == 1 and { root_markers, { '.git' } } - or vim.list_extend(root_markers, { '.git' }) - -- only include deno projects - local deno_root = vim.fs.root(bufnr, { 'deno.json', 'deno.jsonc' }) - local deno_lock_root = vim.fs.root(bufnr, { 'deno.lock' }) - local project_root = vim.fs.root(bufnr, root_markers) - if - (deno_lock_root and (not project_root or #deno_lock_root > #project_root)) - or (deno_root and (not project_root or #deno_root >= #project_root)) - then - -- deno config is closer than or equal to package manager lock, - -- or deno lock is closer than package manager lock. Attach at the project root, - -- or deno lock or deno config path. At least one of these is always set at this point. - on_dir(project_root or deno_lock_root or deno_root) - end - end, - ---@type lspconfig.settings.denols - settings = { - deno = { - enable = true, - suggest = { - imports = { - hosts = { - ['https://deno.land'] = true, - }, - }, - }, - }, - }, - handlers = { - ['textDocument/definition'] = denols_handler, - ['textDocument/typeDefinition'] = denols_handler, - ['textDocument/references'] = denols_handler, - }, - on_attach = function(client, bufnr) - vim.api.nvim_buf_create_user_command(bufnr, 'LspDenolsCache', function() - client:exec_cmd({ - title = 'DenolsCache', - command = 'deno.cache', - arguments = { {}, vim.uri_from_bufnr(bufnr) }, - }, { bufnr = bufnr }, function(err, _, ctx) - if err then - local uri = ctx.params.arguments[2] - vim.notify('cache command failed for' .. vim.uri_to_fname(uri), - vim.log.levels.ERROR) - end - end) - end, { - desc = 'Cache a module and all of its dependencies.', - }) - end, -} diff --git a/nvim/.config/nvim/lsp/lua_ls.lua b/nvim/.config/nvim/lsp/lua_ls.lua deleted file mode 100644 index b8dc67c..0000000 --- a/nvim/.config/nvim/lsp/lua_ls.lua +++ /dev/null @@ -1,21 +0,0 @@ -return { - cmd = { 'lua-language-server' }, - filetypes = { 'lua' }, - settings = { - Lua = { - diagnostics = { - globals = { "vim" } - } - } - }, - root_markers = { - '.luarc.json', - '.luarc.jsonc', - '.luacheckrc', - '.stylua.toml', - 'stylua.toml', - 'selene.toml', - 'selene.yml', - '.git', - }, -} diff --git a/nvim/.config/nvim/lsp/rust-analyzer.lua b/nvim/.config/nvim/lsp/rust-analyzer.lua deleted file mode 100644 index bf9b918..0000000 --- a/nvim/.config/nvim/lsp/rust-analyzer.lua +++ /dev/null @@ -1,17 +0,0 @@ --- ~/.config/nvim/lsp/rust-analyzer.lua -return { - cmd = { "rust-analyzer" }, - filetypes = { "rust" }, - root_markers = { "Cargo.toml", ".git" }, - settings = { - ["rust-analyzer"] = { - diagnostics = { - enable = false, -- As you requested - }, - checkOnSave = { - enable = true, - command = "clippy", - }, - }, - }, -} diff --git a/nvim/.config/nvim/lua/DarthMooMancer/colors.lua b/nvim/.config/nvim/lua/DarthMooMancer/colors.lua new file mode 100644 index 0000000..e15cfe0 --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/colors.lua @@ -0,0 +1,16 @@ +vim.cmd.colorscheme('rose-pine') +vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) +vim.api.nvim_set_hl(0, 'NormalFloat', { link = 'Normal' }) +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 } +) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua b/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua new file mode 100644 index 0000000..965d404 --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/keymaps.lua @@ -0,0 +1,73 @@ +vim.keymap.set('v', 'J', ":m '>+1gv=gv") +vim.keymap.set('v', 'K', ":m '<-2gv=gv") +-- vim.keymap.set("n", "ff", vim.lsp.buf.format) +vim.keymap.set('n', 'ff', function() + require('conform').format({ async = true, lsp_format = 'never' }) +end) +vim.keymap.set('n', 'vs', ':vsplit') +vim.keymap.set('n', 'ss', ':split') +vim.keymap.set('n', 'E', ':Ex') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', '', 'zz') +vim.keymap.set('n', 'n', 'nzzzv') +vim.keymap.set('n', 'N', 'Nzzzv') +vim.keymap.set('x', 'p', [["_dP]]) +local builtin = require('telescope.builtin') +vim.keymap.set( + 'n', + '', + builtin.find_files, + { desc = 'Telescope find files' } +) +vim.keymap.set( + 'n', + 'fh', + builtin.help_tags, + { desc = 'Telescope help tags' } +) +vim.keymap.set( + 'n', + 'fg', + builtin.live_grep, + { desc = 'Telescope live grep' } +) +vim.keymap.set( + 'n', + 'fm', + builtin.man_pages, + { desc = 'Telescope man_pages' } +) +vim.keymap.set( + 'n', + 'xx', + builtin.diagnostics, + { desc = 'Telescope diagnostics' } +) +vim.keymap.set( + 'n', + 'xn', + ':Telescope notify', + { desc = 'Telescope notify' } +) +-- vim.keymap.set('n', 'xx', ':FzfLua diagnostics_workspace') + +vim.keymap.set('n', 'fs', vim.lsp.buf.document_symbol) +vim.keymap.set('n', 'gd', vim.lsp.buf.definition) +vim.keymap.set('n', 'gr', vim.lsp.buf.references) +vim.keymap.set('n', 'gR', vim.lsp.buf.rename) +vim.keymap.set('n', 'gc', vim.lsp.buf.code_action) +vim.keymap.set('n', 'uu', ':UndotreeToggle') +vim.keymap.set('n', '[', 'H', { silent = true, noremap = true }) +vim.keymap.set('n', ']', 'K', { silent = true, noremap = true }) +vim.keymap.set('n', '[q', ':cprevzz', { desc = 'Previous Quickfix Item' }) +vim.keymap.set('n', ']q', ':cnextzz', { desc = 'Next Quickfix Item' }) +vim.keymap.set('n', 'qo', ':copen', { desc = 'Open Quickfix' }) +vim.keymap.set('n', 'qc', ':cclose', { desc = 'Close Quickfix' }) +vim.keymap.set('n', '', ':NvimTmuxNavigateLeft', { silent = true }) +vim.keymap.set('n', '', ':NvimTmuxNavigateDown', { silent = true }) +vim.keymap.set('n', '', ':NvimTmuxNavigateUp', { silent = true }) +vim.keymap.set('n', '', ':NvimTmuxNavigateRight', { silent = true }) +vim.keymap.set('n', 'fr', ':FlutterRun') +vim.keymap.set('n', 'fq', ':FlutterQuit') +vim.keymap.set('n', 'fR', ':FlutterReload') +vim.keymap.set('n', 'frr', ':FlutterRestart') diff --git a/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua b/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua new file mode 100644 index 0000000..72897e0 --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/lsp.lua @@ -0,0 +1,83 @@ +require('mason').setup() +require('mason-lspconfig').setup({ + ensure_installed = { + 'vtsls', + 'lua_ls', + 'pylsp', + 'gopls', + 'html', + 'tailwindcss', + 'bashls', + }, + automatic_enable = false, +}) + +require('nvim-treesitter').install({ + 'rust', + 'c', + 'cpp', + 'lua', + 'javascript', + 'go', + 'typescript', + 'css', + 'html', + 'python', + 'dart', + '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' }, + dart = { 'dart_format', lsp_format = 'fallback' }, + ['_'] = { '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, + settings = { + Lua = { + diagnostics = { globals = { 'vim' } }, + workspace = { + library = vim.api.nvim_get_runtime_file('', true), + checkThirdParty = false, + }, + }, + }, +}) +vim.lsp.config('vtsls', { + settings = { + typescript = { + updateImportsOnFileMove = { enabled = 'always' }, + inlayHints = { + parameterNames = { enabled = 'all' }, + variableTypes = { enabled = true }, + }, + }, + }, +}) + +vim.lsp.enable({ + 'lua_ls', + 'clangd', + 'rust-analyzer', + 'vtsls', + 'tailwindcss-language-server', + 'vscode-html-language-server', + 'gopls', +}) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/opts.lua b/nvim/.config/nvim/lua/DarthMooMancer/opts.lua new file mode 100644 index 0000000..df17e4e --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/opts.lua @@ -0,0 +1,63 @@ +vim.opt.termguicolors = true +vim.g.mapleader = ' ' +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.tabstop = 8 -- Number of spaces a counts for +vim.opt.shiftwidth = 8 -- Number of spaces for autoindent (>>, <<, etc.) +vim.opt.softtabstop = 8 -- Number of spaces for in insert mode (backspace deletes 4 spaces) +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 }, + dart = { ts = 2, sw = 2, sts = 2 }, + } + local ft = map[ev.match] + if ft then + vim.bo[ev.buf].tabstop = ft.ts + vim.bo[ev.buf].shiftwidth = ft.sw + vim.bo[ev.buf].softtabstop = ft.sts + vim.bo[ev.buf].expandtab = ft.et ~= nil and ft.et or true + end + end, +}) +vim.opt.autoindent = true -- Copy indent from current line when starting a new line +vim.opt.wrap = false +vim.opt.swapfile = false +vim.opt.signcolumn = 'yes' +vim.opt.undofile = true -- Keeps undo history even after we close a file +vim.opt.scrolloff = 4 +vim.opt.sidescrolloff = 8 +vim.opt.hlsearch = false +vim.opt.completeopt = { 'menuone', 'noselect', 'popup' } +vim.g.netrw_browse_split = 0 +vim.g.netrw_banner = 0 +vim.g.netrw_liststyle = 3 +vim.g.netrw_winsize = 25 +vim.opt.wrapscan = true -- begin search from top of the file when nothng is found +vim.opt.cursorline = true -- enable cursorline +vim.opt.cursorlineopt = { 'screenline', 'number' } -- cursorline look +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.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 +vim.opt.laststatus = 3 +vim.opt.showmode = false +vim.opt.cmdheight = 0 +vim.opt.smoothscroll = true +vim.diagnostic.config({ + virtual_text = true, -- This is the magic line + signs = true, -- Shows icons in the gutter + underline = true, + update_in_insert = false, -- Don't clutter the screen while typing + severity_sort = true, +}) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua b/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua new file mode 100644 index 0000000..e18e4e3 --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/plugins.lua @@ -0,0 +1,41 @@ +vim.pack.add({ + { + src = 'https://github.com/rose-pine/neovim', + name = 'rose-pine', + }, + { 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 = 'git@moo:dmm/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-lualine/lualine.nvim' }, + { src = 'https://github.com/nvim-lua/plenary.nvim' }, + { src = 'https://github.com/folke/noice.nvim' }, + { src = 'https://github.com/akinsho/flutter-tools.nvim' }, + { src = 'https://github.com/mfussenegger/nvim-dap' }, + { src = 'https://github.com/stevearc/dressing.nvim' }, + { src = 'https://github.com/rcarriga/nvim-notify' }, +}) diff --git a/nvim/.config/nvim/lua/DarthMooMancer/tools.lua b/nvim/.config/nvim/lua/DarthMooMancer/tools.lua new file mode 100644 index 0000000..353abaf --- /dev/null +++ b/nvim/.config/nvim/lua/DarthMooMancer/tools.lua @@ -0,0 +1,113 @@ +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', + }, + + -- Highlight hex color strings (`#rrggbb`) using that color + hex_color = hipatterns.gen_highlighter.hex_color(), + }, +}) + +--- +--- Functionality +--- + +-- require('flutter-tools').setup({}) +require('flutter-tools').setup({ + decorations = { + statusline = { + app_version = true, + device = true, + }, + }, + widget_guides = { + enabled = true, + }, + closing_tags = { + highlight = 'Comment', + prefix = '//', + enabled = true, + }, + lsp = { + -- color = { + -- enabled = true, + -- background = true, + -- foreground = false, + -- virtual_text = true, + -- virtual_text_str = '■', + -- }, + settings = { + showTodos = true, + completeFunctionCalls = true, + enableSnippets = true, + }, + }, +}) +require('mini.pairs').setup() +require('nvim-tmux-navigation').setup({ + disable_when_zoomed = true, -- defaults to false +}) +require('blink.cmp').setup({ + completion = { + menu = { + draw = { + columns = { + { 'label', gap = 1 }, + { 'kind_icon', gap = 1, 'kind' }, + }, + }, + }, + }, +}) + +--- +--- Project Management +--- +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 ttl then + progress[k] = nil + end + end + if next(progress) then + frame = (frame % #spinner_frames) + 1 + end + vim.cmd('redrawstatus') + end) +) +--- Build the LSP section of the statusline +local function lsp_section() + local bufnr = vim.api.nvim_get_current_buf() + local clients = vim.lsp.get_clients({ bufnr = bufnr }) + if #clients == 0 then + return '' + end + -- Show progress spinner if any active for visible clients + local client_ids = {} + for _, c in ipairs(clients) 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] and not p.done then + if not latest or p.t > latest.t then + latest = p + end + end + end + if latest then + return '%#StatusLspSpinner# ○ ' .. latest.msg .. ' %*' + end + -- Fallback: most recent done entry (lasts 2s for smooth transition) + for key, p in pairs(progress) do + local cid = tonumber(key:match('^(%d+):')) + if cid and client_ids[cid] and p.done then + if not latest or p.t > latest.t then + latest = p + end + end + end + if latest then + return '%#StatusLspSpinner# ○ ' .. latest.msg .. ' %*' + end + -- Idle: show client names + local names = {} + for _, c in ipairs(clients) do + table.insert(names, c.name) + end + return '%#StatusLsp# ● ' .. table.concat(names, ', ') .. ' %*' +end + +--- Diagnostics summary. +local function diag_section() + local diag = vim.diagnostic.get(vim.api.nvim_get_current_buf()) + local parts = {} + local counts = { errors = 0, warnings = 0, hints = 0 } + for _, d in ipairs(diag) do + if d.severity == vim.diagnostic.severity.ERROR then + counts.errors = counts.errors + 1 + elseif d.severity == vim.diagnostic.severity.WARN then + counts.warnings = counts.warnings + 1 + elseif d.severity == vim.diagnostic.severity.HINT then + counts.hints = counts.hints + 1 + end + end + if counts.errors > 0 then + table.insert(parts, '%#StatusDiagError# E' .. counts.errors .. ' %*') + end + if counts.warnings > 0 then + table.insert(parts, '%#StatusDiagWarn# W' .. counts.warnings .. ' %*') + end + if counts.hints > 0 then + table.insert(parts, '%#StatusDiagHint# H' .. counts.hints .. ' %*') + end + return table.concat(parts) +end +--- Main statusline renderer. +function _G.__statusline() + local m = vim.fn.mode() + local mode_hl = mode_hl_map[m] or 'StatusModeNormal' + local mode_txt = mode_map[m] or ' ?? ' + local parts = {} + -- Mode + parts[#parts + 1] = '%#' .. mode_hl .. '#' .. mode_txt .. '%*' + -- Git + local git = vim.b.git_branch or '' + if git ~= '' then + parts[#parts + 1] = '%#StatusGit#  ' .. git .. ' %*' + end + -- LSP + parts[#parts + 1] = lsp_section() + -- Right align + parts[#parts + 1] = '%=' + -- Diagnostics + parts[#parts + 1] = diag_section() + -- Cursor position + parts[#parts + 1] = '%#StatusCursor# %l:%-2c %*' + -- Percentage + parts[#parts + 1] = '%#' .. mode_hl .. '# %p%% %*' + return table.concat(parts) +end +vim.o.statusline = '%!v:lua.__statusline()' + +local helpers = require('incline.helpers') +local devicons = require('nvim-web-devicons') +require('incline').setup({ + window = { + padding = 0, + margin = { horizontal = 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 + return { + ft_icon and { + ' ', + ft_icon, + ' ', + guibg = ft_color, + guifg = helpers.contrast_color(ft_color), + } or '', + ' ', + { filename, gui = modified and 'bold,italic' or 'bold' }, + ' ', + guibg = '#44406e', + } + 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, + }, + }, + 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', +}) diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json index d4bec79..8130022 100644 --- a/nvim/.config/nvim/nvim-pack-lock.json +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -5,54 +5,67 @@ "src": "https://github.com/saghen/blink.cmp", "version": ">=0.0.0" }, - "colorizer": { - "rev": "a065833f35a3a7cc3ef137ac88b5381da2ba302e", - "src": "https://github.com/norcalli/nvim-colorizer.lua" + "catppuccin": { + "rev": "426dbebe06b5c69fd846ceb17b42e12f890aedf1", + "src": "https://github.com/catppuccin/nvim" }, "conform.nvim": { "rev": "dca1a190aa85f9065979ef35802fb77131911106", "src": "https://github.com/stevearc/conform.nvim" }, + "dart-vim-plugin": { + "rev": "dd74e59c50e29896483a87373743136f2cbd24e7", + "src": "https://github.com/dart-lang/dart-vim-plugin" + }, + "dressing.nvim": { + "rev": "2d7c2db2507fa3c4956142ee607431ddb2828639", + "src": "https://github.com/stevearc/dressing.nvim" + }, + "flutter-tools.nvim": { + "rev": "7d1acfd139215e02d2784733af69a61aaebe06e8", + "src": "https://github.com/akinsho/flutter-tools.nvim" + }, "fzf-lua": { - "rev": "17e3507b788699776ba6d2f8dd101ec177f37a96", + "rev": "33fe4b6f0c817c4d99a7baeea82c4d17e57efd64", "src": "https://github.com/ibhagwan/fzf-lua" }, "incline.nvim": { - "rev": "8b54c59bcb23366645ae10edca6edfb9d3a0853e", + "rev": "debd628e9395f7a9da57bdc31ce75ca6b40a880b", "src": "https://github.com/b0o/incline.nvim" }, - "lackluster.nvim": { - "rev": "70dd682e564784893b984deb51dd5ddd263c8cc7", - "src": "https://github.com/slugbyte/lackluster.nvim" + "kanagawa.nvim": { + "rev": "8ad3b4cdcc804b332c32db8f9743667e1bb82b99", + "src": "https://github.com/rebelot/kanagawa.nvim" + }, + "lsp-status.nvim": { + "rev": "54f48eb5017632d81d0fd40112065f1d062d0629", + "src": "https://github.com/nvim-lua/lsp-status.nvim" }, "lualine.nvim": { "rev": "131a558e13f9f28b15cd235557150ccb23f89286", "src": "https://github.com/nvim-lualine/lualine.nvim" }, "mason-lspconfig.nvim": { - "rev": "0c2823e0418f3d9230ff8b201c976e84de1cb401", + "rev": "1423254f58a3407a5afd5ade0ccd901f3eecc6ba", "src": "https://github.com/mason-org/mason-lspconfig.nvim" }, "mason.nvim": { - "rev": "cb8445f8ce85d957416c106b780efd51c6298f89", + "rev": "e54f5bf5f12c560da31c17eee5b3e1bd369f3ff9", "src": "https://github.com/mason-org/mason.nvim" }, + "mini.hipatterns": { + "rev": "add8d8abad602787377ec5d81f6b248605828e0f", + "src": "https://github.com/nvim-mini/mini.hipatterns", + "version": ">=0.0.0" + }, "mini.pairs": { "rev": "d5a29b6254dad07757832db505ea5aeab9aad43a", "src": "https://github.com/nvim-mini/mini.pairs", "version": ">=0.0.0" }, - "muted.nvim": { - "rev": "6967424df29fecf248f58a5a597b9ec94cc8b36a", - "src": "https://github.com/pisgahk/muted.nvim" - }, - "neo-tree.nvim": { - "rev": "ff84e6e1608b24773f1b73cd4182e0bcf2b3d637", - "src": "https://github.com/nvim-neo-tree/neo-tree.nvim" - }, - "neogen": { - "rev": "23e7e9f883d01289ebd90e98025acc860ea26366", - "src": "https://github.com/danymat/neogen" + "mini.statusline": { + "rev": "b456bfe845e475e9cec065b7a9a1ef657ad2f41b", + "src": "https://github.com/nvim-mini/mini.statusline" }, "noice.nvim": { "rev": "7bfd942445fb63089b59f97ca487d605e715f155", @@ -62,26 +75,18 @@ "rev": "de740991c12411b663994b2860f1a4fd0937c130", "src": "https://github.com/MunifTanjim/nui.nvim" }, - "nvim-colorizer.lua": { - "rev": "a065833f35a3a7cc3ef137ac88b5381da2ba302e", - "src": "https://github.com/norcalli/nvim-colorizer.lua" - }, "nvim-dap": { "rev": "45a69eba683a2c448dd9ecfc4de89511f0646b5f", "src": "https://github.com/mfussenegger/nvim-dap" }, - "nvim-dap-ui": { - "rev": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49", - "src": "https://github.com/rcarriga/nvim-dap-ui" - }, - "nvim-highlight-colors": { - "rev": "e4c7af0211866162d999ce0bdd6a029302e19139", - "src": "https://github.com/brenoprata10/nvim-highlight-colors" - }, "nvim-lspconfig": { - "rev": "31026a13eefb20681124706a79fc1df6bf11ab27", + "rev": "cd576dd72d31ddffcbfa6d064c0dd697ca218758", "src": "https://github.com/neovim/nvim-lspconfig" }, + "nvim-notify": { + "rev": "8701bece920b38ea289b457f902e2ad184131a5d", + "src": "https://github.com/rcarriga/nvim-notify" + }, "nvim-tmux-navigation": { "rev": "4898c98702954439233fdaf764c39636681e2861", "src": "https://github.com/alexghergh/nvim-tmux-navigation" @@ -110,21 +115,17 @@ "rev": "6a961effd67f6130d36df6d1c05c48c739796dd2", "src": "https://github.com/rose-pine/neovim" }, - "snacks.nvim": { - "rev": "ad9ede6a9cddf16cedbd31b8932d6dcdee9b716e", - "src": "https://github.com/folke/snacks.nvim" + "statusline.lua": { + "rev": "4c7083cdd8b902ce06762861124ac4c031b2e581", + "src": "https://github.com/beauwilliams/statusline.lua" + }, + "telescope.nvim": { + "rev": "f04ab730b8f9c6bf3f54a206d0dcddfd70c52d59", + "src": "https://github.com/nvim-telescope/telescope.nvim" }, "undotree": { "rev": "6fa6b57cda8459e1e4b2ca34df702f55242f4e4d", "src": "https://github.com/mbbill/undotree" - }, - "which-key.nvim": { - "rev": "3aab2147e74890957785941f0c1ad87d0a44c15a", - "src": "https://github.com/folke/which-key.nvim" - }, - "xcodebuild.nvim": { - "rev": "59ee76b947cfd680b0354f3318aec2cab71a18db", - "src": "https://github.com/wojciech-kulik/xcodebuild.nvim" } } } diff --git a/zshrc/.zshrc b/zshrc/.zshrc index d64fea8..2e4579b 100644 --- a/zshrc/.zshrc +++ b/zshrc/.zshrc @@ -46,6 +46,7 @@ if [[ $(uname) != "Darwin" ]]; then 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 @@ -62,3 +63,6 @@ fi # bun export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" +export PATH="/opt/homebrew/opt/ruby/bin:$PATH" +export LDFLAGS="-L/opt/homebrew/opt/ruby/lib" +export CPPFLAGS="-I/opt/homebrew/opt/ruby/include"