From 1c933f1054d5b985203eee8511b2977eaf0f0c69 Mon Sep 17 00:00:00 2001 From: Jeff LANCE Date: Sun, 7 Sep 2025 11:18:48 +0200 Subject: [PATCH] up --- ftplugin/tex.lua | 45 +++++++++++++ lua/custom/keymaps/buffers.lua | 4 +- lua/custom/keymaps/toggles.lua | 10 +++ lua/custom/plugins/neotree-helper.lua | 6 +- lua/kickstart/plugins/autoformat.lua | 1 + lua/kickstart/plugins/bbye.lua | 20 ++++++ lua/kickstart/plugins/better-escape.lua | 32 ++++++++++ lua/kickstart/plugins/colorizer.lua | 12 ++++ lua/kickstart/plugins/edgy.lua | 84 ++++++++++++------------- lua/kickstart/plugins/latex.lua | 6 +- lua/kickstart/plugins/lint.lua | 1 + lua/kickstart/plugins/lsp.lua | 1 + lua/kickstart/plugins/mini.lua | 6 +- lua/kickstart/plugins/suda.lua | 14 +++++ lua/kickstart/plugins/treesitter.lua | 18 +++++- 15 files changed, 206 insertions(+), 54 deletions(-) create mode 100644 ftplugin/tex.lua create mode 100644 lua/kickstart/plugins/bbye.lua create mode 100644 lua/kickstart/plugins/better-escape.lua create mode 100644 lua/kickstart/plugins/colorizer.lua create mode 100644 lua/kickstart/plugins/suda.lua diff --git a/ftplugin/tex.lua b/ftplugin/tex.lua new file mode 100644 index 0000000..b98df43 --- /dev/null +++ b/ftplugin/tex.lua @@ -0,0 +1,45 @@ +--[[-- +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.add { + { 'L', '', group = '[L]aTeX' }, + { 'Lc', 'VimtexCompileSS', desc = 'Single-shot compile project' }, + + { 'LC', '', group = '[C]ompile' }, + { 'LCs', 'VimtexStop', desc = 'Stop compile' }, + { 'LCc', 'VimtexCompileSelected', desc = 'Compile Selected' }, + + { 'Ld', 'VimtexDocPackage', desc = 'Open Doc for package' }, + { 'Le', 'VimtexErrors', desc = 'Look at the errors' }, + { 'Lm', 'VimtexToggleMain let @+ = expand("%:t")', desc = 'Toggle Main' }, + { 'Lo', 'VimtexView', desc = 'View pdf' }, + { 'Ls', 'VimtexStatus', desc = 'Look at the status' }, + + { 'LT', '', group = '[T]oc' }, + { 'LTo', 'VimtexTocOpen', desc = 'Open TOC' }, + { 'LTt', 'VimtexTocToggle', desc = 'Toggle TOC' }, +} diff --git a/lua/custom/keymaps/buffers.lua b/lua/custom/keymaps/buffers.lua index e13bafc..ffb2798 100644 --- a/lua/custom/keymaps/buffers.lua +++ b/lua/custom/keymaps/buffers.lua @@ -19,7 +19,7 @@ end wk.add { { mode = { 'n', 'v', 'i' }, - { 'bd', mbr.delete, desc = '[d]elete buffer', noremap = true, silent = true }, + -- { 'bd', mbr.delete, desc = '[d]elete buffer', noremap = true, silent = true }, { 'bF', function() @@ -42,7 +42,7 @@ wk.add { { mode = { 'n', 'v', 'i' }, -- mapping runs here as which-key intercepts ctrl-z signal before term - { '', mbr.delete, desc = 'Delete buffer', noremap = true, silent = true, hidden = true }, + { '', 'Bdelete', desc = 'Close current buffer', noremap = true, silent = true, hidden = true }, { '', 'w', desc = 'Save buffer', noremap = true, silent = true, hidden = true }, }, } diff --git a/lua/custom/keymaps/toggles.lua b/lua/custom/keymaps/toggles.lua index c3e19b7..ae668c8 100644 --- a/lua/custom/keymaps/toggles.lua +++ b/lua/custom/keymaps/toggles.lua @@ -3,6 +3,7 @@ local wk = require 'which-key' local gitsigns = require 'gitsigns' +local img = require 'image' local function toggle_light_dark_theme() if vim.o.background == 'light' then @@ -21,11 +22,20 @@ local function toggle_conceal() end end +local function toggle_image_rendering() + if img.is_enabled() then + img.disable() + else + img.enable() + end +end + wk.add { mode = { 'n' }, -- gitsigns { 'tb', gitsigns.toggle_current_line_blame, desc = 'toggle git show [b]lame line' }, { 'td', gitsigns.preview_hunk_inline, desc = 'toggle git show [d]eleted' }, + { 'ti', toggle_image_rendering, desc = 'toggle git show [d]eleted' }, { 'tm', 'RenderMarkdown buf_toggle', desc = 'toggle [m]arkdown rendering for current' }, { 'tt', toggle_light_dark_theme, desc = 'toggle light/dark [t]heme' }, { 'tc', toggle_conceal, desc = 'toggle [c]onceal' }, diff --git a/lua/custom/plugins/neotree-helper.lua b/lua/custom/plugins/neotree-helper.lua index a3b2aca..8342a3f 100644 --- a/lua/custom/plugins/neotree-helper.lua +++ b/lua/custom/plugins/neotree-helper.lua @@ -28,11 +28,11 @@ function M.smart_open() -- Si c'est le dashboard ministarter, ouvrir dans le home if filetype == 'ministarter' then - vim.cmd('Neotree toggle reveal=false position=float dir=' .. vim.fn.expand '~') + vim.cmd('Neotree toggle reveal position=float dir=' .. vim.fn.getcwd()) -- Si c'est un fichier réel, révéler le fichier dans l'arborescence elseif is_real_file and bufname ~= '' then - vim.cmd('Neotree toggle position=left reveal_force_cwd=true dir=' .. vim.fn.expand '%:p:h') - -- vim.cmd 'Neotree toggle position=left reveal_force_cwd=true' + -- vim.cmd('Neotree toggle position=left reveal_force_cwd=true dir=' .. vim.fn.expand '%:p:h') + vim.cmd 'Neotree toggle position=left reveal_force_cwd=true' -- Sinon, ouvrir dans le répertoire de travail courant else vim.cmd('Neotree toggle position=left reveal=true dir=' .. vim.fn.getcwd()) diff --git a/lua/kickstart/plugins/autoformat.lua b/lua/kickstart/plugins/autoformat.lua index c916aae..1d94123 100644 --- a/lua/kickstart/plugins/autoformat.lua +++ b/lua/kickstart/plugins/autoformat.lua @@ -40,6 +40,7 @@ return { lua = { 'stylua' }, -- Conform can also run multiple formatters sequentially python = { 'isort', 'black' }, + tex = { 'tex-fmt' }, -- -- You can use 'stop_after_first' to run the first available formatter from the list -- javascript = { "prettierd", "prettier", stop_after_first = true }, diff --git a/lua/kickstart/plugins/bbye.lua b/lua/kickstart/plugins/bbye.lua new file mode 100644 index 0000000..fa7a359 --- /dev/null +++ b/lua/kickstart/plugins/bbye.lua @@ -0,0 +1,20 @@ +-- bbye +-- +-- Bbye allows you to do delete buffers (close files) without closing your windows or messing up your layout. +-- +-- https://github.com/moll/vim-bbye +-- + +return { + { + 'moll/vim-bbye', + keys = { + { 'bc', 'Bdelete', desc = '[c]lose current buffer' }, + { + 'bC', + 'bufdo :Bdelete', + desc = '[C]lose all buffers', + }, + }, + }, +} diff --git a/lua/kickstart/plugins/better-escape.lua b/lua/kickstart/plugins/better-escape.lua new file mode 100644 index 0000000..7a9edc0 --- /dev/null +++ b/lua/kickstart/plugins/better-escape.lua @@ -0,0 +1,32 @@ +-- better-escape +-- +-- A lot of people have mappings like jk or jj to escape insert mode. +-- The problem with this mappings is that whenever you type a j, +-- neovim wait about 100-500ms (depending on your timeoutlen) to see, +-- if you type a j or a k because these are mapped. +-- Only after that time the j will be inserted. +-- Then you always get a delay when typing a j. +-- +-- https://github.com/max397574/better-escape.nvim +-- + +return { + { + 'max397574/better-escape.nvim', + config = function() + require('better_escape').setup { + timeout = vim.o.timeoutlen, -- after `timeout` passes, you can press the escape key and the plugin will ignore it + default_mappings = false, -- setting this to false removes all the default mappings + mappings = { + -- i for insert + i = { + j = { + -- These can all also be functions + j = '', + }, + }, + }, + } + end, + }, +} diff --git a/lua/kickstart/plugins/colorizer.lua b/lua/kickstart/plugins/colorizer.lua new file mode 100644 index 0000000..d34311f --- /dev/null +++ b/lua/kickstart/plugins/colorizer.lua @@ -0,0 +1,12 @@ +-- colorizer +-- +-- A high-performance color highlighter for Neovim which has no external dependencies! Written in performant Luajit. +-- +-- https://github.com/norcalli/nvim-colorizer.lua +-- + +return { + { + 'norcalli/nvim-colorizer.lua', + }, +} diff --git a/lua/kickstart/plugins/edgy.lua b/lua/kickstart/plugins/edgy.lua index 5c6823c..dd529cf 100644 --- a/lua/kickstart/plugins/edgy.lua +++ b/lua/kickstart/plugins/edgy.lua @@ -46,48 +46,48 @@ return { }, { ft = 'spectre_panel', size = { height = 0.4 } }, }, - left = { - -- Neo-tree filesystem always takes half the screen height - { - title = 'Neo-Tree', - ft = 'neo-tree', - filter = function(buf) - return vim.b[buf].neo_tree_source == 'filesystem' - end, - size = { height = 0.5 }, - }, - { - title = 'Neo-Tree Git', - ft = 'neo-tree', - filter = function(buf) - return vim.b[buf].neo_tree_source == 'git_status' - end, - pinned = true, - collapsed = true, -- show window as closed/collapsed on start - open = 'Neotree position=right git_status', - }, - { - title = 'Neo-Tree Buffers', - ft = 'neo-tree', - filter = function(buf) - return vim.b[buf].neo_tree_source == 'buffers' - end, - pinned = true, - collapsed = true, -- show window as closed/collapsed on start - open = 'Neotree position=top buffers', - }, - { - title = function() - local buf_name = vim.api.nvim_buf_get_name(0) or '[No Name]' - return vim.fn.fnamemodify(buf_name, ':t') - end, - ft = 'Outline', - pinned = true, - open = 'SymbolsOutlineOpen', - }, - -- any other neo-tree windows - 'neo-tree', - }, + -- left = { + -- -- Neo-tree filesystem always takes half the screen height + -- { + -- title = 'Neo-Tree', + -- ft = 'neo-tree', + -- filter = function(buf) + -- return vim.b[buf].neo_tree_source == 'filesystem' + -- end, + -- size = { height = 0.5 }, + -- }, + -- { + -- title = 'Neo-Tree Git', + -- ft = 'neo-tree', + -- filter = function(buf) + -- return vim.b[buf].neo_tree_source == 'git_status' + -- end, + -- pinned = true, + -- collapsed = true, -- show window as closed/collapsed on start + -- open = 'Neotree position=right git_status', + -- }, + -- { + -- title = 'Neo-Tree Buffers', + -- ft = 'neo-tree', + -- filter = function(buf) + -- return vim.b[buf].neo_tree_source == 'buffers' + -- end, + -- pinned = true, + -- collapsed = true, -- show window as closed/collapsed on start + -- open = 'Neotree position=top buffers', + -- }, + -- { + -- title = function() + -- local buf_name = vim.api.nvim_buf_get_name(0) or '[No Name]' + -- return vim.fn.fnamemodify(buf_name, ':t') + -- end, + -- ft = 'Outline', + -- pinned = true, + -- open = 'SymbolsOutlineOpen', + -- }, + -- -- any other neo-tree windows + -- 'neo-tree', + -- }, }, }, } diff --git a/lua/kickstart/plugins/latex.lua b/lua/kickstart/plugins/latex.lua index 22733d5..08cc198 100644 --- a/lua/kickstart/plugins/latex.lua +++ b/lua/kickstart/plugins/latex.lua @@ -15,8 +15,8 @@ return { vim.g.vimtex_mappings_disable = { ['n'] = { 'K' } } -- disable `K` as it conflicts with LSP hover vim.g.vimtex_quickfix_method = vim.fn.executable 'pplatex' == 1 and 'pplatex' or 'latexlog' end, - keys = { - { 'l', '', desc = 'LaTeX', ft = 'tex' }, - }, + -- keys = { + -- { 'l', '', desc = 'LaTeX', ft = 'tex' }, + -- }, }, } diff --git a/lua/kickstart/plugins/lint.lua b/lua/kickstart/plugins/lint.lua index 818bfbf..e597ecb 100644 --- a/lua/kickstart/plugins/lint.lua +++ b/lua/kickstart/plugins/lint.lua @@ -18,6 +18,7 @@ return { local lint = require 'lint' lint.linters_by_ft = { markdown = { 'markdownlint' }, + tex = { 'lacheck' }, } -- To allow other plugins to add linters to require('lint').linters_by_ft, diff --git a/lua/kickstart/plugins/lsp.lua b/lua/kickstart/plugins/lsp.lua index afeb61f..7ef8115 100644 --- a/lua/kickstart/plugins/lsp.lua +++ b/lua/kickstart/plugins/lsp.lua @@ -266,6 +266,7 @@ return { local ensure_installed = vim.tbl_keys(servers or {}) vim.list_extend(ensure_installed, { 'stylua', -- Used to format Lua code + 'tex-fmt', }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } diff --git a/lua/kickstart/plugins/mini.lua b/lua/kickstart/plugins/mini.lua index 6835763..a7e32b0 100644 --- a/lua/kickstart/plugins/mini.lua +++ b/lua/kickstart/plugins/mini.lua @@ -100,9 +100,9 @@ return { }, } - -- Buffer removing (unshow, delete, wipeout), which saves window layout - local bufremove = require 'mini.bufremove' - bufremove.setup {} + -- -- Buffer removing (unshow, delete, wipeout), which saves window layout + -- local bufremove = require 'mini.bufremove' + -- bufremove.setup {} local icons = require 'mini.icons' icons.setup { diff --git a/lua/kickstart/plugins/suda.lua b/lua/kickstart/plugins/suda.lua new file mode 100644 index 0000000..5793aa0 --- /dev/null +++ b/lua/kickstart/plugins/suda.lua @@ -0,0 +1,14 @@ +-- suda +-- +-- Neovim plugin for seamless sudo file editing with permissions preservation. +-- +-- https://github.com/masajinobe-ef/suda.nvim +-- + +return { + 'masajinobe-ef/suda.nvim', + config = function() + require('suda').setup {} + end, + opts = {}, +} diff --git a/lua/kickstart/plugins/treesitter.lua b/lua/kickstart/plugins/treesitter.lua index 26b4b5e..e5d7184 100644 --- a/lua/kickstart/plugins/treesitter.lua +++ b/lua/kickstart/plugins/treesitter.lua @@ -14,7 +14,23 @@ return { main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'latex', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'r', 'vim', 'vimdoc', 'yaml' }, + ensure_installed = { + 'bash', + 'c', + 'diff', + 'html', + 'hyprlang', + 'latex', + 'lua', + 'luadoc', + 'markdown', + 'markdown_inline', + 'query', + 'r', + 'vim', + 'vimdoc', + 'yaml', + }, -- Autoinstall languages that are not installed auto_install = true, highlight = {