Merge branch 'dev' into logos
This commit is contained in:
commit
09faf18588
@ -38,13 +38,7 @@
|
|||||||
# Scale factor. It is auto-detected if value is 0.
|
# Scale factor. It is auto-detected if value is 0.
|
||||||
scale = 0
|
scale = 0
|
||||||
|
|
||||||
# Maximum number of notification (0 means no limit)
|
# Turn on the progess bar
|
||||||
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
|
|
||||||
progress_bar = true
|
progress_bar = true
|
||||||
|
|
||||||
# Set the progress bar height. This includes the frame, so make sure
|
# Set the progress bar height. This includes the frame, so make sure
|
||||||
@ -237,16 +231,6 @@
|
|||||||
# user defined timeout.
|
# user defined timeout.
|
||||||
ignore_dbusclose = false
|
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
|
### Legacy
|
||||||
|
|
||||||
# Use the Xinerama extension instead of RandR for multi-monitor support.
|
# Use the Xinerama extension instead of RandR for multi-monitor support.
|
||||||
|
@ -90,6 +90,7 @@ CertificateFile /etc/ssl/certs/ca-certificates.crt
|
|||||||
MaildirStore david.julien@centrale-marseille.fr-local
|
MaildirStore david.julien@centrale-marseille.fr-local
|
||||||
Subfolders Verbatim
|
Subfolders Verbatim
|
||||||
Path /home/swytch/.local/share/mail/david.julien@centrale-marseille.fr/
|
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
|
Channel david.julien@centrale-marseille.fr
|
||||||
Expunge Both
|
Expunge Both
|
||||||
|
@ -23,7 +23,7 @@ set signature="/home/swytch/.config/mutt/accounts/ens.signature"
|
|||||||
unmacro index o
|
unmacro index o
|
||||||
macro index o "<shell-escape>mailsync<enter>" "run mbsync to sync david.julien@ens-lyon.fr"
|
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"
|
set record = "+Sent"
|
||||||
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
|
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
|
||||||
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail 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 gI "<change-folder>=internship<enter>" "go to internship"
|
||||||
macro index,pager MI ";<save-message>=internship<enter>" "move mail 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 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"
|
||||||
|
@ -23,7 +23,7 @@ set signature="/home/swytch/.config/mutt/accounts/mailo.signature"
|
|||||||
unmacro index o
|
unmacro index o
|
||||||
macro index o "<shell-escape>mailsync<enter>" "run mbsync to sync david.julien@mailo.com"
|
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"
|
set record = "+sent"
|
||||||
macro index,pager gs "<change-folder>=sent<enter>" "go to sent"
|
macro index,pager gs "<change-folder>=sent<enter>" "go to sent"
|
||||||
macro index,pager Ms ";<save-message>=sent<enter>" "move mail 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 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 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 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"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# vim: filetype=neomuttrc
|
# vim: filetype=neomuttrc
|
||||||
# muttrc file for account david.julien@centrale-marseille.fr
|
# muttrc file for account david.julien@centrale-marseille.fr
|
||||||
set realname = "David JULIEN"
|
set realname = "Smecta"
|
||||||
set from = "david.julien@centrale-marseille.fr"
|
set from = "david.julien@centrale-marseille.fr"
|
||||||
set sendmail = "msmtp -a david.julien@centrale-marseille.fr"
|
set sendmail = "msmtp -a david.julien@centrale-marseille.fr"
|
||||||
alias me david.julien <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 message_cachedir = /home/swytch/.cache/mutt/david.julien@centrale-marseille.fr/bodies
|
||||||
set mbox_type = Maildir
|
set mbox_type = Maildir
|
||||||
|
|
||||||
set crypt_autosign = yes
|
set crypt_autosign = no
|
||||||
set pgp_sign_as = "0x9F46CD164AE1E813"
|
set pgp_sign_as = "0x9F46CD164AE1E813"
|
||||||
|
|
||||||
bind index,pager gg noop
|
bind index,pager gg noop
|
||||||
@ -23,7 +23,7 @@ set signature="/home/swytch/.config/mutt/accounts/centrale.signature"
|
|||||||
unmacro index o
|
unmacro index o
|
||||||
macro index o "<shell-escape>mailsync<enter>" "run mbsync to sync david.julien@centrale-marseille.fr"
|
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"
|
set record = "+Sent"
|
||||||
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
|
macro index,pager gs "<change-folder>=Sent<enter>" "go to sent"
|
||||||
macro index,pager Ms ";<save-message>=Sent<enter>" "move mail 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 Mt ";<save-message>=Trash<enter>" "move mail to trash"
|
||||||
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash"
|
macro index,pager Ct ";<copy-message>=Trash<enter>" "copy mail to trash"
|
||||||
set trash = "+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 gf "<change-folder>=Fanfare<enter>" "go to fanfare"
|
||||||
macro index,pager Mf ";<save-message>=Fanfare<enter>" "move mail 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"
|
macro index,pager Cf ";<copy-message>=Fanfare<enter>" "copy mail to fanfare"
|
||||||
|
@ -234,7 +234,7 @@ mpd_music_dir = ~/music
|
|||||||
song_list_format = "{$3[%l]$9} {$6%t$9}|{$6%30f$9} %n"
|
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_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_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
|
||||||
#
|
#
|
||||||
#song_library_format = {%n - }{%t}|{%f}
|
#song_library_format = {%n - }{%t}|{%f}
|
||||||
@ -313,7 +313,7 @@ song_status_format = $b {$3%a$9 - $7{%t}}|{%f} {(%b)}
|
|||||||
## available.
|
## 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}
|
#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
|
||||||
#
|
#
|
||||||
##### various settings #####
|
##### various settings #####
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
-- Description : c settings file
|
-- Description : c settings file
|
||||||
|
|
||||||
|
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
opt.formatoptions = "trq1jp"
|
opt.formatoptions = "trq1jp"
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
local ls = require("luasnip")
|
local ls = require("luasnip")
|
||||||
@ -20,32 +20,32 @@ local f = ls.function_node
|
|||||||
|
|
||||||
local copy = utils.copy
|
local copy = utils.copy
|
||||||
|
|
||||||
ls.snippets = {
|
ls.add_snippets( "c", {
|
||||||
c = {
|
s("main", {
|
||||||
s("main", {
|
t({ "int main(int argc, char* argv[])" }),
|
||||||
t({ "int main(int argc, char* argv[])" }),
|
t({ "", "{", "\t" }),
|
||||||
t({ "", "{", "\t" }),
|
i(0),
|
||||||
i(0),
|
t({ "", "\treturn 0;"}),
|
||||||
t({ "", "\treturn 0;"}),
|
t({ "", "}"}),
|
||||||
t({ "", "}"}),
|
}),
|
||||||
}),
|
s("fn", {
|
||||||
s("fn", {
|
-- Simple static text.
|
||||||
-- Simple static text.
|
t("//Parameters: "),
|
||||||
t("//Parameters: "),
|
-- function, first parameter is the function, second the Placeholders
|
||||||
-- function, first parameter is the function, second the Placeholders
|
-- whose text it gets as input.
|
||||||
-- whose text it gets as input.
|
f(copy, 2),
|
||||||
f(copy, 2),
|
t({ "", "" }),
|
||||||
t({ "", "" }),
|
-- Placeholder/Insert.
|
||||||
-- Placeholder/Insert.
|
i(1),
|
||||||
i(1),
|
t("("),
|
||||||
t("("),
|
-- Placeholder with initial text.
|
||||||
-- Placeholder with initial text.
|
i(2, "int foo"),
|
||||||
i(2, "int foo"),
|
-- Linebreak
|
||||||
-- Linebreak
|
t({ ")", "{", "\t" }),
|
||||||
t({ ")", "{", "\t" }),
|
i(0),
|
||||||
i(0),
|
t({ "", "\treturn 0;"}),
|
||||||
t({ "", "\treturn 0;"}),
|
t({ "", "}"}),
|
||||||
t({ "", "}"}),
|
}),
|
||||||
}),
|
}, {
|
||||||
},
|
key = "c"
|
||||||
}
|
})
|
||||||
|
@ -6,4 +6,5 @@
|
|||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
opt.formatoptions = "trq1jp"
|
opt.formatoptions = "trq1jp"
|
||||||
|
opt.tabstop = 4
|
||||||
|
@ -4,34 +4,33 @@
|
|||||||
-- Description : tex filetype config
|
-- Description : tex filetype config
|
||||||
|
|
||||||
|
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
local g = vim.g
|
|
||||||
|
|
||||||
opt.formatoptions = "trq1jp"
|
opt.formatoptions = "trq1jp"
|
||||||
opt.tabstop = 4
|
opt.tabstop = 4
|
||||||
|
|
||||||
-- Caps
|
-- Caps
|
||||||
utils.map("i", "AA", "À")
|
vim.keymap.set("i", "AA", "À")
|
||||||
utils.map("i", "CC", "Ç")
|
vim.keymap.set("i", "CC", "Ç")
|
||||||
utils.map("i", "EE", "É")
|
vim.keymap.set("i", "EE", "É")
|
||||||
|
|
||||||
-- Unbreakable spaces
|
-- Unbreakable spaces
|
||||||
utils.map("i", "<Space>etc", "\\,etc.")
|
vim.keymap.set("i", "<Space>etc", "\\,etc.")
|
||||||
utils.map("i", "<Space>:", "\\,:")
|
vim.keymap.set("i", "<Space>:", "\\,:")
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
local ls = require("luasnip")
|
local ls = require("luasnip")
|
||||||
|
|
||||||
-- some shorthands...
|
-- some shorthands...
|
||||||
local s = ls.snippet
|
local s = ls.snippet
|
||||||
local sn = ls.snippet_node
|
local sn = ls.snippet_node
|
||||||
local t = ls.text_node
|
local t = ls.text_node
|
||||||
local i = ls.insert_node
|
local i = ls.insert_node
|
||||||
local f = ls.function_node
|
local f = ls.function_node
|
||||||
local c = ls.choice_node
|
local c = ls.choice_node
|
||||||
local d = ls.dynamic_node
|
local d = ls.dynamic_node
|
||||||
|
|
||||||
local copy = utils.copy
|
local copy = utils.copy
|
||||||
|
|
||||||
-- 'recursive' dynamic snippet. Expands to some text followed by itself.
|
-- 'recursive' dynamic snippet. Expands to some text followed by itself.
|
||||||
local function rec_ls()
|
local function rec_ls()
|
||||||
@ -45,86 +44,86 @@ local function rec_ls()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
ls.snippets = {
|
ls.add_snippets("tex", {
|
||||||
tex = {
|
-- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many
|
||||||
-- rec_ls is self-referencing. That makes this snippet 'infinite' eg. have as many
|
-- \item as necessary by utilizing a choiceNode.
|
||||||
-- \item as necessary by utilizing a choiceNode.
|
s("ls", {
|
||||||
s("ls", {
|
t({ "\\begin{itemize}", "\t\\item " }),
|
||||||
t({ "\\begin{itemize}", "\t\\item " }),
|
i(1),
|
||||||
i(1),
|
t({ "" }),
|
||||||
t({ "" }),
|
d(2, rec_ls, {}),
|
||||||
d(2, rec_ls, {}),
|
t({ "", "\\end{itemize}" }),
|
||||||
t({ "", "\\end{itemize}", "" }),
|
}),
|
||||||
}),
|
s("lsl", {
|
||||||
s("lsl", {
|
t({ "\\begin{itemize}[label=" }),
|
||||||
t({ "\\begin{itemize}[label=" }),
|
i(1),
|
||||||
i(1),
|
t( { "]", "\t\\item " }),
|
||||||
t( { "]", "\t\\item " }),
|
i(2),
|
||||||
i(2),
|
t({ "" }),
|
||||||
t({ "" }),
|
d(3, rec_ls, {}),
|
||||||
d(3, rec_ls, {}),
|
t({ "", "\\end{itemize}" }),
|
||||||
t({ "", "\\end{itemize}", "" }),
|
}),
|
||||||
}),
|
s("frm", {
|
||||||
s("frm", {
|
t({ "\\begin{" }),
|
||||||
t({ "\\begin{" }),
|
i(1),
|
||||||
i(1),
|
t({ "}[" }),
|
||||||
t({ "}[" }),
|
i(2),
|
||||||
i(2),
|
t({ "]{" }),
|
||||||
t({ "]{" }),
|
f(copy, 1),
|
||||||
f(copy, 1),
|
t({ ":" }),
|
||||||
t({ ":" }),
|
i(3, "foo"),
|
||||||
i(3, "foo"),
|
t({ "}", "\t" }),
|
||||||
t({ "}", "\t" }),
|
i(0),
|
||||||
i(0),
|
t({ "", "\\end{" }),
|
||||||
t({ "", "\\end{" }),
|
f(copy, 1),
|
||||||
f(copy, 1),
|
t({ "}" }),
|
||||||
t({ "}", "" }),
|
}),
|
||||||
}),
|
s("env", {
|
||||||
s("env", {
|
t({ "\\begin{" }),
|
||||||
t({ "\\begin{" }),
|
i(1, "foo"),
|
||||||
i(1, "foo"),
|
t({ "}", "\t" }),
|
||||||
t({ "}", "\t" }),
|
i(2),
|
||||||
i(2),
|
t({ "", "\\end{" }),
|
||||||
t({ "", "\\end{" }),
|
f(copy,1),
|
||||||
f(copy,1),
|
t({ "}"}),
|
||||||
t({ "}", "" }),
|
}),
|
||||||
}),
|
s("tikz", {
|
||||||
s("tikz", {
|
t({ "\\begin{center}" }),
|
||||||
t({ "\\begin{center}" }),
|
t({ "", "\t\\begin{tikzpicture}[main/.style = {draw,circle}]", "\t\t" }),
|
||||||
t({ "", "\t\\begin{tikzpicture}[main/.style = {draw,circle}]", "\t\t" }),
|
i(1),
|
||||||
i(1),
|
t({ "", "\t\\end{tikzpicture}", "\\end{center}" }),
|
||||||
t({ "", "\t\\end{tikzpicture}", "\\end{center}" }),
|
}),
|
||||||
}),
|
s("ra", { t( "\\rightarrow" )}),
|
||||||
s("ra", { t( "\\rightarrow" )}),
|
s("Ra", { t("\\Rightarrow" )}),
|
||||||
s("Ra", { t("\\Rightarrow" )}),
|
s("la", { t("\\leftarrow" )}),
|
||||||
s("la", { t("\\leftarrow" )}),
|
s("La", { t("\\Leftarrow" )}),
|
||||||
s("La", { t("\\Leftarrow" )}),
|
s("lra", { t("\\leftrightarrow" )}),
|
||||||
s("lra", { t("\\leftrightarrow" )}),
|
s("Lra", { t("\\Leftrightarrow" )}),
|
||||||
s("Lra", { t("\\Leftrightarrow" )}),
|
s("bb", {
|
||||||
s("bb", {
|
t({ "\\textbf{" }),
|
||||||
t({ "\\textbf{" }),
|
i(1),
|
||||||
i(1),
|
t({ "}"}),
|
||||||
t({ "}"}),
|
}),
|
||||||
}),
|
s("tt", {
|
||||||
s("tt", {
|
t({ "\\texttt{" }),
|
||||||
t({ "\\texttt{" }),
|
i(1),
|
||||||
i(1),
|
t({ "}"}),
|
||||||
t({ "}"}),
|
}),
|
||||||
}),
|
s("ii", {
|
||||||
s("ii", {
|
t({ "\\textit{" }),
|
||||||
t({ "\\textit{" }),
|
i(1),
|
||||||
i(1),
|
t({ "}"}),
|
||||||
t({ "}"}),
|
}),
|
||||||
}),
|
s("uu", {
|
||||||
s("uu", {
|
t({ "\\underline{" }),
|
||||||
t({ "\\underline{" }),
|
i(1),
|
||||||
i(1),
|
t({ "}"}),
|
||||||
t({ "}"}),
|
}),
|
||||||
}),
|
s("fsc", {
|
||||||
s("fsc", {
|
t({ "\\textsc{" }),
|
||||||
t({ "\\textsc{" }),
|
i(1),
|
||||||
i(1),
|
t({ "}"}),
|
||||||
t({ "}"}),
|
}),
|
||||||
}),
|
}, {
|
||||||
},
|
key = "tex"
|
||||||
}
|
})
|
||||||
|
@ -9,5 +9,5 @@ local file = os.getenv("XDG_STATE_HOME") .. "/nvim_colorscheme"
|
|||||||
local colorscheme = utils.lines_from(file)[0]
|
local colorscheme = utils.lines_from(file)[0]
|
||||||
|
|
||||||
require("astronomy").setup {
|
require("astronomy").setup {
|
||||||
variant = colorscheme,
|
variant = colorscheme,
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,11 @@
|
|||||||
local M = {} -- The module to export
|
local M = {} -- The module to export
|
||||||
|
|
||||||
M = {
|
M = {
|
||||||
lsp_path = vim.fn.stdpath("data").. "/lsp",
|
-- misc
|
||||||
|
sign_error = "",
|
||||||
-- misc
|
sign_warn = "",
|
||||||
sign_error = "",
|
sign_hint = "",
|
||||||
sign_warning = "",
|
sign_info = "",
|
||||||
sign_hint = "",
|
|
||||||
sign_info = "",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Make it accessible everywhere
|
-- Make it accessible everywhere
|
||||||
|
@ -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,
|
|
||||||
}
|
|
@ -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
|
|
@ -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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
@ -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" }
|
|
||||||
}
|
|
@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,30 +3,31 @@
|
|||||||
-- License : GPLv3
|
-- License : GPLv3
|
||||||
-- Description : neovim mappings file
|
-- Description : neovim mappings file
|
||||||
|
|
||||||
utils.map("n", "<space>", "<leader>")
|
vim.keymap.set({ "n", "v" }, "<space>", "<Nop>", { silent = true })
|
||||||
utils.map("n", "<leader>y", "\"+y")
|
vim.g.mapleader = " "
|
||||||
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>")
|
|
||||||
|
|
||||||
-- LSP
|
-- Dealing with word wrap
|
||||||
utils.map("n", "gd", "<cmd>lua vim.lsp.buf.definition()<CR>")
|
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'",
|
||||||
utils.map("n", "gD", "<cmd>lua vim.lsp.buf.declaration()<CR>")
|
{ expr = true, silent = true })
|
||||||
utils.map("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>")
|
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'",
|
||||||
utils.map("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>")
|
{ expr = true, silent = true })
|
||||||
utils.map("n", "<leader>ln", "<cmd>lua vim.diagnostic.goto_next()<CR>")
|
|
||||||
utils.map("n", "<leader>lp", "<cmd>lua vim.diagnostic.goto_prev()<CR>")
|
vim.keymap.set("n", "<leader>y", "\"+y")
|
||||||
utils.map("n", "<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>")
|
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
|
-- telescope
|
||||||
utils.map("n", "<leader>tf", "<cmd>Telescope find_files<CR>")
|
vim.keymap.set("n", "<leader>ff",
|
||||||
utils.map("n", "<leader>tb", "<cmd>Telescope file_browser<CR>")
|
function() require("telescope.builtin").find_files() end)
|
||||||
utils.map("n", "<leader>tl", "<cmd>Telescope live_grep<CR>")
|
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
|
-- 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
|
-- snippets
|
||||||
utils.map("i", "<C-E>", "<Plug>luasnip-next-choice", {})
|
vim.keymap.set({ "i", "s" }, "<C-E>", "<Plug>luasnip-next-choice")
|
||||||
utils.map("s", "<C-E>", "<Plug>luasnip-next-choice", {})
|
|
||||||
|
@ -7,77 +7,121 @@ local cmp = require("cmp")
|
|||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||||
|
|
||||||
local check_backspace = function()
|
local has_words_before = function()
|
||||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||||
return col ~= 0 and
|
return col ~= 0 and
|
||||||
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:
|
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:
|
||||||
sub(col, col):match('%s') == nil
|
sub(col, col):match('%s') == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- If you want insert `(` after select function or method item
|
-- If you want insert `(` after select function or method item
|
||||||
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
||||||
|
|
||||||
cmp.setup {
|
-- Custom item icons
|
||||||
completion = {
|
local icons = {
|
||||||
autocomplete = false
|
Class = "",
|
||||||
},
|
Color = "",
|
||||||
sources = {
|
Constant = "µ",
|
||||||
{ name = "path" },
|
Constructor = "",
|
||||||
{ name = "luasnip" },
|
Enum = "",
|
||||||
{ name = "nvim_lsp" },
|
EnumMember = "",
|
||||||
{ name = "buffer" },
|
Event = "",
|
||||||
{ name = "nvim_lua" },
|
Field = "",
|
||||||
{ name = "calc" },
|
File = "",
|
||||||
{ name = "spell" },
|
Folder = "",
|
||||||
{ name = "treesitter" },
|
Function = "",
|
||||||
},
|
Keyword = "",
|
||||||
formatting = {
|
Interface = "",
|
||||||
format = function(entry, vim_item)
|
Method = "",
|
||||||
vim_item.menu = ({
|
Module = "",
|
||||||
nvim_lsp = "[lsp]",
|
Operator = "",
|
||||||
nvim_lua = "[nvim]",
|
Property = "",
|
||||||
luasnip = "[snip]",
|
Reference = "",
|
||||||
path = "[path]",
|
Snippet = "",
|
||||||
buffer = "[buff]",
|
Struct = "",
|
||||||
calc = "[calc]",
|
Text = "",
|
||||||
spell = "[spel]",
|
TypeParameter = "",
|
||||||
treesitter = "[tree]",
|
Unit = "",
|
||||||
})[entry.source.name]
|
Value = "",
|
||||||
return vim_item
|
Variable = "",
|
||||||
end,
|
}
|
||||||
},
|
|
||||||
snippet = {
|
cmp.setup {
|
||||||
expand = function(args)
|
completion = {
|
||||||
require("luasnip").lsp_expand(args.body)
|
autocomplete = true
|
||||||
end,
|
},
|
||||||
},
|
sources = {
|
||||||
mapping = {
|
{ name = "path" },
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
{ name = "luasnip" },
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
{ name = "nvim_lsp" },
|
||||||
["<C-e>"] = cmp.mapping.close(),
|
{ name = "buffer" },
|
||||||
["<CR>"] = cmp.mapping.confirm({
|
{ name = "nvim_lua" },
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
{ name = "calc" },
|
||||||
select = true,
|
{ name = "spell" },
|
||||||
}),
|
{ name = "treesitter" },
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
},
|
||||||
if cmp.visible() then
|
formatting = {
|
||||||
cmp.select_next_item()
|
format = function(entry, vim_item)
|
||||||
elseif luasnip.expand_or_jumpable() then
|
vim_item.kind = string.format("%s %s", icons[vim_item.kind],
|
||||||
luasnip.expand_or_jump()
|
vim_item.kind)
|
||||||
elseif check_backspace() then
|
vim_item.menu = ({
|
||||||
cmp.complete()
|
nvim_lsp = "[lsp]",
|
||||||
else
|
nvim_lua = "[nvim]",
|
||||||
fallback()
|
luasnip = "[snip]",
|
||||||
end
|
path = "[path]",
|
||||||
end, { "i", "s" }),
|
buffer = "[buff]",
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
calc = "[calc]",
|
||||||
if cmp.visible() then
|
spell = "[spel]",
|
||||||
cmp.select_prev_item()
|
treesitter = "[tree]",
|
||||||
elseif luasnip.jumpable(-1) then
|
})[entry.source.name]
|
||||||
luasnip.jump(-1)
|
return vim_item
|
||||||
else
|
end,
|
||||||
fallback()
|
},
|
||||||
end
|
snippet = {
|
||||||
end, { "i", "s" }),
|
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' }
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
23
.config/nvim/lua/plugin/lsp/clangd.lua
Normal file
23
.config/nvim/lua/plugin/lsp/clangd.lua
Normal 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
|
82
.config/nvim/lua/plugin/lsp/init.lua
Normal file
82
.config/nvim/lua/plugin/lsp/init.lua
Normal 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
|
47
.config/nvim/lua/plugin/lsp/sumneko_lua.lua
Normal file
47
.config/nvim/lua/plugin/lsp/sumneko_lua.lua
Normal 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
|
18
.config/nvim/lua/plugin/lsp/texlab.lua
Normal file
18
.config/nvim/lua/plugin/lsp/texlab.lua
Normal 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
|
||||||
|
|
@ -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)
|
|
@ -31,7 +31,26 @@ ls.config.set_config({
|
|||||||
ext_opts = {
|
ext_opts = {
|
||||||
[types.choiceNode] = {
|
[types.choiceNode] = {
|
||||||
active = {
|
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
|
-- Returns a snippet_node wrapped around an insert_node whose initial
|
||||||
-- text value is set to the current date in the desired format.
|
-- text value is set to the current date in the desired format.
|
||||||
local function date_input(fmt)
|
local function date_input(fmt)
|
||||||
local fmt = fmt or "%Y-%m-%d"
|
local format = fmt or "%Y-%m-%d"
|
||||||
return sn(nil, i(1, os.date(fmt)))
|
return sn(nil, i(1, os.date(format)))
|
||||||
end
|
end
|
||||||
|
|
||||||
ls.snippets = {
|
local copy = utils.copy
|
||||||
-- When trying to expand a snippet, luasnip first searches the tables for
|
|
||||||
-- each filetype specified in 'filetype' followed by 'all'.
|
-- snippets are added via ls.add_snippets(filetype, snippets[, opts]), where
|
||||||
-- If ie. the filetype is 'lua.c'
|
-- opts may specify the `type` of the snippets ("snippets" or "autosnippets",
|
||||||
-- - luasnip.lua
|
-- for snippets that should expand directly after the trigger is typed).
|
||||||
-- - luasnip.c
|
--
|
||||||
-- - luasnip.all
|
-- opts can also specify a key. By passing an unique key to each add_snippets, it's possible to reload snippets by
|
||||||
-- are searched in that order.
|
-- re-`:luafile`ing the file in which they are defined (eg. this one).
|
||||||
all = {
|
ls.add_snippets( "all", {
|
||||||
-- trigger is fn.
|
-- trigger is fn.
|
||||||
s("fn", {
|
s("fn", {
|
||||||
-- Simple static text.
|
-- Simple static text.
|
||||||
t("//Parameters: "),
|
t("//Parameters: "),
|
||||||
-- function, first parameter is the function, second the Placeholders
|
-- function, first parameter is the function, second the Placeholders
|
||||||
-- whose text it gets as input.
|
-- whose text it gets as input.
|
||||||
f(copy, 2),
|
f(copy, 2),
|
||||||
t({ "", "function " }),
|
t({ "", "function " }),
|
||||||
-- Placeholder/Insert.
|
-- Placeholder/Insert.
|
||||||
i(1),
|
i(1),
|
||||||
t("("),
|
t("("),
|
||||||
-- Placeholder with initial text.
|
-- Placeholder with initial text.
|
||||||
i(2, "int foo"),
|
i(2, "int foo"),
|
||||||
-- Linebreak
|
-- Linebreak
|
||||||
t({ ") {", "\t" }),
|
t({ ") {", "\t" }),
|
||||||
-- Last Placeholder, exit Point of the snippet. EVERY 'outer' SNIPPET NEEDS Placeholder 0.
|
-- Last Placeholder, exit Point of the snippet. EVERY 'outer' SNIPPET NEEDS Placeholder 0.
|
||||||
i(0),
|
i(0),
|
||||||
t({ "", "}" }),
|
t({ "", "}" }),
|
||||||
}),
|
}),
|
||||||
s("class", {
|
s("class", {
|
||||||
-- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes.
|
-- Choice: Switch between two different Nodes, first parameter is its position, second a list of nodes.
|
||||||
c(1, {
|
c(1, {
|
||||||
t("public "),
|
t("public "),
|
||||||
t("private "),
|
t("private "),
|
||||||
}),
|
}),
|
||||||
t("class "),
|
t("class "),
|
||||||
i(2),
|
i(2),
|
||||||
t(" "),
|
t(" "),
|
||||||
c(3, {
|
c(3, {
|
||||||
t("{"),
|
t("{"),
|
||||||
-- sn: Nested Snippet. Instead of a trigger, it has a position, just like insert-nodes. !!! These don't expect a 0-node!!!!
|
-- 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.
|
-- Inside Choices, Nodes don't need a position as the choice node is the one being jumped to.
|
||||||
sn(nil, {
|
sn(nil, {
|
||||||
t("extends "),
|
t("extends "),
|
||||||
i(1),
|
i(1),
|
||||||
t(" {"),
|
t(" {"),
|
||||||
}),
|
}),
|
||||||
sn(nil, {
|
sn(nil, {
|
||||||
t("implements "),
|
t("implements "),
|
||||||
i(1),
|
i(1),
|
||||||
t(" {"),
|
t(" {"),
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
t({ "", "\t" }),
|
t({ "", "\t" }),
|
||||||
i(0),
|
i(0),
|
||||||
t({ "", "}" }),
|
t({ "", "}" }),
|
||||||
}),
|
}),
|
||||||
-- Use a dynamic_node to interpolate the output of a
|
-- Use a dynamic_node to interpolate the output of a
|
||||||
-- function (see date_input above) into the initial
|
-- function (see date_input above) into the initial
|
||||||
-- value of an insert_node.
|
-- value of an insert_node.
|
||||||
s("novel", {
|
s("novel", {
|
||||||
t("It was a dark and stormy night on "),
|
t("It was a dark and stormy night on "),
|
||||||
d(1, date_input, {}, "%A, %B %d of %Y"),
|
d(1, date_input, {}, "%A, %B %d of %Y"),
|
||||||
t(" and the clocks were striking thirteen."),
|
t(" and the clocks were striking thirteen."),
|
||||||
}),
|
}),
|
||||||
-- Parsing snippets: First parameter: Snippet-Trigger, Second: Snippet body.
|
-- 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.
|
-- 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.
|
-- This means they are not SELECTed like in other editors/Snippet engines.
|
||||||
ls.parser.parse_snippet(
|
ls.parser.parse_snippet(
|
||||||
"lspsyn",
|
"lspsyn",
|
||||||
"Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"
|
"Wow! This ${1:Stuff} really ${2:works. ${3:Well, a bit.}}"
|
||||||
),
|
),
|
||||||
|
|
||||||
-- When wordTrig is set to false, snippets may also expand inside other words.
|
-- When wordTrig is set to false, snippets may also expand inside other words.
|
||||||
ls.parser.parse_snippet(
|
ls.parser.parse_snippet(
|
||||||
{ trig = "te", wordTrig = false },
|
{ trig = "te", wordTrig = false },
|
||||||
"${1:cond} ? ${2:true} : ${3:false}"
|
"${1:cond} ? ${2:true} : ${3:false}"
|
||||||
),
|
),
|
||||||
|
|
||||||
-- When regTrig is set, trig is treated like a pattern, this snippet will expand after any number.
|
-- 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!!"),
|
ls.parser.parse_snippet({ trig = "%d", regTrig = true }, "A Number!!"),
|
||||||
-- Using the condition, it's possible to allow expansion only in specific cases.
|
-- Using the condition, it's possible to allow expansion only in specific cases.
|
||||||
s("cond", {
|
s("cond", {
|
||||||
t("will only expand in c-style comments"),
|
t("will only expand in c-style comments"),
|
||||||
}, {
|
}, {
|
||||||
condition = function(line_to_cursor, matched_trigger, captures)
|
condition = function(line_to_cursor, matched_trigger, captures)
|
||||||
-- optional whitespace followed by //
|
-- optional whitespace followed by //
|
||||||
return line_to_cursor:match("%s*//")
|
return line_to_cursor:match("%s*//")
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
-- there's some built-in conditions in "luasnip.extras.expand_conditions".
|
-- there's some built-in conditions in "luasnip.extras.expand_conditions".
|
||||||
s("cond2", {
|
s("cond2", {
|
||||||
t("will only expand at the beginning of the line"),
|
t("will only expand at the beginning of the line"),
|
||||||
}, {
|
}, {
|
||||||
condition = conds.line_begin,
|
condition = conds.line_begin,
|
||||||
}),
|
}),
|
||||||
-- The last entry of args passed to the user-function is the surrounding snippet.
|
-- The last entry of args passed to the user-function is the surrounding snippet.
|
||||||
s(
|
s(
|
||||||
{ trig = "a%d", regTrig = true },
|
{ trig = "a%d", regTrig = true },
|
||||||
f(function(_, snip)
|
f(function(_, snip)
|
||||||
return "Triggered with " .. snip.trigger .. "."
|
return "Triggered with " .. snip.trigger .. "."
|
||||||
end, {})
|
end, {})
|
||||||
),
|
),
|
||||||
-- It's possible to use capture-groups inside regex-triggers.
|
-- It's possible to use capture-groups inside regex-triggers.
|
||||||
s(
|
s(
|
||||||
{ trig = "b(%d)", regTrig = true },
|
{ trig = "b(%d)", regTrig = true },
|
||||||
f(function(_, snip)
|
f(function(_, snip)
|
||||||
return "Captured Text: " .. snip.captures[1] .. "."
|
return "Captured Text: " .. snip.captures[1] .. "."
|
||||||
end, {})
|
end, {})
|
||||||
),
|
),
|
||||||
s({ trig = "c(%d+)", regTrig = true }, {
|
s({ trig = "c(%d+)", regTrig = true }, {
|
||||||
t("will only expand for even numbers"),
|
t("will only expand for even numbers"),
|
||||||
}, {
|
}, {
|
||||||
condition = function(line_to_cursor, matched_trigger, captures)
|
condition = function(line_to_cursor, matched_trigger, captures)
|
||||||
return tonumber(captures[1]) % 2 == 0
|
return tonumber(captures[1]) % 2 == 0
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
-- Use a function to execute any shell command and print its text.
|
-- Use a function to execute any shell command and print its text.
|
||||||
s("bash", f(bash, {}, "ls")),
|
s("bash", f(bash, {}, "ls")),
|
||||||
-- Short version for applying String transformations using function nodes.
|
-- Short version for applying String transformations using function nodes.
|
||||||
s("transform", {
|
s("transform", {
|
||||||
i(1, "initial text"),
|
i(1, "initial text"),
|
||||||
t({ "", "" }),
|
t({ "", "" }),
|
||||||
-- lambda nodes accept an l._1,2,3,4,5, which in turn accept any string transformations.
|
-- 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.
|
-- 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),
|
l(l._1:match("[^i]*$"):gsub("i", "o"):gsub(" ", "_"):upper(), 1),
|
||||||
}),
|
}),
|
||||||
s("transform2", {
|
s("transform2", {
|
||||||
i(1, "initial text"),
|
i(1, "initial text"),
|
||||||
t("::"),
|
t("::"),
|
||||||
i(2, "replacement for e"),
|
i(2, "replacement for e"),
|
||||||
t({ "", "" }),
|
t({ "", "" }),
|
||||||
-- Lambdas can also apply transforms USING the text of other nodes:
|
-- Lambdas can also apply transforms USING the text of other nodes:
|
||||||
l(l._1:gsub("e", l._2), { 1, 2 }),
|
l(l._1:gsub("e", l._2), { 1, 2 }),
|
||||||
}),
|
}),
|
||||||
s({ trig = "trafo(%d+)", regTrig = true }, {
|
s({ trig = "trafo(%d+)", regTrig = true }, {
|
||||||
-- env-variables and captures can also be used:
|
-- env-variables and captures can also be used:
|
||||||
l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}),
|
l(l.CAPTURE1:gsub("1", l.TM_FILENAME), {}),
|
||||||
}),
|
}),
|
||||||
-- Set store_selection_keys = "<Tab>" (for example) in your
|
-- Set store_selection_keys = "<Tab>" (for example) in your
|
||||||
-- luasnip.config.setup() call to access TM_SELECTED_TEXT. In
|
-- luasnip.config.setup() call to access TM_SELECTED_TEXT. In
|
||||||
-- this case, select a URL, hit Tab, then expand this snippet.
|
-- this case, select a URL, hit Tab, then expand this snippet.
|
||||||
s("link_url", {
|
s("link_url", {
|
||||||
t('<a href="'),
|
t('<a href="'),
|
||||||
f(function(_, snip)
|
f(function(_, snip)
|
||||||
return snip.env.TM_SELECTED_TEXT[1] or {}
|
return snip.env.TM_SELECTED_TEXT[1] or {}
|
||||||
end, {}),
|
end, {}),
|
||||||
t('">'),
|
t('">'),
|
||||||
i(1),
|
i(1),
|
||||||
t("</a>"),
|
t("</a>"),
|
||||||
i(0),
|
i(0),
|
||||||
}),
|
}),
|
||||||
-- Shorthand for repeating the text in a given node.
|
-- Shorthand for repeating the text in a given node.
|
||||||
s("repeat", { i(1, "text"), t({ "", "" }), r(1) }),
|
s("repeat", { i(1, "text"), t({ "", "" }), r(1) }),
|
||||||
-- Directly insert the ouput from a function evaluated at runtime.
|
-- Directly insert the ouput from a function evaluated at runtime.
|
||||||
s("part", p(os.date, "%Y")),
|
s("part", p(os.date, "%Y")),
|
||||||
-- use matchNodes to insert text based on a pattern/function/lambda-evaluation.
|
-- use matchNodes to insert text based on a pattern/function/lambda-evaluation.
|
||||||
s("mat", {
|
s("mat", {
|
||||||
i(1, { "sample_text" }),
|
i(1, { "sample_text" }),
|
||||||
t(": "),
|
t(": "),
|
||||||
m(1, "%d", "contains a number", "no number :("),
|
m(1, "%d", "contains a number", "no number :("),
|
||||||
}),
|
}),
|
||||||
-- The inserted text defaults to the first capture group/the entire
|
-- The inserted text defaults to the first capture group/the entire
|
||||||
-- match if there are none
|
-- match if there are none
|
||||||
s("mat2", {
|
s("mat2", {
|
||||||
i(1, { "sample_text" }),
|
i(1, { "sample_text" }),
|
||||||
t(": "),
|
t(": "),
|
||||||
m(1, "[abc][abc][abc]"),
|
m(1, "[abc][abc][abc]"),
|
||||||
}),
|
}),
|
||||||
-- It is even possible to apply gsubs' or other transformations
|
-- It is even possible to apply gsubs' or other transformations
|
||||||
-- before matching.
|
-- before matching.
|
||||||
s("mat3", {
|
s("mat3", {
|
||||||
i(1, { "sample_text" }),
|
i(1, { "sample_text" }),
|
||||||
t(": "),
|
t(": "),
|
||||||
m(
|
m(
|
||||||
1,
|
1,
|
||||||
l._1:gsub("[123]", ""):match("%d"),
|
l._1:gsub("[123]", ""):match("%d"),
|
||||||
"contains a number that isn't 1, 2 or 3!"
|
"contains a number that isn't 1, 2 or 3!"
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
-- `match` also accepts a function, which in turn accepts a string
|
-- `match` also accepts a function, which in turn accepts a string
|
||||||
-- (text in node, \n-concatted) and returns any non-nil value to match.
|
-- (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.
|
-- If that value is a string, it is used for the default-inserted text.
|
||||||
s("mat4", {
|
s("mat4", {
|
||||||
i(1, { "sample_text" }),
|
i(1, { "sample_text" }),
|
||||||
t(": "),
|
t(": "),
|
||||||
m(1, function(text)
|
m(1, function(text)
|
||||||
return (#text % 2 == 0 and text) or nil
|
return (#text % 2 == 0 and text) or nil
|
||||||
end),
|
end),
|
||||||
}),
|
}),
|
||||||
-- The nonempty-node inserts text depending on whether the arg-node is
|
-- The nonempty-node inserts text depending on whether the arg-node is
|
||||||
-- empty.
|
-- empty.
|
||||||
s("nempty", {
|
s("nempty", {
|
||||||
i(1, "sample_text"),
|
i(1, "sample_text"),
|
||||||
n(1, "i(1) is not empty!"),
|
n(1, "i(1) is not empty!"),
|
||||||
}),
|
}),
|
||||||
-- dynamic lambdas work exactly like regular lambdas, except that they
|
-- dynamic lambdas work exactly like regular lambdas, except that they
|
||||||
-- don't return a textNode, but a dynamicNode containing one insertNode.
|
-- don't return a textNode, but a dynamicNode containing one insertNode.
|
||||||
-- This makes it easier to dynamically set preset-text for insertNodes.
|
-- This makes it easier to dynamically set preset-text for insertNodes.
|
||||||
s("dl1", {
|
s("dl1", {
|
||||||
i(1, "sample_text"),
|
i(1, "sample_text"),
|
||||||
t({ ":", "" }),
|
t({ ":", "" }),
|
||||||
dl(2, l._1, 1),
|
dl(2, l._1, 1),
|
||||||
}),
|
}),
|
||||||
-- Obviously, it's also possible to apply transformations, just like lambdas.
|
-- Obviously, it's also possible to apply transformations, just like lambdas.
|
||||||
s("dl2", {
|
s("dl2", {
|
||||||
i(1, "sample_text"),
|
i(1, "sample_text"),
|
||||||
i(2, "sample_text_2"),
|
i(2, "sample_text_2"),
|
||||||
t({ "", "" }),
|
t({ "", "" }),
|
||||||
dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }),
|
dl(3, l._1:gsub("\n", " linebreak ") .. l._2, { 1, 2 }),
|
||||||
}),
|
}),
|
||||||
-- Alternative printf-like notation for defining snippets. It uses format
|
-- Alternative printf-like notation for defining snippets. It uses format
|
||||||
-- string with placeholders similar to the ones used with Python's .format().
|
-- string with placeholders similar to the ones used with Python's .format().
|
||||||
s(
|
s(
|
||||||
"fmt1",
|
"fmt1",
|
||||||
fmt("To {title} {} {}.", {
|
fmt("To {title} {} {}.", {
|
||||||
i(2, "Name"),
|
i(2, "Name"),
|
||||||
i(3, "Surname"),
|
i(3, "Surname"),
|
||||||
title = c(1, { t("Mr."), t("Ms.") }),
|
title = c(1, { t("Mr."), t("Ms.") }),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
-- To escape delimiters use double them, e.g. `{}` -> `{{}}`.
|
-- To escape delimiters use double them, e.g. `{}` -> `{{}}`.
|
||||||
-- Multi-line format strings by default have empty first/last line removed.
|
-- 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
|
-- Indent common to all lines is also removed. Use the third `opts` argument
|
||||||
-- to control this behaviour.
|
-- to control this behaviour.
|
||||||
s(
|
s(
|
||||||
"fmt2",
|
"fmt2",
|
||||||
fmt(
|
fmt(
|
||||||
[[
|
[[
|
||||||
foo({1}, {3}) {{
|
foo({1}, {3}) {{
|
||||||
return {2} * {4}
|
return {2} * {4}
|
||||||
}}
|
}}
|
||||||
]],
|
]],
|
||||||
{
|
{
|
||||||
i(1, "x"),
|
i(1, "x"),
|
||||||
r(1),
|
r(1),
|
||||||
i(2, "y"),
|
i(2, "y"),
|
||||||
r(2),
|
r(2),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
-- Empty placeholders are numbered automatically starting from 1 or the last
|
-- Empty placeholders are numbered automatically starting from 1 or the last
|
||||||
-- value of a numbered placeholder. Named placeholders do not affect numbering.
|
-- value of a numbered placeholder. Named placeholders do not affect numbering.
|
||||||
s(
|
s(
|
||||||
"fmt3",
|
"fmt3",
|
||||||
fmt("{} {a} {} {1} {}", {
|
fmt("{} {a} {} {1} {}", {
|
||||||
t("1"),
|
t("1"),
|
||||||
t("2"),
|
t("2"),
|
||||||
a = t("A"),
|
a = t("A"),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
-- The delimiters can be changed from the default `{}` to something else.
|
-- The delimiters can be changed from the default `{}` to something else.
|
||||||
s(
|
s(
|
||||||
"fmt4",
|
"fmt4",
|
||||||
fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })
|
fmt("foo() { return []; }", i(1, "x"), { delimiters = "[]" })
|
||||||
),
|
),
|
||||||
-- `fmta` is a convenient wrapper that uses `<>` instead of `{}`.
|
-- `fmta` is a convenient wrapper that uses `<>` instead of `{}`.
|
||||||
s("fmt5", fmta("foo() { return <>; }", i(1, "x"))),
|
s("fmt5", fmta("foo() { return <>; }", i(1, "x"))),
|
||||||
-- By default all args must be used. Use strict=false to disable the check
|
-- By default all args must be used. Use strict=false to disable the check
|
||||||
s(
|
s(
|
||||||
"fmt6",
|
"fmt6",
|
||||||
fmt("use {} only", { t("this"), t("not this") }, { strict = false })
|
fmt("use {} only", { t("this"), t("not this") }, { strict = false })
|
||||||
),
|
),
|
||||||
},
|
}, {
|
||||||
}
|
key = "all",
|
||||||
|
})
|
||||||
|
|
||||||
-- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets.
|
-- autotriggered snippets have to be defined in a separate table, luasnip.autosnippets.
|
||||||
ls.autosnippets = {
|
ls.autosnippets = {
|
||||||
|
@ -1,111 +1,114 @@
|
|||||||
-- Author : swytch
|
-- Author : swytch
|
||||||
-- Created : Friday Mar 12, 2021 22:28:34 CET
|
-- Created : Friday Mar 12, 2021 22:28:34 CET
|
||||||
-- License : GPLv3
|
-- License : GPLv3
|
||||||
-- Description : neovim plugins file
|
-- Description : neovim packer config file
|
||||||
|
|
||||||
|
|
||||||
local execute = vim.api.nvim_command
|
local packer = require("packer")
|
||||||
local fn = vim.fn
|
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||||
|
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||||
local install_path = fn.stdpath("data").."/site/pack/packer/start/packer.nvim"
|
print("Cloning packer...")
|
||||||
|
PACKER_BOOTSTRAP = vim.fn.system({
|
||||||
if fn.empty(fn.glob(install_path)) > 0 then
|
"git",
|
||||||
fn.system({"git", "clone", "https://github.com/wbthomason/packer.nvim", install_path})
|
"clone",
|
||||||
execute "packadd packer.nvim"
|
"--depth",
|
||||||
|
"1",
|
||||||
|
"https://github.com/wbthomason/packer.nvim",
|
||||||
|
install_path,
|
||||||
|
})
|
||||||
|
vim.cmd([[packadd packer.nvim]])
|
||||||
|
print("Done.")
|
||||||
end
|
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()
|
return require("packer").startup(function()
|
||||||
-- packer manages itself
|
-- packer manages itself
|
||||||
use "wbthomason/packer.nvim"
|
use "wbthomason/packer.nvim"
|
||||||
|
|
||||||
-- colorscheme
|
-- colorscheme
|
||||||
use {
|
use {
|
||||||
"~/.local/src/astronomy.nvim",
|
"~/.local/src/astronomy.nvim",
|
||||||
config = function() require("colorscheme") end
|
config = function() require("colorscheme") end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- tree-sitter
|
-- tree-sitter
|
||||||
use {
|
use {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
run = ":TSUpdate",
|
run = ":TSUpdate",
|
||||||
config = function() require("plugin.treesitter") end
|
config = function() require("plugin.treesitter") end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- fuzzy finder
|
-- fuzzy finder
|
||||||
use {
|
use {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
opt = true,
|
requires = {
|
||||||
requires = {
|
{
|
||||||
{
|
"nvim-lua/plenary.nvim",
|
||||||
"nvim-lua/popup.nvim",
|
},
|
||||||
opt = true
|
{
|
||||||
},
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
{
|
run = "make"
|
||||||
"nvim-lua/plenary.nvim",
|
}
|
||||||
opt = true
|
},
|
||||||
}
|
}
|
||||||
},
|
|
||||||
cmd = "Telescope"
|
|
||||||
}
|
|
||||||
|
|
||||||
-- LSP
|
-- LSP
|
||||||
use {
|
use {
|
||||||
"williamboman/nvim-lsp-installer",
|
"neovim/nvim-lspconfig",
|
||||||
cmd = {
|
requires = {
|
||||||
"LspInstall",
|
"williamboman/nvim-lsp-installer",
|
||||||
"LspInstallInfo"
|
},
|
||||||
},
|
config = function() require("plugin.lsp") end
|
||||||
config = function() require("plugin.lsp_installer").setup() end
|
}
|
||||||
}
|
|
||||||
|
|
||||||
use {
|
-- auto completion
|
||||||
"neovim/nvim-lspconfig",
|
use {
|
||||||
ft = { "c", "cpp", "lua", "python", "tex"},
|
"hrsh7th/nvim-cmp",
|
||||||
config = function() require("lsp").setup() end
|
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
|
-- commenting, simplified
|
||||||
use {
|
use {
|
||||||
"hrsh7th/nvim-cmp",
|
"numToStr/Comment.nvim",
|
||||||
requires = {
|
config = function() require("plugin.comment") end
|
||||||
{
|
}
|
||||||
"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
|
-- autopairs
|
||||||
use {
|
use {
|
||||||
"numToStr/Comment.nvim",
|
"windwp/nvim-autopairs",
|
||||||
config = function() require("plugin.comment") end
|
config = function() require("nvim-autopairs").setup() end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- autopairs
|
|
||||||
use {
|
|
||||||
"windwp/nvim-autopairs",
|
|
||||||
config = function() require('nvim-autopairs').setup() end
|
|
||||||
}
|
|
||||||
|
|
||||||
-- display colors directly in editor
|
-- automatically setup the config after cloning
|
||||||
use {
|
if PACKER_BOOTSTRAP then
|
||||||
"norcalli/nvim-colorizer.lua",
|
require("packer").sync()
|
||||||
cmd = "ColorizerToggle"
|
end
|
||||||
}
|
|
||||||
|
|
||||||
-- ens
|
|
||||||
use {
|
|
||||||
"whonore/Coqtail",
|
|
||||||
ft = { "verilog" },
|
|
||||||
config = vim.cmd[[let g:coqtail_nomap = 1]]
|
|
||||||
}
|
|
||||||
end)
|
end)
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
-- Description : treesitter config file
|
-- Description : treesitter config file
|
||||||
|
|
||||||
require("nvim-treesitter.configs").setup {
|
require("nvim-treesitter.configs").setup {
|
||||||
ensure_installed = { "c", "lua", "python", "bash" },
|
ensure_installed = { "c", "lua", "python", "bash" },
|
||||||
ignore_install = { "javascript" },
|
ignore_install = { "javascript" },
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
indent = {
|
indent = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ local opt = vim.opt
|
|||||||
local g = vim.g
|
local g = vim.g
|
||||||
|
|
||||||
-- general
|
-- general
|
||||||
opt.wildignore = {
|
opt.wildignore = {
|
||||||
".git",
|
".git",
|
||||||
"*.o", "*.class",
|
"*.o", "*.class",
|
||||||
"*.jpg", "*.jpeg", "*.png",
|
"*.jpg", "*.jpeg", "*.png",
|
||||||
@ -18,41 +18,41 @@ opt.wildmode = { "longest", "full" }
|
|||||||
opt.wildoptions = "pum"
|
opt.wildoptions = "pum"
|
||||||
|
|
||||||
-- editor
|
-- editor
|
||||||
opt.lazyredraw = true
|
opt.lazyredraw = true
|
||||||
opt.splitright = true
|
opt.splitright = true
|
||||||
opt.splitbelow = true
|
opt.splitbelow = true
|
||||||
opt.scrolloff = 4
|
opt.scrolloff = 4
|
||||||
opt.termguicolors = true
|
opt.termguicolors = true
|
||||||
opt.background = "dark"
|
opt.background = "dark"
|
||||||
opt.cursorline = true
|
opt.cursorline = true
|
||||||
opt.shortmess = opt.shortmess:append { c = true }
|
opt.shortmess = opt.shortmess:append { c = true }
|
||||||
opt.number = true
|
opt.number = true
|
||||||
opt.relativenumber = true
|
opt.relativenumber = true
|
||||||
opt.signcolumn = "yes"
|
opt.signcolumn = "yes"
|
||||||
opt.listchars = {
|
opt.listchars = {
|
||||||
tab = "<->",
|
tab = "<->",
|
||||||
nbsp = "␣",
|
nbsp = "␣",
|
||||||
trail = "·",
|
trail = "·",
|
||||||
extends = ">",
|
extends = ">",
|
||||||
precedes = "<",
|
precedes = "<",
|
||||||
}
|
}
|
||||||
opt.showmatch = true
|
opt.showmatch = true
|
||||||
opt.ignorecase = true
|
opt.ignorecase = true
|
||||||
opt.smartcase = true
|
opt.smartcase = true
|
||||||
opt.inccommand = "split"
|
opt.inccommand = "split"
|
||||||
opt.completeopt = { "menuone", "noselect" }
|
opt.completeopt = { "menuone", "noselect" }
|
||||||
|
|
||||||
-- statusline
|
-- statusline
|
||||||
opt.laststatus = 2
|
opt.laststatus = 2
|
||||||
opt.showmode = false
|
opt.showmode = false
|
||||||
|
|
||||||
-- text, tabs, indents
|
-- text, tabs, indents
|
||||||
opt.textwidth = 79
|
opt.textwidth = 79
|
||||||
opt.shiftwidth = 8
|
opt.shiftwidth = 8
|
||||||
opt.softtabstop = -1
|
opt.softtabstop = -1
|
||||||
opt.expandtab = true
|
opt.expandtab = true
|
||||||
opt.shiftwidth = 0
|
opt.shiftwidth = 0
|
||||||
opt.backspace = { "indent", "eol", "start" }
|
opt.backspace = { "indent", "eol", "start" }
|
||||||
|
|
||||||
-- augroups
|
-- augroups
|
||||||
utils.create_augroup({
|
utils.create_augroup({
|
||||||
|
@ -6,204 +6,204 @@
|
|||||||
|
|
||||||
|
|
||||||
local function gen_section(hl_string, items)
|
local function gen_section(hl_string, items)
|
||||||
local out = ""
|
local out = ""
|
||||||
for _, item in pairs(items) do
|
for _, item in pairs(items) do
|
||||||
if item ~= "" then
|
if item ~= "" then
|
||||||
out = out .. " " .. item
|
out = out .. " " .. item
|
||||||
end
|
|
||||||
end
|
|
||||||
if out ~="" then
|
|
||||||
return hl_string .. out .. " "
|
|
||||||
else
|
|
||||||
return out
|
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
if out ~="" then
|
||||||
|
return hl_string .. out .. " "
|
||||||
|
else
|
||||||
|
return out
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- sensible names for vim modes
|
-- sensible names for vim modes
|
||||||
local function get_mode(m)
|
local function get_mode(m)
|
||||||
local mode_group = {
|
local mode_group = {
|
||||||
["n"] = "Normal",
|
["n"] = "Normal",
|
||||||
["no"] = "O-Pending",
|
["no"] = "O-Pending",
|
||||||
["nov"] = "O-Pending",
|
["nov"] = "O-Pending",
|
||||||
["noV"] = "O-Pending",
|
["noV"] = "O-Pending",
|
||||||
["no"] = "O-Pending",
|
["no"] = "O-Pending",
|
||||||
["niI"] = "Normal",
|
["niI"] = "Normal",
|
||||||
["niR"] = "Normal",
|
["niR"] = "Normal",
|
||||||
["niV"] = "Normal",
|
["niV"] = "Normal",
|
||||||
["v"] = "Visual",
|
["v"] = "Visual",
|
||||||
["V"] = "V-Line",
|
["V"] = "V-Line",
|
||||||
[""] = "V-Block",
|
[""] = "V-Block",
|
||||||
["s"] = "Select",
|
["s"] = "Select",
|
||||||
["S"] = "S-Line",
|
["S"] = "S-Line",
|
||||||
[""] = "S-Block",
|
[""] = "S-Block",
|
||||||
["i"] = "Insert",
|
["i"] = "Insert",
|
||||||
["ic"] = "Insert",
|
["ic"] = "Insert",
|
||||||
["ix"] = "Insert",
|
["ix"] = "Insert",
|
||||||
["R"] = "Replace",
|
["R"] = "Replace",
|
||||||
["Rc"] = "Replace",
|
["Rc"] = "Replace",
|
||||||
["Rv"] = "V-Replace",
|
["Rv"] = "V-Replace",
|
||||||
["Rx"] = "Replace",
|
["Rx"] = "Replace",
|
||||||
["c"] = "Command",
|
["c"] = "Command",
|
||||||
["cv"] = "Ex",
|
["cv"] = "Ex",
|
||||||
["ce"] = "Ex",
|
["ce"] = "Ex",
|
||||||
["r"] = "Prompt",
|
["r"] = "Prompt",
|
||||||
["rm"] = "Prompt",
|
["rm"] = "Prompt",
|
||||||
["r?"] = "Prompt",
|
["r?"] = "Prompt",
|
||||||
["!"] = "Shell",
|
["!"] = "Shell",
|
||||||
["t"] = "Terminal",
|
["t"] = "Terminal",
|
||||||
}
|
}
|
||||||
return mode_group[m] or "None"
|
return mode_group[m] or "None"
|
||||||
end
|
end
|
||||||
|
|
||||||
local function get_mode_display_name(m)
|
local function get_mode_display_name(m)
|
||||||
local mode = {
|
local mode = {
|
||||||
["Normal"] = "[ NRM ]",
|
["Normal"] = "[ NRM ]",
|
||||||
["O-Pending"] = "[ OTR ]",
|
["O-Pending"] = "[ OTR ]",
|
||||||
["Visual"] = "[ VSL ]",
|
["Visual"] = "[ VSL ]",
|
||||||
["V-Line"] = "[ V·L ]",
|
["V-Line"] = "[ V·L ]",
|
||||||
["V-Block"] = "[ V·B ]",
|
["V-Block"] = "[ V·B ]",
|
||||||
["Select"] = "[ SEL ]",
|
["Select"] = "[ SEL ]",
|
||||||
["S-Line"] = "[ S·L ]",
|
["S-Line"] = "[ S·L ]",
|
||||||
["S-Block"] = "[ S·B ]",
|
["S-Block"] = "[ S·B ]",
|
||||||
["Insert"] = "[ INS ]",
|
["Insert"] = "[ INS ]",
|
||||||
["Replace"] = "[ RPL ]",
|
["Replace"] = "[ RPL ]",
|
||||||
["Command"] = "[ CMD ]",
|
["Command"] = "[ CMD ]",
|
||||||
["Prompt"] = "[ PMT ]",
|
["Prompt"] = "[ PMT ]",
|
||||||
["Shell"] = "[ SHL ]",
|
["Shell"] = "[ SHL ]",
|
||||||
["Terminal"] = "[ TRM ]",
|
["Terminal"] = "[ TRM ]",
|
||||||
["None"] = "[ --- ]"
|
["None"] = "[ --- ]"
|
||||||
}
|
}
|
||||||
return mode[m]
|
return mode[m]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- get the highlight group for a mode group
|
-- get the highlight group for a mode group
|
||||||
local function get_mode_color(m)
|
local function get_mode_color(m)
|
||||||
local color = {
|
local color = {
|
||||||
["Normal"] = "%#NormalMode#",
|
["Normal"] = "%#NormalMode#",
|
||||||
["O-Pending"] = "%#NormalMode#",
|
["O-Pending"] = "%#NormalMode#",
|
||||||
["Visual"] = "%#VisualMode#",
|
["Visual"] = "%#VisualMode#",
|
||||||
["V-Line"] = "%#VisualMode#",
|
["V-Line"] = "%#VisualMode#",
|
||||||
["V-Block"] = "%#VisualMode#",
|
["V-Block"] = "%#VisualMode#",
|
||||||
["Select"] = "%#NormalMode#",
|
["Select"] = "%#NormalMode#",
|
||||||
["S-Line"] = "%#NormalMode#",
|
["S-Line"] = "%#NormalMode#",
|
||||||
["S-Block"] = "%#NormalMode#",
|
["S-Block"] = "%#NormalMode#",
|
||||||
["Insert"] = "%#InsertMode#",
|
["Insert"] = "%#InsertMode#",
|
||||||
["Replace"] = "%#ReplaceMode#",
|
["Replace"] = "%#ReplaceMode#",
|
||||||
["Command"] = "%#CommandMode#",
|
["Command"] = "%#CommandMode#",
|
||||||
["Prompt"] = "%#NormalMode#",
|
["Prompt"] = "%#NormalMode#",
|
||||||
["Shell"] = "%#NormalMode#",
|
["Shell"] = "%#NormalMode#",
|
||||||
["Terminal"] = "%#NormalMode#",
|
["Terminal"] = "%#NormalMode#",
|
||||||
["None"] = "%#NormalMode#"
|
["None"] = "%#NormalMode#"
|
||||||
}
|
}
|
||||||
return color[m]
|
return color[m]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- from https://github.com/nvim-lua/lsp-status.nvim/blob/master/lua/lsp-status/diagnostics.lua
|
-- from https://github.com/nvim-lua/lsp-status.nvim/blob/master/lua/lsp-status/diagnostics.lua
|
||||||
local function get_lsp_diagnostics(bufnr)
|
local function get_lsp_diagnostics()
|
||||||
local result = {}
|
local result = {}
|
||||||
local levels = {
|
local levels = {
|
||||||
errors = "Error",
|
error = "Error",
|
||||||
warnings = "Warn",
|
warn = "Warn",
|
||||||
info = "Info",
|
info = "Info",
|
||||||
hints = "Hint"
|
hint = "Hint"
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, level in pairs(levels) do
|
for k, level in pairs(levels) do
|
||||||
local count = 0
|
local count = 0
|
||||||
local diags = vim.diagnostic.get(bufnr, { severity = level })
|
local diags = vim.diagnostic.get(0, { severity = level })
|
||||||
for _, _ in pairs(diags) do
|
for _, _ in pairs(diags) do
|
||||||
count = count + 1
|
count = count + 1
|
||||||
end
|
|
||||||
result[k] = count
|
|
||||||
end
|
end
|
||||||
|
result[k] = count
|
||||||
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local function process_diagnostics(prefix, n, hl)
|
local function process_diagnostics(prefix, n, hl)
|
||||||
if n > 0 then
|
if n > 0 then
|
||||||
return hl .. prefix .. n
|
return hl .. prefix .. n
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function spell_check()
|
local function spell_check()
|
||||||
if vim.wo.spell then
|
if vim.wo.spell then
|
||||||
local lang = vim.o.spelllang
|
local lang = vim.o.spelllang
|
||||||
return "[SPELL=" .. lang .. "]"
|
return "[SPELL=" .. lang .. "]"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function statusline_focused()
|
local function statusline_focused()
|
||||||
local diagnostics = get_lsp_diagnostics()
|
local diagnostics = get_lsp_diagnostics()
|
||||||
local mode = vim.fn.mode()
|
local mode = vim.fn.mode()
|
||||||
local mg = get_mode(mode)
|
local mg = get_mode(mode)
|
||||||
local accent_color = get_mode_color(mg)
|
local accent_color = get_mode_color(mg)
|
||||||
|
|
||||||
local left = table.concat {
|
local left = table.concat {
|
||||||
gen_section(accent_color, {get_mode_display_name(mg)}),
|
gen_section(accent_color, {get_mode_display_name(mg)}),
|
||||||
gen_section("%#Middle#", {"%f"}),
|
gen_section("%#Middle#", {"%f"}),
|
||||||
gen_section("%#Bottom#", {"%m", "%r"}),
|
gen_section("%#Bottom#", {"%m", "%r"}),
|
||||||
gen_section(
|
gen_section(
|
||||||
"%#Alert#",
|
"%#Alert#",
|
||||||
{
|
{
|
||||||
process_diagnostics(
|
process_diagnostics(
|
||||||
globals.sign_error .. " ",
|
globals.sign_error .. " ",
|
||||||
diagnostics.errors,
|
diagnostics.error,
|
||||||
"%#DiagnosticVirtualTextError#"
|
"%#DiagnosticVirtualTextError#"
|
||||||
),
|
),
|
||||||
process_diagnostics(
|
process_diagnostics(
|
||||||
globals.sign_warning .. " ",
|
globals.sign_warn .. " ",
|
||||||
diagnostics.warnings,
|
diagnostics.warn,
|
||||||
"%#DiagnosticVirtualTextWarn#"
|
"%#DiagnosticVirtualTextWarn#"
|
||||||
),
|
),
|
||||||
process_diagnostics(
|
process_diagnostics(
|
||||||
globals.sign_info .. " ",
|
globals.sign_info .. " ",
|
||||||
diagnostics.info,
|
diagnostics.info,
|
||||||
"%#DiagnosticVirtualTextInfo#"
|
"%#DiagnosticVirtualTextInfo#"
|
||||||
)
|
)
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
local right = table.concat {
|
)
|
||||||
gen_section(
|
}
|
||||||
"%#Bottom#",
|
local right = table.concat {
|
||||||
{
|
gen_section(
|
||||||
spell_check(),
|
"%#Bottom#",
|
||||||
vim.bo.filetype
|
{
|
||||||
}
|
spell_check(),
|
||||||
),
|
vim.bo.filetype
|
||||||
gen_section("%#Middle#", {"%03.p%%"}),
|
|
||||||
gen_section("%#Top#", {"-%03.c-"})
|
|
||||||
}
|
}
|
||||||
|
),
|
||||||
|
gen_section("%#Middle#", {"%03.p%%"}),
|
||||||
|
gen_section("%#Top#", {"-%03.c-"})
|
||||||
|
}
|
||||||
|
|
||||||
return table.concat {
|
return table.concat {
|
||||||
left,
|
left,
|
||||||
"%#Statusline#",
|
"%#Statusline#",
|
||||||
"%=",
|
"%=",
|
||||||
right
|
right
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function statusline_not_focused()
|
local function statusline_not_focused()
|
||||||
return table.concat {
|
return table.concat {
|
||||||
gen_section("%#StatuslineNF#", {"%f", "%m"}),
|
gen_section("%#StatuslineNF#", {"%f", "%m"}),
|
||||||
"%=",
|
"%=",
|
||||||
gen_section("%#StatuslineNF#", {"%03.p%%"}),
|
gen_section("%#StatuslineNF#", {"%03.p%%"}),
|
||||||
gen_section("%#StatuslineNF#", {"-%03.c-"})
|
gen_section("%#StatuslineNF#", {"-%03.c-"})
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function _G.gen_statusline()
|
function _G.gen_statusline()
|
||||||
if vim.g.statusline_winid == vim.fn.win_getid() then
|
if vim.g.statusline_winid == vim.fn.win_getid() then
|
||||||
return statusline_focused()
|
return statusline_focused()
|
||||||
else
|
else
|
||||||
return statusline_not_focused()
|
return statusline_not_focused()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.o.statusline = "%!luaeval(\"gen_statusline()\")"
|
vim.o.statusline = "%!luaeval(\"gen_statusline()\")"
|
||||||
|
@ -22,12 +22,6 @@ function M.add_rtp(path)
|
|||||||
rtp = rtp .. "," .. path
|
rtp = rtp .. "," .. path
|
||||||
end
|
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
|
-- see if a file exists
|
||||||
function M.file_exists(file)
|
function M.file_exists(file)
|
||||||
local f = io.open(file, "rb")
|
local f = io.open(file, "rb")
|
||||||
|
@ -23,6 +23,9 @@ super + shift + s
|
|||||||
super + shift + r
|
super + shift + r
|
||||||
dmenuprompt "reboot?" "reboot"
|
dmenuprompt "reboot?" "reboot"
|
||||||
|
|
||||||
|
super + BackSpace
|
||||||
|
slock
|
||||||
|
|
||||||
super + shift + d
|
super + shift + d
|
||||||
displayselect
|
displayselect
|
||||||
|
|
||||||
@ -32,7 +35,7 @@ super + shift + o
|
|||||||
super + c
|
super + c
|
||||||
switch-colors
|
switch-colors
|
||||||
|
|
||||||
super + shift + c
|
super + alt + c
|
||||||
switch-colors -s
|
switch-colors -s
|
||||||
|
|
||||||
# Others
|
# Others
|
||||||
@ -48,6 +51,12 @@ super + d
|
|||||||
super + shift + o
|
super + shift + o
|
||||||
dmenuopen
|
dmenuopen
|
||||||
|
|
||||||
|
super + p
|
||||||
|
screenshot
|
||||||
|
|
||||||
|
super + alt + p
|
||||||
|
screenshot -w
|
||||||
|
|
||||||
super + shift + {w,z}
|
super + shift + {w,z}
|
||||||
$BROWSER
|
$BROWSER
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
set-option -g status-style bg=color0 # bg=bg1, fg=fg1
|
set-option -g status-style bg=color0 # bg=bg1, fg=fg1
|
||||||
|
|
||||||
set-option -g status-left "\
|
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 "\
|
set-option -g status-right "\
|
||||||
#[fg=color7, bg=color8] %b. %d \
|
#[fg=color7, bg=color8] %b. %d \
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
|
|
||||||
|
|
||||||
[ $1 = "" ] && 1="mv -i"
|
[ $1 = "" ] && 1="mv -i"
|
||||||
[ $1 = "sox" ] && flags="-C 320"
|
[ $1 = "sox" ] && flags="-C 6"
|
||||||
\ls | $EDITOR - -c ":%s/.*/$1 \"&\" $flags \"&\"/g"
|
\ls | $EDITOR - -c ":%s/.*/$1 \"&\" $flags \"&\"/g"
|
||||||
|
@ -31,15 +31,21 @@ shebangtest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
texcompile() { \
|
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")"
|
bibliography="$(grep '\\bibliography' "$file")"
|
||||||
|
|
||||||
if [ -n "$bibliography" ]; then
|
if [ -n "$bibliography" ]; then
|
||||||
pdflatex --output-directory="$dir" "$base" &&
|
$cmd --output-directory="$dir" "$base" &&
|
||||||
bibtex "$base" &&
|
bibtex "$base" &&
|
||||||
pdflatex --output-directory="$dir" "$base" &&
|
$cmd --output-directory="$dir" "$base" &&
|
||||||
pdflatex --output-directory="$dir" "$base"
|
$cmd --output-directory="$dir" "$base"
|
||||||
else
|
else
|
||||||
pdflatex --output-directory="$dir" "$base" &&
|
$cmd --output-directory="$dir" "$base" &&
|
||||||
pdflatex --output-directory="$dir" "$base"
|
$cmd --output-directory="$dir" "$base"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
.local/bin/screenshot
Executable file
23
.local/bin/screenshot
Executable 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
|
@ -42,18 +42,22 @@ do
|
|||||||
status=" " && capacity="FULL"
|
status=" " && capacity="FULL"
|
||||||
printf " %s:%s(%s) " "$slot" "$status" "$capacity"
|
printf " %s:%s(%s) " "$slot" "$status" "$capacity"
|
||||||
else
|
else
|
||||||
if [ "$status" = "Charging" ]; then
|
if [ 100 -lt $(expr $capacity) ]; then
|
||||||
status=""
|
status=""
|
||||||
else
|
else
|
||||||
case "$capacity" in
|
if [ "$status" = "Charging" ]; then
|
||||||
100|[8-9][0-9]) status="" ;;
|
status=""
|
||||||
[6-7][0-9]) status="" ;;
|
else
|
||||||
[4-5][0-9]) status="" ;;
|
case "$capacity" in
|
||||||
[2-3][0-9]) status="" ;;
|
100|[8-9][0-9]) status="" ;;
|
||||||
*) status="" ;;
|
[6-7][0-9]) status="" ;;
|
||||||
esac
|
[4-5][0-9]) status="" ;;
|
||||||
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
|
[2-3][0-9]) status="" ;;
|
||||||
|
*) status="" ;;
|
||||||
|
esac
|
||||||
|
[ "BAT0" = $slot ] && [ 30 -gt $capacity ] && notify;
|
||||||
|
fi
|
||||||
|
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
|
||||||
fi
|
fi
|
||||||
printf " %s:%s (%0.2d%%) " "$slot" "$status" "$capacity";
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -14,7 +14,11 @@
|
|||||||
eth="$(cat /sys/class/net/eno1/operstate)"
|
eth="$(cat /sys/class/net/eno1/operstate)"
|
||||||
ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')"
|
ssid="$(wpa_cli status | grep -i ^ssid | sed -e 's/.*=//')"
|
||||||
state="$(wpa_cli status | grep -i ^wpa_state | 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
|
if [ "up" = "$eth" ]; then
|
||||||
str="$(printf "%s / " "$str")"
|
str="$(printf "%s / " "$str")"
|
||||||
fi
|
fi
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit d77e1cfe127418ab00c6d5fb076f89cdf9b49e94
|
Subproject commit 41edd2a8502cc6d3be9ad18387e8b3c67d2dd4c3
|
@ -1 +1 @@
|
|||||||
Subproject commit f8ad07e02878adfbdab1241869630d608566c5c0
|
Subproject commit 82003c8dad7b966ab65f339749fb4272eafb8f4b
|
Reference in New Issue
Block a user