dotfiles/dot_config/nvim/init.lua

80 lines
2.2 KiB
Lua

require('plugins')
vim.g.netrw_liststyle = 3
-- Use number column
vim.opt.number = true
-- Color column for 80 characters
vim.opt.cc = "80"
-- REMAPS --
-- Use ; in place of : in normal mode
vim.keymap.set('n', ';', ':')
-- Remap navigation between windows
vim.keymap.set('n', '<C-H>', '<C-W><C-H>')
vim.keymap.set('n', '<C-J>', '<C-W><C-J>')
vim.keymap.set('n', '<C-K>', '<C-W><C-K>')
vim.keymap.set('n', '<C-L>', '<C-W><C-L>')
-- Map copy to system clipboard to <C-c>
vim.keymap.set('', '<C-c>', '"+y<CR>')
-- coc.nvim - remap <cr> to make it confirm completion.
vim.keymap.set('i', '<cr>', function()
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#confirm']() end
return '<cr>'
end, { expr=true })
-- coc.nvim - use <Tab> / <S-Tab> to navigate completion list
vim.keymap.set('i', '<Tab>', function()
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end
return '<Tab>'
end, { expr=true })
vim.keymap.set('i', '<S-Tab>', function()
if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end
return '<S-Tab>'
end, { expr=true })
-- Tab stuff
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.tabstop = 2
vim.opt.expandtab = true
-- set filetype for void-packages templates
vim.api.nvim_create_autocmd(
{ "BufRead", "BufNewFile" },
{ pattern = { "template" }, command = "setlocal filetype=sh" }
)
-- treesitter
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true
}
}
-- Install coc extensions
vim.g.coc_global_extensions = {'coc-json', 'coc-lua', 'coc-pyright', 'coc-rust-analyzer', 'coc-yaml'}
-- Turn on nice things
vim.opt.clipboard = "unnamedplus"
vim.opt.mouse = "a"
-- Colorscheme
vim.opt.termguicolors = true
vim.o.background = "light"
vim.g.gruvbox_contrast_light = "medium"
vim.g.gruvbox_italicize_comments = 0
vim.cmd([[colorscheme gruvbox]])