Nvim lua stuff

Load a file

  • Suppose file is ~/.config/nvim/lua/core/chad.lua
  • Note that lua dir in your nvim config is already in the runtime!
  1. require 'core.chad'
  • If you rename that chad.lua to init.lua
  1. require 'core'

options

vimscript:

  1. set mouse = a

lua:

  1. vim.opt.mouse = "a"

autocmds / augroups

  1. vim.cmd "augroup stuff"
  2. -- multiline :
  3. vim.cmd([[
  4. stuff
  5. stuff
  6. ]])

globals

vimscript:

  1. let g:autosave = true

lua:

  1. vim.g.autosave = true
  • multiline global stuff

vimscript:

  1. let g:nvim_tree_show_icons = {
  2. \ 'git': 1,
  3. \ 'folders': 0,
  4. \ }

lua:

  1. vim.g.nvim_tree_show_icons = {
  2. git = 1,
  3. folders = 0,
  4. }

check nvim-lua guide for better explanation and more info!