nvim: @nerdypepper fixes shitty lua; news at 9
Anirudh Oppiliappan x@icyphox.sh
Sat, 06 Feb 2021 15:05:45 +0530
2 files changed,
18 insertions(+),
9 deletions(-)
M
config/nvim/lua/fzy/jump.lua
→
config/nvim/lua/fzy/jump.lua
@@ -2,20 +2,29 @@ local fn = vim.fn
local cmd = vim.cmd local M = {} +local function get_line_nr(s) + for c in s:gmatch('%d+%s') do + c = string.gsub(c, '%s', '') + return tonumber(c) + end +end + -local function build_index() +local function annotated_input() local lines = {} -- index each line in the current buffer -- for jumping to - for line = 1, fn.line('$') do - lines[fn.getline(line)] = line + -- + for nr = 1, fn.line('$') do + table.insert(lines, fn.getline(nr)) end + local outfile = fn.tempname() local f = io.open(outfile, 'a') - for l, _ in pairs(lines) do - f:write(l, '\n') + for n, l in pairs(lines) do + f:write(n .. '\t' .. l, '\n') end f:close()@@ -24,7 +33,7 @@ end
function M.fzy_jmp() local outfile = fn.tempname() - local idxfile, lines = build_index() + local idxfile, lines = annotated_input() shell_cmd = { '/bin/sh', '-c',@@ -46,10 +55,10 @@ local f = io.open(outfile, 'r')
line_choice = f:read('*all') -- strip '\n' - line_choice, _ = string.gsub(line_choice, '\n', '') + selected, _ = string.gsub(line_choice, '\n', '') -- jump to line - cmd(':' .. lines[line_choice]) + cmd(':' .. get_line_nr(selected)) -- housekeeping f:close()
M
weechat/sec.conf
→
weechat/sec.conf
@@ -17,4 +17,4 @@ salt = on
[data] __passphrase__ = on -znc = "7C4136A4FD2B04F35BFE92C08AB35CD0A4BDBABF9DB49B38CF30638F66D0E5A099EA09BF03A4072408D6CFC56CA5C32D629955" +znc = "361E6D0328E1D064BF7D0CEB5B3AF758BC33D3E945CA9660CDE16779EBA968A6CD472344C40EA2814B092F7D99476602A422CD"