Compare commits

...

10 Commits

6 changed files with 38 additions and 22 deletions

1
.gitignore vendored
View File

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

View File

@ -1,11 +1,5 @@
local markdown = vim.api.nvim_create_augroup("markdown", { clear = true }) local markdown = vim.api.nvim_create_augroup("markdown", { clear = true })
local spelling = vim.api.nvim_create_augroup("spelling", { 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
-- Recognize .md as pandoc -- Recognize .md as pandoc
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
@ -15,6 +9,7 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
vim.o.filetype = 'pandoc' vim.o.filetype = 'pandoc'
require('luasnip').filetype_extend("pandoc", { "markdown" }) require('luasnip').filetype_extend("pandoc", { "markdown" })
vim.o.spell = true vim.o.spell = true
require('spelling').spell_keymap()
vim.o.spelllang = 'en' vim.o.spelllang = 'en'
vim.o.formatoptions = "qj" vim.o.formatoptions = "qj"
-- email commands: my/msy to paste the html inside the clipboard -- email commands: my/msy to paste the html inside the clipboard
@ -37,23 +32,15 @@ vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
-- Spell shortcuts -- Spell shortcuts
vim.api.nvim_create_autocmd({ "OptionSet" }, { vim.api.nvim_create_autocmd({ "OptionSet" }, {
pattern = { "spell" }, pattern = { "spell" },
group = markdown, group = spelling,
callback = function() callback = require('spelling').spell_keymap
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
}) })
-- LaTeX configuration -- LaTeX configuration
local texgroup = vim.api.nvim_create_augroup("latex", { clear = true }) local texgroup = vim.api.nvim_create_augroup("latex", { clear = true })
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
pattern = { "latex" }, pattern = { "latex", "tex" },
group = texgroup, group = texgroup,
callback = function() callback = function()
-- vimtex configuration -- vimtex configuration
@ -67,5 +54,6 @@ vim.api.nvim_create_autocmd("FileType", {
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)' vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
vim.o.foldtext = 'vimtex#fold#text()' vim.o.foldtext = 'vimtex#fold#text()'
vim.o.spell = true vim.o.spell = true
require('spelling').spell_keymap()
end, end,
}) })

View File

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

View File

@ -81,6 +81,7 @@ local servers = {
tsserver = {}, tsserver = {},
-- html = { filetypes = { 'html', 'twig', 'hbs'} }, -- html = { filetypes = { 'html', 'twig', 'hbs'} },
texlab = {}, texlab = {},
ltex = {},
lua_ls = { lua_ls = {
Lua = { Lua = {
@ -117,8 +118,7 @@ mason_lspconfig.setup_handlers {
end, end,
} }
-- System LSPs -- [[ System LSPs ]]
local lspconfig = require('lspconfig') local lspconfig = require('lspconfig')
servers = { servers = {
rust_analyzer = { 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). [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim).
The provided `init.lua` file has then been split into (tryingly) semantically The provided `init.lua` file has then been split into (tryingly) semantically
consistent files inside `lua/` and personal customizations have been applied. 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 ## Testing it
To try it, you can use the `NVIM_APPNAME` environment variable: To try it, you can use the `NVIM_APPNAME` environment variable: