From 3186006e193bc75b11323a66802cf42918dee965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Av=C3=A9?= Date: Wed, 6 Sep 2023 16:28:37 +0200 Subject: [PATCH] Format lua --- awesome/components/screen.lua | 2 +- awesome/components/widgets/tag-list.lua | 12 ++--- awesome/components/widgets/task-list.lua | 46 ++++++++--------- awesome/keys.lua | 64 ++++++++++++------------ awesome/rc.lua | 24 ++++----- awesome/utils/mouse.lua | 2 +- awesome/utils/signals.lua | 18 +++---- nvim/lua/lsp_config.lua | 46 ++++++++--------- nvim/lua/lualine_config.lua | 2 +- nvim/lua/plugins.lua | 16 +++--- 10 files changed, 116 insertions(+), 116 deletions(-) diff --git a/awesome/components/screen.lua b/awesome/components/screen.lua index edca00a..a196e60 100644 --- a/awesome/components/screen.lua +++ b/awesome/components/screen.lua @@ -9,7 +9,7 @@ local top_panel = require("components.top-panel") -- Set up each screen (add tags & panels) awful.screen.connect_for_each_screen(function(s) for i = 1, 10, 1 - do + do awful.tag.add(tostring(i % 10), { layout = grid, screen = s, diff --git a/awesome/components/widgets/tag-list.lua b/awesome/components/widgets/tag-list.lua index b564d25..c6d8104 100644 --- a/awesome/components/widgets/tag-list.lua +++ b/awesome/components/widgets/tag-list.lua @@ -17,14 +17,14 @@ tag_list.create = function(s) local taglist_buttons = awful.util.table.join( awful.button({}, 1, - function(c) - c.selected = true - for _, tag in ipairs(s.tags) do - if tag.index ~= c.index then - tag.selected = false + function(c) + c.selected = true + for _, tag in ipairs(s.tags) do + if tag.index ~= c.index then + tag.selected = false + end end end - end ) ) return awful.widget.taglist { diff --git a/awesome/components/widgets/task-list.lua b/awesome/components/widgets/task-list.lua index c3d895a..f23f8dd 100644 --- a/awesome/components/widgets/task-list.lua +++ b/awesome/components/widgets/task-list.lua @@ -57,7 +57,7 @@ local function list_update(w, buttons, label, _, objects) local index = 0 local count = 0 for _ in pairs(objects) do - count = count + 1 + count = count + 1 end local static_length = 16 * count local total_text_length = 0 @@ -95,13 +95,13 @@ local function list_update(w, buttons, label, _, objects) ll:add(cbm) if (index % 2 == 0) then - local end_color = (count == index or objects[index+1].minimized) and "" or theme.top_panel_powerline - local main_color = o.minimized and "" or theme.bg_normal - bgb:set_widget(pl(ll, main_color, end_color, true)) + local end_color = (count == index or objects[index+1].minimized) and "" or theme.top_panel_powerline + local main_color = o.minimized and "" or theme.bg_normal + bgb:set_widget(pl(ll, main_color, end_color, true)) else - local end_color = (count == index or objects[index+1].minimized) and "" or theme.bg_normal - local main_color = o.minimized and "" or theme.top_panel_powerline - bgb:set_widget(pl(ll, main_color, end_color, true)) + local end_color = (count == index or objects[index+1].minimized) and "" or theme.bg_normal + local main_color = o.minimized and "" or theme.top_panel_powerline + bgb:set_widget(pl(ll, main_color, end_color, true)) end l:buttons(create_buttons(buttons, o)) @@ -121,7 +121,7 @@ local function list_update(w, buttons, label, _, objects) if text == nil or text == '' then tbm:set_margins(0) else - -- truncate when title is too long + -- truncate when title is too long local text_only = text:match('>(.*)<') local max_length = math.floor((155 - static_length) / count) if (truncate and text_only:len() > max_length) then @@ -141,11 +141,11 @@ local function list_update(w, buttons, label, _, objects) bg_image = bg_image(tb, o, nil, objects, i) end -- bgb:set_bgimage(bg_image) - if icon then - ib.image = icon - else - ibm:set_margins(0) - end + if icon then + ib.image = icon + else + ibm:set_margins(0) + end w:add(bgb) end @@ -163,16 +163,16 @@ local tasklist_buttons = awful.util.table.join( if c == client.focus then c.minimized = true else - -- Without this, the following - -- :isvisible() makes no sense - c.minimized = false - if not c:isvisible() and c.first_tag then - c.first_tag:view_only() - end - -- This will also un-minimize - -- the client, if needed - client.focus = c - c:raise() + -- Without this, the following + -- :isvisible() makes no sense + c.minimized = false + if not c:isvisible() and c.first_tag then + c.first_tag:view_only() + end + -- This will also un-minimize + -- the client, if needed + client.focus = c + c:raise() end end ), diff --git a/awesome/keys.lua b/awesome/keys.lua index c9fe554..9916241 100644 --- a/awesome/keys.lua +++ b/awesome/keys.lua @@ -41,14 +41,14 @@ local focus_bydirection = function(direction) end require("awesomewm-vim-tmux-navigator") { - up = {"Up", "k"}, - down = {"Down", "j"}, - left = {"Left", "h"}, - right = {"Right", "l"}, - mod = "Mod4", - mod_keysym = "Super_L", - experimental = true, - focus = focus_bydirection + up = {"Up", "k"}, + down = {"Down", "j"}, + left = {"Left", "h"}, + right = {"Right", "l"}, + mod = "Mod4", + mod_keysym = "Super_L", + experimental = true, + focus = focus_bydirection } @@ -73,7 +73,7 @@ local function move_client(sel, dir) client.focus = sel sel:raise() - -- swapping to an empty screen + -- swapping to an empty screen elseif sel == c then sel:move_to_screen(awful.screen.focused()) @@ -182,10 +182,10 @@ keys.globalkeys = gears.table.join( ), -- Lock the screen awful.key({"Control", "Mod1"}, "l", - function() - awful.spawn('bash -c "i3lockr --blur 25"') - end, - {description = "Open lock", group = "launcher"} + function() + awful.spawn('bash -c "i3lockr --blur 25"') + end, + {description = "Open lock", group = "launcher"} ), -- Generate TOTP awful.key({modkey}, "y", @@ -260,22 +260,22 @@ keys.globalkeys = gears.table.join( -- ALSA volume control awful.key({}, "XF86AudioRaiseVolume", - function() - volume_widget:inc(5) - end, - {description = "volume up", group = "hotkeys"} + function() + volume_widget:inc(5) + end, + {description = "volume up", group = "hotkeys"} ), awful.key({}, "XF86AudioLowerVolume", - function() - volume_widget:dec(5) - end, - {description = "volume down", group = "hotkeys"} + function() + volume_widget:dec(5) + end, + {description = "volume down", group = "hotkeys"} ), awful.key({}, "XF86AudioMute", - function() - volume_widget:toggle() - end, - {description = "toggle mute", group = "hotkeys"} + function() + volume_widget:toggle() + end, + {description = "toggle mute", group = "hotkeys"} ), awful.key({}, "XF86AudioNext", function() @@ -302,16 +302,16 @@ keys.globalkeys = gears.table.join( {description = "play/pause music", group = "hotkeys"} ), awful.key({modkey}, "XF86AudioRaiseVolume", - function() + function() awful.spawn("playerctl next", false) - end, - {description = "volume up", group = "hotkeys"} + end, + {description = "volume up", group = "hotkeys"} ), awful.key({modkey}, "XF86AudioLowerVolume", - function() + function() awful.spawn("playerctl previous", false) - end, - {description = "volume down", group = "hotkeys"} + end, + {description = "volume down", group = "hotkeys"} ), -- Screenshot on prtscn using scrot @@ -638,7 +638,7 @@ keys.clientkeys = gears.table.join( -- float client awful.key({modkey}, "f", function(c) - awful.client.floating.toggle(c) + awful.client.floating.toggle(c) end, {description = "float", group = "client"} ), diff --git a/awesome/rc.lua b/awesome/rc.lua index 94eccd6..4492fad 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -21,23 +21,23 @@ require("awful.autofocus") -- List of apps to run on start-up local run_on_start_up = { - "numlockx on", - "nm-applet", - "xcape -e \"Super_L=Super_L|XF86Launch5\" -t 5000", - gears.filesystem.get_configuration_dir() .. "/scripts/setup_display.sh", + "numlockx on", + "nm-applet", + "xcape -e \"Super_L=Super_L|XF86Launch5\" -t 5000", + gears.filesystem.get_configuration_dir() .. "/scripts/setup_display.sh", "feh --no-fehbg --bg-fill " .. gears.filesystem.get_configuration_dir() .. "/images/wallpaper.png", } -- Define layouts awful.layout.layouts = { - awful.layout.suit.tile, - awful.layout.suit.floating, - grid.horizontal, - awful.layout.suit.fair.horizontal, - awful.layout.suit.tile.left, - awful.layout.suit.tile.bottom, - awful.layout.suit.tile.top, - grid, + awful.layout.suit.tile, + awful.layout.suit.floating, + grid.horizontal, + awful.layout.suit.fair.horizontal, + awful.layout.suit.tile.left, + awful.layout.suit.tile.bottom, + awful.layout.suit.tile.top, + grid, } -- Run all the apps listed in run_on_start_up diff --git a/awesome/utils/mouse.lua b/awesome/utils/mouse.lua index dfe8d6b..42379d1 100644 --- a/awesome/utils/mouse.lua +++ b/awesome/utils/mouse.lua @@ -2,7 +2,7 @@ local mouse_utils = {} function mouse_utils.move_mouse_onto_focused_client() local c = client.focus - if c then + if c then local geometry = c:geometry() local mouse_coords = mouse.coords() local margin = 10 diff --git a/awesome/utils/signals.lua b/awesome/utils/signals.lua index fc79fa3..19f8583 100644 --- a/awesome/utils/signals.lua +++ b/awesome/utils/signals.lua @@ -47,14 +47,14 @@ collectgarbage("setpause", 110) collectgarbage("setstepmul", 1000) client.connect_signal("property::maximized", function(focused) - local hide = focused.maximized or focused.fullscreen - for _, c in ipairs(client.get()) do - if not c.floating and c.screen == focused.screen and c.first_tag == focused.first_tag then - c.minimized = hide - end - end + local hide = focused.maximized or focused.fullscreen + for _, c in ipairs(client.get()) do + if not c.floating and c.screen == focused.screen and c.first_tag == focused.first_tag then + c.minimized = hide + end + end - focused.minimized = false + focused.minimized = false end) client.connect_signal("unmanage", function(unmanaged) @@ -69,11 +69,11 @@ end) client.connect_signal("focus", function(c) if #c.screen.clients > 1 then - c.border_color = beautiful.border_focus + c.border_color = beautiful.border_focus end gears.timer.delayed_call(mouse_utils.move_mouse_onto_focused_client) end) client.connect_signal("unfocus", function(c) - c.border_color = beautiful.border_normal + c.border_color = beautiful.border_normal end) diff --git a/nvim/lua/lsp_config.lua b/nvim/lua/lsp_config.lua index a738d09..1bfa56f 100644 --- a/nvim/lua/lsp_config.lua +++ b/nvim/lua/lsp_config.lua @@ -5,32 +5,32 @@ if not hascmp then end local select_next = function(fallback) - if cmp.visible() then + if cmp.visible() then if require'snippy'.can_expand_or_advance() then - cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) + cmp.select_next_item({ behavior = cmp.SelectBehavior.Select }) else - cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) + cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert }) end - elseif require'snippy'.can_expand_or_advance() then + elseif require'snippy'.can_expand_or_advance() then require'snippy'.expand_or_advance() - else + else fallback() - end + end end local select_previous = function(fallback) - if cmp.visible() then + if cmp.visible() then if require'snippy'.can_expand_or_advance() then - cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Select }) else - cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) + cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert }) end - elseif require'snippy'.can_jump(-1) then + elseif require'snippy'.can_jump(-1) then require'snippy'.previous() - else + else fallback() - end end +end cmp.setup({ snippet = { @@ -61,8 +61,8 @@ cmp.setup({ -- { name = 'ultisnips' }, -- For ultisnips users. { name = 'snippy' }, -- For snippy users. }, { - { name = 'buffer' }, - }) + { name = 'buffer' }, + }) }) require('snippy').setup({ @@ -79,8 +79,8 @@ cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. }, { - { name = 'buffer' }, - }) + { name = 'buffer' }, + }) }) -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). @@ -97,8 +97,8 @@ cmp.setup.cmdline(':', { sources = cmp.config.sources({ { name = 'path' } }, { - { name = 'cmdline' } - }) + { name = 'cmdline' } + }) }) local cmp_completion = require('nvim-autopairs.completion.cmp') @@ -194,11 +194,11 @@ require('lspconfig').emmet_ls.setup({ capabilities = capabilities, filetypes = { "css", "eruby", "html", "javascript", "javascriptreact", "less", "sass", "scss", "svelte", "pug", "typescriptreact", "vue" }, init_options = { - html = { - options = { - ["bem.enabled"] = true, + html = { + options = { + ["bem.enabled"] = true, + }, }, - }, } }) @@ -280,7 +280,7 @@ require("formatter").setup { require("formatter.filetypes.python").black, }, - } + } } -- Show line diagnostics automatically in hover window diff --git a/nvim/lua/lualine_config.lua b/nvim/lua/lualine_config.lua index 749546e..2a03c28 100644 --- a/nvim/lua/lualine_config.lua +++ b/nvim/lua/lualine_config.lua @@ -4,7 +4,7 @@ if not haslualine then end local function getWords() - return tostring(vim.fn.wordcount().words) .. " Words" + return tostring(vim.fn.wordcount().words) .. " Words" end lualine.setup({ diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index c10d5c1..e8b9f48 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -1,14 +1,14 @@ -- Install Lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end vim.opt.rtp:prepend(lazypath)