dot

packages and services management
Log | Files | Refs | README

commit 8433c72fa06fc50c2b1e2014f518175dfd55c85b
parent 3d9338e29cbcc34e753229422877e1462d52fcca
Author: sshbio <jd@ssh.bio>
Date:   Tue, 16 Aug 2016 16:26:49 +0200

Edited visrc

Diffstat:
Mvis/.config/vis/swiper.lua | 16++++++++++++++++
Mvis/.config/vis/visrc.lua | 54++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/vis/.config/vis/swiper.lua b/vis/.config/vis/swiper.lua @@ -6,4 +6,20 @@ -- \___/ \____/ \// ____/ \___\ \/ - Select a line with vis-menu --=================\/=========================================================== +require 'vis' +vis.events.win_open = function (win) + printf('%s\n', table.concat(file.lines, '\n')) +end + +function swiper () + print('test test test\n') + local p = io.popen( + 'expand ' + .. vis.win.file.name + .. ' | sed \'s/$/\r/\' | vis-menu -l 10', + 'r' + ) + p:read('*a') + p:close() +end diff --git a/vis/.config/vis/visrc.lua b/vis/.config/vis/visrc.lua @@ -11,6 +11,10 @@ require 'swiper' local leader = ' ' + +-- Runtime options and bindings +-------------------------------------------------------------------------------- + vis.events.win_open = function (win) -- Syntax highlighting for known file types @@ -35,4 +39,54 @@ vis.events.win_open = function (win) vis:command('map! normal "] " "<open-line-below><Escape>"') vis:command('map! normal "[e" "<vis-operator-delete><vis-operator-delete><cursor-line-up><put-before>"') vis:command('map! normal "]e" "<vis-operator-delete><vis-operator-delete><put-after>"') + + -- Plugins + vis:map(vis.MODE_NORMAL, leader .. 'c', swiper) +end + + +-- Status line +-------------------------------------------------------------------------------- + +vis.events.win_status = function(win) + local left, right = {}, {} + + if vis.modes[vis.mode] ~= '' and vis.win == win then + table.insert(left, vis.modes[vis.mode]) + end + + table.insert( + left, + (win.file.name or '[No Name]') + .. (win.file.modified and ' [+]' or '') + .. (vis.recording and ' @' or '') + ) + + if win.file.newlines ~= "nl" then + table.insert(right, 'NL') + end + + if #win.cursors > 1 then + table.insert(right, win.cursor.number .. '/' .. #win.cursors) + end + + table.insert( + right, + ( + win.file.size == 0 and "0" + or math.ceil(win.cursor.pos / win.file.size * 100) + ) .. '%' + ) + + if not win.large then + table.insert(right, win.cursor.line .. ':' .. win.cursor.col) + if win.file.size > 33554432 or win.cursor.col > 65536 then + win.large = true + end + end + + win:status( + ' ' .. table.concat(left, " - ") .. ' ', + ' ' .. table.concat(right, " - ") .. ' ' + ) end