mv conf file to dir and update task

This commit is contained in:
Jeff Lance 2023-08-06 15:45:02 +02:00
parent 844e227103
commit 19d42d184f
8 changed files with 1008 additions and 554 deletions

View File

@ -0,0 +1,25 @@
--[[--
File : python.lua
Author : Jeff Lance <email@jefflance.me>
Date : 06.08.2023 12:46:43
Last Modified Date: 06.08.2023 12:46:43
Last Modified By : Jeff Lance <email@jefflance.me>
--]]--
-- linters
--
local linters = require("lvim.lsp.null-ls.linters")
linters.setup({
{ command = "flake8", filetypes = { "python" } },
})
-- formatters
--
local formatters = require("lvim.lsp.null-ls.formatters")
formatters.setup({
{ name = "black" },
})

View File

@ -0,0 +1,26 @@
--[[--
File : /home/jeff/.config/lvim/after/ftplugin/tex.lua
Author : Jeff Lance <email@jefflance.me>
Date : 05.08.2023 00:54:40
Last Modified Date: 05.08.2023 00:54:40
Last Modified By : Jeff Lance <email@jefflance.me>
--]]--
-- linters
--
local linters = require("lvim.lsp.null-ls.linters")
linters.setup({
{ command = "chktex", filetypes = { "tex" } },
})
-- formatters
--
local formatters = require("lvim.lsp.null-ls.formatters")
formatters.setup({
{ command = "latexindent", filetypes = { "tex" } },
})

505
conf.d/lvim/config.lua Normal file
View File

@ -0,0 +1,505 @@
--[[--
File : /home/jeff/.config/lvim/config.lua
Author : Jeff Lance <email@jefflance.me>
Date : 03.08.2023 16:16:54
Last Modified Date: 04.08.2023 00:49:41
Last Modified By : Jeff Lance <email@jefflance.me>
---
lvim is the global options object
--]]--
-- general
--
-- lvim config
lvim.log.level = "warn"
lvim.format_on_save.enabled = true
lvim.format_on_save.pattern = { "*.py", "*.tex" }
lvim.colorscheme = "onedark_dark"
lvim.background = "dark"
lvim.transparent_window = true
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false
-- core plugins config
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.luasnip.enable_autosnippets = true
lvim.builtin.nvimtree.active = false
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
lvim.builtin.terminal.active = true
-- theme settings
--
-- lvim.builtin.theme.options.dim_inactive = true
-- lvim.builtin.theme.options.style = "storm"
-- variables
--
-- functions
--
-- keymappings [view all the defaults by pressing <leader>Lvk]
--
lvim.leader = ";"
lvim.keys.insert_mode[";;"] = "<Esc>"
lvim.keys.normal_mode["<C-s>"] = "<CMD>w<CR>"
lvim.keys.normal_mode["<C-r>"] = "<CMD>redo<CR>"
lvim.keys.normal_mode["<C-u>"] = "<CMD>undo<CR>"
lvim.keys.normal_mode["<C-[>"] = ":<<CR>"
lvim.keys.normal_mode["<C-]>"] = ":><CR>"
-- remap neo-tree shortcut to rnvimr
lvim.builtin.which_key.mappings["e"] = { "<CMD>RnvimrToggle<CR>", "File explorer" }
lvim.builtin.which_key.mappings["d"] = lvim.builtin.which_key.mappings[";"]
lvim.builtin.which_key.mappings["G"] = lvim.builtin.which_key.mappings["g"]
lvim.builtin.which_key.mappings["g"] = {}
lvim.builtin.which_key.mappings["H"] = {
name = "Header",
H = { "<CMD>AddHeader<CR>" , "Add header to the file" },
h = { "<CMD>AddMinHeader<CR>" , "Add minimal header to the file" },
lg = { "<CMD>AddGNULicense<CR>", "Add GPLv3 License" },
lm = { "<CMD>AddMITLicense<CR>", "Add MIT License" },
}
lvim.builtin.which_key.mappings["Lv"] = lvim.builtin.which_key.mappings["L"]
lvim.builtin.which_key.mappings["Ll"] = lvim.builtin.which_key.mappings["l"]
lvim.builtin.which_key.mappings["l"] = {}
lvim.builtin.which_key.mappings["L"] = {
name = "LSP, Lunar"
}
lvim.builtin.which_key.mappings["n"] = {
name = "Notes",
n = { "<CMD>ZkNew { title = vim.fn.input('Titre: ') }<CR>", "Créer une nouvelle note" },
o = { "<CMD>ZkNotes { sort = { 'modified' } }<CR>", "Ouvrir une note"},
O = { "<CMD>ZkTags<CR>", "Ouvrir les notes avec le tag sélectionné" },
f = { "<CMD>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Rechercher note: ') } }<CR>", "Rechercher une note" },
F = { ":'<,'>ZkMatch<CR>", "Rechercher les notes contenant la sélection" },
}
lvim.builtin.which_key.mappings["o"] = { "<CMD>Telescope find_files<CR>", "Open a file" }
lvim.builtin.which_key.mappings["P"] = lvim.builtin.which_key.mappings["p"]
lvim.builtin.which_key.mappings["p"] = { "<CMD>Telescope projects<CR>", "Projects"}
lvim.builtin.which_key.mappings["S"] = lvim.builtin.which_key.mappings["s"]
lvim.builtin.which_key.mappings["s"] = { "<CMD>echom 'Sourcing' <BAR> source %<CR>", "Source current file" }
lvim.builtin.which_key.mappings["r"] = { "<CMD>Telescope oldfiles<CR>", "Open recent file" }
lvim.builtin.which_key.mappings["x"] = { "<CMD>w! <BAR> q!<CR>", "Save and quit"}
lvim.builtin.which_key.mappings[";"] = {}
lvim.builtin.terminal.open_mapping = "<C-t>"
-- Treesitter settings
--
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
"bash",
"c",
"javascript",
"json",
"latex",
"lua",
"python",
"typescript",
"tsx",
"css",
"rust",
"java",
"yaml",
}
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enable = true
lvim.builtin.treesitter.rainbow.enable = true
-- Generic LSP settings
--
vim.diagnostic.config({ virtual_text = true })
-- setup LSP
local capabilities = require("lvim.lsp").common_capabilities()
require("lvim.lsp.manager").setup("texlab", {
on_attach = require("lvim.lsp").common_on_attach,
on_init = require("lvim.lsp").common_on_init,
capabilities = capabilities,
})
-- Setup formatters and linters
--
-- Currently started with ftplugin for:
-- latex
-- python
-- Python management setup
--
-- setup debug adapter
lvim.builtin.dap.active = true
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/")
pcall(function()
require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python")
end)
-- setup testing
require("neotest").setup({
adapters = {
require("neotest-python")({
-- Extra arguments for nvim-dap configuration
-- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values
dap = {
justMyCode = false,
console = "integratedTerminal",
},
args = { "--log-level", "DEBUG", "--quiet" },
runner = "pytest",
})
}
})
-- Additional Plugins
--
lvim.plugins = {
-- addheader
{
'alpertuna/vim-header',
config = function ()
vim.cmd ([[
let g:header_field_author = 'Jeff Lance'
let g:header_field_author_email = 'email@jefflance.me'
let g:header_auto_update_header = 1
let g:header_field_filename_path = 1
let g:header_field_timestamp_format = '%d.%m.%Y %H:%M:%S'
]])
end,
},
-- asyncrun
{
"skywind3000/asyncrun.vim",
},
-- colorschemes
{
'Abstract-IDE/Abstract-cs',
},
{
'ishan9299/modus-theme-vim',
},
{
'NLKNguyen/papercolor-theme',
},
{
'olimorris/onedarkpro.nvim',
priority = 1000,
config = function ()
require("onedarkpro").setup({
colors = {
onedark = {
bg = "#000000" -- black
},
onelight = {
bg = "#FFFFFF" -- white
},
-- cursorline = "#FF0000",
},
styles = {
types = "NONE",
methods = "NONE",
numbers = "NONE",
strings = "NONE",
comments = "italic",
keywords = "bold,italic",
constants = "NONE",
functions = "italic",
operators = "NONE",
variables = "NONE",
parameters = "NONE",
conditionals = "italic",
virtual_text = "NONE",
},
options = {
cursorline = true,
transparency = true,
}
})
end
},
-- markdown previewer
{
'iamcco/markdown-preview.nvim',
build = "cd app && npm install",
ft = "markdown",
config = function()
vim.cmd ([[
let g:mkdp_auto_start = 1
]])
end,
},
-- minimap
{
'echasnovski/mini.map',
branch = "stable",
config = function()
require('mini.map').setup()
local map = require('mini.map')
map.setup({
integrations = {
map.gen_integration.builtin_search(),
map.gen_integration.diagnostic({
error = 'DiagnosticFloatingError',
warn = 'DiagnosticFloatingWarn',
info = 'DiagnosticFloatingInfo',
hint = 'DiagnosticFloatingHint',
}),
},
symbols = {
encode = map.gen_encode_symbols.dot('2x1'),
},
window = {
side = 'right',
width = 20, -- set to 1 for a pure scrollbar :)
winblend = 15,
show_integration_count = false,
},
})
end
},
-- neoscroll: smooth scrolling
{
"karb94/neoscroll.nvim",
event = "WinScrolled",
config = function()
require('neoscroll').setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>',
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'},
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
})
end
},
-- zk: a plain text note-taking assistant
{
'mickael-menu/zk-nvim',
config = function()
require("zk").setup({
})
end,
},
-- nvim-ts-rainbow: rainbowed parenthesis
{
"mrjones2014/nvim-ts-rainbow",
},
-- colorizer: color highlighter
{
'norcalli/nvim-colorizer.lua',
config = function()
require("colorizer").setup({ '*' }, {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
mode = 'background',
})
end,
},
{
"kevinhwang91/rnvimr",
cmd = "RnvimrToggle",
config = function()
vim.cmd ([[
let g:rnvimr_draw_border = 1
let g:rnvimr_pick_enable = 1
let g:rnvimr_bw_enable = 1
]])
end,
},
-- suda
{
'lambdalisue/suda.vim',
config = function()
vim.cmd ([[
let g:prompt = 'Mot de passe: '
let g:suda_smart_edit = 1
]])
end,
},
-- -- telescope-project
-- {
-- "nvim-telescope/telescope-project.nvim",
-- event = "BufWinEnter",
-- setup = function()
-- vim.cmd ([[
-- packadd telescope.nvim
-- ]])
-- end,
-- },
-- trouble
{
'folke/trouble.nvim',
cmd = "TroubleToggle",
},
-- vim-repeat: enable repeating supported plugin maps with "."
{
"tpope/vim-repeat"
},
-- vim-surround
{
'tpope/vim-surround',
config = function ()
vim.cmd ([[
let timeoutlen = 500
]])
end,
},
-- LaTeX management needed plugins
{
"lervag/vimtex",
config = function ()
vim.cmd([[
let g:vimtex_view_method = "zathura"
let g:vimtex_quickfix_enabled = 0
let g:vimtex_compiler_method = 'latexmk'
let g:vimtex_view_use_temp_files = 1
]])
end,
},
{
"kdheepak/cmp-latex-symbols"
},
{
"KeitaNakamura/tex-conceal.vim"
},
{
-- "SirVer/ultisnips"
},
-- Python management needed plugins
{
"ChristianChiarulli/swenv.nvim"
},
{
"stevearc/dressing.nvim"
},
{
"mfussenegger/nvim-dap-python"
},
{
"nvim-neotest/neotest"
},
{
"nvim-neotest/neotest-python"
},
}
-- Telescope plugins load
--
lvim.builtin.telescope.on_config_done = function(telescope)
-- pcall(telescope.load_extension, "project")
-- any other extensions loading
end
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
--
-- minimap view
-- lvim.autocommands = {
-- {
-- {"BufEnter", "Filetype"},
-- {
-- desc = "Open mini.map and exclude some filetypes",
-- pattern = { "*" },
-- callback = function()
-- local exclude_ft = {
-- "qf",
-- "NvimTree",
-- "toggleterm",
-- "TelescopePrompt",
-- "alpha",
-- "netrw",
-- }
-- local map = require('mini.map')
-- if vim.tbl_contains(exclude_ft, vim.o.filetype) then
-- vim.b.minimap_disable = true
-- map.close()
-- elseif vim.o.buftype == "" then
-- map.open()
-- end
-- end,
-- },
-- },
-- }
-- wrap mode for json files
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.json", "*.jsonc" },
-- enable wrap mode for json files only
command = "setlocal wrap",
})
-- bash highlight for zsh files
vim.api.nvim_create_autocmd("FileType", {
pattern = "zsh",
callback = function()
-- let treesitter use bash highlight for zsh files as well
require("nvim-treesitter.highlight").attach(0, "bash")
end,
})
-- -- latex cmp
-- vim.api.nvim_create_autocmd("FileType", {
-- group = vim.api.nvim_create_augroup("LaTeXGroup", { clear = true }),
-- pattern = "tex",
-- callback = function()
-- require("user.cmp")
-- end,
-- })

View File

@ -0,0 +1,61 @@
--[[--
File : ftplugin/tex.lua
Author : Jeff Lance <email@jefflance.me>
Date : 06.08.2023 11:07:22
Last Modified Date: 06.08.2023 11:07:22
Last Modified By : Jeff Lance <email@jefflance.me>
--]]--
local opts = {}
local status_ok, whk = pcall(require, "which-key")
if not status_ok then
return
end
whk.register {
["<leader>l"] = {
name = "LaTeX",
m = { "<cmd>VimtexContextMenu<CR>", "Open Context Menu" },
u = { "<cmd>VimtexCountLetters<CR>", "Count Letters" },
w = { "<cmd>VimtexCountWords<CR>", "Count Words" },
d = { "<cmd>VimtexDocPackage<CR>", "Open Doc for package" },
e = { "<cmd>VimtexErrors<CR>", "Look at the errors" },
s = { "<cmd>VimtexStatus<CR>", "Look at the status" },
a = { "<cmd>VimtexToggleMain<CR>", "Toggle Main" },
v = { "<cmd>VimtexView<CR>", "View pdf" },
i = { "<cmd>VimtexInfo<CR>", "Vimtex Info" },
l = {
name = "Clean",
l = { "<cmd>VimtexClean<CR>", "Clean Project" },
c = { "<cmd>VimtexClean<CR>", "Clean Cache" },
},
c = {
name = "Compile",
c = { "<cmd>VimtexCompile<CR>", "Compile Project" },
o = {
"<cmd>VimtexCompileOutput<CR>",
"Compile Project and Show Output",
},
s = { "<cmd>VimtexCompileSS<CR>", "Compile project super fast" },
e = { "<cmd>VimtexCompileSelected<CR>", "Compile Selected" },
},
r = {
name = "Reload",
r = { "<cmd>VimtexReload<CR>", "Reload" },
s = { "<cmd>VimtexReloadState<CR>", "Reload State" },
},
o = {
name = "Stop",
p = { "<cmd>VimtexStop<CR>", "Stop" },
a = { "<cmd>VimtexStopAll<CR>", "Stop All" },
},
t = {
name = "TOC",
o = { "<cmd>VimtexTocOpen<CR>", "Open TOC" },
t = { "<cmd>VimtexTocToggle<CR>", "Toggle TOC" },
},
}
}

View File

@ -0,0 +1,89 @@
--[[--
File : luasnip-helper-funcs.lua
Author : Jeff Lance <email@jefflance.me>
Date : 05.08.2023 20:35:21
Last Modified Date: 05.08.2023 20:35:21
Last Modified By : Jeff Lance <email@jefflance.me>
--]]--
local M = {}
-- Be sure to explicitly define these LuaSnip node abbreviations!
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_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 r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
local k = require("luasnip.nodes.key_indexer").new_key
function M.get_visual(args, parent)
if (#parent.snippet.env.LS_SELECT_RAW > 0) then
return sn(nil, i(1, parent.snippet.env.LS_SELECT_RAW))
else
return sn(nil, i(1, ''))
end
end
function M.rec_ls()
return sn(nil, {
c(1, {
-- important!! Having the sn(...) as the first choice will cause infinite recursion.
t({""}),
-- The same dynamicNode as in the snippet (also note: self reference).
sn(nil, {t({"", "\t\\item "}), i(1), d(2, rec_ls, {})}),
}),
});
end
function M.table_node(args)
local tabs = {}
local count
table = args[1][1]:gsub("%s",""):gsub("|","")
count = table:len()
for j=1, count do
local iNode
iNode = i(j)
tabs[2*j-1] = iNode
if j~=count then
tabs[2*j] = t" & "
end
end
return sn(nil, tabs)
end
function M.rec_table()
return sn(nil,
{
c(1, {
t({""}),
sn(nil, {t{"\\\\",""}, d(1, table_node, {ai[1]}), d(2, rec_table, {ai[1]})})
}),
}
);
end
return M

View File

@ -0,0 +1,295 @@
--[[--
File : .config/lvim/luasnippets/tex.lua
Author : Jeff Lance <email@jefflance.me>
Date : 05.08.2023 00:54:18
Last Modified Date: 06.08.2023 12:55:15
Last Modified By : Jeff Lance <email@jefflance.me>
--]]--
-- local get_visual = function(args, parent)
-- if (#parent.snippet.env.LS_SELECT_RAW > 0) then
-- return sn(nil, i(1, parent.snippet.env.LS_SELECT_RAW))
-- else
-- return sn(nil, i(1, ''))
-- end
-- end
-- local rec_ls = function()
-- return sn(nil, {
-- c(1, {
-- -- important!! Having the sn(...) as the first choice will cause infinite recursion.
-- t({""}),
-- -- The same dynamicNode as in the snippet (also note: self reference).
-- sn(nil, {t({"", "\t\\item "}), i(1), d(2, rec_ls, {})}),
-- }),
-- });
-- end
-- local table_node = function(args)
-- local tabs = {}
-- local count
-- table = args[1][1]:gsub("%s",""):gsub("|","")
-- count = table:len()
-- for j=1, count do
-- local iNode
-- iNode = i(j)
-- tabs[2*j-1] = iNode
-- if j~=count then
-- tabs[2*j] = t" & "
-- end
-- end
-- return sn(nil, tabs)
-- end
-- local rec_table = function()
-- return sn(nil,
-- {
-- c(1, {
-- t({""}),
-- sn(nil, {t{"\\\\",""}, d(1, table_node, {ai[1]}), d(2, rec_table, {ai[1]})})
-- }),
-- }
-- );
-- end
--
return {
-- s({trig = "ls", dscr = ""},
-- fmta(
-- [[
-- \begin{itemize}
-- \item <>
-- \end{itemize}
-- ]],
-- {
-- i(1),
-- d(2, rec_ls, {}),
-- i(0),
-- }
-- )
-- ),
-- s({trig = "tti", dscr = "Expands 'tii' into LaTeX's textit{} command."},
-- fmta("\\textit{<>}",
-- {
-- d(1, get_visual),
-- }
-- )
-- ),
-- s("table",
-- {
-- t{"\\begin{tabular}{"},
-- i(1,"0"),
-- t{"}",""},
-- d(2, table_node, {1}, {}),
-- d(3, rec_table, {1}),
-- t{"","\\end{tabular}"}
-- }
-- ),
--
-- environments
--
s({trig="env", dscr="A LaTeX empty environment"},
fmt(
[[
\begin{<>}[<>]
<>
\end{<>}
]],
-- The insert node is placed in the <> angle brackets
{
i(1),
i(2),
i(3),
rep(1), -- This node repeat insert node 1
},
-- This is where I specify that angle brackets are used as node positions.
{ delimiters = "<>" }
)
),
s({trig="def", dscr="My LaTeX class definition environment"},
fmt(
[[
\begin{definition}[<>]
<>
\end{definition}
]],
-- The insert node is placed in the <> angle brackets
{
i(1),
i(2)
},
-- This is where I specify that angle brackets are used as node positions.
{ delimiters = "<>" }
)
),
s({trig="ppt", dscr="My LaTeX class property environment"},
fmt(
[[
\begin{propriete}[<>]
<>
\end{propriete}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="cor", dscr="My LaTeX class corollair environment"},
fmt(
[[
\begin{corollaire}[<>]
<>
\end{corollaire}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="thm", dscr="My LaTeX class theorem environment"},
fmt(
[[
\begin{theoreme}[<>]
<>
\end{theoreme}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="dem", dscr="My LaTeX class proof environment"},
fmt(
[[
\begin{preuve}[<>]
<>
\end{preuve}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="csq", dscr="My LaTeX class consequence environment"},
fmt(
[[
\begin{consequence}[<>]
<>
\end{consequence}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="rem", dscr="My LaTeX class remark environment"},
fmt(
[[
\begin{remarque}[<>]
<>
\end{remarque}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="exp", dscr="My LaTeX class example environment"},
fmt(
[[
\begin{exemple}[<>]
<>
\end{exemple}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="met", dscr="My LaTeX class method environment"},
fmt(
[[
\begin{methode}[<>]
<>
\end{methode}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="app", dscr="My LaTeX class application environment"},
fmt(
[[
\begin{application}[<>]
<>
\end{application}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="exe", dscr="My LaTeX class exercise environment"},
fmt(
[[
\begin{exercice}[<>]
<>
\end{exercice}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="rap", dscr="My LaTeX class recall environment"},
fmt(
[[
\begin{rappel}[<>]
<>
\end{rappel}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
s({trig="aid", dscr="My LaTeX class help environment"},
fmt(
[[
\begin{aide}[<>]
<>
\end{aide}
]],
{
i(1),
i(2)
},
{ delimiters = "<>" }
)
),
}

View File

@ -1,552 +1,4 @@
--[[--
File : /home/jeff/.config/lvim/config.lua
Author : Jeff Lance <email@jefflance.me>
Date : 03.08.2023 16:16:54
Last Modified Date: 04.08.2023 00:49:41
Last Modified By : Jeff Lance <email@jefflance.me>
---
lvim is the global options object
--]]--
-- general
--
lvim.log.level = "warn"
lvim.format_on_save.enabled = false
lvim.colorscheme = "onedark_dark"
lvim.background = "dark"
lvim.transparent_window = true
-- to enable neo-tree file browsing, comment the following
lvim.builtin.nvimtree.active = false
-- to disable icons and use a minimalist setup, uncomment the following
-- lvim.use_icons = false
-- variables
--
-- functions
--
-- keymappings [view all the defaults by pressing <leader>Lvk]
--
lvim.leader = ";"
lvim.keys.insert_mode[";;"] = "<Esc>"
lvim.keys.normal_mode["<C-s>"] = "<CMD>w<CR>"
lvim.keys.normal_mode["<C-r>"] = "<CMD>redo<CR>"
lvim.keys.normal_mode["<C-u>"] = "<CMD>undo<CR>"
lvim.keys.normal_mode["<C-[>"] = ":<<CR>"
lvim.keys.normal_mode["<C-]>"] = ":><CR>"
-- remap neo-tree shortcut to rnvimr
lvim.builtin.which_key.mappings["e"] = { "<CMD>RnvimrToggle<CR>", "File explorer" }
lvim.builtin.which_key.mappings["d"] = lvim.builtin.which_key.mappings[";"]
lvim.builtin.which_key.mappings["G"] = lvim.builtin.which_key.mappings["g"]
lvim.builtin.which_key.mappings["g"] = {}
lvim.builtin.which_key.mappings["H"] = {
name = "Header",
H = { "<CMD>AddHeader<CR>" , "Add header to the file" },
h = { "<CMD>AddMinHeader<CR>" , "Add minimal header to the file" },
lg = { "<CMD>AddGNULicense<CR>", "Add GPLv3 License" },
lm = { "<CMD>AddMITLicense<CR>", "Add MIT License" },
}
lvim.builtin.which_key.mappings["Lv"] = lvim.builtin.which_key.mappings["L"]
lvim.builtin.which_key.mappings["Ll"] = lvim.builtin.which_key.mappings["l"]
lvim.builtin.which_key.mappings["l"] = {}
lvim.builtin.which_key.mappings["L"] = {
name = "LSP, Lunar"
}
lvim.builtin.which_key.mappings["l"] = {
name = "LaTeX",
m = { "<cmd>VimtexContextMenu<CR>", "Open Context Menu" },
u = { "<cmd>VimtexCountLetters<CR>", "Count Letters" },
w = { "<cmd>VimtexCountWords<CR>", "Count Words" },
d = { "<cmd>VimtexDocPackage<CR>", "Open Doc for package" },
e = { "<cmd>VimtexErrors<CR>", "Look at the errors" },
s = { "<cmd>VimtexStatus<CR>", "Look at the status" },
a = { "<cmd>VimtexToggleMain<CR>", "Toggle Main" },
v = { "<cmd>VimtexView<CR>", "View pdf" },
i = { "<cmd>VimtexInfo<CR>", "Vimtex Info" },
l = {
name = "Clean",
l = { "<cmd>VimtexClean<CR>", "Clean Project" },
c = { "<cmd>VimtexClean<CR>", "Clean Cache" },
},
c = {
name = "Compile",
c = { "<cmd>VimtexCompile<CR>", "Compile Project" },
o = {
"<cmd>VimtexCompileOutput<CR>",
"Compile Project and Show Output",
},
s = { "<cmd>VimtexCompileSS<CR>", "Compile project super fast" },
e = { "<cmd>VimtexCompileSelected<CR>", "Compile Selected" },
},
r = {
name = "Reload",
r = { "<cmd>VimtexReload<CR>", "Reload" },
s = { "<cmd>VimtexReloadState<CR>", "Reload State" },
},
o = {
name = "Stop",
p = { "<cmd>VimtexStop<CR>", "Stop" },
a = { "<cmd>VimtexStopAll<CR>", "Stop All" },
},
t = {
name = "TOC",
o = { "<cmd>VimtexTocOpen<CR>", "Open TOC" },
t = { "<cmd>VimtexTocToggle<CR>", "Toggle TOC" },
},
}
lvim.builtin.which_key.mappings["n"] = {
name = "Notes",
n = { "<CMD>ZkNew { title = vim.fn.input('Titre: ') }<CR>", "Créer une nouvelle note" },
o = { "<CMD>ZkNotes { sort = { 'modified' } }<CR>", "Ouvrir une note"},
O = { "<CMD>ZkTags<CR>", "Ouvrir les notes avec le tag sélectionné" },
f = { "<CMD>ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Rechercher note: ') } }<CR>", "Rechercher une note" },
F = { ":'<,'>ZkMatch<CR>", "Rechercher les notes contenant la sélection" },
}
lvim.builtin.which_key.mappings["o"] = { "<CMD>Telescope find_files<CR>", "Open a file" }
lvim.builtin.which_key.mappings["P"] = lvim.builtin.which_key.mappings["p"]
lvim.builtin.which_key.mappings["p"] = { "<CMD>Telescope projects<CR>", "Projects"}
lvim.builtin.which_key.mappings["S"] = lvim.builtin.which_key.mappings["s"]
lvim.builtin.which_key.mappings["s"] = { "<CMD>echom 'Sourcing' <BAR> source %<CR>", "Source current file" }
lvim.builtin.which_key.mappings["r"] = { "<CMD>Telescope oldfiles<CR>", "Open recent file" }
lvim.builtin.which_key.mappings["x"] = { "<CMD>w! <BAR> q!<CR>", "Save and quit"}
lvim.builtin.which_key.mappings[";"] = {}
lvim.builtin.terminal.open_mapping = "<C-t>"
-- Change theme settings
--
-- lvim.builtin.theme.options.dim_inactive = true
-- lvim.builtin.theme.options.style = "storm"
-- TODO: User Config for predefined plugins
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
lvim.builtin.alpha.active = true
lvim.builtin.alpha.mode = "dashboard"
lvim.builtin.terminal.active = true
lvim.builtin.nvimtree.setup.view.side = "left"
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
-- Treesitter settings
--
-- if you don't want all the parsers change this to a table of the ones you want
lvim.builtin.treesitter.ensure_installed = {
"bash",
"c",
"javascript",
"json",
"latex",
"lua",
"python",
"typescript",
"tsx",
"css",
"rust",
"java",
"yaml",
}
lvim.builtin.treesitter.ignore_install = { "haskell" }
lvim.builtin.treesitter.highlight.enable = true
lvim.builtin.treesitter.rainbow.enable = true
-- Generic LSP settings
--
vim.diagnostic.config({ virtual_text = true })
-- setup LSP
local capabilities = require("lvim.lsp").common_capabilities()
require("lvim.lsp.manager").setup("texlab", {
on_attach = require("lvim.lsp").common_on_attach,
on_init = require("lvim.lsp").common_on_init,
capabilities = capabilities,
})
-- Setup formatters and linters
--
-- formatters
local formatters = require("lvim.lsp.null-ls.formatters")
formatters.setup({
{ name = "black" },
{ command = "latexindent", filetypes = { "tex" } },
})
lvim.format_on_save.enabled = true
lvim.format_on_save.pattern = { "*.py", "*.tex" }
-- linters
local linters = require("lvim.lsp.null-ls.linters")
linters.setup({
{ command = "flake8", filetypes = { "python" } },
-- { command = "chktex", filetypes = { "tex" } },
})
-- Python management setup
--
-- setup debug adapter
lvim.builtin.dap.active = true
local mason_path = vim.fn.glob(vim.fn.stdpath "data" .. "/mason/")
pcall(function()
require("dap-python").setup(mason_path .. "packages/debugpy/venv/bin/python")
end)
-- setup testing
require("neotest").setup({
adapters = {
require("neotest-python")({
-- Extra arguments for nvim-dap configuration
-- See https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for values
dap = {
justMyCode = false,
console = "integratedTerminal",
},
args = { "--log-level", "DEBUG", "--quiet" },
runner = "pytest",
})
}
})
-- Additional Plugins
--
lvim.plugins = {
-- addheader
{
'alpertuna/vim-header',
config = function ()
vim.cmd ([[
let g:header_field_author = 'Jeff Lance'
let g:header_field_author_email = 'email@jefflance.me'
let g:header_auto_update_header = 1
let g:header_field_filename_path = 1
let g:header_field_timestamp_format = '%d.%m.%Y %H:%M:%S'
]])
end,
},
-- asyncrun
{
"skywind3000/asyncrun.vim",
},
-- colorschemes
{
'Abstract-IDE/Abstract-cs',
},
{
'ishan9299/modus-theme-vim',
},
{
'NLKNguyen/papercolor-theme',
},
{
'olimorris/onedarkpro.nvim',
priority = 1000,
config = function ()
require("onedarkpro").setup({
colors = {
onedark = {
bg = "#000000" -- black
},
onelight = {
bg = "#FFFFFF" -- white
},
-- cursorline = "#FF0000",
},
styles = {
types = "NONE",
methods = "NONE",
numbers = "NONE",
strings = "NONE",
comments = "italic",
keywords = "bold,italic",
constants = "NONE",
functions = "italic",
operators = "NONE",
variables = "NONE",
parameters = "NONE",
conditionals = "italic",
virtual_text = "NONE",
},
options = {
cursorline = true,
transparency = true,
}
})
end
},
-- markdown previewer
{
'iamcco/markdown-preview.nvim',
build = "cd app && npm install",
ft = "markdown",
config = function()
vim.g.mkdp_auto_start = 1
end,
},
-- minimap
{
'echasnovski/mini.map',
branch = "stable",
config = function()
require('mini.map').setup()
local map = require('mini.map')
map.setup({
integrations = {
map.gen_integration.builtin_search(),
map.gen_integration.diagnostic({
error = 'DiagnosticFloatingError',
warn = 'DiagnosticFloatingWarn',
info = 'DiagnosticFloatingInfo',
hint = 'DiagnosticFloatingHint',
}),
},
symbols = {
encode = map.gen_encode_symbols.dot('2x1'),
},
window = {
side = 'right',
width = 20, -- set to 1 for a pure scrollbar :)
winblend = 15,
show_integration_count = false,
},
})
end
},
-- neoscroll: smooth scrolling
{
"karb94/neoscroll.nvim",
event = "WinScrolled",
config = function()
require('neoscroll').setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>',
'<C-y>', '<C-e>', 'zt', 'zz', 'zb'},
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = nil, -- Default easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
})
end
},
-- zk: a plain text note-taking assistant
{
'mickael-menu/zk-nvim',
config = function()
require("zk").setup({
})
end,
},
-- nvim-ts-rainbow: rainbowed parenthesis
{
"mrjones2014/nvim-ts-rainbow",
},
-- colorizer: color highlighter
{
'norcalli/nvim-colorizer.lua',
config = function()
require("colorizer").setup({ '*' }, {
RGB = true, -- #RGB hex codes
RRGGBB = true, -- #RRGGBB hex codes
RRGGBBAA = true, -- #RRGGBBAA hex codes
rgb_fn = true, -- CSS rgb() and rgba() functions
hsl_fn = true, -- CSS hsl() and hsla() functions
css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
css_fn = true, -- Enable all CSS *functions*: rgb_fn, hsl_fn
mode = 'background',
})
end,
},
{
"kevinhwang91/rnvimr",
cmd = "RnvimrToggle",
config = function()
vim.g.rnvimr_draw_border = 1
vim.g.rnvimr_pick_enable = 1
vim.g.rnvimr_bw_enable = 1
end,
},
-- suda
{
'lambdalisue/suda.vim',
config = function()
vim.g.prompt = 'Mot de passe: '
vim.g.suda_smart_edit = 1
end,
},
---- telescope-project
--{
-- "nvim-telescope/telescope-project.nvim",
-- event = "BufWinEnter",
-- setup = function()
-- vim.cmd [[packadd telescope.nvim]]
-- end,
--},
-- trouble
{
'folke/trouble.nvim',
cmd = "TroubleToggle",
},
-- vim-repeat: enable repeating supported plugin maps with "."
{
"tpope/vim-repeat"
},
-- vim-surround
{
'tpope/vim-surround',
config = function ()
vim.o.timeoutlen = 500
end,
},
-- LaTeX management needed plugins
{
"lervag/vimtex",
config = function ()
vim.cmd([[
" let g:vimtex_view_method = "zathura"
let g:vimtex_quickfix_enabled = 0
let g:vimtex_compiler_method = 'latexmk'
let g:vimtex_view_use_temp_files = 1
]])
end,
},
{
"kdheepak/cmp-latex-symbols"
},
{
"KeitaNakamura/tex-conceal.vim"
},
{
-- "SirVer/ultisnips"
},
-- Python management needed plugins
{
"ChristianChiarulli/swenv.nvim"
},
{
"stevearc/dressing.nvim"
},
{
"mfussenegger/nvim-dap-python"
},
{
"nvim-neotest/neotest"
},
{
"nvim-neotest/neotest-python"
},
}
-- Telescope plugins load
--
lvim.builtin.telescope.on_config_done = function(telescope)
-- pcall(telescope.load_extension, "telescope-project")
-- any other extensions loading
end
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
--
-- minimap view
-- lvim.autocommands = {
-- {
-- {"BufEnter", "Filetype"},
-- {
-- desc = "Open mini.map and exclude some filetypes",
-- pattern = { "*" },
-- callback = function()
-- local exclude_ft = {
-- "qf",
-- "NvimTree",
-- "toggleterm",
-- "TelescopePrompt",
-- "alpha",
-- "netrw",
-- }
-- local map = require('mini.map')
-- if vim.tbl_contains(exclude_ft, vim.o.filetype) then
-- vim.b.minimap_disable = true
-- map.close()
-- elseif vim.o.buftype == "" then
-- map.open()
-- end
-- end,
-- },
-- },
-- }
-- wrap mode for json files
vim.api.nvim_create_autocmd("BufEnter", {
pattern = { "*.json", "*.jsonc" },
-- enable wrap mode for json files only
command = "setlocal wrap",
})
-- bash highlight for zsh files
vim.api.nvim_create_autocmd("FileType", {
pattern = "zsh",
callback = function()
-- let treesitter use bash highlight for zsh files as well
require("nvim-treesitter.highlight").attach(0, "bash")
end,
})
-- -- latex cmp
-- vim.api.nvim_create_autocmd("FileType", {
-- group = vim.api.nvim_create_augroup("LaTeXGroup", { clear = true }),
-- pattern = "tex",
-- callback = function()
-- require("user.cmp")
-- end,
-- })
-- Read the docs: https://www.lunarvim.org/docs/configuration
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6
-- Forum: https://www.reddit.com/r/lunarvim/
-- Discord: https://discord.com/invite/Xb9B4Ny

View File

@ -1,4 +1,5 @@
- link:
${HOME}/.config/lvim/config.lua:
path: conf/lvim.lua
${HOME}/.config/lvim:
glob: true
path: conf.d/lvim/*