DEV Community

bashbunni
bashbunni

Posted on • Updated on

How to Set up Neovim for Full Stack Development

Set up Neovim for Full Stack Development

You'll need:

  • Coc
  • emmet

If you're new to neovim:

  1. install neovim

  2. Install vim-plug (or any other plugin manager)
    https://github.com/junegunn/vim-plug

  3. I recommend checking out my dotfiles which has lots of comments so you can find any extra features that might be helpful for you.

I will write another post for a more in-depth description of getting started with neovim...

Install Coc

To install Coc, you'll want to follow their instructions at the link below. It is
https://github.com/neoclide/coc.nvim

Configuring Coc

With neovim open, type the following:
:CocInstall coc-html coc-tsserver coc-json coc-emmet coc-prettier

Coc tsserver is for javascript, typescript, and JSX support

You'll want to create a shortcut for :call CocAction('format'). I have the following shortcut so that I can format my projects with space + f:
nnoremap <leader>f :call CocAction('format')<CR>

Install Node and Npm

head over to the Node.js downloads page and follow their installation instructions. You can also use your package manager to install Node.

Debian and Ubuntu

sudo apt install nodejs

Arch Linux

sudo pacman -S nodejs

Other Recommendations

I highly recommend installing tmux so you can run your frontend, backend, neovim, and git cli in the same terminal window which makes it way easier to keep your workspace clear. Tmux is great because you can name your sessions and easily navigate to the right spot for what you're looking to do.
e.g.
tmux demo

Top comments (9)

Collapse
 
bashbunni profile image
bashbunni

fwiw I wouldn't use coc anymore. Just use lsps. All the instructions for each lsp server are here

You can also use github.com/VonHeikemen/lsp-zero.nvim if you're just getting started :)

Collapse
 
waylonwalker profile image
Waylon Walker

Hey @bashbunni 👋.

Another great benefit of tmux right away is that it runs its own server in a separate process not tied to the parent shell. So if you kill your terminal your good or if your disconnected over ssh your good. Just this week I had an nvidia issue and had to restart my display manager, killed all my gui apps, but not tmux.

Collapse
 
bashbunni profile image
bashbunni

Amazing! I didn't know that. Thank you so much for sharing :) One more reason to love tmux

Collapse
 
boydkelly profile image
Boyd Kelly

i use built in lsp. And also use Fedora cutting edge Silver Blue. Coc is obsolete. Fedora is best dev OS.

Collapse
 
bashbunni profile image
bashbunni

Nice! I haven't configured native LSP yet, but it's the next step on my list. Changing my config to lua instead of vimscript will follow after that. I personally found that Coc was very easy to adjust to as a beginner which is why I included it in this case, but will definitely be doing a post on how to set up native LSP once I get there :) Thanks for sharing!

Collapse
 
hinogi profile image
Stefan Schneider

CocInstall ?

Collapse
 
bashbunni profile image
bashbunni

Whoops, quite the typo. Thanks for catching it! Just updated the post

Collapse
 
ayrbox profile image
ayrbox

Do you know how to config LSP in your neovim (esp. for typescript/javascript and go)?

Collapse
 
bashbunni profile image
bashbunni

I haven't set up native LSP for neovim yet! I figured Coc might be a bit easier for beginners (it was for me). That's definitely my next step though :)