diff --git a/after/plugin/mappings.lua b/after/plugin/mappings.lua index 4dc4923..0a4ea0c 100644 --- a/after/plugin/mappings.lua +++ b/after/plugin/mappings.lua @@ -8,38 +8,38 @@ if vim.fn.maparg("gbc") ~= "" then vim.keymap.del("n", "gbc") vim.keymap.set('n', 'gBc', function() - return vim.api.nvim_get_vvar('count') == 0 and '(comment_toggle_blockwise_current)' - or '(comment_toggle_blockwise_count)' - end, { expr = true, desc = 'Comment toggle current block' }) + return vim.api.nvim_get_vvar('count') == 0 and '(comment_toggle_blockwise_current)' + or '(comment_toggle_blockwise_count)' + end, { expr = true, desc = 'Comment toggle current block' }) end -- [[ vimtex ]] -- Some BÉPO mappings for vimtex local texgroup = vim.api.nvim_create_augroup("latex", { clear = true }) -vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { - pattern = {"*.tex", "*.bib", "*.cls", "*.tikz", }, +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.tex", "*.bib", "*.cls", "*.tikz", }, group = texgroup, callback = function() local vimtex_remaps = { -- c <-> t - { mode = "n", source = "csd", target = "tsd", command = "(vimtex-delim-change-math)"}, - { mode = "n", source = "csc", target = "lsc", command = "(vimtex-cmd-change)"}, - { mode = "n", source = "cse", target = "lse", command = "(vimtex-env-change)"}, - { mode = "n", source = "cs$", target = "ls$", command = "(vimtex-env-change-math))"}, + { mode = "n", source = "csd", target = "tsd", command = "(vimtex-delim-change-math)" }, + { mode = "n", source = "csc", target = "lsc", command = "(vimtex-cmd-change)" }, + { mode = "n", source = "cse", target = "lse", command = "(vimtex-env-change)" }, + { mode = "n", source = "cs$", target = "ls$", command = "(vimtex-env-change-math))" }, -- t <-> j - { mode = {"x", "n"}, source = "tsD", target = "jsD", command = "(vimtex-delim-toggle-modifier-reverse)"}, - { mode = {"x", "n"}, source = "tsd", target = "jsd", command = "(vimtex-delim-toggle-modifier)"}, - { mode = {"x", "n"}, source = "tsf", target = "jsf", command = "(vimtex-cmd-toggle-frac)"}, - { mode = "n", source = "tsc", target = "jsc", command = "(vimtex-cmd-toggle-star)"}, - { mode = "n", source = "ts$", target = "js$", command = "(vimtex-env-toggle-math)"}, - { mode = "n", source = "tse", target = "jse", command = "(vimtex-env-toggle-star)"}, + { mode = { "x", "n" }, source = "tsD", target = "jsD", command = "(vimtex-delim-toggle-modifier-reverse)" }, + { mode = { "x", "n" }, source = "tsd", target = "jsd", command = "(vimtex-delim-toggle-modifier)" }, + { mode = { "x", "n" }, source = "tsf", target = "jsf", command = "(vimtex-cmd-toggle-frac)" }, + { mode = "n", source = "tsc", target = "jsc", command = "(vimtex-cmd-toggle-star)" }, + { mode = "n", source = "ts$", target = "js$", command = "(vimtex-env-toggle-math)" }, + { mode = "n", source = "tse", target = "jse", command = "(vimtex-env-toggle-star)" }, } - for _,remap in pairs(vimtex_remaps) do + for _, remap in pairs(vimtex_remaps) do if vim.fn.maparg(remap.source) ~= "" then vim.keymap.del(remap.mode, remap.source, { buffer = true }) - vim.keymap.set(remap.mode, remap.target, remap.command, { silent = true, noremap = true, buffer = true}) + vim.keymap.set(remap.mode, remap.target, remap.command, { silent = true, noremap = true, buffer = true }) end end end, diff --git a/lua/autocommands.lua b/lua/autocommands.lua index 4aa7f46..435cba8 100644 --- a/lua/autocommands.lua +++ b/lua/autocommands.lua @@ -8,38 +8,40 @@ local keyunmap = function(mode, binding) end -- Recognize .md as pandoc -vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { - pattern = {"*.md", }, +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*.md", }, group = markdown, - callback = function() + callback = function() vim.o.filetype = 'pandoc' - require('luasnip').filetype_extend("pandoc", {"markdown"}) + require('luasnip').filetype_extend("pandoc", { "markdown" }) vim.o.spell = true vim.o.spelllang = 'en' vim.o.formatoptions = "qj" -- email commands: my/msy to paste the html inside the clipboard - vim.keymap.set('', 'msy', ':w !pandoc -f markdown+emoji -t html5 -s | wl-copy', { noremap = true, silent = true }) - vim.keymap.set('', 'my', ':w !pandoc -f markdown+emoji --wrap=none -t html5 | wl-copy', { noremap = true, silent = true }) + vim.keymap.set('', 'msy', ':w !pandoc -f markdown+emoji -t html5 -s | wl-copy', + { noremap = true, silent = true }) + vim.keymap.set('', 'my', ':w !pandoc -f markdown+emoji --wrap=none -t html5 | wl-copy', + { noremap = true, silent = true }) end }) -- French markdown files -vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { - pattern = {"*-fr.md", }, +vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { + pattern = { "*-fr.md", }, group = markdown, - callback = function() + callback = function() vim.o.spelllang = 'fr' end }) -- Spell shortcuts -vim.api.nvim_create_autocmd({"OptionSet"}, { +vim.api.nvim_create_autocmd({ "OptionSet" }, { pattern = { "spell" }, group = markdown, callback = function() if vim.o.spell == true then - vim.keymap.set("n", "i", "mz[s1z=`z", {noremap = true, silent = true}) - vim.keymap.set("n", "à", "]s", {noremap = true, silent = true}) + vim.keymap.set("n", "i", "mz[s1z=`z", { noremap = true, silent = true }) + vim.keymap.set("n", "à", "]s", { noremap = true, silent = true }) else keyunmap("n", "i") keyunmap("n", "à") @@ -51,18 +53,19 @@ vim.api.nvim_create_autocmd({"OptionSet"}, { local texgroup = vim.api.nvim_create_augroup("latex", { clear = true }) vim.api.nvim_create_autocmd("FileType", { - pattern = {"latex"}, + pattern = { "latex" }, group = texgroup, callback = function() -- vimtex configuration vim.g.vimtex_view_method = 'zathura' - vim.g.maplocalleader = ' ' + vim.g.maplocalleader = ' ' -- Legacy shortcut from my vim-latexsuite days - vim.api.nvim_set_keymap("n", "ls", ":VimtexView", {noremap = true, silent = true, desc = 'View [L]atex Document'}) + vim.api.nvim_set_keymap("n", "ls", ":VimtexView", + { noremap = true, silent = true, desc = 'View [L]atex Document' }) vim.o.foldmethod = 'expr' - vim.o.foldexpr='vimtex#fold#level(v:lnum)' - vim.o.foldtext='vimtex#fold#text()' + vim.o.foldexpr = 'vimtex#fold#level(v:lnum)' + vim.o.foldtext = 'vimtex#fold#text()' vim.o.spell = true end, }) diff --git a/lua/general-options.lua b/lua/general-options.lua index 80a5272..cd5c59d 100644 --- a/lua/general-options.lua +++ b/lua/general-options.lua @@ -43,17 +43,17 @@ vim.o.background = "light" -- general purpose options local set_true = { 'title', 'relativenumber', 'ruler', 'modeline', -'autoread', 'cursorline', 'cursorcolumn', -'incsearch', -'showcmd', 'showmatch', 'lazyredraw', 'linebreak', 'wrap', -'wildmenu', 'wildignorecase', 'showfulltag', } + 'autoread', 'cursorline', 'cursorcolumn', + 'incsearch', + 'showcmd', 'showmatch', 'lazyredraw', 'linebreak', 'wrap', + 'wildmenu', 'wildignorecase', 'showfulltag', } vim.o.colorcolumn = '+1' -for _,o in ipairs(set_true) do +for _, o in ipairs(set_true) do vim.o[o] = true end -- folds -vim.g.ip_skipfold=true +vim.g.ip_skipfold = true -- window management vim.o.tw = 80 diff --git a/lua/lazy-configure.lua b/lua/lazy-configure.lua index 6704bf1..ebd78aa 100644 --- a/lua/lazy-configure.lua +++ b/lua/lazy-configure.lua @@ -211,7 +211,8 @@ require('lazy').setup({ -- Pandoc 'vim-pandoc/vim-pandoc-syntax', -- neorg - { 'nvim-neorg/neorg', + { + 'nvim-neorg/neorg', build = ':Neorg sync-parsers', dependencies = { "nvim-lua/plenary.nvim" }, }, diff --git a/lua/mappings.lua b/lua/mappings.lua index ec2e89f..f78dda9 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -7,7 +7,7 @@ local map_list = { local keymap = vim.keymap.set for key, binding in pairs(map_list) do - keymap("n", key, binding .. "", {noremap = true, silent = true}) + keymap("n", key, binding .. "", { noremap = true, silent = true }) end -- [[ kickstart.nvim ]] @@ -25,15 +25,13 @@ keymap('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next diagnostic mess keymap('n', 'e', vim.diagnostic.open_float, { desc = 'Open floating diagnostic message' }) keymap('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagnostics list' }) -keymap("n", "y", '"+y', {noremap = true, silent = true}) -keymap("v", "y", '"+y', {noremap = true, silent = true}) -keymap("n", "p", '"+p', {noremap = true, silent = true}) -keymap("v", "p", '"+p', {noremap = true, silent = true}) +keymap({ "n", "v" }, "y", '"+y', { noremap = true, silent = true, desc = "[Y]ank to system clipboard" }) +keymap({ "n", "v" }, "p", '"+p', { noremap = true, silent = true, desc = "[P]ast from system clipboard" }) -- z0…z9 to open folds to a certain level -for i=0,9 do - keymap('n', 'z' .. i , ':set fdl=' .. i .. '', {noremap = true, silent = false}) +for i = 0, 9 do + keymap('n', 'z' .. i, ':set fdl=' .. i .. '', { noremap = true, silent = false }) end -- in :terminal esc exits edit mode -keymap('t', '', '', {noremap = true, silent = true}) +keymap('t', '', '', { noremap = true, silent = true }) diff --git a/lua/neorg-configure.lua b/lua/neorg-configure.lua index b8606da..1ef818b 100644 --- a/lua/neorg-configure.lua +++ b/lua/neorg-configure.lua @@ -1,22 +1,29 @@ --vim.api.nvim_set_keymap('', 'à', '', { noremap = true, silent = true }) local neorgroup = vim.api.nvim_create_augroup("neorg", { clear = true }) -vim.api.nvim_create_autocmd({"FileType"}, { - pattern = {"norg"}, +vim.api.nvim_create_autocmd({ "FileType" }, { + pattern = { "norg" }, group = neorgroup, callback = function() - vim.g.maplocalleader=' ' - vim.o.conceallevel=2 - vim.api.nvim_set_keymap("n", "nr", ":Neorg return", {noremap = true, silent = true, desc = "[N]eorg [R]eturn"}) + vim.g.maplocalleader = ' ' + vim.o.conceallevel = 2 + vim.api.nvim_set_keymap("n", "nr", ":Neorg return", + { noremap = true, silent = true, desc = "[N]eorg [R]eturn" }) end, }) -vim.api.nvim_set_keymap("n", "ni", ":Neorg index", {noremap = true, silent = true, desc = "[N]eorg [I]ndex"}) -vim.api.nvim_set_keymap("n", "nm", ":Neorg inject-metadata", {noremap = true, silent = true, desc = "[N]eorg insert [M]etadata"}) -vim.api.nvim_set_keymap("n", "nj", ":Neorg journal toc open", {noremap = true, silent = true, desc = "[N]eorg [J]ournal"}) -vim.api.nvim_set_keymap("n", "nt", ":Neorg journal today", {noremap = true, silent = true, desc = "[N]eorg [T]oday"}) -vim.api.nvim_set_keymap("n", "ns", ":Neorg journal tomorrow", {noremap = true, silent = true, desc = "Neorg tomorrow"}) -vim.api.nvim_set_keymap("n", "ny", ":Neorg journal yesterday", {noremap = true, silent = true, desc = "[N]eorg [Y]esterday"}) +vim.api.nvim_set_keymap("n", "ni", ":Neorg index", + { noremap = true, silent = true, desc = "[N]eorg [I]ndex" }) +vim.api.nvim_set_keymap("n", "nm", ":Neorg inject-metadata", + { noremap = true, silent = true, desc = "[N]eorg insert [M]etadata" }) +vim.api.nvim_set_keymap("n", "nj", ":Neorg journal toc open", + { noremap = true, silent = true, desc = "[N]eorg [J]ournal" }) +vim.api.nvim_set_keymap("n", "nt", ":Neorg journal today", + { noremap = true, silent = true, desc = "[N]eorg [T]oday" }) +vim.api.nvim_set_keymap("n", "ns", ":Neorg journal tomorrow", + { noremap = true, silent = true, desc = "Neorg tomorrow" }) +vim.api.nvim_set_keymap("n", "ny", ":Neorg journal yesterday", + { noremap = true, silent = true, desc = "[N]eorg [Y]esterday" }) local neorg = require('neorg')