From VimScript into Lua
This is my cheat sheet for migrating VimScript into Lua. Things I often forget. There are places to learn about Lua use in Neovim . But, for some reason, I could not find side-by-side examples of VimScript vs Lua for quick migration. So I decided to start my own.
| VimScript | Lua | 
|---|---|
| :nmap abc :something | vim.keymap.add({'n'}, 'abc', ':something),noremapwill be with more in the first{} | 
| let g:session_autosave = 'yes' | vim.g.session_autosave = 'yes' | 
| autocmd BufWrite *py :call DeleteTrailingWs() | vim.api.nvim_create_autocmd({'BufWrite'}, {pattern={'*.py'}, command = ":call DeleteTrailingWs()"}) | 
| let splitbelow = 1 | vim.opt.splitbelow = true | 
| (any vimscript commands) | vim.api.nvim_exec2([[ (any vimscript commands) ]]) | 
| " comment | -- comment(oh, well) | 
Replacing tabs with spaces
I keep forgetting this: how to set tabstop at 4, and use spaces not tabs to space.
:set tabstop=4 shiftwidth=4 expandtab
:retab