diff options
author | sinanmohd <sinan@sinanmohd.com> | 2024-03-01 19:11:19 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2024-03-01 19:12:16 +0530 |
commit | 1bc4074843eeba4b30d6ee2ed877afd74e1fc44e (patch) | |
tree | 6a498e69d47ecb174bd13989f948735faf8bf0a6 /lua/plugins | |
parent | 32f76c11be0556da1263b83b295e0381e6ee45f0 (diff) |
fmt: init stylua
Diffstat (limited to 'lua/plugins')
-rw-r--r-- | lua/plugins/init.lua | 31 | ||||
-rw-r--r-- | lua/plugins/maps.lua | 46 | ||||
-rw-r--r-- | lua/plugins/opts/cmp.lua | 160 | ||||
-rw-r--r-- | lua/plugins/opts/lspconfig.lua | 48 | ||||
-rw-r--r-- | lua/plugins/opts/lualine.lua | 2 | ||||
-rw-r--r-- | lua/plugins/opts/misc.lua | 40 |
6 files changed, 163 insertions, 164 deletions
diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 07d7639..3a2fc26 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -11,7 +11,7 @@ require("lazy").setup({ { "nvim-lualine/lualine.nvim", - opts = require "plugins.opts.lualine", + opts = require("plugins.opts.lualine"), }, { @@ -19,10 +19,10 @@ require("lazy").setup({ lazy = false, priority = 1000, - opts = { transparent = true, }, + opts = { transparent = true }, config = function(_, opts) require("tokyonight").setup(opts) - vim.cmd.colorscheme "tokyonight-night" + vim.cmd.colorscheme("tokyonight-night") end, }, @@ -32,15 +32,15 @@ require("lazy").setup({ event = { "BufReadPost", "BufNewFile" }, cmd = { "TSInstall", "TSBufEnable", "TSBufDisable", "TSModuleInfo" }, - opts = require "plugins.opts.treesitter", + opts = require("plugins.opts.treesitter"), config = function(_, opts) require("nvim-treesitter.configs").setup(opts) end, }, { - 'VonHeikemen/lsp-zero.nvim', - branch = 'v3.x', + "VonHeikemen/lsp-zero.nvim", + branch = "v3.x", lazy = true, config = false, @@ -52,11 +52,11 @@ require("lazy").setup({ }, { - 'hrsh7th/nvim-cmp', - event = 'InsertEnter', + "hrsh7th/nvim-cmp", + event = "InsertEnter", dependencies = { { - 'L3MON4D3/LuaSnip', + "L3MON4D3/LuaSnip", dependencies = "rafamadriz/friendly-snippets", config = function(_, opts) @@ -74,7 +74,7 @@ require("lazy").setup({ require("nvim-autopairs").setup(opts) -- setup cmp for autopairs - local cmp_autopairs = require "nvim-autopairs.completion.cmp" + local cmp_autopairs = require("nvim-autopairs.completion.cmp") require("cmp").event:on("confirm_done", cmp_autopairs.on_confirm_done()) end, }, @@ -89,18 +89,17 @@ require("lazy").setup({ }, opts = function() - return require "plugins.opts.cmp" + return require("plugins.opts.cmp") end, - }, { - 'neovim/nvim-lspconfig', - cmd = 'LspInfo', - event = { 'BufReadPre', 'BufNewFile' }, + "neovim/nvim-lspconfig", + cmd = "LspInfo", + event = { "BufReadPre", "BufNewFile" }, config = function() - require "plugins.opts.lspconfig" + require("plugins.opts.lspconfig") end, }, }) diff --git a/lua/plugins/maps.lua b/lua/plugins/maps.lua index 7c5f29b..84a0703 100644 --- a/lua/plugins/maps.lua +++ b/lua/plugins/maps.lua @@ -2,34 +2,34 @@ local M = {} local maps = {} maps.gitsigns = { - n = { - ["<leader>gb"] = { - function() - package.loaded.gitsigns.blame_line() - end, - "Blame line", - }, + n = { + ["<leader>gb"] = { + function() + package.loaded.gitsigns.blame_line() + end, + "Blame line", + }, - ["<leader>td"] = { - function() - require("gitsigns").toggle_deleted() - end, - "Toggle deleted", - }, - }, + ["<leader>td"] = { + function() + require("gitsigns").toggle_deleted() + end, + "Toggle deleted", + }, + }, } M.load = function(name, opts) - local submaps = maps[name] - opts = opts or {} + local submaps = maps[name] + opts = opts or {} - vim.schedule(function() - for mode, keytab in pairs(submaps) do - for key, fun in pairs(keytab) do - vim.keymap.set(mode, key, fun[1], { desc = fun[2] }, opts) - end - end - end) + vim.schedule(function() + for mode, keytab in pairs(submaps) do + for key, fun in pairs(keytab) do + vim.keymap.set(mode, key, fun[1], { desc = fun[2] }, opts) + end + end + end) end return M diff --git a/lua/plugins/opts/cmp.lua b/lua/plugins/opts/cmp.lua index c423a31..65e48b5 100644 --- a/lua/plugins/opts/cmp.lua +++ b/lua/plugins/opts/cmp.lua @@ -1,96 +1,96 @@ -local cmp = require "cmp" -local lspzero_cmp_act = require('lsp-zero').cmp_action() +local cmp = require("cmp") +local lspzero_cmp_act = require("lsp-zero").cmp_action() local function border(hl_name) - return { - { "╭", hl_name }, - { "─", hl_name }, - { "╮", hl_name }, - { "│", hl_name }, - { "╯", hl_name }, - { "─", hl_name }, - { "╰", hl_name }, - { "│", hl_name }, - } + return { + { "╭", hl_name }, + { "─", hl_name }, + { "╮", hl_name }, + { "│", hl_name }, + { "╯", hl_name }, + { "─", hl_name }, + { "╰", hl_name }, + { "│", hl_name }, + } end local options = { - completion = { - completeopt = "menu,menuone", - }, + completion = { + completeopt = "menu,menuone", + }, - window = { - completion = { - border = border "CmpBorder", - winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,CursorLine:PmenuSel", - scrollbar = false, - }, - documentation = { - border = border "CmpDocBorder", - winhighlight = "Normal:CmpDoc", - }, - }, + window = { + completion = { + border = border("CmpBorder"), + winhighlight = "Normal:CmpPmenu,CursorLine:CmpSel,CursorLine:PmenuSel", + scrollbar = false, + }, + documentation = { + border = border("CmpDocBorder"), + winhighlight = "Normal:CmpDoc", + }, + }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, - formatting = { - fields = { "abbr", "kind", "menu" }, + formatting = { + fields = { "abbr", "kind", "menu" }, - format = function(_, item) - local icons = { - Text = " ", - Method = " ", - Function = " ", - Constructor = " ", - Field = " ", - Variable = " ", - Class = " ", - Interface = " ", - Module = " ", - Property = " ", - Unit = " ", - Value = " ", - Enum = " ", - Keyword = " ", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - } + format = function(_, item) + local icons = { + Text = " ", + Method = " ", + Function = " ", + Constructor = " ", + Field = " ", + Variable = " ", + Class = " ", + Interface = " ", + Module = " ", + Property = " ", + Unit = " ", + Value = " ", + Enum = " ", + Keyword = " ", + Snippet = " ", + Color = " ", + File = " ", + Reference = " ", + Folder = " ", + EnumMember = " ", + Constant = " ", + Struct = " ", + Event = " ", + Operator = " ", + TypeParameter = " ", + } - local icon = icons[item.kind] or "" - item.kind = string.format(" %s %s", icon, item.kind) + local icon = icons[item.kind] or "" + item.kind = string.format(" %s %s", icon, item.kind) - return item - end, - }, + return item + end, + }, - mapping = cmp.mapping.preset.insert({ - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-u>'] = cmp.mapping.scroll_docs(-4), - ['<C-d>'] = cmp.mapping.scroll_docs(4), - ['<C-f>'] = lspzero_cmp_act.luasnip_jump_forward(), - ['<C-b>'] = lspzero_cmp_act.luasnip_jump_backward(), - }), + mapping = cmp.mapping.preset.insert({ + ["<C-Space>"] = cmp.mapping.complete(), + ["<C-u>"] = cmp.mapping.scroll_docs(-4), + ["<C-d>"] = cmp.mapping.scroll_docs(4), + ["<C-f>"] = lspzero_cmp_act.luasnip_jump_forward(), + ["<C-b>"] = lspzero_cmp_act.luasnip_jump_backward(), + }), - sources = { - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "nvim_lua" }, - { name = "path" }, - }, + sources = { + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "nvim_lua" }, + { name = "path" }, + }, } return options diff --git a/lua/plugins/opts/lspconfig.lua b/lua/plugins/opts/lspconfig.lua index 798e6c8..0a00fa7 100644 --- a/lua/plugins/opts/lspconfig.lua +++ b/lua/plugins/opts/lspconfig.lua @@ -1,35 +1,35 @@ -local lspconfig = require "lspconfig" -local lsp_zero = require "lsp-zero" +local lspconfig = require("lspconfig") +local lsp_zero = require("lsp-zero") lsp_zero.extend_lspconfig() lsp_zero.set_sign_icons({ - error = " ", - warn = " ", - info = " ", - hint = " " + error = " ", + warn = " ", + info = " ", + hint = " ", }) lsp_zero.on_attach(function(_, bufnr) - lsp_zero.default_keymaps({buffer = bufnr}) + lsp_zero.default_keymaps({ buffer = bufnr }) end) lspconfig.lua_ls.setup(lsp_zero.nvim_lua_ls({ - settings = { - Lua = { - diagnostics = { - globals = { 'mp' } -- mpv global - } - } - } + settings = { + Lua = { + diagnostics = { + globals = { "mp" }, -- mpv global + }, + }, + }, })) -lspconfig.ccls.setup { - init_options = { - cache = { - directory = vim.fn.stdpath('cache') .. '/ccls' - } - } -} +lspconfig.ccls.setup({ + init_options = { + cache = { + directory = vim.fn.stdpath("cache") .. "/ccls", + }, + }, +}) -lspconfig.bashls.setup {} -lspconfig.nil_ls.setup {} -lspconfig.pyright.setup {} +lspconfig.bashls.setup({}) +lspconfig.nil_ls.setup({}) +lspconfig.pyright.setup({}) diff --git a/lua/plugins/opts/lualine.lua b/lua/plugins/opts/lualine.lua index 456fa37..708a12b 100644 --- a/lua/plugins/opts/lualine.lua +++ b/lua/plugins/opts/lualine.lua @@ -2,7 +2,7 @@ return { sections = { lualine_a = { "mode" }, lualine_b = { "branch", "diff" }, - lualine_c = {{ "buffers", mode = 2 }}, + lualine_c = { { "buffers", mode = 2 } }, lualine_x = { "diagnostics" }, lualine_y = { "progress" }, diff --git a/lua/plugins/opts/misc.lua b/lua/plugins/opts/misc.lua index e228023..a7cbafa 100644 --- a/lua/plugins/opts/misc.lua +++ b/lua/plugins/opts/misc.lua @@ -1,30 +1,30 @@ local M = {} -local maps = require "plugins.maps" +local maps = require("plugins.maps") M.gitsigns = { - signs = { - add = { text = "+" }, - change = { text = "~" }, - delete = { text = "-" }, - topdelete = { text = "‾" }, - changedelete = { text = "~" }, - untracked = { text = "│" }, - }, + signs = { + add = { text = "+" }, + change = { text = "~" }, + delete = { text = "-" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "│" }, + }, - on_attach = function(bufnr) - maps.load("gitsigns", { buffer = bufnr }) - end, + on_attach = function(bufnr) + maps.load("gitsigns", { buffer = bufnr }) + end, } -M.luasnip = function (opts) - require("luasnip").config.set_config(opts) +M.luasnip = function(opts) + require("luasnip").config.set_config(opts) - -- vscode format - require("luasnip.loaders.from_vscode").lazy_load() - -- snipmate format - require("luasnip.loaders.from_snipmate").lazy_load() - -- lua format - require("luasnip.loaders.from_lua").lazy_load() + -- vscode format + require("luasnip.loaders.from_vscode").lazy_load() + -- snipmate format + require("luasnip.loaders.from_snipmate").lazy_load() + -- lua format + require("luasnip.loaders.from_lua").lazy_load() end return M |