neovim + TypeScript = ⚡️
This is a rave about neovim.
I've been using (neo)vim for nearly a decade now. Investing my time into learning how to operate it was the best decision I've made, as far as tech skills goes.
It gives me super speed when editing. It’s lightweight and distraction-free. It enables me to take full advantage of my "flow moments" by helping me work faster. It runs in Terminal, my native environment for everything; I don't have to choose between my editor or Terminal, or jankily embed a Terminal into my editor. It lightens the load on my wrists since I never have to use the mouse when editing or writing (which is a huge life-saver when working on laptops!)
My set-up #
- NERDTree for directory navigation
- coc.nvim + a language server to turn
neovim into an IDE.
- This gives me everything the language server offers: completion, goto definition, etc.
- For TypeScript, I'm using neoclide/coc-tsserver
- You can find my coc.nvim config here
- fzf.vim for fuzzy search (filename and contents), powered by ripgrep
You can find all of my neovim config here.
Here's what I can do! #
Auto-complete #
CTRL + N allows me to cycle through completions, with a small window
displaying type information and docstrings.
Navigate quickly #
I can open up a project tree with <leader>;
(NERDTree), do a filename fuzzy-search
using <leader>t (fzf.vim).
Fuzzy-search all files in project #
<leader>s
brings up a ripgrep window I can use
for fuzzy-searching text across the entire project.
Browse to type signatures #
SHIFT + K gives me a popup with the type signature and docstring. It's a
general function for displaying information about the current symbol. It can
use the LSP, or even man pages, so I can SHIFT + K almost anything to
bring up its documentation!
Browsing to the full type definition (.d.ts) is triggered by
gd hotkey,
which calls the jumpDefinition function of coc.nvim.
Auto-fix and format #
<leader>i sorts
and organize imports. It calls the LSP's (tsserver in this case)
organizeImport function via coc.nvim.
<leader>f
formats the file using the same method via a configured formatter on the LSP
(I'm using Prettier).
Like what you see? #
Give neovim a whirl! Once you get past the learning curve and start building muscle memory, you'll wonder why you didn't start using it earlier.
Feel free to contact me if you want some help on using neovim - I'm happy to chat about it!