This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

nvim: add treefmt-nix integration to autoformat in devshells

+44 -4
+44 -4
tools/nvim.nix
··· 37 37 " need to use lua to expand $HOME 38 38 lua vim.o.undodir = vim.fs.normalize('$HOME/.vim/undodir') 39 39 ''; 40 + extraConfigLua = '' 41 + local null_ls = require("null-ls") 42 + local helpers = require("null-ls.helpers") 43 + 44 + local treefmt_nix = { 45 + method = null_ls.methods.FORMATTING, 46 + filetypes = {}, 47 + generator = helpers.formatter_factory({ 48 + command = "treefmt", 49 + args = { "--allow-missing-formatter", "--stdin", "$FILENAME" }, 50 + to_stdin = true, 51 + }), 52 + } 53 + 54 + null_ls.register(treefmt_nix) 55 + ''; 40 56 keymaps = [ 41 57 { 42 58 mode = "i"; ··· 130 146 action = "<Plug>(YankyPutBefore)"; 131 147 } 132 148 ]; 149 + # autoCmd = [ 150 + # { 151 + # event = "BufWritePost"; 152 + # desc = "run treefmt on save"; 153 + # # https://stackoverflow.com/questions/77466697/how-to-automatically-format-on-save 154 + # callback.__raw = '' 155 + # function() 156 + # vim.cmd("silent !treefmt %") 157 + # vim.cmd("edit") 158 + # end 159 + # ''; 160 + # } 161 + # ]; 162 + plugins.none-ls = { 163 + enable = true; 164 + # sources.formatting.treefmt = { 165 + # enable = true; 166 + # package = pkgs.emptyDirectory; 167 + # }; 168 + # package = pkgs.vimPlugins.none-ls-nvim.overrideAttrs (_old: { 169 + # src = pkgs.fetchFromGitHub { 170 + # owner = "lassulus"; 171 + # repo = "none-ls.nvim"; 172 + # rev = "292c2b5eadea0a097b9a01804aea70f5c8125200"; 173 + # sha256 = "sha256-nbzqXsxmYfxngdJH3NXMLmGgygh6reSEnruoc6l8t/s="; 174 + # }; 175 + # }); 176 + }; 133 177 plugins.web-devicons.enable = true; 134 178 plugins.telescope = { 135 179 enable = true; ··· 199 243 "<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; 200 244 }; 201 245 }; 202 - }; 203 - plugins.none-ls = { 204 - enable = true; 205 - sources.formatting.treefmt.enable = true; 206 246 }; 207 247 plugins.bufferline.enable = true; 208 248 plugins.which-key.enable = true;