-- Encoding.
vim.o.encoding = 'utf-8'
vim.o.fileencoding = 'utf-8'
vim.o.backup = false
vim.o.swapfile = false

-- Lines.
vim.o.number = true
vim.o.relativenumber = true
vim.o.colorcolumn = '79'
vim.o.signcolumn = 'yes'

-- Tabs.
vim.o.tabstop = 2
vim.o.shiftwidth = 2
-- vim.o.expandtab = true

-- Etc.
vim.o.guicursor = ''
vim.o.clipboard = 'unnamedplus'

-- View.
vim.g.mapleader = ' '
vim.g.netrw_liststyle = 3

vim.o.list = true
vim.opt.listchars:append 'space:⋅'
-- vim.opt.listchars:append 'eol:↴'
-- vim.opt.listchars:append 'tab:>-'

-- Mappings tabs.
vim.keymap.set('n', '<C-h>', ':-tabmove<CR>')
vim.keymap.set('n', '<C-l>', ':+tabmove<CR>')

-- Mappings buffers.
vim.keymap.set('n', '<leader>k', ':bn<CR>')
vim.keymap.set('n', '<leader>j', ':bp<CR>')

-- Move cursour vertical.
vim.keymap.set('n', '<C-d>', '<C-d>zz')
vim.keymap.set('n', '<C-u>', '<C-u>zz')

-- Diagnostic keymaps.
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
