From 4774b0d0863bc1d88aff7ebcc743848b0d9862c3 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Sat, 17 Jan 2026 23:52:42 -0500 Subject: [PATCH] laptop current state --- init.lua | 2 ++ lazy-lock.json | 51 +++++++++++++------------- lua/chadrc.lua | 2 +- lua/configs/conform.lua | 25 ++++++++----- lua/mappings.lua | 25 +++++++++++++ lua/options.lua | 7 ++++ lua/plugins/init.lua | 79 ++++++++++++++++++++++------------------- 7 files changed, 119 insertions(+), 72 deletions(-) diff --git a/init.lua b/init.lua index d297ed2..21fc103 100644 --- a/init.lua +++ b/init.lua @@ -58,3 +58,5 @@ vim.opt.expandtab = true -- Use spaces instead of tabs vim.opt.shiftwidth = 4 -- Number of spaces for each indentation level vim.opt.tabstop = 4 -- Number of spaces a tab counts for vim.opt.softtabstop = 4 -- Number of spaces a tab feels like when editing +-- in your init.lua (after plugins) or an ftplugin +-- vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" diff --git a/lazy-lock.json b/lazy-lock.json index e342405..b7dc84a 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,31 +1,30 @@ { - "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, - "NvChad": { "branch": "v2.5", "commit": "6f25b2739684389ca69ea8229386c098c566c408" }, + "LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" }, + "NvChad": { "branch": "v2.5", "commit": "30e75dbbdf33f393430d6e7612dd32ef84e2a710" }, "base46": { "branch": "v2.5", "commit": "fde7a2cd54599e148d376f82980407c2d24b0fa2" }, - "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, - "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, - "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-async-path": { "branch": "main", "commit": "a14d3a9c7f303551a0b8c64a0e4e6527ce39a8a2" }, + "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, + "cmp-nvim-lua": { "branch": "main", "commit": "e3a22cb071eb9d6508a156306b102c45cd2d573d" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, - "conform.nvim": { "branch": "master", "commit": "a6f5bdb78caa305496357d17e962bbc4c0b392e2" }, - "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, - "gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" }, - "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, - "menu": { "branch": "main", "commit": "7769b17c2a131108c02b10e9f844e504aa605cc2" }, - "minty": { "branch": "main", "commit": "6dce9f097667862537823d515a0250ce58faab05" }, - "nvim-autopairs": { "branch": "master", "commit": "68f0e5c3dab23261a945272032ee6700af86227a" }, - "nvim-cmp": { "branch": "main", "commit": "5a11682453ac6b13dbf32cd403da4ee9c07ef1c3" }, - "nvim-lspconfig": { "branch": "master", "commit": "99c75820f2606b6b446cad7c75ec2ef7ee8a1317" }, - "nvim-tree.lua": { "branch": "master", "commit": "6709463b2d18e77f7a946027917aa00d4aaed6f4" }, - "nvim-treesitter": { "branch": "master", "commit": "8f87d28442f7f91347e993661c319135f47729c7" }, - "nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" }, + "conform.nvim": { "branch": "master", "commit": "8314f4c9e205e7f30b62147069729f9a1227d8bf" }, + "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, + "gitsigns.nvim": { "branch": "main", "commit": "dfac404ac94b0eb1461bd7da32279e16950dfd67" }, + "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" }, + "menu": { "branch": "main", "commit": "7a0a4a2896b715c066cfbe320bdc048091874cc6" }, + "minty": { "branch": "main", "commit": "aafc9e8e0afe6bf57580858a2849578d8d8db9e0" }, + "nvim-autopairs": { "branch": "master", "commit": "c2a0dd0d931d0fb07665e1fedb1ea688da3b80b4" }, + "nvim-cmp": { "branch": "main", "commit": "85bbfad83f804f11688d1ab9486b459e699292d6" }, + "nvim-lspconfig": { "branch": "master", "commit": "0b38bc74487e73489624d61396af7805af9cc75f" }, + "nvim-tree.lua": { "branch": "master", "commit": "b8b44b6a2494d086a9177251a119f9daec6cace8" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, + "nvim-web-devicons": { "branch": "master", "commit": "6788013bb9cb784e606ada44206b0e755e4323d7" }, "obsidian.nvim": { "branch": "main", "commit": "ae1f76a75c7ce36866e1d9342a8f6f5b9c2caf9b" }, - "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, - "telescope.nvim": { "branch": "master", "commit": "814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4" }, - "transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" }, - "ui": { "branch": "v3.0", "commit": "6e624338cc4ba1811b60c26484440105541d3b07" }, - "volt": { "branch": "main", "commit": "21a2351697abfed26d4469b88d3ab124d55a1b3f" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } + "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, + "telescope.nvim": { "branch": "master", "commit": "3333a52ff548ba0a68af6d8da1e54f9cd96e9179" }, + "ui": { "branch": "v3.0", "commit": "ebf58649bc5c759ee6c730c87d8d2d4dd4124c0d" }, + "volt": { "branch": "main", "commit": "620de1321f275ec9d80028c68d1b88b409c0c8b1" }, + "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } } diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 520be16..c82dca1 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -6,7 +6,7 @@ local M = {} M.base46 = { - theme = "vscode_dark", + theme = "onedark", -- hl_override = { -- Comment = { italic = true }, diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua index 35ba6cf..edaa43d 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -1,15 +1,22 @@ local options = { formatters_by_ft = { lua = { "stylua" }, - -- css = { "prettier" }, - -- html = { "prettier" }, + sql = { "pg_format", "sqlfluff" }, -- pg_format first, fallback to sqlfluff + json = { "jq" }, + markdown = { "mdformat" }, + }, + -- no format_on_save (manual-only) + formatters = { + pg_format = { + prepend_args = { + "--keyword-case", "2", -- 1 = UPPER + "--function-case", "2", -- 2 = lower + "--spaces", "4", + }, + }, + sqlfluff = { + args = { "fix", "--force", "--dialect", "postgres", "-" }, + }, }, - - -- format_on_save = { - -- -- These options will be passed to conform.format() - -- timeout_ms = 500, - -- lsp_fallback = true, - -- }, } - return options diff --git a/lua/mappings.lua b/lua/mappings.lua index 9cae29b..7ed0a18 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -70,3 +70,28 @@ vim.keymap.set('x', '"', function() local text = vim.fn.getreg('"') -- Get the visually selected text vim.cmd('normal! c"' .. text .. '"') end, { desc = "Wrap selected text in double quotes" }) + +-- Format just the visual selection +-- vim.keymap.set("v", "cf", function() +-- require("conform").format({ +-- async = true, +-- lsp_fallback = false, +-- range = { start = vim.fn.line("v"), ["end"] = vim.fn.line(".") }, +-- }) +-- end, { desc = "Conform format selection" }) + +-- vim.keymap.set("", "cf", function() +-- require("conform").format({ async = true }, function(err) +-- if not err then +-- local mode = vim.api.nvim_get_mode().mode +-- if vim.startswith(string.lower(mode), "v") then +-- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("", true, false, true), "n", true) +-- end +-- end +-- end) +-- end, { desc = "Format code" }) + +-- vim.lsp.enable('postgres_lsp') +-- -- Gitsigns blame current line +vim.keymap.set("n", "gb", ":Gitsigns blame_line", { noremap = true, silent = true, desc = "Git blame line" }) + diff --git a/lua/options.lua b/lua/options.lua index f153a94..f1008eb 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -54,3 +54,10 @@ require('nvim-tree').setup{ }, }, } + +require('gitsigns').setup({ + preview_config = { + -- Options passed to nvim_open_win + border = 'rounded', -- 'none'|'single'|'double'|'rounded'|'solid'|'shadow' + }, +}) diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index e6c33fa..1471df3 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -1,11 +1,25 @@ return { + -- Conform (formatter) { "stevearc/conform.nvim", - -- event = 'BufWritePre', -- uncomment for format on save - opts = require "configs.conform", + lazy = false, + cmd = { "ConformInfo", "ConformFormat" }, -- enables :ConformInfo before load + keys = { + { + "g+w", + function() + require("conform").format({ async = false, lsp_fallback = true }) + end, + mode = "n", + desc = "Format file (Conform)", + }, + }, + config = function() + require("conform").setup(require "configs.conform") + end, }, - -- These are some examples, uncomment them if you want to see them work! + -- LSP { "neovim/nvim-lspconfig", config = function() @@ -13,43 +27,36 @@ return { end, }, - { - 'nvim-telescope/telescope.nvim', - requires = { {'nvim-lua/plenary.nvim'} }, - config = function() - require('telescope').setup { - defaults = { - -- Your default configuration for Telescope (optional) - } - } - end - }, + -- Telescope { - 'nvim-treesitter/nvim-treesitter', - build = ':TSUpdate', + "nvim-telescope/telescope.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, config = function() - require'nvim-treesitter.configs'.setup { - -- Enable Treesitter syntax highlighting - ensure_installed = { "markdown", "sql","vim", - "lua", "vimdoc", "html", "css" }, -- add other languages if needed - highlight = { - enable = true, - additional_vim_regex_highlighting = { "markdown" }, - }, + require("telescope").setup {} + end, + }, + + -- Treesitter + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + require("nvim-treesitter.configs").setup { + ensure_installed = { "markdown", "sql", "vim", "lua", "vimdoc", "html", "css" }, + highlight = { enable = true, additional_vim_regex_highlighting = { "markdown" } }, } end, }, + + -- Transparent (optional) + -- { "xiyaowong/transparent.nvim", lazy = false }, + + -- Mason (to install pgformatter/sqlfluff) { - 'xiyaowong/transparent.nvim', - lazy = false - } - -- { - -- "nvim-treesitter/nvim-treesitter", - -- opts = { - -- ensure_installed = { - -- "vim", "lua", "vimdoc", - -- "html", "css" - -- }, - -- }, - -- }, + "williamboman/mason.nvim", + cmd = { "Mason", "MasonInstall", "MasonUpdate" }, + config = function() + require("mason").setup() + end, + }, }