dotfiles/dot_config/nvim/init.lua

83 lines
2.4 KiB
Lua
Raw Normal View History

2023-07-21 15:46:33 -04:00
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 })
2024-10-18 14:00:03 -04:00
-- Code search? https://news.ycombinator.com/item?id=41739452
vim.keymap.set('n', 'gv', '<c-w>v<cmd>lua vim.lsp.buf.definition()<CR>', opts)
2023-07-21 15:46:33 -04:00
-- Tab stuff
vim.opt.shiftwidth = 2
vim.opt.softtabstop = 2
vim.opt.tabstop = 2
2024-03-18 16:28:17 -04:00
vim.opt.expandtab = true
2023-07-21 15:46:33 -04:00
-- 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
}
}
2023-08-18 16:16:05 -04:00
-- Install coc extensions
2024-05-10 09:51:24 -04:00
vim.g.coc_global_extensions = {'coc-json', 'coc-lua', 'coc-pyright', 'coc-rust-analyzer', 'coc-yaml', 'coc-eslint'}
2023-08-18 16:16:05 -04:00
2023-07-21 15:46:33 -04:00
-- Turn on nice things
vim.opt.clipboard:append("unnamedplus")
2023-07-21 15:46:33 -04:00
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]])