~keving/dotfiles

3545ff72f5f02c298694406262575d443eecdddd — Kevin Guillaumond 8 months ago 9168879
Cosmetic changes in init.lua
1 files changed, 28 insertions(+), 1 deletions(-)

M .config/nvim/init.lua
M .config/nvim/init.lua => .config/nvim/init.lua +28 -1
@@ 136,7 136,10 @@ utils.map('n', [[ysa"]], [[ys2i"]])
utils.map('n', [[ysa`]], [[ys2i`]])


--
-- General
--

-- Sets how many lines of history VIM has to remember
vim.o.history = 500



@@ 150,7 153,10 @@ utils.map('n', '<leader>si', ':luafile ~/.config/nvim/init.lua<CR>', {silent = t
utils.map('n', '<leader>sc', ':luafile %<CR>', {silent = true})


--
-- User interface
--

-- Show the number of the current line and the relative number of the others
vim.o.number = true
vim.o.relativenumber = true


@@ 223,7 229,10 @@ vim.o.termguicolors = true
vim.o.fileformats = 'unix,dos,mac'


--
-- Text, tab and indent
--

-- Use spaces instead of tabs
vim.o.expandtab = true



@@ 242,18 251,27 @@ vim.o.colorcolumn = '80'
vim.o.smartindent = true


--
-- Visual mode
--

-- Visual mode pressing * or # searches for the current selection
utils.map('v', '*', ':<C-u>call VisualSelection("", "")<CR>/<C-R>=@/<CR><CR>', {silent = true})
utils.map('v', '#', ':<C-u>call VisualSelection("", "")<CR>?<C-R>=@/<CR><CR>', {silent = true})


--
-- Terminal mode
--

-- Better command to switch from insert to normal mode
utils.map('t', '<C-o>', [[<C-\><C-n>]])


--
-- Moving around, tabs, windows and buffers
--

-- Map j to gj so vim behaves as expected with wrapped lines
-- But keep normal behaviour if doing something like 4j
cmd "nnoremap <expr> j v:count ? 'j' : 'gj'"


@@ 293,7 311,10 @@ vim.o.showtabline = 1
vim.cmd([[autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]])


--
-- Editing mappings
--

-- Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
-- which is the default
utils.map('n', 'Y', 'y$')


@@ 311,10 332,13 @@ function clean_extra_spaces()
  vim.fn.setreg('/', old_query)
end

vim.cmd('autocmd BufWritePre *.txt,*.js,*.py,*.c,*.sh,*.lua :lua clean_extra_spaces()')
vim.cmd('autocmd BufWritePre *.txt,*.js,*.py,*.sh,*.lua :lua clean_extra_spaces()')


--
-- Code
--

-- Enable code folding
vim.o.foldmethod = 'indent'
vim.o.foldlevel = 99


@@ 376,7 400,10 @@ utils.map('n', '<leader>se', ':setlocal spelllang=en_en<CR>')
utils.map('n', '<leader>sf', ':setlocal spelllang=fr<CR>')


--
-- Misc
--

-- Remove the Windows ^M - when the encodings gets messed up
utils.map('n', '<leader>m', "mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm")