dot

NixOS dotfiles
git clone https://git.echoz.io/dot.git
Log | Files | Refs

listchars.nix (937B)


      1 {
      2   programs.neovim.customPlugins.listchars = {
      3     "plugin/listchars.lua" = # lua
      4       ''
      5         vim.opt.list = true
      6         vim.opt.listchars = {
      7           trail = '~',
      8           tab = '|  ',
      9           leadmultispace = ':' .. string.rep(' ', vim.opt.shiftwidth:get() - 1),
     10         }
     11 
     12         local function update()
     13           local listchars = vim.opt_local.listchars:get()
     14           listchars.leadmultispace = ':' .. string.rep(' ', vim.opt_local.shiftwidth:get() - 1)
     15           vim.opt_local.listchars = listchars
     16         end
     17 
     18         local group = vim.api.nvim_create_augroup('ListcharsLeadmultispaceWidth', { clear = true }),
     19 
     20         vim.api.nvim_create_autocmd('OptionSet', {
     21           group = group,
     22           pattern = 'shiftwidth',
     23           callback = update,
     24         })
     25 
     26         vim.api.nvim_create_autocmd({ 'FileType', 'BufWinEnter' }, {
     27           group = group,
     28           callback = update,
     29         })
     30       '';
     31   };
     32 }