nvim-config

Log | Files | Refs | Submodules | README

commit 8cb6b99cc8e140f07e8c4f5661c62c707da5dcea
parent 54ec9a801729ebd0c5686a54d02e3fdc8fe7619d
Author: Thomas Vigouroux <thomas.vigouroux@protonmail.com>
Date:   Tue, 26 Jul 2022 11:10:59 +0200

Update

Diffstat:
Minit.lua | 23+++++++++++++++++++++++
Mlua/lsp_config.lua | 32+++++++++++++++-----------------
2 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/init.lua b/init.lua @@ -93,4 +93,27 @@ vim.cmd.colorscheme "oak" require "mappings" require "neogit-config" +do + local ignored_fts = { + gitcommit = true, + rebase = true, + text = true, + help = true, + } + vim.api.nvim_create_autocmd("BufRead", { + callback = function(src) + vim.api.nvim_create_autocmd("Filetype", { + once = true, + buffer = src.buf, + callback = function(opts) + local mline = vim.fn.line [['"]] + if not ignored_fts[vim.bo[opts.buf].filetype] and mline > 1 and mline <= vim.fn.line "$" then + vim.api.nvim_input [[g`"zz]] + end + end + }) + end + }) +end + return M diff --git a/lua/lsp_config.lua b/lua/lsp_config.lua @@ -1,5 +1,4 @@ local lsp = require 'lspconfig' -vim.cmd [[packadd nvim-lspconfig]] vim.diagnostic.config { virtual_text = false, @@ -35,7 +34,7 @@ vim.api.nvim_create_autocmd({ "User LspProgressUpdate" }, { }) local function on_attach(client, bufnr) - local function buf_set_keymap(lhs, func) + local function set_keymap(lhs, func) vim.keymap.set("n", lhs, "", { remap = false, silent = true, @@ -52,20 +51,18 @@ local function on_attach(client, bufnr) end -- Mappings. - -- autocmd CursorHold,CursorHoldI *.rs lua vim.lsp.diagnostic.show_line_diagnostics{focusable=false} -- See `:help vim.lsp.*` for documentation on any of the below functions - buf_set_keymap('gD', vim.lsp.buf.implementation) - buf_set_keymap('<Leader>d', vim.lsp.buf.definition) - buf_set_keymap('K', vim.lsp.buf.hover) - buf_set_keymap('<C-S-K>', vim.lsp.buf.signature_help) - buf_set_keymap('gr', vim.lsp.buf.rename) - buf_set_keymap('<Leader>a', vim.lsp.buf.code_action) - buf_set_keymap('[d', vim.diagnostic.goto_prev) - buf_set_keymap(']d', vim.diagnostic.goto_next) - buf_set_keymap('<Leader>q', vim.diagnostic.setqflist) - buf_set_keymap('<Leader>=', function() vim.lsp.buf.format { async = true } end) - buf_set_keymap('gR', require "telescope.builtin".lsp_references) - buf_set_keymap('<Leader>s', require "telescope.builtin".lsp_dynamic_workspace_symbols) + set_keymap('gD', vim.lsp.buf.implementation) + set_keymap('<Leader>d', vim.lsp.buf.definition) + set_keymap('K', vim.lsp.buf.hover) + set_keymap('gr', vim.lsp.buf.rename) + set_keymap('<Leader>a', vim.lsp.buf.code_action) + set_keymap('[d', vim.diagnostic.goto_prev) + set_keymap(']d', vim.diagnostic.goto_next) + set_keymap('<Leader>q', vim.diagnostic.setqflist) + set_keymap('<Leader>=', function() vim.lsp.buf.format { async = true } end) + set_keymap('gR', require "telescope.builtin".lsp_references) + set_keymap('<Leader>s', require "telescope.builtin".lsp_dynamic_workspace_symbols) local f = nil for _, path in pairs(vim.lsp.buf.list_workspace_folders()) do @@ -74,10 +71,10 @@ local function on_attach(client, bufnr) break end end - buf_set_keymap('<Leader>e', function() require "telescope.builtin".fd { cwd = f } end) + set_keymap('<Leader>e', function() require "telescope.builtin".fd { cwd = f } end) -- LSP lines setup - buf_set_keymap('<Leader>l', require("lsp_lines").toggle) + set_keymap('<Leader>l', require("lsp_lines").toggle) set_autocmd("InsertEnter", function() -- Force off lsp_lines on enter vim.diagnostic.config { virtual_lines = false } @@ -319,6 +316,7 @@ require 'ltex-ls'.setup { motherTongue = "fr", }, disabledRules = { + en = { "TOO_LONG_SENTENCE" }, fr = { "APOS_TYP", "FRENCH_WHITESPACE" } }, latex = {