Creating init.lua Setup0:00
So far, we've covered the basics of using NeoVim, and we've configured our terminal and tmux. So now let's dive into configuring NeoVim to make it the perfect tool for working with PHP and JavaScript. Back in our terminal, I'm going to run everything in tmux from now on, and I'm going to use the keyboard shortcut I set up, Ctrl-Space-Shift-D, to automatically create a new session in my .files repo. Let's go ahead and create a directory for our NeoVim configurations, and inside here, let's create a file called init.lua. This serves as the entry point to your NeoVim configuration.
Testing the Configuration1:07
stuff. So, I'd highly recommend checking that one out. Alright, so let's go ahead and test out our configuration. So we'll add print, hello, laracasts, and let's save and quit that, and let's add it to our install script. Let's do some copy-pasting this time, so we'll use 4j to come down four lines, Shift-V and j to select these lines, and we'll yank those with y, and then we'll jump down to the bottom of the file with Shift-G, we'll press p to paste, and Shift-O to create a new line above. Now let's search for the text kitty, so using / and then kitty, and to change
Search and Replace Edits1:37
new line above. Now let's search for the text kitty, so using forward slash and then kitty, and to change the next occurrence of a search match, we can use cgn, so if we go cgn and then type in nvim and then go escape, we can then use the dot character to just repeat that on the next matches. Let's go ahead and save that, and run our install script, and then let's start up Vim, and we can see down the bottom it says hello laracasts, so we know our init.lua has been sourced. Let's jump back into our init.lua file, and let's talk about the ways we can configure NeoVim.
Requiring Modules in Lua4:01
and to test this out, let's add another print in here, and we'll just say options file. And then let's save and quit all together, and open up Vim again. So now we can see down the bottom it says options file, so we know that our module requiring has worked. In the next lesson, we'll talk about changing some of NeoVim's default settings.
