refactor(nvim): Reformat code

This commit is contained in:
Ahmad Ansori Palembani 2025-05-27 11:02:37 +07:00
parent b39c708cde
commit 26954bc417
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6
5 changed files with 507 additions and 501 deletions

View file

@ -5,14 +5,14 @@ return {
"folke/tokyonight.nvim", "folke/tokyonight.nvim",
lazy = false, lazy = false,
priority = 1000, priority = 1000,
config = function () config = function()
require("tokyonight").setup({ require("tokyonight").setup({
style = "moon", style = "moon",
transparent = true, transparent = true,
styles = { styles = {
sidebars = "transparent" sidebars = "transparent"
}, },
on_highlights = function (hl, c) on_highlights = function(hl, c)
hl.CursorLineNr = { fg = c.yellow, bold = true } hl.CursorLineNr = { fg = c.yellow, bold = true }
end, end,
}) })
@ -22,13 +22,13 @@ return {
{ {
"nvim-lualine/lualine.nvim", "nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" }, dependencies = { "nvim-tree/nvim-web-devicons" },
config = function () config = function()
local _progress = require("lualine.components.progress") local _progress = require("lualine.components.progress")
local progress = function () local progress = function()
return "" .. _progress() return "" .. _progress()
end end
local _location = require("lualine.components.location") local _location = require("lualine.components.location")
local location = function () local location = function()
return "" .. _location() return "" .. _location()
end end
require("lualine").setup { require("lualine").setup {
@ -38,14 +38,14 @@ return {
section_separators = "", section_separators = "",
component_separators = "", component_separators = "",
}, },
extensions = {"neo-tree", "oil", "lazy"}, extensions = { "neo-tree", "oil", "lazy" },
sections = { sections = {
lualine_a = {"mode"}, lualine_a = { "mode" },
lualine_b = {"branch", "diff", "diagnostics"}, lualine_b = { "branch", "diff", "diagnostics" },
lualine_c = {"filename"}, lualine_c = { "filename" },
lualine_x = {location}, lualine_x = { location },
lualine_y = {progress}, lualine_y = { progress },
lualine_z = {"encoding", "fileformat", "filetype"}, lualine_z = { "encoding", "fileformat", "filetype" },
}, },
} }
end, end,
@ -55,7 +55,7 @@ return {
keys = { keys = {
{ "gc", mode = { "n", "v", "i" } }, { "gc", mode = { "n", "v", "i" } },
}, },
init = function () init = function()
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { "nix", "hyprlang" }, pattern = { "nix", "hyprlang" },
callback = function() callback = function()
@ -68,14 +68,14 @@ return {
{ {
"dstein64/vim-startuptime", "dstein64/vim-startuptime",
cmd = "StartupTime", -- Note to self: lazy load on command cmd = "StartupTime", -- Note to self: lazy load on command
init = function () init = function()
-- Note to self: init is called during startup. Configuration for vim plugins typically should be set in an init function -- Note to self: init is called during startup. Configuration for vim plugins typically should be set in an init function
end, end,
}, },
{ {
"lukas-reineke/indent-blankline.nvim", "lukas-reineke/indent-blankline.nvim",
main = "ibl", main = "ibl",
config = function () config = function()
require("ibl").setup() require("ibl").setup()
end end
}, },

View file

@ -137,7 +137,7 @@ return {
}, },
opts = function() opts = function()
return { return {
ignored = { }, ignored = {},
} }
end, end,
config = function(_, opts) config = function(_, opts)
@ -177,7 +177,8 @@ return {
local has_words_before = function() local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0)) local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
cmp.setup({ cmp.setup({
@ -207,7 +208,7 @@ return {
else else
fallback() fallback()
end end
end, {"i", "s"}), end, { "i", "s" }),
["<Tab>"] = cmp.mapping(function(fallback) ["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then if cmp.visible() then
cmp.select_next_item() cmp.select_next_item()

View file

@ -37,26 +37,26 @@ return {
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
}, },
config = function (_, opts) config = function(_, opts)
local config = require("nvim-treesitter.parsers").get_parser_configs() local config = require("nvim-treesitter.parsers").get_parser_configs()
config.gsp = { config.gsp = {
install_info = { install_info = {
url = "https://git.sr.ht/~mango/tree-sitter-gsp", url = "https://git.sr.ht/~mango/tree-sitter-gsp",
files = {"src/parser.c"}, files = { "src/parser.c" },
}, },
filetype = "gsp", filetype = "gsp",
} }
config.fluent = { config.fluent = {
install_info = { install_info = {
url = "https://github.com/projectfluent/tree-sitter-fluent", -- local path or git repo url = "https://github.com/projectfluent/tree-sitter-fluent", -- local path or git repo
files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
}, },
filetype = "fluent", -- if filetype does not match the parser name filetype = "fluent", -- if filetype does not match the parser name
} }
config.htmljinja = { config.htmljinja = {
install_info = { install_info = {
url = "https://github.com/null2264/tree-sitter-htmldjango", -- local path or git repo url = "https://github.com/null2264/tree-sitter-htmldjango", -- local path or git repo
files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc files = { "src/parser.c" }, -- note that some parsers also require src/scanner.c or src/scanner.cc
}, },
filetype = "htmljinja", -- if filetype does not match the parser name filetype = "htmljinja", -- if filetype does not match the parser name
} }

View file

@ -20,7 +20,7 @@ end
function M.map(modes, key, target, opts) function M.map(modes, key, target, opts)
local mt = {} local mt = {}
for mode in modes:gmatch"." do for mode in modes:gmatch "." do
table.insert(mt, mode) table.insert(mt, mode)
end end
@ -98,6 +98,7 @@ function M.lazy_file()
end, end,
}) })
end end
-- >>[LAZY] -- >>[LAZY]
return M return M

View file

@ -2,6 +2,10 @@
end_of_line = lf end_of_line = lf
insert_final_newline = true insert_final_newline = true
[*.lua]
indent_style = space
indent_size = 4
[*.{nix,kbd}] [*.{nix,kbd}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2