From 46d8707e32d9480b7b08f8f6b2a80787140fcd5c Mon Sep 17 00:00:00 2001 From: Gregory Trolliet Date: Sat, 19 Oct 2024 16:26:07 +0200 Subject: [PATCH] [nvim] add grammalect --- .config/nvim/init.lua | 21 +++++++++++++++++++++ .config/nvim/lua/core/options.lua | 3 +++ .config/nvim/lua/plugins/grammalect.lua | 3 +++ .config/nvim/lua/plugins/treesitter.lua | 14 +++++++++++--- 4 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .config/nvim/lua/plugins/grammalect.lua diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index eb5f467..aba9afb 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -24,6 +24,9 @@ map('n', 'gc', ':Telescope git_commits', options) map('n', '', ':Telescope buffers', options) map('n', 't', ':TagbarToggle', options) +vim.g.grammalecte_cli_py = "~/Grammalecte-fr/grammalecte-cli.py" + + -------------------------------------------------- -- LSP -------------------------------------------------- @@ -68,6 +71,24 @@ cmp.setup({ sources = { {name = 'nvim_lsp'}, }, + completion = { + autocomplete = false + }, + mapping = cmp.mapping.preset.insert({ + -- Navigate between completion items + [''] = cmp.mapping.select_prev_item({behavior = 'select'}), + [''] = cmp.mapping.select_next_item({behavior = 'select'}), + + -- `Enter` key to confirm completion + [''] = cmp.mapping.confirm({select = false}), + + -- Ctrl+Space to trigger completion menu + [''] = cmp.mapping.complete(), + + -- Scroll up and down in the completion documentation + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + }), snippet = { expand = function(args) require('luasnip').lsp_expand(args.body) diff --git a/.config/nvim/lua/core/options.lua b/.config/nvim/lua/core/options.lua index b7aec38..e326ae3 100644 --- a/.config/nvim/lua/core/options.lua +++ b/.config/nvim/lua/core/options.lua @@ -9,6 +9,7 @@ vim.opt.relativenumber = true -- display relative line numbers vim.opt.tabstop = 4 -- number of columns occupied by a tab character vim.opt.shiftwidth = 4 -- width for autoindents vim.opt.softtabstop = 4 -- see multiple spaces as tabstops so does the right thing +vim.opt.linebreak = true -- wrap lines between words vim.opt.listchars:append { eol = "$", @@ -20,3 +21,5 @@ vim.opt.listchars:append { precedes = "<", } vim.opt.list = true + +vim.opt.spelllang = {'fr', 'en'} diff --git a/.config/nvim/lua/plugins/grammalect.lua b/.config/nvim/lua/plugins/grammalect.lua new file mode 100644 index 0000000..2db8d13 --- /dev/null +++ b/.config/nvim/lua/plugins/grammalect.lua @@ -0,0 +1,3 @@ +return { + "dpelle/vim-Grammalecte", +} diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 8c2e44b..435bedb 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,6 +1,14 @@ return { "nvim-treesitter/nvim-treesitter", - build = function() - require("nvim-treesitter.install").update({ with_sync = true })() - end, + build = ":TSUpdate", + config = function () + local configs = require("nvim-treesitter.configs") + + configs.setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end }