mitchellhanberg.com

Modern Format on Save in Neovim (opens in new tab)

From Mitchell Hanberg's Blog: Formatting on save is a popular workflow and is builtin to many text editors and IDEs. In Neovim, you must create this manually, but it is very easy using `autocmds`. 1. We create a new `autocmd` that fires on the `LspAttach` event. This event is fired when an LSP client attaches to a buffer. In this `autocmd`, you can easily set configuration that is specific to that buffer and LSP client. 2. We create another `autcmd` inside the `LspAttach` callback, this time ...

Read the original article
Sign in to keep reading the full article.

Keyboard Shortcuts

Navigation

Next / previous post
j/k
Open post
oorEnter
Preview post
v

Post Actions

Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s

Recommendations

Add interest / feed
Enter
Not interested
x

Go to

Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Discover
gb
Search
/

General

Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help