Neovim: How to set up Neovim with Lua ver. 7

Last Updated on July 25, 2022 by shibatau

The red part is corrected.

I. What is Neovim and Lua?

It reads at How to Install and Set Up Neovim for Code Editing

Neovim is an extension of Vim that has the potential to offer many of the same conveniences you’d expect from most modern IDEs—all while retaining the classic Vim functionality that so many developers are used to. What’s more, the latest versions of Neovim include an embedded scripting language, Lua, which offers much more control and extensibility to the user.
With the powerhouse combo of Neovim and Lua, you can customize your own, personal IDE that’s configured to your exact specifications.

You can learn how to install plugins here:

Turning Neovim into a Full-Fledged Code Editor with Lua

II. What will you get?

I have set up Neovim following the tutorials mentioned above. I have completed almost all the settings now. I have Startify enabled and got a quote from cowsay at the top of the screen. Let me show you what I’ve gotten. First I’ll open Neovim from the terminal.

I have also installed nvim_tree and toggle it with , + n.

I have followed almost all the codes of the tutorials but I have changed the following three parts because they don’t work in my environment. The first one is the command to download Packer. Add a space before \ :

git clone --depth 1 https://github.com/wbthomason/packer.nvim \~/.config/nvim/site/pack/packer/start/packer.nvim

The second one is the following codes in the plug.lua file and I have replaced a pair of parentheses with curly brackets like this:

I also write keys.lua like this:

--[[ keys.lua ]]
local map = vim.api.nvim_set_keymap

-- remap the key used to leave insert mode
map('i', 'jk', '', {})
-- Toggle nvim-tree
map('n', '<Leader>n', [[:NvimTreeToggle]], {})
-- Toggle more plugins
map('n', '<Leader>l', [[:IndentLinesToggle]], {})
map('n', '<Leader>t', [[:TagbarToggle]], {})
map('n', '<Leader>ff', [[:Telescope find_files]], {})

III. Configure the built-in LSP

I have configured LSP following the tutorial:

Neovim for Beginners — LSP (Part 1)

IV. vim-grammarous

Neovim has a built-in spell checker (:h spell), dictionary (:h dictionary) and thesaurus (:h thesaurus). I have added vim-grammarous. You can learn how to install it from the post:

Grammar Check in Neovim with LanguageTool

These are the ways to install languagetool and vim-grammarous on Mac.

1.Run in the terminal.

brew install languagetool
export PATH="/usr/local/opt/openjdk/bin:$PATH"

2.Add the following lines in plug.lua in my structures of lua files.

  use {
      "rhysd/vim-grammarous"
  }

Usage

Run the command in Neovim

:GrammarousCheck

Vim-grammarous doesn’t check spelling. You have to run :set spell when you want to the spell checking.

To be continued.

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.