neovim: switched to treefmt
This commit is contained in:
parent
73fc3d09ba
commit
80f4fbcb61
|
@ -1,13 +1,16 @@
|
|||
{ sources ? import ./nix/sources.nix, system ? builtins.currentSystem
|
||||
, crossSystem ? null, config ? { }
|
||||
, alejandraUnstable ? (import sources.nixpkgsUnstable { }).alejandra
|
||||
, cardanoNodeProject ? import sources.cardano-node { } }@args:
|
||||
with import ./nix args; {
|
||||
shell = mkShell {
|
||||
inherit (import sources.niv { }) niv;
|
||||
buildInputs = [
|
||||
alejandraUnstable # The Uncompromising Nix Code Formatter
|
||||
cardanoNodeProject.cardano-cli # required for KES key rotation
|
||||
niv
|
||||
nixopsUnstable # work around for issue #127423
|
||||
treefmt # one CLI to format the code tree
|
||||
];
|
||||
NIX_PATH = "nixpkgs=${sources.nixpkgs}";
|
||||
NIXOPS_DEPLOYMENT = "${globals.deploymentName}";
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
start = [
|
||||
airline # Lean & mean status/tabline for vim that's light as air
|
||||
dracula-vim # Dracula theme for vim
|
||||
formatter-nvim # A format runner for neovim
|
||||
fugitive # Vim Git wrapper
|
||||
fzf-vim # Full path fuzzy file, buffer, mru, tag, finder for Vim
|
||||
haskell-vim # Syntax Highlighting and Indentation for Haskell
|
||||
indentLine # Display thin vertical lines at each indentation level
|
||||
neocomplete-vim # Keyword completion system
|
||||
neoformat # A (Neo)vim plugin for formatting code.
|
||||
nerdcommenter # Comment functions so powerful—no comment necessary
|
||||
nerdtree # File system explorer
|
||||
nerdtree-git-plugin # Plugin for nerdtree showing git status
|
||||
|
@ -23,7 +23,6 @@
|
|||
supertab # Allows you to use <Tab> for all your insert completion
|
||||
syntastic # Syntax checking hacks
|
||||
vim-addon-nix # Scripts assisting writing .nix files
|
||||
vim-autoformat # Automatically format code
|
||||
vim-cue # Cue filetype plugin for Vim
|
||||
vim-lastplace
|
||||
vim-markdown-toc # Generate table of contents for Markdown files
|
||||
|
@ -88,7 +87,11 @@
|
|||
autocmd FileAppendPre * :call TrimWhiteSpace()
|
||||
autocmd FilterWritePre * :call TrimWhiteSpace()
|
||||
autocmd BufWritePre * :call TrimWhiteSpace()
|
||||
"autocmd BufWrite * :Autoformat
|
||||
|
||||
augroup FormatAutogroup
|
||||
autocmd!
|
||||
autocmd BufWritePost * silent! FormatWrite
|
||||
augroup END
|
||||
|
||||
" FIXME: Currently always set to dark due to issues with Termonad Solarized theme
|
||||
" Light during the day, dark during the night
|
||||
|
@ -128,12 +131,6 @@
|
|||
autocmd BufWritePost,FileWritePost *.gpg u
|
||||
augroup END
|
||||
|
||||
" Use Neoformat to automatically format files
|
||||
augroup fmt
|
||||
autocmd!
|
||||
autocmd BufWritePre * undojoin | Neoformat
|
||||
augroup END
|
||||
|
||||
" Manage ISO files
|
||||
augroup iso
|
||||
au!
|
||||
|
@ -301,6 +298,33 @@
|
|||
set spell!
|
||||
endfunction
|
||||
autocmd BufNewFile,BufFilePre,BufRead *.sh :call BashSettings()
|
||||
|
||||
lua <<EOF
|
||||
local treefmt = {
|
||||
function()
|
||||
return {
|
||||
exe = "treefmt",
|
||||
args = {"--stdin", vim.fn.fnameescape(vim.api.nvim_buf_get_name(0))},
|
||||
stdin = true,
|
||||
}
|
||||
end
|
||||
}
|
||||
require("formatter").setup({
|
||||
filetype = {
|
||||
crystal = treefmt,
|
||||
cue = treefmt,
|
||||
go = treefmt,
|
||||
javascript = treefmt,
|
||||
lua = treefmt,
|
||||
mint = treefmt,
|
||||
nix = treefmt,
|
||||
rego = treefmt,
|
||||
ruby = treefmt,
|
||||
rust = treefmt,
|
||||
vim = treefmt,
|
||||
}
|
||||
})
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
|
3
treefmt.toml
Normal file
3
treefmt.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[formatter.nix]
|
||||
command = "alejandra"
|
||||
includes = ["*.nix"]
|
Loading…
Reference in a new issue