Last active
October 5, 2021 16:26
-
-
Save rogeruiz/7df38114eae00ccd4e4f06b5646686d9 to your computer and use it in GitHub Desktop.
Making NeoVim ready for a JSX/TSX workflow.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nvim/bundles.vim b/nvim/bundles.vim | |
index fa91ed5..c20c7e2 100644 | |
--- a/nvim/bundles.vim | |
+++ b/nvim/bundles.vim | |
@@ -80,7 +80,11 @@ | |
Plug 'othree/javascript-libraries-syntax.vim' | |
Plug 'moll/vim-node' | |
Plug 'marijnh/tern_for_vim' | |
- Plug 'mxw/vim-jsx' | |
+ Plug 'maxmellon/vim-jsx-pretty' | |
+ " TypeScript { | |
+ Plug 'leafgarland/typescript-vim' | |
+ Plug 'peitalin/vim-jsx-typescript' | |
+ " } | |
" } | |
" Templating { | |
Plug 'mustache/vim-mustache-handlebars' | |
@@ -97,6 +101,7 @@ | |
" Cascading Style Sheets { | |
Plug 'hail2u/vim-css3-syntax' | |
Plug 'cakebaker/scss-syntax.vim' | |
+ Plug 'styled-components/vim-styled-components', { 'branch': 'main' } | |
" } | |
Plug 'ekalinin/Dockerfile.vim' | |
Plug 'andrewstuart/vim-kubernetes' | |
diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json | |
index 997d2ae..122a78d 100644 | |
--- a/nvim/coc-settings.json | |
+++ b/nvim/coc-settings.json | |
@@ -1,6 +1,9 @@ | |
{ | |
"codeLens.enable": true, | |
"coc.source.emoji.filetypes": ["markdown", "gitcommit"], | |
+ "coc.preferences.messageLevel": "error", | |
+ "eslint.autoFixOnSave": true, | |
+ "eslint.fileTypes": ["javascript", "javascriptreact", "typescript", "typescriptreact"], | |
"diagnostic.hintSign": "\uf684", | |
"diagnostic.errorSign": "\uf686", | |
"diagnostic.warningSign": "\uf67d", | |
@@ -14,6 +17,7 @@ | |
"git.changeRemovedSign.text": "\uf459", | |
"git.addedSign.text": "\uf457", | |
"git.removedSign.text": "\uf458", | |
+ "prettier.disableSuccessMessage": true, | |
// README: https://github.com/neoclide/coc.nvim/wiki/Language-servers | |
"languageserver": { | |
"elixirLS": { | |
diff --git a/nvim/init.vim b/nvim/init.vim | |
index c2359f2..26357d5 100644 | |
--- a/nvim/init.vim | |
+++ b/nvim/init.vim | |
@@ -144,6 +144,7 @@ | |
\ 'coc-elixir', | |
\ 'coc-ember', | |
\ 'coc-emmet', | |
+ \ 'coc-eslint', | |
\ 'coc-git', | |
\ 'coc-go', | |
\ 'coc-highlight', | |
@@ -153,12 +154,14 @@ | |
\ 'coc-htmlhint', | |
\ 'coc-json', | |
\ 'coc-lua', | |
+ \ 'coc-prettier', | |
\ 'coc-pyright', | |
\ 'coc-rust-analyzer', | |
\ 'coc-sh', | |
\ 'coc-sql', | |
\ 'coc-swagger', | |
\ 'coc-toml', | |
+ \ 'coc-tsserver', | |
\ 'coc-yaml' | |
\ ] | |
@@ -318,6 +321,13 @@ | |
" } | |
+" JavaScript / TypeScript Preferences { | |
+ | |
+ autocmd BufEnter *.{js,jsx,ts,tsx} :syntax sync fromstart | |
+ autocmd BufLeave *.{js,jsx,ts,tsx} :syntax sync clear | |
+ | |
+" } | |
+ | |
" Elixir { | |
let g:mix_format_on_save = 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Borrowed heavily from this blog post: https://thoughtbot.com/blog/modern-typescript-and-react-development-in-vim