Set up Neovim for Full Stack Development
You'll need:
- Coc
- emmet
If you're new to neovim:
Install vim-plug (or any other plugin manager)
https://github.com/junegunn/vim-plugI 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.
Top comments (9)
fwiw I wouldn't use
coc
anymore. Just use lsps. All the instructions for each lsp server are hereYou can also use github.com/VonHeikemen/lsp-zero.nvim if you're just getting started :)
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.
Amazing! I didn't know that. Thank you so much for sharing :) One more reason to love tmux
CocInstall ?
Whoops, quite the typo. Thanks for catching it! Just updated the post
i use built in lsp. And also use Fedora cutting edge Silver Blue. Coc is obsolete. Fedora is best dev OS.
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!
Do you know how to config LSP in your neovim (esp. for typescript/javascript and go)?
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 :)