This commit is contained in:
2025-09-07 11:18:48 +02:00
parent 6132b60ca3
commit 1c933f1054
15 changed files with 206 additions and 54 deletions

45
ftplugin/tex.lua Normal file
View File

@@ -0,0 +1,45 @@
--[[--
File : conf.d/lvim/ftplugin/tex.lua
Author : Jeff Lance <email@jefflance.me>
Date : 06.08.2023 11:07:22
Last Modified Date: 15.08.2023 00:46:47
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
-- Shortcuts
--
-- old way making the LaTeX menu appears with the LSP and Lunar one
-- whk.register {
-- ["<leader>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 {
{ '<localleader>L', '', group = '[L]aTeX' },
{ '<localleader>Lc', '<CMD>VimtexCompileSS<CR>', desc = 'Single-shot compile project' },
{ '<localleader>LC', '', group = '[C]ompile' },
{ '<localleader>LCs', '<CMD>VimtexStop<CR>', desc = 'Stop compile' },
{ '<localleader>LCc', '<CMD>VimtexCompileSelected<CR>', desc = 'Compile Selected' },
{ '<localleader>Ld', '<CMD>VimtexDocPackage<CR>', desc = 'Open Doc for package' },
{ '<localleader>Le', '<CMD>VimtexErrors<CR>', desc = 'Look at the errors' },
{ '<localleader>Lm', '<CMD>VimtexToggleMain <bar> let @+ = expand("%:t")<CR>', desc = 'Toggle Main' },
{ '<localleader>Lo', '<CMD>VimtexView<CR>', desc = 'View pdf' },
{ '<localleader>Ls', '<CMD>VimtexStatus<CR>', desc = 'Look at the status' },
{ '<localleader>LT', '', group = '[T]oc' },
{ '<localleader>LTo', '<CMD>VimtexTocOpen<CR>', desc = 'Open TOC' },
{ '<localleader>LTt', '<CMD>VimtexTocToggle<CR>', desc = 'Toggle TOC' },
}

View File

@@ -19,7 +19,7 @@ end
wk.add {
{
mode = { 'n', 'v', 'i' },
{ '<leader>bd', mbr.delete, desc = '[d]elete buffer', noremap = true, silent = true },
-- { '<leader>bd', mbr.delete, desc = '[d]elete buffer', noremap = true, silent = true },
{
'<leader>bF',
function()
@@ -42,7 +42,7 @@ wk.add {
{
mode = { 'n', 'v', 'i' },
-- mapping runs here as which-key intercepts ctrl-z signal before term
{ '<C-c>', mbr.delete, desc = 'Delete buffer', noremap = true, silent = true, hidden = true },
{ '<C-c>', '<CMD>Bdelete<CR>', desc = 'Close current buffer', noremap = true, silent = true, hidden = true },
{ '<C-s>', '<CMD>w<CR><ESC>', desc = 'Save buffer', noremap = true, silent = true, hidden = true },
},
}

View File

@@ -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
{ '<leader>tb', gitsigns.toggle_current_line_blame, desc = 'toggle git show [b]lame line' },
{ '<leader>td', gitsigns.preview_hunk_inline, desc = 'toggle git show [d]eleted' },
{ '<leader>ti', toggle_image_rendering, desc = 'toggle git show [d]eleted' },
{ '<leader>tm', '<CMD>RenderMarkdown buf_toggle<CR>', desc = 'toggle [m]arkdown rendering for current' },
{ '<leader>tt', toggle_light_dark_theme, desc = 'toggle light/dark [t]heme' },
{ '<leader>tc', toggle_conceal, desc = 'toggle [c]onceal' },

View File

@@ -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())

View File

@@ -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 },

View File

@@ -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 = {
{ '<leader>bc', '<CMD>Bdelete<CR>', desc = '[c]lose current buffer' },
{
'<leader>bC',
'<CMD>bufdo :Bdelete<CR>',
desc = '[C]lose all buffers',
},
},
},
}

View File

@@ -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 = '<Esc>',
},
},
},
}
end,
},
}

View File

@@ -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',
},
}

View File

@@ -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',
-- },
},
},
}

View File

@@ -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 = {
{ '<localLeader>l', '', desc = 'LaTeX', ft = 'tex' },
},
-- keys = {
-- { '<localLeader>l', '', desc = 'LaTeX', ft = 'tex' },
-- },
},
}

View File

@@ -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,

View File

@@ -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 }

View File

@@ -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 {

View File

@@ -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 = {},
}

View File

@@ -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 = {