plugin/formatter: add neoformat
This commit is contained in:
parent
c6d1be78e8
commit
354cef331a
3 changed files with 21 additions and 1 deletions
|
@ -10,9 +10,10 @@ let
|
||||||
./plugins/explorer
|
./plugins/explorer
|
||||||
./plugins/theme
|
./plugins/theme
|
||||||
./plugins/lsp
|
./plugins/lsp
|
||||||
|
./plugins/formatter
|
||||||
];
|
];
|
||||||
|
|
||||||
basicConfigs = [builtins.readFile ./config/basic.lua];
|
basicConfigs = map builtins.readFile [ ./config/basic.lua ];
|
||||||
pluginConfigs = lib.extractAttrs "luaConfig" plugins;
|
pluginConfigs = lib.extractAttrs "luaConfig" plugins;
|
||||||
allConfigs = basicConfigs ++ pluginConfigs;
|
allConfigs = basicConfigs ++ pluginConfigs;
|
||||||
in
|
in
|
||||||
|
|
9
plugins/formatter/default.nix
Normal file
9
plugins/formatter/default.nix
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{ vimPlugins, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
luaConfig = builtins.readFile ./neoformat.lua;
|
||||||
|
|
||||||
|
plugins = [
|
||||||
|
vimPlugins.neoformat
|
||||||
|
];
|
||||||
|
}
|
10
plugins/formatter/neoformat.lua
Normal file
10
plugins/formatter/neoformat.lua
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
vim.g.neoformat_try_node_exe = 1
|
||||||
|
vim.g.neoformat_only_msg_on_error = 1
|
||||||
|
vim.g.neoformat_enabled_markdown = { "denofmt" }
|
||||||
|
|
||||||
|
vim.cmd[[
|
||||||
|
aug fmt
|
||||||
|
au!
|
||||||
|
au BufWritePre * try | undojoin | Neoformat | catch /E790/ | Neoformat | endtry
|
||||||
|
aug END
|
||||||
|
]]
|
Reference in a new issue