Feat: début de transition vers lua

This commit is contained in:
Bertrand Benjamin 2021-09-15 16:22:17 +02:00
parent 9dd08b6d18
commit da6ff29448
3 changed files with 75 additions and 0 deletions

View File

@ -0,0 +1 @@
require('settings')

View File

@ -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', '<C-h>', '<C-w>h', default_opts)
map('n', '<C-j>', '<C-w>j', default_opts)
map('n', '<C-k>', '<C-w>k', default_opts)
map('n', '<C-l>', '<C-w>l', default_opts)
-- Align blocks of text and keep them selected
map('v', '<', '<gv', {})
map('v', '>', '>gv', {})
-- Automatically spell check last error in insert mode
map('i', '<c-f>', '<c-g>u<Esc>[s1z=`]a<c-g>u', default_opts)
-- Find files using Telescope command-line sugar.
map('n', '<leader>e', '<cmd>Telescope find_files<cr>')
map('n', '<leader>g', '<cmd>Telescope live_grep<cr>')
map('n', '<leader>b', '<cmd>Telescope buffers<cr>')
map('n', '<leader>h', '<cmd>Telescope help_tags<cr>')

View File

@ -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)