--load standard vis module, providing parts of the Lua API require('vis') require('plugins/vis-commentary') require('plugins/vis-complete-line') local smart_backspace = require('plugins/vis-smart-backspace') smart_backspace.tab_width = 2 require('plugins/vis-cursors') vis.events.subscribe(vis.events.INIT, function() --global configuration options vis:command('set theme zenburn_foot_variant') vis:command('set tabwidth 2') vis:command('set expandtab on') vis:command('langmap йцукенгшщзхъ qwertyuiop[]') vis:command('langmap фывапролдж asdfghjkl;') vis:command('langmap ячсмитьбю zxcvbnm,.') vis:command('langmap ЙЦУКЕНГШЩЗХЪ QWERTYUIOP{}') vis:command('langmap ФЫВАПРОЛДЖ ASDFGHJKL:') vis:command('langmap ЯЧСМИТЬБЮ ZXCVBNM<>') end) vis.events.subscribe(vis.events.WIN_OPEN, function() --per window configuration options vis:command('set colorcolumn 80') vis:command('set cursorline on') vis:command('set layout v') vis:command('set ignorecase yes') vis:command('set autoindent yes') end) vis:operator_new("gq", function(file, range) local status, out, err = vis:pipe(file, range, "fmt -w 80 -g 80") if not status then vis:info(err) else file:delete(range) file:insert(range.start, out) end return range.start -- new cursor location end, "Formating operator, filter range through fmt(1)") vis:operator_new("U", function(file, range) local out = string.upper(vis.win.file:content(range)) file:delete(range) file:insert(range.start, out) return range.start -- new cursor location end, "Convert selection to upper case") vis:operator_new("L", function(file, range) local out = string.lower(vis.win.file:content(range)) file:delete(range) file:insert(range.start, out) return range.start -- new cursor location end, "Convert selection to lower case")