Compare commits

..

1 Commits

Author SHA1 Message Date
482f80003c vis: remove lfs dependency 2025-09-30 21:04:34 +02:00

View File

@@ -194,7 +194,7 @@ end
local last_theme = 'default' local last_theme = 'default'
local function set_current_theme() function set_current_theme()
local path = os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf' local path = os.getenv('HOME') .. '/.config/xsettingsd/xsettingsd.conf'
local f = io.open(path) local f = io.open(path)
if f then if f then
@@ -241,39 +241,6 @@ local function close_next_win()
end end
end end
local function ensure_last_line_empty()
local size = vis.win.file.size
if size > 0 then
if vis.win.file:content(size - 1, size) ~= '\n' then
vis.win.file:insert(size, '\n')
end
local lines = vis.win.file.lines
if string.find(lines[#lines], '%S') then
lines[#lines + 1] = ''
end
end
end
local function add_note()
local path = vis.win.file.path
local line = path and path .. ':' .. vis.win.selection.line .. ':' .. vis.win.selection.col .. ': ' .. vis.win.file.lines[vis.win.selection.line]
vis:command('o ~/notes/notes.md')
ensure_last_line_empty()
local lines = vis.win.file.lines
lines[#lines + 1] = '## '
local pos = vis.win.file.size - 1
local code, date, err = vis:pipe("date '+%F %T'")
if code ~= 0 then
vis:message(err)
else
lines[#lines + 1] = '* time: ' .. date:gsub('%s+$', '')
end
if line then
lines[#lines + 1] = '* line: ' .. line
end
vis.win.selection.pos = pos
end
vis.events.subscribe(vis.events.INIT, function() vis.events.subscribe(vis.events.INIT, function()
vis:command('set autoindent') vis:command('set autoindent')
@@ -379,7 +346,9 @@ vis.events.subscribe(vis.events.INIT, function()
vis:command('o ~/.config/vis/global-marks.txt') vis:command('o ~/.config/vis/global-marks.txt')
end, 'global marks: edit') end, 'global marks: edit')
vis:map(vis.modes.NORMAL, ' n', add_note) vis:map(vis.modes.NORMAL, ' n', function()
vis:command('o ~/notes/notes.md')
end, 'add note')
vis:map(vis.modes.NORMAL, ' N', function() vis:map(vis.modes.NORMAL, ' N', function()
search(fzf_reload(ripgrep .. ' --with-filename {q} ~/notes')) search(fzf_reload(ripgrep .. ' --with-filename {q} ~/notes'))