-------------- -- init.lua -- -------------- -- Default config vim.o.fileencoding = 'utf8' vim.o.encoding = 'utf-8' vim.o.ff = 'unix' vim.o.backspace = 'indent,eol,start' -- Options local set_true = { 'title', 'number', 'relativenumber', 'ruler', 'modeline', 'autoread', --- Search options 'incsearch', 'ignorecase', 'smartcase', 'showcmd', 'showmatch', 'lazyredraw', 'linebreak', 'wrap', 'wildmenu', 'wildignorecase', 'showfulltag', } local set_false = {'hlsearch', 'compatible', } for _,o in ipairs(set_true) do vim.o[o] = true end for _,o in ipairs(set_false) do vim.o[o] = false end --- Indent & Tab options vim.cmd 'filetype indent on' local indent_options = { 'cindent', 'smartindent', 'autoindent', 'expandtab' } local tab_options = { 'tabstop', 'softtabstop', 'shiftwidth' } for _,o in ipairs(indent_options) do vim.o[o] = true end for _,o in ipairs(tab_options) do vim.o[o] = 2 end --- Position vim.o.tw = 80 vim.o.winwidth = 88 vim.o.scrolloff = 6 vim.cmd "set formatoptions-=t" -- undodir: undo across sessions (but not upon reboot) vim.o.undodir = '/tmp/undo' vim.o.undofile = true vim.o.backup = false -- Theme vim.o.background = "light" vim.cmd "colorscheme lunaperche" -- Remappings local map_list = { --- w| / w- to create vertical and horizontal splits ['w|'] = ':vsplit', ['w-'] = ':split', --- gi / ge to move between buffers ['gi'] = ':bprevious', ['ge'] = ':bnext', --- W to save, ^t to create a tab ['W'] = ':w', [''] = ':tabnew', } for key, binding in pairs(map_list) do vim.api.nvim_set_keymap('n', key, binding .. '', { noremap = true, silent = true }) end