caio.co/de/dotfiles

Format lua code

Id
1425cce642313dca52a9251bbe769f76e1753e4a
Author
Caio
Commit time
2025-10-09T12:47:25+02:00

Modified config/nvim/init.lua

@@ -35,9 +35,9

g.mapleader = ' '
-- A way less "in your face" netrw
-g.netrw_sizestyle="h"
-g.netrw_banner=0
-g.netrw_list_style=3
+g.netrw_sizestyle = "h"
+g.netrw_banner = 0
+g.netrw_list_style = 3
g.netrw_list_hide = [[\(^\|\s\s\)\zs\.\S\+]]

vim.diagnostic.config({
@@ -54,7 +54,7
})
-- }}}

-vim.g.zenbones_darkness = "stark" -- warm/undef
+vim.g.zenbones_darkness = "stark" -- warm/undef
vim.g.zenbones_lightness = "bright" -- dim/undef
vim.opt.termguicolors = true
vim.opt.background = "light"
@@ -66,7 +66,7
require('config.telescope')

-- Don't leave preview windows hanging
-vim.api.nvim_create_autocmd({'CursorMovedI', 'InsertLeave'}, {
+vim.api.nvim_create_autocmd({ 'CursorMovedI', 'InsertLeave' }, {
command = "if pumvisible() == 0| pclose | endif"
})

Modified config/nvim/lua/config/lsp.lua

@@ -12,7 +12,7
-- grn: rename
-- gra: code_action
local function nmap(seq, action)
- local opts = { silent = true, noremap = true}
+ local opts = { silent = true, noremap = true }
vim.api.nvim_buf_set_keymap(args.buf, 'n', seq, string.format("<cmd>%s<CR>", action), opts)
end
nmap('gy', 'lua vim.lsp.buf.type_definition()')
@@ -33,7 +33,7
vim.o.foldexpr = "v:lua.vim.lsp.foldexpr()"
end

- local group = vim.api.nvim_create_augroup('my.lsp', {clear=false})
+ local group = vim.api.nvim_create_augroup('my.lsp', { clear = false })

local setup_handler = function(event, callback)
vim.api.nvim_create_autocmd(event, {
@@ -52,13 +52,12

if client:supports_method('textDocument/documentHighlight') then
setup_handler('CursorHold', function()
- vim.lsp.buf.document_highlight()
+ vim.lsp.buf.document_highlight()
end)
setup_handler('CursorMoved', function()
- vim.lsp.buf.clear_references()
+ vim.lsp.buf.clear_references()
end)
end
-
end,
})

@@ -76,7 +75,7
})

vim.lsp.config("rust_analyzer", {
- cmd = {"rustup", "run", "stable", "rust-analyzer"},
+ cmd = { "rustup", "run", "stable", "rust-analyzer" },
filetypes = { "rust" },
settings = {
["rust-analyzer"] = {

Modified config/nvim/lua/config/telescope.lua

@@ -36,8 +36,8
-- it would pass `-- path/to/current/buffer/directory`
-- to `git ls-files` when outside of the repository root
local opts = {}
- local ok = pcall(require'telescope.builtin'.git_files, opts)
- if not ok then require'telescope.builtin'.find_files(opts) end
+ local ok = pcall(require 'telescope.builtin'.git_files, opts)
+ if not ok then require 'telescope.builtin'.find_files(opts) end
end

local map = vim.keymap.set

Modified config/nvim/lua/custom/init.lua

@@ -34,17 +34,16
end

function M.home_cache_dir(tail)
- local base = vim.env.XDG_CACHE_HOME
- if not base and vim.env.HOME then
- base = vim.env.HOME .. "/.cache"
- end
- -- fallback to a hidden dir on cwd
- if not base then
- return '.' .. tail
- end
+ local base = vim.env.XDG_CACHE_HOME
+ if not base and vim.env.HOME then
+ base = vim.env.HOME .. "/.cache"
+ end
+ -- fallback to a hidden dir on cwd
+ if not base then
+ return '.' .. tail
+ end

- return base .. '/' .. tail
+ return base .. '/' .. tail
end
-

return M