From abed395a87f28ee2a94c6a352588a58572109855 Mon Sep 17 00:00:00 2001 From: tiyn Date: Tue, 5 Mar 2024 14:44:15 +0100 Subject: [PATCH] nvim: added latexindent with 2 space indent --- .../lua/dictionaries/dictionary_de-de.txt | 1 + .config/nvim/lua/keymap.lua | 54 +++++++++---------- .config/nvim/lua/plugins/conform.lua | 16 ++++-- .config/nvim/lua/plugins/mason.lua | 7 ++- 4 files changed, 45 insertions(+), 33 deletions(-) diff --git a/.config/nvim/lua/dictionaries/dictionary_de-de.txt b/.config/nvim/lua/dictionaries/dictionary_de-de.txt index 64bb329..f64a4a2 100644 --- a/.config/nvim/lua/dictionaries/dictionary_de-de.txt +++ b/.config/nvim/lua/dictionaries/dictionary_de-de.txt @@ -1,4 +1,5 @@ Bonitur Königinnensubstanz Magazinbeute +Magazinbeuten Pollenhose diff --git a/.config/nvim/lua/keymap.lua b/.config/nvim/lua/keymap.lua index 0202437..4e9e5c4 100644 --- a/.config/nvim/lua/keymap.lua +++ b/.config/nvim/lua/keymap.lua @@ -20,43 +20,43 @@ m.nname("s", "Substitute") m.nname("t", "Terminal") -- unmap unwanted commands -m.nnoremap("Zt", '') -m.nnoremap("ZT", '') -m.nnoremap("", '') -m.inoremap("", '') -m.inoremap("", '') -m.inoremap("", '') -m.inoremap("", '') -m.inoremap("", '') -m.inoremap("", '') -m.inoremap("", '') -m.nnoremap("", '') -m.inoremap("", '') -m.nnoremap("", '') -m.inoremap("", '') -m.nnoremap("", '') -m.inoremap("", '') -m.nnoremap("", '') +m.nnoremap("Zt", '') +m.nnoremap("ZT", '') +m.nnoremap("", '') +m.inoremap("", '') +m.inoremap("", '') +m.inoremap("", '') +m.inoremap("", '') +m.inoremap("", '') +m.inoremap("", '') +m.inoremap("", '') +m.nnoremap("", '') +m.inoremap("", '') +m.nnoremap("", '') +m.inoremap("", '') +m.nnoremap("", '') +m.inoremap("", '') +m.nnoremap("", '') -- shortcut for split navigation -m.nnoremap("", 'h', 'Navigation: go to left split') -m.nnoremap("", 'j', 'Navigation: go to lower split') -m.nnoremap("", 'k', 'Navigation: go to upper split') -m.nnoremap("", 'l', 'Navigation: go to right split') +m.nnoremap("", 'h', 'Navigation: go to left split') +m.nnoremap("", 'j', 'Navigation: go to lower split') +m.nnoremap("", 'k', 'Navigation: go to upper split') +m.nnoremap("", 'l', 'Navigation: go to right split') -- remap for dealing with word wrap m.nmap('j', "v:count == 0 ? 'gj' : 'j'", { "expr", "silent" }, 'Navigation: go down in wrapped lines') m.nmap('k', "v:count == 0 ? 'gk' : 'k'", { "expr", "silent" }, 'Navigation: go up in wrapped lines') -- compiler for languages -m.nnoremap("c", ':w! | !compiler %', 'Compile: current file') +m.nnoremap("c", ':w! | !compiler %', 'Compile: current file') -- save file as sudo on files that require root permission -m.cnoremap("w!!", 'execute "silent! write !sudo tee % >/dev/null" edit!', 'Write: overwrite file over with sudo') +m.cnoremap("w!!", 'execute "silent! write !sudo tee % >/dev/null" edit!', 'Write: overwrite file over with sudo') -- tpope/vim-abolish -m.nnoremap("sa", ':%S//g', 'Substitute: free form') -m.nnoremap("ss", ':%S/\\<\\>//g', 'Substitute: word under cursor') +m.nnoremap("sa", ':%S//g', 'Substitute: free form') +m.nnoremap("ss", ':%S/\\<\\>//g', 'Substitute: word under cursor') -- stevearc/aerial.nvim m.nmap('', ':AerialToggle!', 'CTags: toggle') @@ -98,10 +98,10 @@ m.nnoremap("", function() require("conform").format({ async = true, lsp_fall m.nnoremap("", require("renamer").rename, "LSP: rename") -- nvim-telescope/telescope.nvim -m.nnoremap("", ':Telescope find_files', "Telescope: find files") +m.nnoremap("", ':Telescope find_files', "Telescope: find files") -- kamykn/spelunker.vim -m.nnoremap("", ':call spelunker#toggle()', "Spelling: toggle spell check") +m.nnoremap("", ':call spelunker#toggle()', "Spelling: toggle spell check") -- kevinhwang91/nvim-ufo m.nnoremap("K", function() diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua index a7c355a..10cda12 100644 --- a/.config/nvim/lua/plugins/conform.lua +++ b/.config/nvim/lua/plugins/conform.lua @@ -2,11 +2,17 @@ return { -- improved refactoring { 'stevearc/conform.nvim', - opts = { - formatters_by_ft = { - python = { "isort", "black" }, - markdown = { "mdformat" }, + config = function() + require("conform").setup({ + formatters_by_ft = { + python = { "isort", "black" }, + markdown = { "mdformat" }, + tex = { "latexindent" }, + } + }) + require("conform").formatters.latexindent = { + prepend_args = { "-y=defaultIndent: ' '" }, } - } + end } } diff --git a/.config/nvim/lua/plugins/mason.lua b/.config/nvim/lua/plugins/mason.lua index 6b5b1c9..24283c4 100644 --- a/.config/nvim/lua/plugins/mason.lua +++ b/.config/nvim/lua/plugins/mason.lua @@ -13,6 +13,8 @@ return { require("null-ls").builtins.formatting.black, -- markdown require("null-ls").builtins.formatting.mdformat, + -- latex + require("null-ls").builtins.formatting.latexindent, } }) end @@ -22,7 +24,10 @@ return { opts = { automatic_installation = true, ensure_installed = { - "isort", "black", "mdformat" + "black", + "isort", + "latexindent", + "mdformat", } } }