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