From 8123e70d7434ee75e15228b58e0ca3d561359e7c Mon Sep 17 00:00:00 2001 From: Gabe Venberg Date: Sun, 12 Sep 2021 00:29:48 -0500 Subject: [PATCH] transported all of current config to lua. On to learning the new features of neovim 0.5! --- neovim/.config/nvim/init.lua | 36 +++++++++++++++++-- neovim/.config/nvim/legacy.vimrc | 61 -------------------------------- 2 files changed, 34 insertions(+), 63 deletions(-) delete mode 100644 neovim/.config/nvim/legacy.vimrc diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 456a555..ef770fb 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -2,8 +2,18 @@ local cmd=vim.cmd local opt=vim.opt local fn=vim.fn ---source any legacy code that I havent ported to lua yet. -cmd([[source ~/.config/nvim/legacy.vimrc]]) +local map=vim.api.nvim_set_keymap + +--helper functions + local function keyCode(string) + return vim.api.nvim_replace_termcodes(str, true, true, true, true) + end + +--bootstrapping paq-nvim + local install_path = fn.stdpath('data') .. '/site/pack/paqs/start/paq-nvim' + if fn.empty(fn.glob(install_path)) > 0 then + fn.system({'git', 'clone', '--depth=1', 'https://github.com/savq/paq-nvim.git', install_path}) + end --options using vim.opt (aliased, of course.) opt.lazyredraw=true @@ -51,3 +61,25 @@ cmd([[source ~/.config/nvim/legacy.vimrc]]) opt.foldenable=true opt.foldminlines=2 opt.foldignore='' + +--leader key is set through a variable, for some reason. +vim.g.mapleader = '\\' + +--sets colorscheme. to get a list of avalible options, do colorscheme +vim.g.colors_name='default' + +--keyboard mappings + --toggle spell check + map('', 'ss', ':setlocal spell!', {noremap=true, silent=true}) + --easily create splits + map('', '|', ':vs', {noremap=true, silent=true}) + map('', '-', ':sp', {noremap=true, silent=true}) + --use ctrl+direction to move between splits. + map('', '', 'h', {noremap=true, silent=true}) + map('', '', 'j', {noremap=true, silent=true}) + map('', '', 'k', {noremap=true, silent=true}) + map('', '', 'l', {noremap=true, silent=true}) + --toggle folds with space. + map('', '', 'za', {noremap=true, silent=true}) + --clear highlighting with leader+l + map('', 'l', ':nohls', {noremap=true, silent=true}) diff --git a/neovim/.config/nvim/legacy.vimrc b/neovim/.config/nvim/legacy.vimrc deleted file mode 100644 index 2b6d55c..0000000 --- a/neovim/.config/nvim/legacy.vimrc +++ /dev/null @@ -1,61 +0,0 @@ -"Customized vim/neovim config -"Copyright 2018 Gabe Venberg - -"This program is free software: you can redistribute it and/or modify -"it under the terms of the GNU General Public License as published by -"the Free Software Foundation, either version 3 of the License, or -"(at your option) any later version. -" -"This program is distributed in the hope that it will be useful, -"but WITHOUT ANY WARRANTY; without even the implied warranty of -"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -"GNU General Public License for more details. -" -"You should have received a copy of the GNU General Public License -"along with this program. If not, see . - -filetype plugin on - -"useful keybinds - let mapleader = "\\" - "spell checking - "toggle spell checking - noremap ss :setlocal spell! - - "splitting panels with | or - - nnoremap \| :vs - nnoremap \- :sp - - " shortcuts using leader - " noremap sn ]s - " noremap sp [s - " noremap s? z= - - "navigating splits: Control+hjkl will move from split to split - nnoremap h - nnoremap j - nnoremap k - nnoremap l - - "command mode keybinds - "w!! writes using sudo - "cnoremap w!! w !sudo tee % >/dev/null - -"highlighting/colour stuff - "sets the colorscheme. to get a list of the available colors, do :colorscheme - colorscheme ron - - syntax enable - - " L clears the search highlighting - noremap l :nohls - -"neovim stuff -" if has('nvim') -" set guicursor= -" endif - -"folding stuff TODO: implement other folding methods. - - "spacebar opens or closes a fold in normal mode - noremap za