From da6ff2944803eb89a57115e72a4a8f1d04243f3a Mon Sep 17 00:00:00 2001 From: Bertrand Benjamin Date: Wed, 15 Sep 2021 16:22:17 +0200 Subject: [PATCH] =?UTF-8?q?Feat:=20d=C3=A9but=20de=20transition=20vers=20l?= =?UTF-8?q?ua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvim/.config/nvim/init.lua | 1 + nvim/.config/nvim/lua/mappings.lua | 22 +++++++++++++ nvim/.config/nvim/lua/settings.lua | 52 ++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 nvim/.config/nvim/init.lua create mode 100644 nvim/.config/nvim/lua/mappings.lua create mode 100644 nvim/.config/nvim/lua/settings.lua diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..ae1697b --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1 @@ +require('settings') diff --git a/nvim/.config/nvim/lua/mappings.lua b/nvim/.config/nvim/lua/mappings.lua new file mode 100644 index 0000000..7c402a1 --- /dev/null +++ b/nvim/.config/nvim/lua/mappings.lua @@ -0,0 +1,22 @@ +local map = vim.api.nvim_set_keymap +local default_opts = {noremap = true, silent = true} + +-- move around splits using Ctrl + {h,j,k,l} +map('n', '', 'h', default_opts) +map('n', '', 'j', default_opts) +map('n', '', 'k', default_opts) +map('n', '', 'l', default_opts) + +-- Align blocks of text and keep them selected +map('v', '<', '', '>gv', {}) + + +-- Automatically spell check last error in insert mode +map('i', '', 'u[s1z=`]au', default_opts) + +-- Find files using Telescope command-line sugar. +map('n', 'e', 'Telescope find_files') +map('n', 'g', 'Telescope live_grep') +map('n', 'b', 'Telescope buffers') +map('n', 'h', 'Telescope help_tags') diff --git a/nvim/.config/nvim/lua/settings.lua b/nvim/.config/nvim/lua/settings.lua new file mode 100644 index 0000000..232480f --- /dev/null +++ b/nvim/.config/nvim/lua/settings.lua @@ -0,0 +1,52 @@ +local cmd = vim.cmd -- execute Vim commands +local exec = vim.api.nvim_exec -- execute Vimscript +-- local fn = vim.fn -- call Vim functions +local g = vim.g -- global variables +local opt = vim.opt -- global/buffer/windows-scoped options + +g.mapleader = ' ' -- Leaderkey +g.showmode = true +g.hidden = true -- Required to keep multiple buffers open multiple buffers +opt.mouse = 'a' -- enable mouse +opt.clipboard = 'unnamedplus' -- copy/paste with system +opt.swapfile = false -- no swapfile + +opt.wrap = true -- Display long lines as just one line +opt.expandtab = true -- Use space instead of tabs +opt.tabstop = 4 -- Insert 4 spaces for a tab +opt.shiftwidth = 4 -- Change the number of space characters inserted for indentation +opt.smarttab = true -- Makes tabbing smarter will realize you have 2 vs 4 +opt.autoindent = true -- Good auto indent +opt.foldmethod='indent' + +opt.number = true -- show line number +opt.relativenumber = true -- show relative line number +opt.cursorline = true -- highlight current line + +opt.ignorecase = true -- Ignore case on search +opt.smartcase = true -- ignore lowercse for the whoel pattern + +opt.completeopt = 'menuone,noselect,noinsert' -- completion options +opt.shortmess = 'c' -- don't show completion messages + +opt.spell = true +opt.spelllang = {'fr', 'en'} + +opt.nrformats = opt.nrformats + 'alpha' + +g.showtabline = true + +-- don't auto commenting new lines +cmd[[au BufEnter * set fo-=c fo-=r fo-=o]] + +opt.showmatch = true -- show parenthethis match + +-- Highlight on yank +exec([[ + augroup YankHighlight + autocmd! + autocmd TextYankPost * silent! lua vim.highlight.on_yank{higroup="IncSearch", timeout=700} + augroup end +]], false) + +