dotfiles

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

commit debb73d213dff5bcbf40ada0acbd31011372feb0
parent 1903739ca6a1fdeef78e0b5a8a230c7f4bc9c4f5
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Thu, 12 Dec 2019 05:42:39 -0500

Vis: Add file type-based indent settings

Diffstat:
M.config/vis/visrc.lua | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/.config/vis/visrc.lua b/.config/vis/visrc.lua @@ -4,10 +4,31 @@ require('vis') vis.events.subscribe(vis.events.INIT, function() -- Your global configuration options vis:command('set theme djmoch') + vis:command('set autoindent') end) vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- Your per window configuration options e.g. - vis:command('set syntax off') vis:command('set number') + set_indent(win.syntax) end) + +function set_indent(syntax) + if syntax == "powershell" then size_indent(4, true) + elseif syntax == "python" then size_indent(4, true) + elseif syntax == "rust" then size_indent(4, true) + elseif syntax == "java" then size_indent(2, true) + elseif syntax == "groovy" then size_indent(2, true) + else size_indent(8, false) + end +end + +function size_indent(tabwidth, expandtab) + vis:command('set tabwidth '..tabwidth) + if expandtab + then + vis:command('set expandtab') + else + vis:command('set expandtab off') + end +end