Compare commits

..

10 Commits

6 changed files with 38 additions and 22 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
lazy-lock.json
spell/

View File

@ -1,11 +1,5 @@
local markdown = vim.api.nvim_create_augroup("markdown", { clear = true })
local keyunmap = function(mode, binding)
print(vim.inspect(vim.fn.maparg(binding, mode)))
if vim.fn.maparg(binding, mode) ~= "" then
vim.keymap.del(mode, binding)
end
end
local spelling = vim.api.nvim_create_augroup("spelling", { clear = true })
-- Recognize .md as pandoc
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
@ -15,6 +9,7 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
vim.o.filetype = 'pandoc'
require('luasnip').filetype_extend("pandoc", { "markdown" })
vim.o.spell = true
require('spelling').spell_keymap()
vim.o.spelllang = 'en'
vim.o.formatoptions = "qj"
-- email commands: my/msy to paste the html inside the clipboard
@ -37,23 +32,15 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
-- Spell shortcuts
vim.api.nvim_create_autocmd({ "OptionSet" }, {
pattern = { "spell" },
group = markdown,
callback = function()
if vim.o.spell == true then
vim.keymap.set("n", "<Leader>i", "mz[s1z=`z", { noremap = true, silent = true })
vim.keymap.set("n", "à", "]s", { noremap = true, silent = true })
else
keyunmap("n", "<Leader>i")
keyunmap("n", "à")
end
end
group = spelling,
callback = require('spelling').spell_keymap
})
-- LaTeX configuration
local texgroup = vim.api.nvim_create_augroup("latex", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
pattern = { "latex" },
pattern = { "latex", "tex" },
group = texgroup,
callback = function()
-- vimtex configuration
@ -67,5 +54,6 @@ vim.api.nvim_create_autocmd("FileType", {
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
vim.o.foldtext = 'vimtex#fold#text()'
vim.o.spell = true
require('spelling').spell_keymap()
end,
})

View File

@ -140,11 +140,17 @@ require('lazy').setup({
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
icons_enabled = true,
theme = 'rose-pine',
component_separators = '|',
section_separators = '',
},
symbols = {
error = "",
warn = "",
info = "",
hint = "",
}
},
},

View File

@ -81,6 +81,7 @@ local servers = {
tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
texlab = {},
ltex = {},
lua_ls = {
Lua = {
@ -117,8 +118,7 @@ mason_lspconfig.setup_handlers {
end,
}
-- System LSPs
-- [[ System LSPs ]]
local lspconfig = require('lspconfig')
servers = {
rust_analyzer = {

19
lua/spelling.lua Normal file
View File

@ -0,0 +1,19 @@
local keyunmap = function(mode, binding)
if vim.fn.maparg(binding, mode) ~= "" then
vim.keymap.del(mode, binding)
end
end
local M = {}
M.spell_keymap = function()
if vim.o.spell == true then
vim.keymap.set("n", "<Leader>i", "mzl[s1z=`z", { noremap = true, silent = true, desc = "f[I]x typo under cursor" })
vim.keymap.set("n", "à", "]s", { noremap = true, silent = true, desc = "Go to the next typo" })
else
keyunmap("n", "<Leader>i")
keyunmap("n", "à")
end
end
return M

View File

@ -1,9 +1,11 @@
In this repository lies my nvim configuration starting from
In this repository lies my Neovim configuration starting from
[kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim).
The provided `init.lua` file has then been split into (tryingly) semantically
consistent files inside `lua/` and personal customizations have been applied.
The process to design this configuration and some thoughts can be found [here](https://blog.epheme.re/software/nvim-kickstart.html).
## Testing it
To try it, you can use the `NVIM_APPNAME` environment variable: