Merge branch 'dev' into logos

This commit is contained in:
David JULIEN 2022-08-17 18:36:37 +02:00
commit 09faf18588
38 changed files with 1117 additions and 1047 deletions

View File

@ -38,13 +38,7 @@
# Scale factor. It is auto-detected if value is 0.
scale = 0
# Maximum number of notification (0 means no limit)
notification_limit = 0
### Progress bar ###
# Turn on the progess bar. It appears when a progress hint is passed with
# for example dunstify -h int:value:12
# Turn on the progess bar
progress_bar = true
# Set the progress bar height. This includes the frame, so make sure
@ -237,16 +231,6 @@
# user defined timeout.
ignore_dbusclose = false
### Wayland ###
# These settings are Wayland-specific. They have no effect when using X11
# Uncomment this if you want to let notications appear under fullscreen
# applications (default: overlay)
# layer = top
# Set this to true to use X11 output on Wayland.
force_xwayland = false
### Legacy
# Use the Xinerama extension instead of RandR for multi-monitor support.

View File

@ -90,6 +90,7 @@ CertificateFile /etc/ssl/certs/ca-certificates.crt
MaildirStore david.julien@centrale-marseille.fr-local
Subfolders Verbatim
Path /home/swytch/.local/share/mail/david.julien@centrale-marseille.fr/
Inbox /home/swytch/.local/share/mail/david.julien@centrale-marseille.fr/INBOX
Channel david.julien@centrale-marseille.fr
Expunge Both

View File

@ -23,7 +23,7 @@ set signature="/home/swytch/.config/mutt/accounts/ens.signature"
unmacro index o
macro index o "<shell-escape>mailsync<enter>" "run mbsync to sync david.julien@ens-lyon.fr"
mailboxes "=Sent" "=Drafts" "=Trash" "=INBOX" "=internship" "=fanfare"
mailboxes "=Sent" "=Drafts" "=Trash" "=INBOX" "=internship" "=MOVEP" "=QEST" "=fanfare"
set record = "+Sent"
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent"
@ -46,3 +46,9 @@ macro index,pager Cf ";<copy-message>=fanfare<enter>" "copy mail to fanfare"
macro index,pager gI "<change-folder>=internship<enter>" "go to internship"
macro index,pager MI ";<save-message>=internship<enter>" "move mail to internship"
macro index,pager CI ";<copy-message>=internship<enter>" "copy mail to internship"
macro index,pager gm "<change-folder>=MOVEP<enter>" "go to MOVEP"
macro index,pager Mm ";<save-message>=MOVEP<enter>" "move mail to MOVEP"
macro index,pager Cm ";<copy-message>=MOVEP<enter>" "copy mail to MOVEP"
macro index,pager gq "<change-folder>=QEST<enter>" "go to QEST"
macro index,pager Mq ";<save-message>=QEST<enter>" "move mail to QEST"
macro index,pager Cq ";<copy-message>=QEST<enter>" "copy mail to QEST"

View File

@ -23,7 +23,7 @@ set signature="/home/swytch/.config/mutt/accounts/mailo.signature"
unmacro index o
macro index o "<shell-escape>mailsync<enter>" "run mbsync to sync david.julien@mailo.com"
mailboxes "=sent" "=draftbox" "=trash" "=INBOX" "=farigoule" "=promo_fanfare"
mailboxes "=sent" "=draftbox" "=trash" "=INBOX" "=farigoule" "=promo_fanfare" "=mediapart" "=git" "=sosh"
set record = "+sent"
macro index,pager gs "<change-folder>=sent<enter>" "go to sent"
macro index,pager Ms ";<save-message>=sent<enter>" "move mail to sent"
@ -47,3 +47,12 @@ macro index,pager Cf ";<copy-message>=farigoule<enter>" "copy mail to farigoule"
macro index,pager gp "<change-folder>=promo_fanfare<enter>" "go to promo_fanfare"
macro index,pager Mp ";<save-message>=promo_fanfare<enter>" "move mail to promo_fanfare"
macro index,pager Cp ";<copy-message>=promo_fanfare<enter>" "copy mail to promo_fanfare"
macro index,pager gm "<change-folder>=mediapart<enter>" "go to mediapart"
macro index,pager Mm ";<save-message>=mediapart<enter>" "move mail to mediapart"
macro index,pager Cm ";<copy-message>=mediapart<enter>" "copy mail to mediapart"
macro index,pager gg "<change-folder>=git<enter>" "go to git"
macro index,pager Mg ";<save-message>=git<enter>" "move mail to git"
macro index,pager Cg ";<copy-message>=git<enter>" "copy mail to git"
macro index,pager gh "<change-folder>=sosh<enter>" "go to sosh"
macro index,pager Mh ";<save-message>=sosh<enter>" "move mail to sosh"
macro index,pager Ch ";<copy-message>=sosh<enter>" "copy mail to sosh"

View File

@ -1,6 +1,6 @@
# vim: filetype=neomuttrc
# muttrc file for account david.julien@centrale-marseille.fr
set realname = "David JULIEN"
set realname = "Smecta"
set from = "david.julien@centrale-marseille.fr"
set sendmail = "msmtp -a david.julien@centrale-marseille.fr"
alias me david.julien <david.julien@centrale-marseille.fr>
@ -9,7 +9,7 @@ set header_cache = /home/swytch/.cache/mutt/david.julien@centrale-marseille.fr/h
set message_cachedir = /home/swytch/.cache/mutt/david.julien@centrale-marseille.fr/bodies
set mbox_type = Maildir
set crypt_autosign = yes
set crypt_autosign = no
set pgp_sign_as = "0x9F46CD164AE1E813"
bind index,pager gg noop
@ -23,7 +23,7 @@ set signature="/home/swytch/.config/mutt/accounts/centrale.signature"
unmacro index o
macro index o "<shell-escape>mailsync<enter>" "run mbsync to sync david.julien@centrale-marseille.fr"
mailboxes "=Sent" "=Drafts" "=Trash" "=Fanfare"
mailboxes "=Sent" "=Drafts" "=INBOX" "=Trash" "=Fanfare"
set record = "+Sent"
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail to sent"
@ -36,6 +36,10 @@ macro index,pager gt "<change-folder>=Trash<enter>" "go to trash"
macro index,pager Mt ";<save-message>=Trash<enter>" "move mail to trash"
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash"
set trash = "+Trash"
macro index,pager gi "<change-folder>=INBOX<enter>" "go to inbox"
macro index,pager Mi ";<save-message>=INBOX<enter>" "move mail to inbox"
macro index,pager Ci ";<copy-message>=INBOX<enter>" "copy mail to inbox"
set spoolfile = "+INBOX"
macro index,pager gf "<change-folder>=Fanfare<enter>" "go to fanfare"
macro index,pager Mf ";<save-message>=Fanfare<enter>" "move mail to fanfare"
macro index,pager Cf ";<copy-message>=Fanfare<enter>" "copy mail to fanfare"

View File

@ -234,7 +234,7 @@ mpd_music_dir = ~/music
song_list_format = "{$3[%l]$9} {$6%t$9}|{$6%30f$9} %n"
#song_list_format = {%a - }{%t}|{$8%f$9}$R{$3%l$9}
#
song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
song_status_format = $b {$7%a$9 - $6{%t}}|{%f} {(%b)}
#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
#
#song_library_format = {%n - }{%t}|{%f}
@ -313,7 +313,7 @@ song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
## available.
##
#
song_columns_list_format = (6f)[green]{NE} (30)[white]{t|f:Title} (7f)[green]{l} (30)[]{a} (30)[]{b}
song_columns_list_format = (6f)[]{NE} (30)[magenta]{t|f:Title} (7f)[green]{l} (30)[blue]{a} (30)[blue]{b}
#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
#
##### various settings #####

View File

@ -4,10 +4,10 @@
-- Description : c settings file
local opt = vim.opt
local g = vim.g
local opt = vim.opt
local g = vim.g
opt.formatoptions = "trq1jp"
opt.formatoptions = "trq1jp"
-- Snippets
local ls = require("luasnip")
@ -20,32 +20,32 @@ local f = ls.function_node
local copy = utils.copy
ls.snippets = {
c = {
s("main", {
t({ "int main(int argc, char* argv[])" }),
t({ "", "{", "\t" }),
i(0),
t({ "", "\treturn 0;"}),
t({ "", "}"}),
}),
s("fn", {
-- Simple static text.
t("//Parameters: "),
-- function, first parameter is the function, second the Placeholders
-- whose text it gets as input.
f(copy, 2),
t({ "", "" }),
-- Placeholder/Insert.
i(1),
t("("),
-- Placeholder with initial text.
i(2, "int foo"),
-- Linebreak
t({ ")", "{", "\t" }),
i(0),
t({ "", "\treturn 0;"}),
t({ "", "}"}),
}),
},
}
ls.add_snippets( "c", {
s("main", {
t({ "int main(int argc, char* argv[])" }),
t({ "", "{", "\t" }),
i(0),
t({ "", "\treturn 0;"}),
t({ "", "}"}),
}),
s("fn", {
-- Simple static text.
t("//Parameters: "),
-- function, first parameter is the function, second the Placeholders
-- whose text it gets as input.
f(copy, 2),
t({ "", "" }),
-- Placeholder/Insert.
i(1),
t("("),
-- Placeholder with initial text.
i(2, "int foo"),
-- Linebreak
t({ ")", "{", "\t" }),
i(0),
t({ "", "\treturn 0;"}),
t({ "", "}"}),
}),
}, {
key = "c"
})

View File

@ -6,4 +6,5 @@
local opt = vim.opt
local g = vim.g
opt.formatoptions = "trq1jp"
opt.formatoptions = "trq1jp"
opt.tabstop = 4

View File

@ -4,34 +4,33 @@
-- Description : tex filetype config
local opt = vim.opt
local g = vim.g
local opt = vim.opt
opt.formatoptions = "trq1jp"
opt.tabstop = 4
opt.formatoptions = "trq1jp"
opt.tabstop = 4
-- Caps
utils.map("i", "AA", "À")
utils.map("i", "CC", "Ç")
utils.map("i", "EE", "É")
vim.keymap.set("i", "AA", "À")
vim.keymap.set("i", "CC", "Ç")
vim.keymap.set("i", "EE", "É")
-- Unbreakable spaces
utils.map("i", "<Space>etc", "\\,etc.")
utils.map("i", "<Space>:", "\\,:")
vim.keymap.set("i", "<Space>etc", "\\,etc.")
vim.keymap.set("i", "<Space>:", "\\,:")
-- Snippets
local ls = require("luasnip")
-- some shorthands...
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local copy = utils.copy
local copy = utils.copy
-- 'recursive' dynamic snippet. Expands to some text followed by itself.
local function rec_ls()
@ -45,86 +44,86 @@ local function rec_ls()
)
end
ls.snippets = {
tex = {
-- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many
-- \item as necessary by utilizing a choiceNode.
s("ls", {
t({ "\\begin{itemize}", "\t\\item " }),
i(1),
t({ "" }),
d(2, rec_ls, {}),
t({ "", "\\end{itemize}", "" }),
}),
s("lsl", {
t({ "\\begin{itemize}[label=" }),
i(1),
t( { "]", "\t\\item " }),
i(2),
t({ "" }),
d(3, rec_ls, {}),
t({ "", "\\end{itemize}", "" }),
}),
s("frm", {
t({ "\\begin{" }),
i(1),
t({ "}[" }),
i(2),
t({ "]{" }),
f(copy, 1),
t({ ":" }),
i(3, "foo"),
t({ "}", "\t" }),
i(0),
t({ "", "\\end{" }),
f(copy, 1),
t({ "}", "" }),
}),
s("env", {
t({ "\\begin{" }),
i(1, "foo"),
t({ "}", "\t" }),
i(2),
t({ "", "\\end{" }),
f(copy,1),
t({ "}", "" }),
}),
s("tikz", {
t({ "\\begin{center}" }),
t({ "", "\t\\begin{tikzpicture}[main/.style = {draw,circle}]", "\t\t" }),
i(1),
t({ "", "\t\\end{tikzpicture}", "\\end{center}" }),
}),
s("ra", { t( "\\rightarrow" )}),
s("Ra", { t("\\Rightarrow" )}),
s("la", { t("\\leftarrow" )}),
s("La", { t("\\Leftarrow" )}),
s("lra", { t("\\leftrightarrow" )}),
s("Lra", { t("\\Leftrightarrow" )}),
s("bb", {
t({ "\\textbf{" }),
i(1),
t({ "}"}),
}),
s("tt", {
t({ "\\texttt{" }),
i(1),
t({ "}"}),
}),
s("ii", {
t({ "\\textit{" }),
i(1),
t({ "}"}),
}),
s("uu", {
t({ "\\underline{" }),
i(1),
t({ "}"}),
}),
s("fsc", {
t({ "\\textsc{" }),
i(1),
t({ "}"}),
}),
},
}
ls.add_snippets("tex", {
-- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many
-- \item as necessary by utilizing a choiceNode.
s("ls", {
t({ "\\begin{itemize}", "\t\\item " }),
i(1),
t({ "" }),
d(2, rec_ls, {}),
t({ "", "\\end{itemize}" }),
}),
s("lsl", {
t({ "\\begin{itemize}[label=" }),
i(1),
t( { "]", "\t\\item " }),
i(2),
t({ "" }),
d(3, rec_ls, {}),
t({ "", "\\end{itemize}" }),
}),
s("frm", {
t({ "\\begin{" }),
i(1),
t({ "}[" }),
i(2),
t({ "]{" }),
f(copy, 1),
t({ ":" }),
i(3, "foo"),
t({ "}", "\t" }),
i(0),
t({ "", "\\end{" }),
f(copy, 1),
t({ "}" }),
}),
s("env", {
t({ "\\begin{" }),
i(1, "foo"),
t({ "}", "\t" }),
i(2),
t({ "", "\\end{" }),
f(copy,1),
t({ "}"}),
}),
s("tikz", {
t({ "\\begin{center}" }),
t({ "", "\t\\begin{tikzpicture}[main/.style = {draw,circle}]", "\t\t" }),
i(1),
t({ "", "\t\\end{tikzpicture}", "\\end{center}" }),
}),
s("ra", { t( "\\rightarrow" )}),
s("Ra", { t("\\Rightarrow" )}),
s("la", { t("\\leftarrow" )}),
s("La", { t("\\Leftarrow" )}),
s("lra", { t("\\leftrightarrow" )}),
s("Lra", { t("\\Leftrightarrow" )}),
s("bb", {
t({ "\\textbf{" }),
i(1),
t({ "}"}),
}),
s("tt", {
t({ "\\texttt{" }),
i(1),
t({ "}"}),
}),
s("ii", {
t({ "\\textit{" }),
i(1),
t({ "}"}),
}),
s("uu", {
t({ "\\underline{" }),
i(1),
t({ "}"}),
}),
s("fsc", {
t({ "\\textsc{" }),
i(1),
t({ "}"}),
}),
}, {
key = "tex"
})

View File

@ -9,5 +9,5 @@ local file = os.getenv("XDG_STATE_HOME") .. "/nvim_colorscheme"
local colorscheme = utils.lines_from(file)[0]
require("astronomy").setup {
variant = colorscheme,
variant = colorscheme,
}

View File

@ -6,13 +6,11 @@
local M = {} -- The module to export
M = {
lsp_path = vim.fn.stdpath("data").. "/lsp",
-- misc
sign_error = "",
sign_warning = "",
sign_hint = "",
sign_info = "",
-- misc
sign_error = "",
sign_warn = "",
sign_hint = "",
sign_info = "",
}
-- Make it accessible everywhere

View File

@ -1,20 +0,0 @@
-- Author : swytch
-- Created : Tuesday May 18, 2021 12:08:51 CET
-- License : GPLv3
-- Description : clangd config file for lsp
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
require("lspconfig").clangd.setup {
cmd = { "clangd",
"--background-index",
"--suggest-missing-includes",
"--clang-tidy",
"--header-insertion=iwyu"
},
-- The following example advertise capabilities to `clangd`.
capabilities = capabilities,
}

View File

@ -1,80 +0,0 @@
-- Author : swytch
-- Created : Tuesday May 18, 2021 12:08:51 CET
-- License : GPLv3
-- Description : neovim lsp config file
local M = {}
vim.fn.sign_define(
"DiagnosticSignError",
{
texthl = "DiagnosticVirtualTextError",
text = globals.sign_error,
numhl = "DiagnosticSignError"
}
)
vim.fn.sign_define(
"DiagnosticSignWarn",
{
texthl = "DiagnosticVirtualTextWarn",
text = globals.sign_warning,
numhl = "DiagnosticSignWarn"
}
)
vim.fn.sign_define(
"DiagnosticSignHint",
{
texthl = "DiagnosticVirtualTextHint",
text = globals.sign_hint,
numhl = "DiagnosticSignHint"
}
)
vim.fn.sign_define(
"DiagnosticSignInfo",
{
texthl = "DiagnosticVirtualTextInfo",
text = globals.sign_info,
numhl = "DiagnosticSignInfo"
}
)
M.icons = {
Class = "",
Color = "",
Constant = " µ ",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "",
Function = "",
Keyword = "",
Interface = "",
Method = "",
Module = "",
Operator = "",
Property = "",
Reference = "",
Snippet = "",
Struct = "",
Text = "",
TypeParameter = "",
Unit = "",
Value = "",
Variable = "",
}
function M.setup()
local kinds = vim.lsp.protocol.CompletionItemKind
for i, kind in ipairs(kinds) do
kinds[i] = M.icons[kind] or kind
end
local ft = vim.bo.filetype
if ft == "cpp" then ft = "c" end
require("lsp." .. ft) -- ./<ft>.lua
end
return M

View File

@ -1,42 +0,0 @@
-- Author : swytch
-- Created : Tuesday May 18, 2021 12:08:51 CET
-- License : GPLv3
-- Description : sumneko (lua) config file for lsp
local system_name = "Linux"
-- set the path to the sumneko installation; if you previously installed via the now deprecated :LspInstall, use
local sumneko_root_path = vim.fn.stdpath("data") ..
"/lsp_servers/sumneko_lua/extension/server"
local sumneko_binary = sumneko_root_path .. "/bin/" .. system_name ..
"/lua-language-server"
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
require'lspconfig'.sumneko_lua.setup {
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"};
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {"vim", "use", "globals", "utils"},
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = {
enable = false,
},
},
},
}

View File

@ -1,8 +0,0 @@
-- Author : swytch
-- Created : Tuesday May 18, 2021 15:03:43 CET
-- License : GPLv3
-- Description : jedi (python) config file for lsp
require("lspconfig").jedi_language_server.setup{
cmd = { vim.fn.stdpath("data") .. "/lsp_servers/jedi_language_server/venv/bin/jedi-language-server" }
}

View File

@ -1,13 +0,0 @@
-- Author : swytch
-- Created : Saturday May 23, 2021 10:34:53 CET
-- License : GPLv3
-- Description : LaTeX config file for lsp
require("lspconfig").texlab.setup {
cmd = { vim.fn.stdpath("data") .. "/lsp_servers/latex/texlab" },
settings = {
build = {
executable = "pdflatex"
}
}
}

View File

@ -3,30 +3,31 @@
-- License : GPLv3
-- Description : neovim mappings file
utils.map("n", "<space>", "<leader>")
utils.map("n", "<leader>y", "\"+y")
utils.map("n", "<leader>p", "\"+P")
utils.map("n", "<leader><enter>", "<cmd>w! | !compiler %<CR>")
utils.map("n", "<leader>u", "<cmd>PackerSync<CR>")
utils.map("n", "<leader>c", "<cmd>ColorizerToggle<CR>")
vim.keymap.set({ "n", "v" }, "<space>", "<Nop>", { silent = true })
vim.g.mapleader = " "
-- LSP
utils.map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
utils.map("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>")
utils.map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>")
utils.map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>")
utils.map("n", "<leader>ln", "<cmd>lua vim.diagnostic.goto_next()<CR>")
utils.map("n", "<leader>lp", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
utils.map("n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>")
-- Dealing with word wrap
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'",
{ expr = true, silent = true })
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'",
{ expr = true, silent = true })
vim.keymap.set("n", "<leader>y", "\"+y")
vim.keymap.set("n", "<leader>p", "\"+P")
vim.keymap.set("n", "<leader><enter>", "<cmd>w! | !compiler %<CR>")
vim.keymap.set("n", "<leader>u", function() require("packer").sync() end)
-- telescope
utils.map("n", "<leader>tf", "<cmd>Telescope find_files<CR>")
utils.map("n", "<leader>tb", "<cmd>Telescope file_browser<CR>")
utils.map("n", "<leader>tl", "<cmd>Telescope live_grep<CR>")
vim.keymap.set("n", "<leader>ff",
function() require("telescope.builtin").find_files() end)
vim.keymap.set("n", "<leader>fb",
function() require("telescope.builtin").buffers() end)
vim.keymap.set("n", "<leader>fl",
function() require("telescope.builtin").live_grep() end)
-- colorscheme
utils.map("n", "<C-s>", "<cmd>lua require(\"astronomy\").toggle_variant()<CR>")
vim.keymap.set("n", "<C-s>",
function() require("astronomy").toggle_variant() end)
-- snippets
utils.map("i", "<C-E>", "<Plug>luasnip-next-choice", {})
utils.map("s", "<C-E>", "<Plug>luasnip-next-choice", {})
vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice")

View File

@ -7,77 +7,121 @@ local cmp = require("cmp")
local luasnip = require("luasnip")
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
local check_backspace = function()
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
local has_words_before = function()
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
end
-- If you want insert `(` after select function or method item
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
cmp.setup {
completion = {
autocomplete = false
},
sources = {
{ name = "path" },
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "calc" },
{ name = "spell" },
{ name = "treesitter" },
},
formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[lsp]",
nvim_lua = "[nvim]",
luasnip = "[snip]",
path = "[path]",
buffer = "[buff]",
calc = "[calc]",
spell = "[spel]",
treesitter = "[tree]",
})[entry.source.name]
return vim_item
end,
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}
-- Custom item icons
local icons = {
Class = "",
Color = "",
Constant = "µ",
Constructor = "",
Enum = "",
EnumMember = "",
Event = "",
Field = "",
File = "",
Folder = "",
Function = "",
Keyword = "",
Interface = "",
Method = "",
Module = "",
Operator = "",
Property = "",
Reference = "",
Snippet = "",
Struct = "",
Text = "",
TypeParameter = "",
Unit = "",
Value = "",
Variable = "",
}
cmp.setup {
completion = {
autocomplete = true
},
sources = {
{ name = "path" },
{ name = "luasnip" },
{ name = "nvim_lsp" },
{ name = "buffer" },
{ name = "nvim_lua" },
{ name = "calc" },
{ name = "spell" },
{ name = "treesitter" },
},
formatting = {
format = function(entry, vim_item)
vim_item.kind = string.format("%s %s", icons[vim_item.kind],
vim_item.kind)
vim_item.menu = ({
nvim_lsp = "[lsp]",
nvim_lua = "[nvim]",
luasnip = "[snip]",
path = "[path]",
buffer = "[buff]",
calc = "[calc]",
spell = "[spel]",
treesitter = "[tree]",
})[entry.source.name]
return vim_item
end,
},
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
mapping = {
["<C-d>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-e>"] = cmp.mapping.close(),
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<Tab>"] = cmp.mapping(function(fallback)
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
["<C-n>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<C-p>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end, { "i", "s" }),
},
view = {
entries = {name = 'custom', selection_order = 'near_cursor' }
},
}

View File

@ -0,0 +1,23 @@
-- Author : swytch
-- Created : Monday May 2, 2022 21:00:24 CET
-- License : GPLv3
-- Description : neovim lsp config file for clangd
local M = {}
local lsp_root_path = vim.fn.stdpath("data") .. "/lsp_servers/"
local clangd_binary = lsp_root_path .. "clangd/clangd/bin/clangd"
M.setup = function(opts)
opts.settings = {
cmd = { clangd_binary,
"--background-index",
"--suggest-missing-includes",
"--clang-tidy",
"--header-insertion=iwyu"
},
}
end
return M

View File

@ -0,0 +1,82 @@
-- Author : swytch
-- Created : Monday May 2, 2022 21:02:02 CET
-- License : GPLv3
-- Description : neovim global lsp config file
local lspconfig = require("lspconfig")
local lsp_installer = require("nvim-lsp-installer")
local globals = require("globals")
local signs = {
Error = globals.sign_error,
Warn = globals.sign_warn,
Hint = globals.sign_hint,
Info = globals.sign_info,
}
for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, {
text = icon,
texthl = hl,
numhl = hl
})
end
vim.diagnostic.config({
update_in_insert = true
})
local on_attach = function(_, bufnr)
local opts = { buffer = bufnr }
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, opts)
vim.keymap.set("n", "<leader>ln", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "<leader>lp", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "<leader>lf", vim.lsp.buf.formatting, opts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, opts)
vim.keymap.set("n", "<leader>wa",
vim.lsp.buf.add_workspace_folder, opts)
vim.keymap.set("n", "<leader>wr",
vim.lsp.buf.remove_workspace_folder, opts)
vim.keymap.set("n", "<leader>wl", function()
vim.inspect(vim.lsp.buf.list_workspace_folders())
end, opts)
vim.keymap.set("n", "<leader>D", vim.lsp.buf.type_definition, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>so",
require("telescope.builtin").lsp_document_symbols, opts)
end
-- nvim-cmp supports additional completion capabilities
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require("cmp_nvim_lsp").update_capabilities(capabilities)
local servers = { "clangd", "sumneko_lua", "texlab" }
lsp_installer.setup {
ensure_installed = servers,
ui = {
icons = {
server_installed = "",
server_pending = "o",
server_uninstalled = ""
}
}
}
for _, server in ipairs(servers) do
local opts = {
on_attach = on_attach,
capabilities = capabilities,
}
local plugin = string.format("%s.%s", "plugin.lsp", server)
require(plugin).setup(opts)
lspconfig[server].setup(opts)
end

View File

@ -0,0 +1,47 @@
-- Author : swytch
-- Created : Monday May 2, 2022 21:00:07 CET
-- License : GPLv3
-- Description : neovim lsp config file for sumneko_lua
local M = {}
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
M.setup = function(opts)
opts.settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're
-- using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
-- Setup your lua path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = {
"vim",
"globals",
"utils"
},
},
workspace = {
-- Make the server aware of Neovim runtime files
library =
vim.api.nvim_get_runtime_file("", true),
},
-- Do not send telemetry data containing a randomized but
-- unique identifier
telemetry = {
enable = false,
},
},
}
end
return M

View File

@ -0,0 +1,18 @@
-- Author : swytch
-- Created : Monday May 17, 2022 16:29:18 CET
-- License : GPLv3
-- Description : neovim lsp config file for texlab
local M = {}
M.setup = function(opts)
opts.settings = {
build = {
executable = "pdflatex"
}
}
end
return M

View File

@ -1,47 +0,0 @@
-- Author : swytch
-- Created : Saturday Sept. 11, 2021 22:12:33 CET
-- License : GPLv3
-- Description : nvim-lsp-installer plugin config file
local lsp_installer = require("nvim-lsp-installer")
lsp_installer.settings {
ui = {
icons = {
server_installed = "",
server_pending = "",
server_uninstalled = ""
}
}
}
local servers = {
"bashls",
"jedi_language_server",
"texlab",
"sumneko_lua",
}
for _, name in pairs(servers) do
local ok, server = lsp_installer.get_server(name)
-- Check that the server is supported in nvim-lsp-installer
if ok then
if not server:is_installed() then
print("Installing " .. name)
server:install()
end
end
end
lsp_installer.on_server_ready(function(server)
local opts = {}
-- (optional) Customize the options passed to the server
-- if server.name == "tsserver" then
-- opts.root_dir = function() ... end
-- end
-- This setup() function is exactly the same as lspconfig's setup function (:help lspconfig-quickstart)
server:setup(opts)
vim.cmd [[ do User LspAttachBuffers ]]
end)

View File

@ -31,7 +31,26 @@ ls.config.set_config({
ext_opts = {
[types.choiceNode] = {
active = {
virt_text = { { "choiceNode", "Comment" } },
virt_text = { { "", "LuaSnipChoice" } },
},
inactive = {
virt_text = { { "", "LuaSnipInactive" } },
},
},
[types.functionNode] = {
active = {
virt_text = { { "", "LuaSnipFunction" } },
},
inactive = {
virt_text = { { "", "LuaSnipInactive" } },
},
},
[types.insertNode] = {
active = {
virt_text = { { "", "LuaSnipInsert" } },
},
inactive = {
virt_text = { { "", "LuaSnipInactive" } },
},
},
},
@ -55,274 +74,275 @@ end
-- Returns a snippet_node wrapped around an insert_node whose initial
-- text value is set to the current date in the desired format.
local function date_input(fmt)
local fmt = fmt or "%Y-%m-%d"
return sn(nil, i(1, os.date(fmt)))
local format = fmt or "%Y-%m-%d"
return sn(nil, i(1, os.date(format)))
end
ls.snippets = {
-- When trying to expand a snippet, luasnip first searches the tables for
-- each filetype specified in 'filetype' followed by 'all'.
-- If ie. the filetype is 'lua.c'
-- - luasnip.lua
-- - luasnip.c
-- - luasnip.all
-- are searched in that order.
all = {
local copy = utils.copy
-- snippets are added via ls.add_snippets(filetype, snippets[, opts]), where
-- opts may specify the `type` of the snippets ("snippets" or "autosnippets",
-- for snippets that should expand directly after the trigger is typed).
--
-- opts can also specify a key. By passing an unique key to each add_snippets, it's possible to reload snippets by
-- re-`:luafile`ing the file in which they are defined (eg. this one).
ls.add_snippets( "all", {
-- trigger is fn.
s("fn", {
-- Simple static text.
t("//Parameters: "),
-- function, first parameter is the function, second the Placeholders
-- whose text it gets as input.
f(copy, 2),
t({ "", "function " }),
-- Placeholder/Insert.
i(1),
t("("),
-- Placeholder with initial text.
i(2, "int foo"),
-- Linebreak
t({ ") {", "\t" }),
-- Last Placeholder, exit Point of the snippet. EVERY 'outer' SNIPPET NEEDS Placeholder 0.
i(0),
t({ "", "}" }),
}),
s("class", {
-- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes.
c(1, {
t("public "),
t("private "),
}),
t("class "),
i(2),
t(" "),
c(3, {
t("{"),
-- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!!
-- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to.
sn(nil, {
t("extends "),
i(1),
t(" {"),
}),
sn(nil, {
t("implements "),
i(1),
t(" {"),
}),
}),
t({ "", "\t" }),
i(0),
t({ "", "}" }),
}),
-- Use a dynamic_node to interpolate the output of a
-- function (see date_input above) into the initial
-- value of an insert_node.
s("novel", {
t("It was a dark and stormy night on "),
d(1, date_input, {}, "%A, %B %d of %Y"),
t(" and the clocks were striking thirteen."),
}),
-- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body.
-- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string.
-- This means they are not SELECTed like in other editors/Snippet engines.
ls.parser.parse_snippet(
"lspsyn",
"Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"
),
s("fn", {
-- Simple static text.
t("//Parameters: "),
-- function, first parameter is the function, second the Placeholders
-- whose text it gets as input.
f(copy, 2),
t({ "", "function " }),
-- Placeholder/Insert.
i(1),
t("("),
-- Placeholder with initial text.
i(2, "int foo"),
-- Linebreak
t({ ") {", "\t" }),
-- Last Placeholder, exit Point of the snippet. EVERY 'outer' SNIPPET NEEDS Placeholder 0.
i(0),
t({ "", "}" }),
}),
s("class", {
-- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes.
c(1, {
t("public "),
t("private "),
}),
t("class "),
i(2),
t(" "),
c(3, {
t("{"),
-- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!!
-- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to.
sn(nil, {
t("extends "),
i(1),
t(" {"),
}),
sn(nil, {
t("implements "),
i(1),
t(" {"),
}),
}),
t({ "", "\t" }),
i(0),
t({ "", "}" }),
}),
-- Use a dynamic_node to interpolate the output of a
-- function (see date_input above) into the initial
-- value of an insert_node.
s("novel", {
t("It was a dark and stormy night on "),
d(1, date_input, {}, "%A, %B %d of %Y"),
t(" and the clocks were striking thirteen."),
}),
-- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body.
-- Placeholders are parsed into choices with 1. the placeholder text(as a snippet) and 2. an empty string.
-- This means they are not SELECTed like in other editors/Snippet engines.
ls.parser.parse_snippet(
"lspsyn",
"Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"
),
-- When wordTrig is set to false, snippets may also expand inside other words.
ls.parser.parse_snippet(
{ trig = "te", wordTrig = false },
"${1:cond} ? ${2:true} : ${3:false}"
),
-- When wordTrig is set to false, snippets may also expand inside other words.
ls.parser.parse_snippet(
{ trig = "te", wordTrig = false },
"${1:cond} ? ${2:true} : ${3:false}"
),
-- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number.
ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"),
-- Using the condition, it's possible to allow expansion only in specific cases.
s("cond", {
t("will only expand in c-style comments"),
}, {
condition = function(line_to_cursor, matched_trigger, captures)
-- optional whitespace followed by //
return line_to_cursor:match("%s*//")
end,
}),
-- there's some built-in conditions in "luasnip.extras.expand_conditions".
s("cond2", {
t("will only expand at the beginning of the line"),
}, {
condition = conds.line_begin,
}),
-- The last entry of args passed to the user-function is the surrounding snippet.
s(
{ trig = "a%d", regTrig = true },
f(function(_, snip)
return "Triggered with " .. snip.trigger .. "."
end, {})
),
-- It's possible to use capture-groups inside regex-triggers.
s(
{ trig = "b(%d)", regTrig = true },
f(function(_, snip)
return "Captured Text: " .. snip.captures[1] .. "."
end, {})
),
s({ trig = "c(%d+)", regTrig = true }, {
t("will only expand for even numbers"),
}, {
condition = function(line_to_cursor, matched_trigger, captures)
return tonumber(captures[1]) % 2 == 0
end,
}),
-- Use a function to execute any shell command and print its text.
s("bash", f(bash, {}, "ls")),
-- Short version for applying String transformations using function nodes.
s("transform", {
i(1, "initial text"),
t({ "", "" }),
-- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations.
-- This list will be applied in order to the first node given in the second argument.
l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1),
}),
s("transform2", {
i(1, "initial text"),
t("::"),
i(2, "replacement for e"),
t({ "", "" }),
-- Lambdas can also apply transforms USING the text of other nodes:
l(l._1:gsub("e", l._2), { 1, 2 }),
}),
s({ trig = "trafo(%d+)", regTrig = true }, {
-- env-variables and captures can also be used:
l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}),
}),
-- Set store_selection_keys = "<Tab>" (for example) in your
-- luasnip.config.setup() call to access TM_SELECTED_TEXT. In
-- this case, select a URL, hit Tab, then expand this snippet.
s("link_url", {
t('<a href="'),
f(function(_, snip)
return snip.env.TM_SELECTED_TEXT[1] or {}
end, {}),
t('">'),
i(1),
t("</a>"),
i(0),
}),
-- Shorthand for repeating the text in a given node.
s("repeat", { i(1, "text"), t({ "", "" }), r(1) }),
-- Directly insert the ouput from a function evaluated at runtime.
s("part", p(os.date, "%Y")),
-- use matchNodes to insert text based on a pattern/function/lambda-evaluation.
s("mat", {
i(1, { "sample_text" }),
t(": "),
m(1, "%d", "contains a number", "no number :("),
}),
-- The inserted text defaults to the first capture group/the entire
-- match if there are none
s("mat2", {
i(1, { "sample_text" }),
t(": "),
m(1, "[abc][abc][abc]"),
}),
-- It is even possible to apply gsubs' or other transformations
-- before matching.
s("mat3", {
i(1, { "sample_text" }),
t(": "),
m(
1,
l._1:gsub("[123]", ""):match("%d"),
"contains a number that isn't 1, 2 or 3!"
),
}),
-- `match` also accepts a function, which in turn accepts a string
-- (text in node, \n-concatted) and returns any non-nil value to match.
-- If that value is a string, it is used for the default-inserted text.
s("mat4", {
i(1, { "sample_text" }),
t(": "),
m(1, function(text)
return (#text % 2 == 0 and text) or nil
end),
}),
-- The nonempty-node inserts text depending on whether the arg-node is
-- empty.
s("nempty", {
i(1, "sample_text"),
n(1, "i(1) is not empty!"),
}),
-- dynamic lambdas work exactly like regular lambdas, except that they
-- don't return a textNode, but a dynamicNode containing one insertNode.
-- This makes it easier to dynamically set preset-text for insertNodes.
s("dl1", {
i(1, "sample_text"),
t({ ":", "" }),
dl(2, l._1, 1),
}),
-- Obviously, it's also possible to apply transformations, just like lambdas.
s("dl2", {
i(1, "sample_text"),
i(2, "sample_text_2"),
t({ "", "" }),
dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }),
}),
-- Alternative printf-like notation for defining snippets. It uses format
-- string with placeholders similar to the ones used with Python's .format().
s(
"fmt1",
fmt("To {title} {} {}.", {
i(2, "Name"),
i(3, "Surname"),
title = c(1, { t("Mr."), t("Ms.") }),
})
),
-- To escape delimiters use double them, e.g. `{}` -> `{{}}`.
-- Multi-line format strings by default have empty first/last line removed.
-- Indent common to all lines is also removed. Use the third `opts` argument
-- to control this behaviour.
s(
"fmt2",
fmt(
[[
foo({1}, {3}) {{
return {2} * {4}
}}
]],
{
i(1, "x"),
r(1),
i(2, "y"),
r(2),
}
)
),
-- Empty placeholders are numbered automatically starting from 1 or the last
-- value of a numbered placeholder. Named placeholders do not affect numbering.
s(
"fmt3",
fmt("{} {a} {} {1} {}", {
t("1"),
t("2"),
a = t("A"),
})
),
-- The delimiters can be changed from the default `{}` to something else.
s(
"fmt4",
fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })
),
-- `fmta` is a convenient wrapper that uses `<>` instead of `{}`.
s("fmt5", fmta("foo() { return <>; }", i(1, "x"))),
-- By default all args must be used. Use strict=false to disable the check
s(
"fmt6",
fmt("use {} only", { t("this"), t("not this") }, { strict = false })
),
},
}
-- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number.
ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"),
-- Using the condition, it's possible to allow expansion only in specific cases.
s("cond", {
t("will only expand in c-style comments"),
}, {
condition = function(line_to_cursor, matched_trigger, captures)
-- optional whitespace followed by //
return line_to_cursor:match("%s*//")
end,
}),
-- there's some built-in conditions in "luasnip.extras.expand_conditions".
s("cond2", {
t("will only expand at the beginning of the line"),
}, {
condition = conds.line_begin,
}),
-- The last entry of args passed to the user-function is the surrounding snippet.
s(
{ trig = "a%d", regTrig = true },
f(function(_, snip)
return "Triggered with " .. snip.trigger .. "."
end, {})
),
-- It's possible to use capture-groups inside regex-triggers.
s(
{ trig = "b(%d)", regTrig = true },
f(function(_, snip)
return "Captured Text: " .. snip.captures[1] .. "."
end, {})
),
s({ trig = "c(%d+)", regTrig = true }, {
t("will only expand for even numbers"),
}, {
condition = function(line_to_cursor, matched_trigger, captures)
return tonumber(captures[1]) % 2 == 0
end,
}),
-- Use a function to execute any shell command and print its text.
s("bash", f(bash, {}, "ls")),
-- Short version for applying String transformations using function nodes.
s("transform", {
i(1, "initial text"),
t({ "", "" }),
-- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations.
-- This list will be applied in order to the first node given in the second argument.
l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1),
}),
s("transform2", {
i(1, "initial text"),
t("::"),
i(2, "replacement for e"),
t({ "", "" }),
-- Lambdas can also apply transforms USING the text of other nodes:
l(l._1:gsub("e", l._2), { 1, 2 }),
}),
s({ trig = "trafo(%d+)", regTrig = true }, {
-- env-variables and captures can also be used:
l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}),
}),
-- Set store_selection_keys = "<Tab>" (for example) in your
-- luasnip.config.setup() call to access TM_SELECTED_TEXT. In
-- this case, select a URL, hit Tab, then expand this snippet.
s("link_url", {
t('<a href="'),
f(function(_, snip)
return snip.env.TM_SELECTED_TEXT[1] or {}
end, {}),
t('">'),
i(1),
t("</a>"),
i(0),
}),
-- Shorthand for repeating the text in a given node.
s("repeat", { i(1, "text"), t({ "", "" }), r(1) }),
-- Directly insert the ouput from a function evaluated at runtime.
s("part", p(os.date, "%Y")),
-- use matchNodes to insert text based on a pattern/function/lambda-evaluation.
s("mat", {
i(1, { "sample_text" }),
t(": "),
m(1, "%d", "contains a number", "no number :("),
}),
-- The inserted text defaults to the first capture group/the entire
-- match if there are none
s("mat2", {
i(1, { "sample_text" }),
t(": "),
m(1, "[abc][abc][abc]"),
}),
-- It is even possible to apply gsubs' or other transformations
-- before matching.
s("mat3", {
i(1, { "sample_text" }),
t(": "),
m(
1,
l._1:gsub("[123]", ""):match("%d"),
"contains a number that isn't 1, 2 or 3!"
),
}),
-- `match` also accepts a function, which in turn accepts a string
-- (text in node, \n-concatted) and returns any non-nil value to match.
-- If that value is a string, it is used for the default-inserted text.
s("mat4", {
i(1, { "sample_text" }),
t(": "),
m(1, function(text)
return (#text % 2 == 0 and text) or nil
end),
}),
-- The nonempty-node inserts text depending on whether the arg-node is
-- empty.
s("nempty", {
i(1, "sample_text"),
n(1, "i(1) is not empty!"),
}),
-- dynamic lambdas work exactly like regular lambdas, except that they
-- don't return a textNode, but a dynamicNode containing one insertNode.
-- This makes it easier to dynamically set preset-text for insertNodes.
s("dl1", {
i(1, "sample_text"),
t({ ":", "" }),
dl(2, l._1, 1),
}),
-- Obviously, it's also possible to apply transformations, just like lambdas.
s("dl2", {
i(1, "sample_text"),
i(2, "sample_text_2"),
t({ "", "" }),
dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }),
}),
-- Alternative printf-like notation for defining snippets. It uses format
-- string with placeholders similar to the ones used with Python's .format().
s(
"fmt1",
fmt("To {title} {} {}.", {
i(2, "Name"),
i(3, "Surname"),
title = c(1, { t("Mr."), t("Ms.") }),
})
),
-- To escape delimiters use double them, e.g. `{}` -> `{{}}`.
-- Multi-line format strings by default have empty first/last line removed.
-- Indent common to all lines is also removed. Use the third `opts` argument
-- to control this behaviour.
s(
"fmt2",
fmt(
[[
foo({1}, {3}) {{
return {2} * {4}
}}
]],
{
i(1, "x"),
r(1),
i(2, "y"),
r(2),
}
)
),
-- Empty placeholders are numbered automatically starting from 1 or the last
-- value of a numbered placeholder. Named placeholders do not affect numbering.
s(
"fmt3",
fmt("{} {a} {} {1} {}", {
t("1"),
t("2"),
a = t("A"),
})
),
-- The delimiters can be changed from the default `{}` to something else.
s(
"fmt4",
fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })
),
-- `fmta` is a convenient wrapper that uses `<>` instead of `{}`.
s("fmt5", fmta("foo() { return <>; }", i(1, "x"))),
-- By default all args must be used. Use strict=false to disable the check
s(
"fmt6",
fmt("use {} only", { t("this"), t("not this") }, { strict = false })
),
}, {
key = "all",
})
-- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets.
ls.autosnippets = {

View File

@ -1,111 +1,114 @@
-- Author : swytch
-- Created : Friday Mar 12, 2021 22:28:34 CET
-- License : GPLv3
-- Description : neovim plugins file
-- Description : neovim packer config file
local execute = vim.api.nvim_command
local fn = vim.fn
local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path})
execute "packadd packer.nvim"
local packer = require("packer")
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
print("Cloning packer...")
PACKER_BOOTSTRAP = vim.fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
vim.cmd([[packadd packer.nvim]])
print("Done.")
end
packer.init({
display = {
working_sym = 'o', -- The symbol for a plugin being installed/updated
error_sym = '', -- The symbol for a plugin with an error in installation/updating
done_sym = '', -- The symbol for a plugin which has completed installation/updating
removed_sym = '-', -- The symbol for an unused plugin which was removed
moved_sym = '', -- The symbol for a plugin which was moved (e.g. from opt to start)
header_sym = '', -- The symbol for the header line in packer's display
},
})
local use = packer.use
return require("packer").startup(function()
-- packer manages itself
use "wbthomason/packer.nvim"
-- packer manages itself
use "wbthomason/packer.nvim"
-- colorscheme
use {
"~/.local/src/astronomy.nvim",
config = function() require("colorscheme") end
}
-- colorscheme
use {
"~/.local/src/astronomy.nvim",
config = function() require("colorscheme") end
}
-- tree-sitter
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function() require("plugin.treesitter") end
}
-- tree-sitter
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function() require("plugin.treesitter") end
}
-- fuzzy finder
use {
"nvim-telescope/telescope.nvim",
opt = true,
requires = {
{
"nvim-lua/popup.nvim",
opt = true
},
{
"nvim-lua/plenary.nvim",
opt = true
}
},
cmd = "Telescope"
}
-- fuzzy finder
use {
"nvim-telescope/telescope.nvim",
requires = {
{
"nvim-lua/plenary.nvim",
},
{
"nvim-telescope/telescope-fzf-native.nvim",
run = "make"
}
},
}
-- LSP
use {
"williamboman/nvim-lsp-installer",
cmd = {
"LspInstall",
"LspInstallInfo"
},
config = function() require("plugin.lsp_installer").setup() end
}
-- LSP
use {
"neovim/nvim-lspconfig",
requires = {
"williamboman/nvim-lsp-installer",
},
config = function() require("plugin.lsp") end
}
use {
"neovim/nvim-lspconfig",
ft = { "c", "cpp", "lua", "python", "tex"},
config = function() require("lsp").setup() end
}
-- auto completion
use {
"hrsh7th/nvim-cmp",
requires = {
{
"L3MON4D3/LuaSnip",
config = function()
require("plugin.luasnip") end
},
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-calc",
"ray-x/cmp-treesitter",
"f3fora/cmp-spell",
},
config = function() require("plugin.cmp") end
}
-- auto completion
use {
"hrsh7th/nvim-cmp",
requires = {
{
"L3MON4D3/LuaSnip",
config = function() require("plugin.luasnip") end
},
"saadparwaiz1/cmp_luasnip",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-calc",
"ray-x/cmp-treesitter",
"f3fora/cmp-spell",
},
config = function() require("plugin.cmp") end
}
-- commenting, simplified
use {
"numToStr/Comment.nvim",
config = function() require("plugin.comment") end
}
-- commenting, simplified
use {
"numToStr/Comment.nvim",
config = function() require("plugin.comment") end
}
-- autopairs
use {
"windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup() end
}
-- autopairs
use {
"windwp/nvim-autopairs",
config = function() require('nvim-autopairs').setup() end
}
-- display colors directly in editor
use {
"norcalli/nvim-colorizer.lua",
cmd = "ColorizerToggle"
}
-- ens
use {
"whonore/Coqtail",
ft = { "verilog" },
config = vim.cmd[[let g:coqtail_nomap = 1]]
}
-- automatically setup the config after cloning
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View File

@ -4,12 +4,12 @@
-- Description : treesitter config file
require("nvim-treesitter.configs").setup {
ensure_installed = { "c", "lua", "python", "bash" },
ignore_install = { "javascript" },
highlight = {
enable = true,
},
indent = {
enable = true,
},
ensure_installed = { "c", "lua", "python", "bash" },
ignore_install = { "javascript" },
highlight = {
enable = true,
},
indent = {
enable = true,
},
}

View File

@ -7,7 +7,7 @@ local opt = vim.opt
local g = vim.g
-- general
opt.wildignore = {
opt.wildignore = {
".git",
"*.o", "*.class",
"*.jpg", "*.jpeg", "*.png",
@ -18,41 +18,41 @@ opt.wildmode = { "longest", "full" }
opt.wildoptions = "pum"
-- editor
opt.lazyredraw = true
opt.splitright = true
opt.splitbelow = true
opt.scrolloff = 4
opt.termguicolors = true
opt.background = "dark"
opt.cursorline = true
opt.shortmess = opt.shortmess:append { c = true }
opt.number = true
opt.relativenumber = true
opt.signcolumn = "yes"
opt.listchars = {
tab = "<->",
nbsp = "",
trail = "·",
extends = ">",
precedes = "<",
opt.lazyredraw = true
opt.splitright = true
opt.splitbelow = true
opt.scrolloff = 4
opt.termguicolors = true
opt.background = "dark"
opt.cursorline = true
opt.shortmess = opt.shortmess:append { c = true }
opt.number = true
opt.relativenumber = true
opt.signcolumn = "yes"
opt.listchars = {
tab = "<->",
nbsp = "",
trail = "·",
extends = ">",
precedes = "<",
}
opt.showmatch = true
opt.ignorecase = true
opt.smartcase = true
opt.inccommand = "split"
opt.completeopt = { "menuone", "noselect" }
opt.showmatch = true
opt.ignorecase = true
opt.smartcase = true
opt.inccommand = "split"
opt.completeopt = { "menuone", "noselect" }
-- statusline
opt.laststatus = 2
opt.showmode = false
opt.laststatus = 2
opt.showmode = false
-- text, tabs, indents
opt.textwidth = 79
opt.shiftwidth = 8
opt.softtabstop = -1
opt.expandtab = true
opt.shiftwidth = 0
opt.backspace = { "indent", "eol", "start" }
opt.textwidth = 79
opt.shiftwidth = 8
opt.softtabstop = -1
opt.expandtab = true
opt.shiftwidth = 0
opt.backspace = { "indent", "eol", "start" }
-- augroups
utils.create_augroup({

View File

@ -6,204 +6,204 @@
local function gen_section(hl_string, items)
local out = ""
for _, item in pairs(items) do
if item ~= "" then
out = out .. " " .. item
end
end
if out ~="" then
return hl_string .. out .. " "
else
return out
local out = ""
for _, item in pairs(items) do
if item ~= "" then
out = out .. " " .. item
end
end
if out ~="" then
return hl_string .. out .. " "
else
return out
end
end
-- sensible names for vim modes
local function get_mode(m)
local mode_group = {
["n"] = "Normal",
["no"] = "O-Pending",
["nov"] = "O-Pending",
["noV"] = "O-Pending",
["no"] = "O-Pending",
["niI"] = "Normal",
["niR"] = "Normal",
["niV"] = "Normal",
["v"] = "Visual",
["V"] = "V-Line",
[""] = "V-Block",
["s"] = "Select",
["S"] = "S-Line",
[""] = "S-Block",
["i"] = "Insert",
["ic"] = "Insert",
["ix"] = "Insert",
["R"] = "Replace",
["Rc"] = "Replace",
["Rv"] = "V-Replace",
["Rx"] = "Replace",
["c"] = "Command",
["cv"] = "Ex",
["ce"] = "Ex",
["r"] = "Prompt",
["rm"] = "Prompt",
["r?"] = "Prompt",
["!"] = "Shell",
["t"] = "Terminal",
}
return mode_group[m] or "None"
local mode_group = {
["n"] = "Normal",
["no"] = "O-Pending",
["nov"] = "O-Pending",
["noV"] = "O-Pending",
["no"] = "O-Pending",
["niI"] = "Normal",
["niR"] = "Normal",
["niV"] = "Normal",
["v"] = "Visual",
["V"] = "V-Line",
[""] = "V-Block",
["s"] = "Select",
["S"] = "S-Line",
[""] = "S-Block",
["i"] = "Insert",
["ic"] = "Insert",
["ix"] = "Insert",
["R"] = "Replace",
["Rc"] = "Replace",
["Rv"] = "V-Replace",
["Rx"] = "Replace",
["c"] = "Command",
["cv"] = "Ex",
["ce"] = "Ex",
["r"] = "Prompt",
["rm"] = "Prompt",
["r?"] = "Prompt",
["!"] = "Shell",
["t"] = "Terminal",
}
return mode_group[m] or "None"
end
local function get_mode_display_name(m)
local mode = {
["Normal"] = "[ NRM ]",
["O-Pending"] = "[ OTR ]",
["Visual"] = "[ VSL ]",
["V-Line"] = "[ V·L ]",
["V-Block"] = "[ V·B ]",
["Select"] = "[ SEL ]",
["S-Line"] = "[ S·L ]",
["S-Block"] = "[ S·B ]",
["Insert"] = "[ INS ]",
["Replace"] = "[ RPL ]",
["Command"] = "[ CMD ]",
["Prompt"] = "[ PMT ]",
["Shell"] = "[ SHL ]",
["Terminal"] = "[ TRM ]",
["None"] = "[ --- ]"
}
return mode[m]
local mode = {
["Normal"] = "[ NRM ]",
["O-Pending"] = "[ OTR ]",
["Visual"] = "[ VSL ]",
["V-Line"] = "[ V·L ]",
["V-Block"] = "[ V·B ]",
["Select"] = "[ SEL ]",
["S-Line"] = "[ S·L ]",
["S-Block"] = "[ S·B ]",
["Insert"] = "[ INS ]",
["Replace"] = "[ RPL ]",
["Command"] = "[ CMD ]",
["Prompt"] = "[ PMT ]",
["Shell"] = "[ SHL ]",
["Terminal"] = "[ TRM ]",
["None"] = "[ --- ]"
}
return mode[m]
end
-- get the highlight group for a mode group
local function get_mode_color(m)
local color = {
["Normal"] = "%#NormalMode#",
["O-Pending"] = "%#NormalMode#",
["Visual"] = "%#VisualMode#",
["V-Line"] = "%#VisualMode#",
["V-Block"] = "%#VisualMode#",
["Select"] = "%#NormalMode#",
["S-Line"] = "%#NormalMode#",
["S-Block"] = "%#NormalMode#",
["Insert"] = "%#InsertMode#",
["Replace"] = "%#ReplaceMode#",
["Command"] = "%#CommandMode#",
["Prompt"] = "%#NormalMode#",
["Shell"] = "%#NormalMode#",
["Terminal"] = "%#NormalMode#",
["None"] = "%#NormalMode#"
}
return color[m]
local color = {
["Normal"] = "%#NormalMode#",
["O-Pending"] = "%#NormalMode#",
["Visual"] = "%#VisualMode#",
["V-Line"] = "%#VisualMode#",
["V-Block"] = "%#VisualMode#",
["Select"] = "%#NormalMode#",
["S-Line"] = "%#NormalMode#",
["S-Block"] = "%#NormalMode#",
["Insert"] = "%#InsertMode#",
["Replace"] = "%#ReplaceMode#",
["Command"] = "%#CommandMode#",
["Prompt"] = "%#NormalMode#",
["Shell"] = "%#NormalMode#",
["Terminal"] = "%#NormalMode#",
["None"] = "%#NormalMode#"
}
return color[m]
end
-- from https://github.com/nvim-lua/lsp-status.nvim/blob/master/lua/lsp-status/diagnostics.lua
local function get_lsp_diagnostics(bufnr)
local result = {}
local levels = {
errors = "Error",
warnings = "Warn",
info = "Info",
hints = "Hint"
}
local function get_lsp_diagnostics()
local result = {}
local levels = {
error = "Error",
warn = "Warn",
info = "Info",
hint = "Hint"
}
for k, level in pairs(levels) do
local count = 0
local diags = vim.diagnostic.get(bufnr, { severity = level })
for _, _ in pairs(diags) do
count = count + 1
end
result[k] = count
for k, level in pairs(levels) do
local count = 0
local diags = vim.diagnostic.get(0, { severity = level })
for _, _ in pairs(diags) do
count = count + 1
end
result[k] = count
end
return result
return result
end
local function process_diagnostics(prefix, n, hl)
if n > 0 then
return hl .. prefix .. n
else
return ""
end
if n > 0 then
return hl .. prefix .. n
else
return ""
end
end
local function spell_check()
if vim.wo.spell then
local lang = vim.o.spelllang
return "[SPELL=" .. lang .. "]"
else
return ""
end
if vim.wo.spell then
local lang = vim.o.spelllang
return "[SPELL=" .. lang .. "]"
else
return ""
end
end
local function statusline_focused()
local diagnostics = get_lsp_diagnostics()
local mode = vim.fn.mode()
local mg = get_mode(mode)
local accent_color = get_mode_color(mg)
local diagnostics = get_lsp_diagnostics()
local mode = vim.fn.mode()
local mg = get_mode(mode)
local accent_color = get_mode_color(mg)
local left = table.concat {
gen_section(accent_color, {get_mode_display_name(mg)}),
gen_section("%#Middle#", {"%f"}),
gen_section("%#Bottom#", {"%m", "%r"}),
gen_section(
"%#Alert#",
{
process_diagnostics(
globals.sign_error .. " ",
diagnostics.errors,
"%#DiagnosticVirtualTextError#"
),
process_diagnostics(
globals.sign_warning .. " ",
diagnostics.warnings,
"%#DiagnosticVirtualTextWarn#"
),
process_diagnostics(
globals.sign_info .. " ",
diagnostics.info,
"%#DiagnosticVirtualTextInfo#"
)
}
)
local left = table.concat {
gen_section(accent_color, {get_mode_display_name(mg)}),
gen_section("%#Middle#", {"%f"}),
gen_section("%#Bottom#", {"%m", "%r"}),
gen_section(
"%#Alert#",
{
process_diagnostics(
globals.sign_error .. " ",
diagnostics.error,
"%#DiagnosticVirtualTextError#"
),
process_diagnostics(
globals.sign_warn .. " ",
diagnostics.warn,
"%#DiagnosticVirtualTextWarn#"
),
process_diagnostics(
globals.sign_info .. " ",
diagnostics.info,
"%#DiagnosticVirtualTextInfo#"
)
}
local right = table.concat {
gen_section(
"%#Bottom#",
{
spell_check(),
vim.bo.filetype
}
),
gen_section("%#Middle#", {"%03.p%%"}),
gen_section("%#Top#", {"-%03.c-"})
)
}
local right = table.concat {
gen_section(
"%#Bottom#",
{
spell_check(),
vim.bo.filetype
}
),
gen_section("%#Middle#", {"%03.p%%"}),
gen_section("%#Top#", {"-%03.c-"})
}
return table.concat {
left,
"%#Statusline#",
"%=",
right
}
return table.concat {
left,
"%#Statusline#",
"%=",
right
}
end
local function statusline_not_focused()
return table.concat {
gen_section("%#StatuslineNF#", {"%f", "%m"}),
"%=",
gen_section("%#StatuslineNF#", {"%03.p%%"}),
gen_section("%#StatuslineNF#", {"-%03.c-"})
}
return table.concat {
gen_section("%#StatuslineNF#", {"%f", "%m"}),
"%=",
gen_section("%#StatuslineNF#", {"%03.p%%"}),
gen_section("%#StatuslineNF#", {"-%03.c-"})
}
end
function _G.gen_statusline()
if vim.g.statusline_winid == vim.fn.win_getid() then
return statusline_focused()
else
return statusline_not_focused()
end
if vim.g.statusline_winid == vim.fn.win_getid() then
return statusline_focused()
else
return statusline_not_focused()
end
end
vim.o.statusline = "%!luaeval(\"gen_statusline()\")"

View File

@ -22,12 +22,6 @@ function M.add_rtp(path)
rtp = rtp .. "," .. path
end
-- map a key with optional options
function M.map(mode, keys, action, options)
options = options or {}
vim.api.nvim_set_keymap(mode, keys, action, options)
end
-- see if a file exists
function M.file_exists(file)
local f = io.open(file, "rb")

View File

@ -23,6 +23,9 @@ super + shift + s
super + shift + r
dmenuprompt "reboot?" "reboot"
super + BackSpace
slock
super + shift + d
displayselect
@ -32,7 +35,7 @@ super + shift + o
super + c
switch-colors
super + shift + c
super + alt + c
switch-colors -s
# Others
@ -48,6 +51,12 @@ super + d
super + shift + o
dmenuopen
super + p
screenshot
super + alt + p
screenshot -w
super + shift + {w,z}
$BROWSER

View File

@ -10,7 +10,7 @@
set-option -g status-style bg=color0 # bg=bg1, fg=fg1
set-option -g status-left "\
#[fg=color8, bg=color7]#{?client_prefix,#[bg=color9],} #S "
#[fg=color8, bg=color7]#{?client_prefix,#[bg=color9],} #S "
set-option -g status-right "\
#[fg=color7, bg=color8] %b. %d \

View File

@ -11,5 +11,5 @@
[ $1 = "" ] && 1="mv -i"
[ $1 = "sox" ] && flags="-C 320"
[ $1 = "sox" ] && flags="-C 6"
\ls | $EDITOR - -c ":%s/.*/$1 \"&\" $flags \"&\"/g"

View File

@ -31,15 +31,21 @@ shebangtest()
}
texcompile() { \
[ "$base" != "notes" ] && [ -e "main.tex" ] && base="main" && file="$base.tex"
cmd="pdflatex"
case "$(head -n 1 $file)" in
*lua*) cmd="lualatex" ;;
esac
bibliography="$(grep '\\bibliography' "$file")"
if [ -n "$bibliography" ]; then
pdflatex --output-directory="$dir" "$base" &&
$cmd --output-directory="$dir" "$base" &&
bibtex "$base" &&
pdflatex --output-directory="$dir" "$base" &&
pdflatex --output-directory="$dir" "$base"
$cmd --output-directory="$dir" "$base" &&
$cmd --output-directory="$dir" "$base"
else
pdflatex --output-directory="$dir" "$base" &&
pdflatex --output-directory="$dir" "$base"
$cmd --output-directory="$dir" "$base" &&
$cmd --output-directory="$dir" "$base"
fi
}

23
.local/bin/screenshot Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env sh
######################################################################
# @author : swytch
# @file : screenshot
# @license : GPLv3
# @created : Wednesday May 20, 2020 17:52:58 CEST
#
# @description : grab a screenshot
# @deps : scrot xclip dunstify
######################################################################
sleep .1
if [ "-w" = "$1" ]; then
scrot -e 'xclip -selection clipboard -t image/png -i $f && rm $f'
else
if [ ! "" = "$1" ]; then
dunstify -u "normal" " Wrong parameter. No screenshot taken" && exit 1
else
scrot -s -e 'xclip -selection clipboard -t image/png -i $f && rm $f'
fi
fi

View File

@ -42,18 +42,22 @@ do
status=" " && capacity="FULL"
printf " %s:%s(%s) " "$slot" "$status" "$capacity"
else
if [ "$status" = "Charging" ]; then
status=""
if [ 100 -lt $(expr $capacity) ]; then
status=""
else
case "$capacity" in
100|[8-9][0-9]) status="" ;;
[6-7][0-9]) status="" ;;
[4-5][0-9]) status="" ;;
[2-3][0-9]) status="" ;;
*) status="" ;;
esac
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
if [ "$status" = "Charging" ]; then
status=""
else
case "$capacity" in
100|[8-9][0-9]) status="" ;;
[6-7][0-9]) status="" ;;
[4-5][0-9]) status="" ;;
[2-3][0-9]) status="" ;;
*) status="" ;;
esac
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
fi
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
fi
done

View File

@ -14,7 +14,11 @@
eth="$(cat /sys/class/net/eno1/operstate)"
ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')"
state="$(wpa_cli status | grep -i ^wpa_state | sed -e 's/.*=//')"
[ "COMPLETED" = $state ] && str="$(printf " %s" $ssid)" || str="$(printf " ---")"
case "$state" in
COMPLETED) str="$(printf " %s" $ssid)" ;;
INTERFACE_DISABLED) str="WIFI DOWN" ;;
*) str="$(printf "NO WIFI")";;
esac
if [ "up" = "$eth" ]; then
str="$(printf "%s /  " "$str")"
fi

@ -1 +1 @@
Subproject commit d77e1cfe127418ab00c6d5fb076f89cdf9b49e94
Subproject commit 41edd2a8502cc6d3be9ad18387e8b3c67d2dd4c3

@ -1 +1 @@
Subproject commit f8ad07e02878adfbdab1241869630d608566c5c0
Subproject commit 82003c8dad7b966ab65f339749fb4272eafb8f4b