visrc.lua (934B)
1 require('vis') 2 3 vis.events.subscribe(vis.events.INIT, function() 4 vis:command('set ignorecase') 5 end) 6 7 vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args 8 if win.syntax == 'html' then 9 local imap = function(i, o) win:map(vis.modes.INSERT, i, o) end 10 imap(';;', '<Escape>/\\+\\+<Enter>"_2s') 11 imap(';t', '<Escape>yT>i;;<Escape>Pi;;') 12 imap(';a', '<a href="">++</a>++<Escape>F"') 13 imap(';>', '><Escape>bybi<<Escape>f>a</<C-r>0>++<Escape>F<i') 14 win:map(vis.modes.NORMAL, ',a', ':0r ~/.local/share/snippets/article.html<Enter>i;;') 15 end 16 17 vis:command('set relativenumber') 18 vis:command('set autoindent') 19 vis:command('set showeof no') 20 vis:command('set breakat " !;:,.?"') 21 end) 22 23 vis.events.subscribe(vis.events.FILE_SAVE_PRE, function(file, _) 24 local lines = file.lines 25 for i=1, #lines do 26 local trimmed = lines[i]:match('^(.-)%s+$') 27 if trimmed then lines[i] = trimmed end 28 end 29 return true 30 end)