From e766144286da6bcf027685962f53b7022075c357 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 21 Jul 2023 15:46:33 -0400 Subject: [PATCH] add nvim --- dot_config/nvim/coc-settings.json | 9 ++++ dot_config/nvim/init.lua | 75 +++++++++++++++++++++++++++++++ dot_config/nvim/lua/plugins.lua | 31 +++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 dot_config/nvim/coc-settings.json create mode 100644 dot_config/nvim/init.lua create mode 100644 dot_config/nvim/lua/plugins.lua diff --git a/dot_config/nvim/coc-settings.json b/dot_config/nvim/coc-settings.json new file mode 100644 index 0000000..fd28554 --- /dev/null +++ b/dot_config/nvim/coc-settings.json @@ -0,0 +1,9 @@ +{ + "coc.preferences.extensionUpdateCheck": "daily", + "workspace.ignoredFolders": [ + "$HOME", + "$HOME/.cargo/**", + "$HOME/.rustup/**" + ], + "rust-analyzer.server.path": "rust-analyzer" +} diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua new file mode 100644 index 0000000..19ada7d --- /dev/null +++ b/dot_config/nvim/init.lua @@ -0,0 +1,75 @@ +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', '', '') +vim.keymap.set('n', '', '') +vim.keymap.set('n', '', '') +vim.keymap.set('n', '', '') + +-- Map copy to system clipboard to +vim.keymap.set('', '', '"+y') + +-- coc.nvim - remap to make it confirm completion. +vim.keymap.set('i', '', function() + if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#confirm']() end + return '' +end, { expr=true }) + +-- coc.nvim - use / to navigate completion list +vim.keymap.set('i', '', function() + if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#next'](1) end + return '' +end, { expr=true }) +vim.keymap.set('i', '', function() + if vim.fn['coc#pum#visible']() == 1 then return vim.fn['coc#pum#prev'](1) end + return '' +end, { expr=true }) + +-- Tab stuff +vim.opt.shiftwidth = 2 +vim.opt.softtabstop = 2 +vim.opt.tabstop = 2 + +-- 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 + } +} + +-- 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]]) diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua new file mode 100644 index 0000000..5558b72 --- /dev/null +++ b/dot_config/nvim/lua/plugins.lua @@ -0,0 +1,31 @@ +local fn = vim.fn +local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +if fn.empty(fn.glob(install_path)) > 0 then + packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) +end + +-- Only required if you have packer configured as `opt` +vim.cmd [[packadd packer.nvim]] + +return require('packer').startup(function(use) + -- Packer can manage itself + use 'wbthomason/packer.nvim' + + -- LSP / COMPLETION -- + use {'neoclide/coc.nvim', branch = "release"} + + -- Gruvbox colorscheme + use 'ellisonleao/gruvbox.nvim' + + use 'lukas-reineke/indent-blankline.nvim' + + use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} + + -- Automatically set up your configuration after cloning packer.nvim + -- Put this at the end after all plugins + if packer_bootstrap then + require('packer').sync() + end +end) + +-- This file can be loaded by calling `lua require('plugins')` from your init.vim