diff --git a/dot_config/lvim/after/indent/arduino.vim b/dot_config/lvim/after/indent/arduino.vim new file mode 100644 index 0000000..b10e6e2 --- /dev/null +++ b/dot_config/lvim/after/indent/arduino.vim @@ -0,0 +1,15 @@ +" Vim indent file +" Language: Arduino +" Maintainer: Kevin Sjöberg +" Last Change: 2014 Feb 28 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" C++ indenting is built-in, thus this is very simple +setlocal cindent + +let b:undo_indent = "setl cin<" diff --git a/dot_config/lvim/ftdetect/arduino.vim b/dot_config/lvim/ftdetect/arduino.vim new file mode 100644 index 0000000..59bf48c --- /dev/null +++ b/dot_config/lvim/ftdetect/arduino.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.ino,*.pde set filetype=arduino diff --git a/dot_config/lvim/ftdetect/asy.vim b/dot_config/lvim/ftdetect/asy.vim new file mode 100644 index 0000000..ea8af9a --- /dev/null +++ b/dot_config/lvim/ftdetect/asy.vim @@ -0,0 +1,3 @@ +" Vim filetype detection file +" Language: Asymptote +au BufNewFile,BufRead *.asy setfiletype asy diff --git a/dot_config/lvim/ftplugin/python.lua b/dot_config/lvim/ftplugin/python.lua new file mode 100644 index 0000000..cb67c43 --- /dev/null +++ b/dot_config/lvim/ftplugin/python.lua @@ -0,0 +1,49 @@ +--[[-- +File : conf.d/lvim/ftplugin/python.lua +Author : Jeff Lance +Date : 06.08.2023 12:46:43 +Last Modified Date: 08.08.2023 19:23:05 +Last Modified By : Jeff Lance +--]] +-- + + + +-- 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", + }) + } +}) + +-- 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" }, +}) diff --git a/dot_config/lvim/ftplugin/tex.lua b/dot_config/lvim/ftplugin/tex.lua new file mode 100644 index 0000000..277ab32 --- /dev/null +++ b/dot_config/lvim/ftplugin/tex.lua @@ -0,0 +1,76 @@ +--[[-- +File : conf.d/lvim/ftplugin/tex.lua +Author : Jeff Lance +Date : 06.08.2023 11:07:22 +Last Modified Date: 15.08.2023 00:46:47 +Last Modified By : Jeff Lance +--]] +-- + + + +local opts = {} + +local status_ok, whk = pcall(require, "which-key") +if not status_ok then + return +end + +-- Shortcuts +-- +-- old way making the LaTeX menu appears with the LSP and Lunar one +-- whk.register { +-- ["L"] = { +-- name = "LSP, Lunar, LaTeX", -- we edit the title of the L shortcut +-- } +-- } + +vim.g.maplocalleader = " " -- we define a leader available only from tex files + +whk.register { + ["l"] = {} -- empties the default VimTeX menu mapping +} + +whk.register { + [""] = { -- to set a completly new using only the localleader key + name = " LaTeX", + c = { "VimtexCompileSS", "Single-shot compile project" }, + C = { + name = " Compile", + s = { "VimtexStop", "Stop compile" }, + c = { "VimtexCompileSelected", "Compile Selected" }, + }, + d = { "VimtexDocPackage", "Open Doc for package" }, + e = { "VimtexErrors", "Look at the errors" }, + m = { "VimtexToggleMain", "Toggle Main" }, + o = { "VimtexView", "View pdf" }, + s = { "VimtexStatus", "Look at the status" }, + T = { + name = " TOC", + o = { "VimtexTocOpen", "Open TOC" }, + t = { "VimtexTocToggle", "Toggle TOC" }, + }, + V = { + name = " VimTeX", + c = { "edit /home/jeff/.config/lvim/ftplugin/tex.lua", "Edit configuration" }, + s = { "edit /home/jeff/.config/lvim/luasnippets/tex.lua", "Edit snippets" }, + i = { "VimtexInfo", "Vimtex Info" }, + }, + } +} + +-- 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" } }, +}) + + diff --git a/dot_config/lvim/lua/user/dap.lua b/dot_config/lvim/lua/user/dap.lua new file mode 100644 index 0000000..2cf8807 --- /dev/null +++ b/dot_config/lvim/lua/user/dap.lua @@ -0,0 +1,24 @@ +--[[-- +File : conf.d/lvim/lua/user/dap.lua +Author : Jeff Lance +Date : 28.12.2023 21:34:48 +Last Modified Date: 06.01.2024 18:53:52 +Last Modified By : Jeff Lance +--]]-- + + + +-- Setup debug adapter +-- + +local M = {} + +M.setup = function() + 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) +end + +return M diff --git a/dot_config/lvim/lua/user/functions.lua b/dot_config/lvim/lua/user/functions.lua new file mode 100644 index 0000000..1ad9621 --- /dev/null +++ b/dot_config/lvim/lua/user/functions.lua @@ -0,0 +1,33 @@ +--[[-- +File : conf.d/lvim/lua/user/functions.lua +Author : Jeff Lance +Date : 28.12.2023 20:13:31 +Last Modified Date: 28.12.2023 20:13:31 +Last Modified By : Jeff Lance +--]]-- + + + +-- function Surround(w_or_W) +-- local open_char = vim.fn.input("Surround with: ") +-- local closed_char = nil +-- if open_char == "(" then closed_char = ")" end +-- if open_char == "[" then closed_char = "]" end +-- if open_char == "{" then closed_char = "}" end +-- if open_char == "<" then closed_char = ">" end +-- if open_char == "'" then closed_char = "'" end +-- if open_char == '"' then closed_char = '"' end +-- if open_char == "`" then closed_char = "`" end +-- if open_char == "/" then closed_char = "/" end +-- if open_char == "|" then closed_char = "|" end + +-- if w_or_W == "w" then +-- vim.cmd("normal! ciw" .. open_char) +-- elseif w_or_W == "W" then +-- vim.cmd([[normal! ciW]] .. open_char) +-- end +-- vim.cmd("normal! p") +-- vim.cmd("normal! a" .. closed_char) +-- vim.cmd("normal! a") +-- end + diff --git a/dot_config/lvim/lua/user/keybindings.lua b/dot_config/lvim/lua/user/keybindings.lua new file mode 100644 index 0000000..b622cd8 --- /dev/null +++ b/dot_config/lvim/lua/user/keybindings.lua @@ -0,0 +1,35 @@ +--[[-- +File : conf.d/lvim/lua/user/keybindings.lua +Author : Jeff Lance +Date : 28.12.2023 20:32:45 +Last Modified Date: 29.12.2023 22:35:31 +Last Modified By : Jeff Lance +--]]-- + + + +local M = {} + +M.setup = function() + -- ============ + -- key mappings + -- + -- vim-surround shortcuts as example + -- vim.api.nvim_set_keymap("n", "sw", "Ysurroundiw", { noremap = true, silent = true }) + -- vim.api.nvim_set_keymap("n", "Sw", "YSurroundiw", { noremap = true, silent = true }) + -- + + lvim.leader = ";" + + lvim.keys.insert_mode[";;"] = "" + + lvim.keys.normal_mode[""] = "w!" + lvim.keys.normal_mode[""] = "undo" + lvim.keys.normal_mode[""] = "redo" + lvim.keys.normal_mode[""] = ":<" + lvim.keys.normal_mode[""] = ":>" + +end + +return M + diff --git a/dot_config/lvim/lua/user/lsp.lua b/dot_config/lvim/lua/user/lsp.lua new file mode 100644 index 0000000..29c3082 --- /dev/null +++ b/dot_config/lvim/lua/user/lsp.lua @@ -0,0 +1,34 @@ +--[[-- +File : conf.d/lvim/lua/user/lsp.lua +Author : Jeff Lance +Date : 28.12.2023 21:34:48 +Last Modified Date: 06.01.2024 18:59:29 +Last Modified By : Jeff Lance +--]]-- + + + +-- Setup debug adapter +-- + +local M = {} + +M.setup = function() + -- 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, + }) + + require("lvim.lsp.manager").setup( + "marksman", { + }) +end + +return M diff --git a/dot_config/lvim/lua/user/luasnip-helper-funcs.lua b/dot_config/lvim/lua/user/luasnip-helper-funcs.lua new file mode 100644 index 0000000..d812c86 --- /dev/null +++ b/dot_config/lvim/lua/user/luasnip-helper-funcs.lua @@ -0,0 +1,109 @@ +--[[-- +File : luasnip-helper-funcs.lua +Author : Jeff Lance +Date : 05.08.2023 20:35:21 +Last Modified Date: 05.08.2023 20:35:21 +Last Modified By : Jeff Lance +--]]-- + + + +-- 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 + +-- function M.mat(args, snip) +-- local rows = tonumber(snip.captures[2]) +-- local cols = tonumber(snip.captures[3]) +-- local nodes = {} +-- local ins_indx = 1 +-- for j = 1, rows do +-- table.insert(nodes, r(ins_indx, tostring(j) .. "x1", i(1))) +-- ins_indx = ins_indx + 1 +-- for k = 2, cols do +-- table.insert(nodes, t(" & ")) +-- table.insert(nodes, r(ins_indx, tostring(j) .. "x" .. tostring(k), i(1))) +-- ins_indx = ins_indx + 1 +-- end +-- table.insert(nodes, t({ " \\\\", "" })) +-- end +-- -- fix last node. +-- nodes[#nodes] = t(" \\\\") +-- return sn(nil, nodes) +-- end + + +-- return M diff --git a/dot_config/lvim/lua/user/plugin-configs.lua b/dot_config/lvim/lua/user/plugin-configs.lua new file mode 100644 index 0000000..7fd0503 --- /dev/null +++ b/dot_config/lvim/lua/user/plugin-configs.lua @@ -0,0 +1,17 @@ +--[[-- +File : conf.d/lvim/lua/user/plugin-configs.lua +Author : Jeff Lance +Date : 28.12.2023 21:34:48 +Last Modified Date: 06.01.2024 18:33:43 +Last Modified By : Jeff Lance +--]]-- + + + +-- Plugins configurations +-- + +local M = {} + + +return M diff --git a/dot_config/lvim/lua/user/plugins.lua b/dot_config/lvim/lua/user/plugins.lua new file mode 100644 index 0000000..fcb86cf --- /dev/null +++ b/dot_config/lvim/lua/user/plugins.lua @@ -0,0 +1,288 @@ +--[[-- +File : conf.d/lvim/lua/user/plugins.lua +Author : Jeff Lance +Date : 28.12.2023 21:31:06 +Last Modified Date: 28.12.2023 21:31:06 +Last Modified By : Jeff Lance +--]]-- + + + +local M = {} + +M.setup = function() + local configs = require("user.plugin-configs") + + lvim.plugins = { + -- abolish + { + 'tpope/vim-abolish', + }, + -- 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, + }, + -- new file plugin + { + 'Mohammed-Taher/AdvancedNewFile.nvim', + }, + -- asyncrun + { + "skywind3000/asyncrun.vim", + }, + -- chatgpt + { + "jackMort/ChatGPT.nvim", + event = "VeryLazy", + config = function() + require("chatgpt").setup({ + api_key_cmd = "pass _api_keys/openai_perso-1" + }) + end, + dependencies = { + "MunifTanjim/nui.nvim", + "nvim-lua/plenary.nvim", + "nvim-telescope/telescope.nvim" + } + }, + -- cmp addons + { + "tzachar/cmp-tabnine", + build = "./install.sh", + dependencies = "hrsh7th/nvim-cmp", + event = "InsertEnter", + }, + { + "micangl/cmp-vimtex", + dependencies = "hrsh7th/nvim-cmp", + }, + -- 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 + }, + -- gitignore + { + 'jefflance/vim-gitignore', + }, + -- languagetool + { + 'dpelle/vim-grammalecte', + config = function () + vim.cmd([[ + let g:grammalecte_cli_py = '/usr/bin/grammalecte-cli' + ]]) + 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 = { '', '', '', '', + '', '', 'zt', 'zz', 'zb' }, + hide_cursor = true, -- Hide cursor while scrolling + stop_eof = true, -- Stop at 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, + }, + -- 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 = 0 + ]]) + end, + }, + { + "KeitaNakamura/tex-conceal.vim" + }, + -- Python management needed plugins + { + "ChristianChiarulli/swenv.nvim" + }, + { + "stevearc/dressing.nvim" + }, + { + "mfussenegger/nvim-dap-python" + }, + { + "nvim-neotest/neotest" + }, + { + "nvim-neotest/neotest-python" + }, + } +end + +return M diff --git a/dot_config/lvim/lua/user/tests.lua b/dot_config/lvim/lua/user/tests.lua new file mode 100644 index 0000000..07c73c7 --- /dev/null +++ b/dot_config/lvim/lua/user/tests.lua @@ -0,0 +1,33 @@ +--[[-- +File : conf.d/lvim/lua/user/tests.lua +Author : Jeff Lance +Date : 28.12.2023 21:34:48 +Last Modified Date: 06.01.2024 18:55:14 +Last Modified By : Jeff Lance +--]]-- + + + +-- Setup test framework +-- + +local M = {} + +M.setup = function() + 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", + }) + } + }) +end + +return M diff --git a/dot_config/lvim/lua/user/whichkey.lua b/dot_config/lvim/lua/user/whichkey.lua new file mode 100644 index 0000000..967f39e --- /dev/null +++ b/dot_config/lvim/lua/user/whichkey.lua @@ -0,0 +1,88 @@ +--[[-- +File : conf.d/lvim/lua/user/whichkey.lua +Author : Jeff Lance +Date : 29.12.2023 22:30:57 +Last Modified Date: 29.12.2023 22:30:57 +Last Modified By : Jeff Lance +--]]-- + + + +local M = {} + +M.setup = function() + -- ================= + -- whichkey mappings + -- + + -- remap neo-tree shortcut to rnvimr + lvim.builtin.which_key.mappings["e"] = { "RnvimrToggle", "File explorer" } + + -- remap dashboard + lvim.builtin.which_key.mappings["d"] = lvim.builtin.which_key.mappings[";"] + + -- remap git + lvim.builtin.which_key.mappings["G"] = lvim.builtin.which_key.mappings["g"] + lvim.builtin.which_key.mappings["g"] = {} + + -- remap highlight + lvim.builtin.which_key.mappings["H"] = lvim.builtin.which_key.mappings["h"] + + -- remap lunarvim and lsp + 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["Lve"] = lvim.builtin.which_key.mappings["Lvc"] + lvim.builtin.which_key.mappings["Lvc"] = {} + + -- zettle mappings + lvim.builtin.which_key.mappings["N"] = { + name = "Notes", + c = { "edit /home/jeff/.config/zk/config.toml", "Edit config.toml" }, + n = { "ZkNew { dir = vim.fn.input('Groupe: '), title = vim.fn.input('Titre: '), date = 'now' }", + "Créer une nouvelle note" }, + o = { "ZkNotes { sort = { 'modified' } }", "Ouvrir une note" }, + O = { "ZkTags", "Ouvrir les notes avec le tag sélectionné" }, + f = { "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Rechercher note: ') } }", + "Rechercher une note" }, + F = { ":'<,'>ZkMatch", "Rechercher les notes contenant la sélection" }, + } + + -- remap plugins mappings + lvim.builtin.which_key.mappings["P"] = { + name = "Plugins" + } + + -- telescope + lvim.builtin.which_key.mappings["P"] = lvim.builtin.which_key.mappings["p"] + lvim.builtin.which_key.mappings["o"] = { "Telescope find_files", "Open a file" } + lvim.builtin.which_key.mappings["p"] = { "Telescope projects", "Projects" } + lvim.builtin.which_key.mappings["r"] = { "Telescope oldfiles", "Open recent file" } + + -- remap search + lvim.builtin.which_key.mappings["S"] = lvim.builtin.which_key.mappings["s"] + + -- new mappings + lvim.builtin.which_key.mappings["h"] = { + name = "Header", + h = { "AddHeader", "Add header to the file" }, + m = { "AddMinHeader", "Add minimal header to the file" }, + lg = { "AddGNULicense", "Add GPLv3 License" }, + lm = { "AddMITLicense", "Add MIT License" }, + } + + lvim.builtin.which_key.mappings["n"] = { "AdvancedNewFile", "Create a new file"} + + lvim.builtin.which_key.mappings["s"] = { "echom 'Sourcing' source %", "Source current file" } + + lvim.builtin.which_key.mappings["x"] = { "w! q!", "Save and quit" } + + lvim.builtin.which_key.mappings[";"] = {} + lvim.builtin.terminal.open_mapping = "" + +end + +return M diff --git a/dot_config/lvim/luasnippets/tex.lua b/dot_config/lvim/luasnippets/tex.lua new file mode 100644 index 0000000..5e1c69d --- /dev/null +++ b/dot_config/lvim/luasnippets/tex.lua @@ -0,0 +1,347 @@ +--[[-- +File : .config/lvim/luasnippets/tex.lua +Author : Jeff Lance +Date : 05.08.2023 00:54:18 +Last Modified Date: 06.08.2023 12:55:15 +Last Modified By : Jeff Lance +--]] +-- + + +-- +-- Helpers functions +-- +local line_begin = require("luasnip.extras.expand_conditions").line_begin + +local in_mathzone = function() + -- The `in_mathzone` function requires the VimTeX plugin + return vim.fn['vimtex#syntax#in_mathzone']() == 1 +end + +local in_text = function() + return not in_mathzone() +end + + + +-- +-- Snippets +-- + +return { + -- + -- text commands + -- + s({ trig = "#", dscr = "Partie"}, + fmta( + [[ + \partie{<>} + ]], + { + i(1), + } + ), + { condition = line_begin } + ), + s({ trig = "##", dscr = "Sous-partie"}, + fmta( + [[ + \sspartie{<>} + ]], + { + i(1), + } + ), + { condition = line_begin } + ), + s({ trig = "###", dscr = "Sous-sous-partie"}, + fmta( + [[ + \ssspartie{<>} + ]], + { + i(1), + } + ), + { condition = line_begin } + ), + -- + -- maths commands + -- + s({ trig = "lim", dscr = "Limit" }, + fmta( + [[ + $ \lim\limits_{ <> } <> $ + ]], + { + i(1), + i(2), + } + ), + {condition = in_text} + ), + s({ trig = "xto", dscr = "Limit" }, + fmta( + [[ + x \to <> + ]], + { + i(1), + } + ) + ), + s({ trig = "stack", dscr = "Limit" }, + fmta( + [[ + \substack{ <> \\ <> } + ]], + { + i(1), + i(2), + } + ) + ), + -- + -- sets + -- + s({ trig = '([^%w])R', regTrig = true, wordTrig = false, dscr = "Set R" }, + fmta( + [[ + \mathbb{R} + ]], + { + } + ), + { condition = in_mathzone } + ), + -- s({ trig = '([^%w])R', regTrig = true, wordTrig = false, dscr = "Set R" }, + -- fmta( + -- [[ + -- $ \mathbb{R} $ + -- ]], + -- { + -- } + -- ), + -- { condition = in_text } + -- ), + -- + -- environments + -- + s({ trig = "table", dscr = "My LaTeX table environment" }, + fmta( + [[ + \begin{tabular}{c|c} + \hline + \rule[-1ex]{0pt}{2.5ex} <> & <> \\ + \hline + \end{tabular} + ]], + { + i(1), + i(2), + } + ) + ), + 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 = "<>" } + ) + ), +}