-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from mgnsk/nvim-formatprg
Use async formatting
- Loading branch information
Showing
30 changed files
with
223 additions
and
152 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set filetype=json |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
let g:neomake_typescript_enabled_makers = ['eslint'] | ||
|
||
autocmd FileType typescript setlocal makeprg=eslint\ --format\ compact | ||
|
||
autocmd BufWritePre *.ts silent call fns#Format() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab | ||
autocmd BufWritePre *.yaml,*.yml silent call fns#Format() |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
require "format".setup { | ||
["*"] = { | ||
{ | ||
cmd = { | ||
-- remove trailing whitespace | ||
"sed -i 's/[ \t]*$//'" | ||
} | ||
} | ||
}, | ||
css = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
scss = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
glsl = { | ||
{ | ||
cmd = { | ||
"clang-format -i" | ||
} | ||
} | ||
}, | ||
go = { | ||
{ | ||
cmd = { | ||
"gofumports -w" | ||
} | ||
} | ||
}, | ||
html = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
json = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
javascript = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
typescript = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
lua = { | ||
{ | ||
cmd = { | ||
"luafmt -w replace" | ||
} | ||
} | ||
}, | ||
proto = { | ||
{ | ||
cmd = { | ||
"clang-format -i" | ||
} | ||
} | ||
}, | ||
rust = { | ||
{ | ||
cmd = { | ||
"rustfmt" | ||
} | ||
} | ||
}, | ||
sh = { | ||
{ | ||
cmd = { | ||
"shfmt -w" | ||
} | ||
} | ||
}, | ||
sql = { | ||
{ | ||
cmd = { | ||
function(file) | ||
return string.format("~/.tools/js/sql_format.mjs %s", file, file) | ||
end | ||
} | ||
} | ||
}, | ||
yaml = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
}, | ||
markdown = { | ||
{ | ||
cmd = { | ||
"prettier -w" | ||
} | ||
} | ||
} | ||
} | ||
|
||
vim.api.nvim_exec( | ||
[[ | ||
augroup FormatAutogroup | ||
autocmd! | ||
autocmd BufWritePost *.css,*.scss,*.vert,*.tesc,*.tese,*.geom,*.frag,*.comp,*.glsl,*go,*.html,*.json,*.js,*.mjs,*.md,*.ts,*.lua,*.proto,*.rs,*.sh,*.sql,*.yml,*.yaml call fns#Format() | ||
augroup END | ||
]], | ||
true | ||
) |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,4 @@ linters: | |
- depguard | ||
- gochecknoinits | ||
- gochecknoglobals | ||
|
||
- exhaustivestruct |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
} | ||
} |
Oops, something went wrong.