تماشای این درس نیاز به اشتراک حرفه‌ای دارد.

Need Better Terminal UX0:35

But by default, pressing escape won't get us back to normal mode, because escape is commonly used in terminal applications. Instead, we need to press ctrl-backslash-ctrl-n to get back to normal mode. Now I love that NeoVim has a built-in terminal, but its default behavior doesn't fit with my mental model. I just want a quick, scratch terminal that I can run ad-hoc commands in, almost like the console from Quake, if you've ever played that. So let's install a plugin called FloatTerm. I'm going to come back into insert mode here and run ctrl-d to exit that terminal session, and let's jump into our plugins.lua file and come down to the bottom again, and

Install FloatTerm Plugin1:03

I'm going to come back into insert mode here and run ctrl-d to exit that terminal session, and let's jump into our plugins.lua file and come down to the bottom again, and back up to under the last plugin we added. And then we'll paste in our floating terminal plugin here, and run our good old pack-a-sink to install it. And there we go. So this one is called Float Term, and we can run it by saying float-term-toggle, and this opens up our little floating terminal window in the middle of our screen. Now by default, this puts us straight into insert mode, so we can start typing in it straight away.

Add FloatTerm Keymaps1:36

Now by default, this puts us straight into insert mode, so we can start typing in it straight away. But getting out of the floating terminal is still a little bit tricky. We still need to do that ctrl-backslash-ctrl-n, and then we can say colon-q to quit that window. So let's go ahead and add some configuration for this one. So we'll say config is a function, and inside here I'm going to paste in some keymaps. So in this case I've got a keymap for normal mode, and I've set it to the F1 key. You can of course set this to anything you like, and this we'll call the float-term-toggle command. I also have another keymap for terminal mode, specified with the T here, also for F1.

Configure Split Terminal Layout3:10

Maybe you want it to pop up from the bottom of the screen, kind of like in VS Code and editors like that. Well we can also do that. We can say vim.g.FloatTermWinType equals split. So we'll save that one, and we'll run packer compile, and we're going to close the floating terminal. And now when we open it, we get a floating terminal at the bottom of our screen. Now the width in this case doesn't really play a factor, so let's comment that one out, and we'll set the height to something like 0.4, or 40% of the screen. So let's run that again, we'll quit that terminal, and now we get a terminal that sits at the

Built-in TerminalFloaterm

دوست دارید گاهی خبرهای Laracasts را ایمیل کنیم؟