- Install iTerm2 (Terminal emulator as alternative to Apple's Terminal app).
- Install ZSH (Zsh is a shell designed for interactive use).
- Install Oh-My-Zsh (Unleash your terminal like never before).
- Install Neovim (hyperextensible Vim-based text editor).
- Install StyLua (An opinionated code formatter for Lua).
- Getting started using Lua in Neovim.
- Setup Neovim for Node.js Developers with Lua.
Downloads are available on the Releases page.
- Latest stable release
- Latest development prerelease
To install the stable version of iTerm2, run the following:
$ brew install --cask iterm2
Try zsh --version
before installing it from Homebrew. Preferably newer than or equal to 5.0.8
.
$ brew install zsh
To set zsh as your default shell, execute the following assuming a default install of Homebrew
Recent macOS versions:
$ chsh -s /usr/local/bin/zsh
macOS High Sierra and older:
$ chsh -s /bin/zsh
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$ sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
$ sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
Downloads are available on the Releases page.
- Latest stable release
- Latest development prerelease
$ curl -LO https://github.com/neovim/neovim/releases/download/nightly/nvim-macos.tar.gz
$ tar xzf nvim-macos.tar.gz
$ ./nvim-osx64/bin/nvim
To install the stable version of Nvim, run the following:
$ brew install neovim
Or install the development version of Nvim:
$ brew install --HEAD neovim
To update the development version of Nvim:
$ brew reinstall neovim
Optional: To check what version of Nvim that you're running, run the following:
$ nvim -v
For details on installing Nvim, see the official wiki.
Optional: Alias v
, vi
, vim
to nvim
permanently:
- Go to home directory (
cd ~
). - Edit
.bashrc
or.zshrc
file. - Copy the following codes to alias vi editor alias to vim.
# alias <flag> <alias_name>='command' alias v='nvim' alias vi='nvim' alias vim='nvim'
- To load the changes, start a new terminal session or source the config file using the command.
$ source ~/.zshrc
- To test the above settings, execute βzshβ on your terminal.
Downloads are available on the Releases page.
To install the stable version of StyLua using cargo, run the following:
$ cargo install stylua
Neovim supports loading an init.lua
file for configuration instead of the usual init.vim
. For details, see :help config
Lua modules are found inside a lua/
folder in runtimepath
and can be imported using require()
.
$ tree .
.
βββ init.lua
βββ lua
βββ basic.lua
βββ plugins
βββ dashboard.lua
The following Lua code will load basic.lua
:
require("basic")
.lua
extension.
Similarly, loading plugins/dashboard.lua
is done like so:
require("plugins.dashboard")
-- or
require("plugins/dashboard")
Path separators are denoted by either a dot .
or a slash /
.
A folder containing init.lua
file can be required directly, without having to specify the name of the file.
require("other_modules") -- load other_modules/init.lua
Neovim exposes a global vim
variable which serves as an entry point to interact with its APIs from Lua. It provides an interface to Vimscript variables
and functions
, and editor commands and options
.
The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed from Lua conveniently and idiomatically by referencing the vim.*
Lua tables described below. In this way you can easily read and modify global Vimscript
variables from Lua.
Example:
vim.g.foo = 5 -- Set the g:foo Vimscript variable.
print(vim.g.foo) -- Get and print the g:foo Vimscript variable.
vim.g.foo = nil -- Delete (:unlet) the Vimscript variable.
vim.b[2].foo = 6 -- Set b:foo for buffer 2