transported all of current config to lua.

On to learning the new features of neovim 0.5!
This commit is contained in:
Gabe Venberg 2021-09-12 00:29:48 -05:00
parent d8d5296ad2
commit 8123e70d74
2 changed files with 34 additions and 63 deletions

View file

@ -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 <Space> <C-d>
vim.g.colors_name='default'
--keyboard mappings
--toggle spell check
map('', '<leader>ss', ':setlocal spell!<CR>', {noremap=true, silent=true})
--easily create splits
map('', '<leader>|', ':vs<CR>', {noremap=true, silent=true})
map('', '<leader>-', ':sp<CR>', {noremap=true, silent=true})
--use ctrl+direction to move between splits.
map('', '<C-h>', '<C-w>h', {noremap=true, silent=true})
map('', '<C-j>', '<C-w>j', {noremap=true, silent=true})
map('', '<C-k>', '<C-w>k', {noremap=true, silent=true})
map('', '<C-l>', '<C-w>l', {noremap=true, silent=true})
--toggle folds with space.
map('', '<Space>', 'za', {noremap=true, silent=true})
--clear highlighting with leader+l
map('', '<leader>l', ':nohls<CR>', {noremap=true, silent=true})

View file

@ -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 <http://www.gnu.org/licenses/>.
filetype plugin on
"useful keybinds
let mapleader = "\\"
"spell checking
"toggle spell checking
noremap <leader>ss :setlocal spell!<CR>
"splitting panels with <leader>| or -
nnoremap <leader>\| :vs<Enter>
nnoremap <leader>\- :sp<Enter>
" shortcuts using leader
" noremap <leader>sn ]s
" noremap <leader>sp [s
" noremap <leader>s? z=
"navigating splits: Control+hjkl will move from split to split
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>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 <Space> <C-d>
colorscheme ron
syntax enable
"<leader> L clears the search highlighting
noremap <leader>l :nohls<CR>
"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 <Space> za