dotfiles

Obligatory dotfiles repo
git clone git://git.danielmoch.com/dotfiles.git
Log | Files | Refs

visrc.lua (974B)


      1 -- load standard vis module, providing parts of the Lua API
      2 require('vis')
      3 
      4 vis.events.subscribe(vis.events.INIT, function()
      5 	-- Your global configuration options
      6 	vis:command('set theme djmoch')
      7 	vis:command('set autoindent')
      8 end)
      9 
     10 vis.events.subscribe(vis.events.WIN_OPEN, function(win)
     11 	-- Your per window configuration options e.g.
     12 	if win.file.name ~= nil and win.file.name:match('.psm1$')
     13 	then
     14 		win.syntax = 'powershell'
     15 	end
     16 	set_indent(win.syntax)
     17 end)
     18 
     19 function set_indent(syntax)
     20 	if syntax == "powershell" then size_indent(4, true)
     21 	elseif syntax == "python" then size_indent(4, true)
     22 	elseif syntax == "rust" then size_indent(4, true)
     23 	elseif syntax == "java" then size_indent(2, true)
     24 	elseif syntax == "groovy" then size_indent(2, true)
     25 	else size_indent(8, false)
     26 	end
     27 end
     28 
     29 function size_indent(tabwidth, expandtab)
     30 	vis:command('set tabwidth '..tabwidth)
     31 	if expandtab
     32 	then
     33 		vis:command('set expandtab')
     34 	else
     35 		vis:command('set expandtab off')
     36 	end
     37 end