1
0
Fork 0

fmt(neovim): stylua

This commit is contained in:
Jeremy Kaplan 2025-10-26 15:23:15 -04:00
commit 97b2bb0d4f
11 changed files with 1190 additions and 1117 deletions

View file

@ -1,14 +1,14 @@
vim.opt.background = 'dark'
vim.g.colors_name = 'jdkaplan-cool'
vim.opt.background = "dark"
vim.g.colors_name = "jdkaplan-cool"
vim.o.termguicolors = true
local pkg = 'jdkaplan.cool_theme'
local pkg = "jdkaplan.cool_theme"
-- Clear the Lua cache for the theme package to force it to load every time.
package.loaded[pkg] = nil
local lush = require('lush')
local lush = require("lush")
local theme = require(pkg)
lush(theme)

View file

@ -1,14 +1,14 @@
vim.opt.background = 'light'
vim.g.colors_name = 'jdkaplan-warm'
vim.opt.background = "light"
vim.g.colors_name = "jdkaplan-warm"
vim.o.termguicolors = true
local pkg = 'jdkaplan.warm_theme'
local pkg = "jdkaplan.warm_theme"
-- Clear the Lua cache for the theme package to force it to load every time.
package.loaded[pkg] = nil
local lush = require('lush')
local lush = require("lush")
local theme = require(pkg)
lush(theme)

View file

@ -1,16 +1,13 @@
local bufnr = vim.api.nvim_get_current_buf()
function rustLspMap(mode, keys, cmd)
vim.keymap.set(
mode,
keys,
function() vim.cmd.RustLsp(cmd) end,
{ silent = true, buffer = bufnr }
)
vim.keymap.set(mode, keys, function()
vim.cmd.RustLsp(cmd)
end, { silent = true, buffer = bufnr })
end
-- Use rust-analyzer's grouping of actions
rustLspMap("n", "gra", "codeAction")
-- Use rustaceanvim's hover actions
rustLspMap("n", "K", {'hover', 'actions'})
rustLspMap("n", "K", { "hover", "actions" })

View file

@ -1,4 +1,4 @@
vim.o.shell = '/bin/sh'
vim.o.shell = "/bin/sh"
vim.g.python3_host_prog = vim.fn.expand("~/.virtualenvs/neovim3/bin/python")
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
@ -13,7 +13,7 @@ require("lazy").setup("plugins", {
change_detection = {
-- Disable automatic reloading of config files.
enabled = false,
}
},
})
theme = "jdkaplan-temp"
@ -74,23 +74,23 @@ vim.o.secure = true
vim.keymap.set("", "<Space>w", "<C-w>", { remap = true })
vim.keymap.set("", '<Space>w"', ":split<CR>")
vim.keymap.set("", '<Space>w%', ":vsplit<CR>")
vim.keymap.set("", "<Space>w%", ":vsplit<CR>")
vim.keymap.set("", '<Leader>w', ":w<CR>")
vim.keymap.set("", "<Leader>w", ":w<CR>")
vim.keymap.set("n", "<C-w>]", function()
if vim.api.nvim_win_get_width(0) > 2 * 80 then
vim.cmd('vertical wincmd ]')
vim.cmd("vertical wincmd ]")
else
vim.cmd('horizontal wincmd ]')
vim.cmd("horizontal wincmd ]")
end
end)
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ';w', ":w<CR>")
vim.keymap.set("", ";w", ":w<CR>")
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set("", ';;', ";")
vim.keymap.set("", ";;", ";")
vim.keymap.set("", "<Space><Space>", ":nohlsearch<CR>")
@ -145,10 +145,18 @@ function auto_correct(mode, old, new, scale, limit, cmd)
end)
end
auto_correct("n", ';"', '<C-w>s', 100, 1000, vim.cmd.split)
auto_correct("n", ';%', '<C-w>v', 100, 1000, vim.cmd.vsplit)
auto_correct("n", ';0', '<C-w>c', 100, 1000, vim.cmd.close)
auto_correct("n", ";h", "<C-w>h", 10, 500, function() vim.cmd.wincmd("h") end)
auto_correct("n", ";j", "<C-w>j", 10, 500, function() vim.cmd.wincmd("j") end)
auto_correct("n", ";k", "<C-w>k", 10, 500, function() vim.cmd.wincmd("k") end)
auto_correct("n", ";l", "<C-w>l", 10, 500, function() vim.cmd.wincmd("l") end)
auto_correct("n", ';"', "<C-w>s", 100, 1000, vim.cmd.split)
auto_correct("n", ";%", "<C-w>v", 100, 1000, vim.cmd.vsplit)
auto_correct("n", ";0", "<C-w>c", 100, 1000, vim.cmd.close)
auto_correct("n", ";h", "<C-w>h", 10, 500, function()
vim.cmd.wincmd("h")
end)
auto_correct("n", ";j", "<C-w>j", 10, 500, function()
vim.cmd.wincmd("j")
end)
auto_correct("n", ";k", "<C-w>k", 10, 500, function()
vim.cmd.wincmd("k")
end)
auto_correct("n", ";l", "<C-w>l", 10, 500, function()
vim.cmd.wincmd("l")
end)

View file

@ -7,9 +7,9 @@
"gitsigns.nvim": { "branch": "main", "commit": "220446c8c86a280180d852efac60991eaf1a21d4" },
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
"keytrail.nvim": { "branch": "main", "commit": "153a76d5891065a328be82316b6813662904da71" },
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
"lazy.nvim": { "branch": "main", "commit": "ed4dc336a73c18da6fea6e1cf7ad6e1b76d281eb" },
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "2304ff65ecc8cb2afc2484de3e2ed9a407edf0b9" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "1d77bd86e1c3eaa777010c95dad455b83823f247" },
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
"nerdtree": { "branch": "master", "commit": "690d061b591525890f1471c6675bcb5bdc8cdff9" },
"none-ls.nvim": { "branch": "main", "commit": "a96172f673f720cd4f3572e1fcd08400ed3eb25d" },
@ -18,8 +18,8 @@
"nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" },
"nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" },
"nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" },
"nvim-lspconfig": { "branch": "master", "commit": "52a893217b2c12e215c6851bd8813b43204416cd" },
"nvim-surround": { "branch": "main", "commit": "0cadeb0f1930e6b25cf65395f8269bfcc36b6791" },
"nvim-lspconfig": { "branch": "master", "commit": "a9b2fb560c4ab22c10728fd5149dbd7b62aa4f69" },
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "a9742cbc1f95db9eaf3293bf8cd0622ca36542bb" },
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },

View file

@ -1,4 +1,4 @@
local lush = require('lush')
local lush = require("lush")
local hsl = lush.hsl
local theme = lush(function(injected_functions)
@ -6,6 +6,7 @@ local theme = lush(function(injected_functions)
-- https://github.com/rktjmp/lush.nvim/issues/109
local sym = injected_functions.sym
-- stylua: ignore
return {
ColorColumn { bg = '#5F0000' }, -- Columns set with 'colorcolumn'
Conceal {}, -- Placeholder characters substituted for concealed text (see 'conceallevel')

View file

@ -1,4 +1,4 @@
local lush = require('lush')
local lush = require("lush")
local hsl = lush.hsl
local theme = lush(function(injected_functions)
@ -6,6 +6,7 @@ local theme = lush(function(injected_functions)
-- https://github.com/rktjmp/lush.nvim/issues/109
local sym = injected_functions.sym
-- stylua: ignore
return {
ColorColumn { bg = '#5F0000' }, -- Columns set with 'colorcolumn'
Conceal {}, -- Placeholder characters substituted for concealed text (see 'conceallevel')

View file

@ -1,6 +1,6 @@
return {
-- Theme
'rktjmp/lush.nvim',
"rktjmp/lush.nvim",
-- tpope extended universe
"tpope/vim-abolish",
@ -74,8 +74,8 @@ return {
enable_cursorcross = false,
disable_cursorcross = false,
toggle_cursorcross = false,
}
}
},
},
},
-- etc.
@ -85,8 +85,8 @@ return {
"almo7aya/openingh.nvim",
url = "https://github.com/jdkaplan/openingh.nvim",
keys = {
{ "<Leader>gh", "V:OpenInGHFile<CR>", mode = {"n"} },
{ "<Leader>gh", ":OpenInGHFile<CR>", mode = {"v"} },
{ "<Leader>gh", "V:OpenInGHFile<CR>", mode = { "n" } },
{ "<Leader>gh", ":OpenInGHFile<CR>", mode = { "v" } },
},
},
{
@ -100,10 +100,10 @@ return {
"ntpeters/vim-better-whitespace",
init = function()
vim.g.better_whitespace_enabled = 1
vim.g.better_whitespace_filetypes_blacklist = { 'diff', 'zig' }
vim.g.better_whitespace_filetypes_blacklist = { "diff", "zig" }
vim.g.strip_whitespace_on_save = 1
vim.g.strip_whitespace_confirm = 0
vim.g.better_whitespace_operator = ''
vim.g.better_whitespace_operator = ""
end,
},
{
@ -161,5 +161,5 @@ return {
desc = "Buffer Local Keymaps (which-key)",
},
},
}
},
}

View file

@ -1,20 +1,20 @@
vim.lsp.inlay_hint.enable(true)
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('jdkaplan.lsp', {}),
vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup("jdkaplan.lsp", {}),
callback = function(args)
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
if client:supports_method('textDocument/completion') then
vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = false})
if client:supports_method("textDocument/completion") then
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = false })
end
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
already_waits = client:supports_method('textDocument/willSaveWaitUntil')
can_fmt = client:supports_method('textDocument/formatting')
already_waits = client:supports_method("textDocument/willSaveWaitUntil")
can_fmt = client:supports_method("textDocument/formatting")
if not already_waits and can_fmt then
vim.api.nvim_create_autocmd('BufWritePre', {
group = vim.api.nvim_create_augroup('jdkaplan.lsp', {clear=false}),
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("jdkaplan.lsp", { clear = false }),
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
@ -79,10 +79,10 @@ return {
signcolumn = false,
show_deleted = false,
current_line_blame = false,
current_line_blame_formatter = ' <author> <author_time:%Y-%m-%d> <summary>',
current_line_blame_formatter = " <author> <author_time:%Y-%m-%d> <summary>",
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol',
virt_text_pos = "eol",
delay = 0,
ignore_whitespace = false,
},
@ -91,16 +91,36 @@ return {
{
"RRethy/vim-illuminate",
init = function()
local illuminate = require('illuminate')
local illuminate = require("illuminate")
illuminate.configure({
delay = 500,
})
end,
keys = {
{ "<leader>ii", function() require('illuminate').toggle_buf() end },
{ "<leader>in", function() require('illuminate').goto_next_reference() end },
{ "<leader>ip", function() require('illuminate').goto_prev_reference() end },
{ "<leader>if", function() require('illuminate').toggle_freeze_buf() end },
{
"<leader>ii",
function()
require("illuminate").toggle_buf()
end,
},
{
"<leader>in",
function()
require("illuminate").goto_next_reference()
end,
},
{
"<leader>ip",
function()
require("illuminate").goto_prev_reference()
end,
},
{
"<leader>if",
function()
require("illuminate").toggle_freeze_buf()
end,
},
},
},
{
@ -108,7 +128,7 @@ return {
main = "ibl",
opts = {
indent = {
char = '',
char = "",
},
scope = { enabled = false },
},
@ -121,9 +141,9 @@ return {
require("coverage").setup({
auto_reload = true,
signs = {
covered = { text="" },
partial = { text="" },
uncovered = { text="" },
covered = { text = "" },
partial = { text = "" },
uncovered = { text = "" },
},
})
end,
@ -138,7 +158,7 @@ return {
url = "https://github.com/jdkaplan/keytrail.nvim",
dependencies = { "nvim-treesitter/nvim-treesitter" },
opts = {
key_mapping = '<Space>j',
key_mapping = "<Space>j",
},
},
@ -147,7 +167,7 @@ return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
init = function()
require('nvim-treesitter.configs').setup({
require("nvim-treesitter.configs").setup({
highlight = { enable = true },
incremental_selection = { enable = true },
@ -241,7 +261,7 @@ return {
-- Telescope
{
"nvim-telescope/telescope.nvim",
version = '^0.1.0',
version = "^0.1.0",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope-fzf-native.nvim",
@ -251,33 +271,33 @@ return {
"nvim-telescope/telescope-symbols.nvim",
},
init = function()
local telescope = require('telescope')
telescope.load_extension('fzf')
telescope.load_extension('aerial')
telescope.load_extension('ui-select')
local telescope = require("telescope")
telescope.load_extension("fzf")
telescope.load_extension("aerial")
telescope.load_extension("ui-select")
local builtin = require('telescope.builtin')
local builtin = require("telescope.builtin")
local function find_files(opts)
opts = opts or {}
opts['hidden'] = true
opts["hidden"] = true
return builtin.find_files(opts)
end
vim.keymap.set('n', '<Space>f', find_files)
vim.keymap.set('n', '<Space>g', builtin.live_grep)
vim.keymap.set('n', '<Space>b', builtin.buffers)
vim.keymap.set('n', '<Space>*', builtin.grep_string)
vim.keymap.set('n', '<Space>o', telescope.extensions.aerial.aerial)
vim.keymap.set('n', '<Space>t', builtin.builtin)
vim.keymap.set("n", "<Space>f", find_files)
vim.keymap.set("n", "<Space>g", builtin.live_grep)
vim.keymap.set("n", "<Space>b", builtin.buffers)
vim.keymap.set("n", "<Space>*", builtin.grep_string)
vim.keymap.set("n", "<Space>o", telescope.extensions.aerial.aerial)
vim.keymap.set("n", "<Space>t", builtin.builtin)
-- TODO: Delete these ; fake-leader bindings
vim.keymap.set('n', ';f', find_files)
vim.keymap.set('n', ';g', builtin.live_grep)
vim.keymap.set('n', ';b', builtin.buffers)
vim.keymap.set('n', ';*', builtin.grep_string)
vim.keymap.set("n", ";f", find_files)
vim.keymap.set("n", ";g", builtin.live_grep)
vim.keymap.set("n", ";b", builtin.buffers)
vim.keymap.set("n", ";*", builtin.grep_string)
vim.keymap.set('i', '<C-G><C-F>', builtin.symbols)
vim.keymap.set("i", "<C-G><C-F>", builtin.symbols)
end,
opts = function(_plugin, _config)
local actions = require("telescope.actions")
@ -350,7 +370,7 @@ return {
end
if row and col then
pcall(vim.api.nvim_win_set_cursor, 0, { row, col-1 })
pcall(vim.api.nvim_win_set_cursor, 0, { row, col - 1 })
end
::continue::
@ -380,7 +400,8 @@ return {
"--smart-case",
-- Include hidden files, but continue ignoring the .git directory itself.
"--hidden",
"--iglob", "!.git",
"--iglob",
"!.git",
},
},
pickers = {},
@ -420,7 +441,7 @@ return {
},
{
"mrcjkb/rustaceanvim",
version = '^6',
version = "^6",
lazy = false,
},
{
@ -454,7 +475,7 @@ return {
},
build = "make install_jsregexp",
init = function()
local luasnip = require('luasnip')
local luasnip = require("luasnip")
luasnip.filetype_extend("typescript", { "javascript" })
luasnip.filetype_extend("typescriptreact", { "javascript", "react" })
@ -463,23 +484,25 @@ return {
require("luasnip.loaders.from_snipmate").lazy_load()
require("luasnip.loaders.from_lua").lazy_load()
local cmp = require('cmp')
cmp.setup {
local cmp = require("cmp")
cmp.setup({
completion = {
autocomplete = false,
},
snippet = {
expand = function(args) luasnip.lsp_expand(args.body) end,
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
@ -487,8 +510,8 @@ return {
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
@ -496,29 +519,69 @@ return {
else
fallback()
end
end, { 'i', 's' }),
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
},
}
})
end,
},
-- Debugging
{
'mfussenegger/nvim-dap',
"mfussenegger/nvim-dap",
lazy = false,
keys = {
{ "<Leader>db", function() require('dap').toggle_breakpoint() end },
{ "<Leader>dB", function() require('dap').set_breakpoint() end },
{ "<Leader>dc", function() require('dap').continue() end },
{ "<Leader>dn", function() require('dap').step_over() end },
{ "<Leader>dsi", function() require('dap').step_into() end },
{ "<Leader>dso", function() require('dap').step_out() end },
{ "<Leader>dj", function() require('dap').down() end },
{ "<Leader>dk", function() require('dap').up() end },
{
"<Leader>db",
function()
require("dap").toggle_breakpoint()
end,
},
{
"<Leader>dB",
function()
require("dap").set_breakpoint()
end,
},
{
"<Leader>dc",
function()
require("dap").continue()
end,
},
{
"<Leader>dn",
function()
require("dap").step_over()
end,
},
{
"<Leader>dsi",
function()
require("dap").step_into()
end,
},
{
"<Leader>dso",
function()
require("dap").step_out()
end,
},
{
"<Leader>dj",
function()
require("dap").down()
end,
},
{
"<Leader>dk",
function()
require("dap").up()
end,
},
},
},
}

3
neovim/stylua.toml Normal file
View file

@ -0,0 +1,3 @@
indent_type = "Spaces"
indent_width = 2
call_parentheses = "Input"