Skip to content
Matěj Cepl edited this page Jan 11, 2025 · 20 revisions

How can I use fennel to configure vis?

See the vis cookbook on the fennel wiki.

See the presentation Configuring Vis with Fennel from FennelConf 2021.

How can I spellcheck the current file?

A solution without using any plugins could be something in the style of :!aspell -t -c $vis_filepath (modify aspell(1) options to work with the spellchecker of your choice). More polished solution is to use vis-spellcheck vis plugin.

How do I open the current file in a repl?

Lua:

:!lua -i $vis_filename

Python:

:!python -i $vis_filename

Guile Scheme:

:!guile -l $vis_filename

Javascript:

!node -i -e "$(< $vis_filename)"

How do I wrap lines to 80 characters wide?

Using command mode, pipe selected text into fold or wrap:

:|fold -w 80 -s

:|wrap -w 80

There is vis-par plugin, but it is in a very rudimentary state yet (although, it is already quite useful for day-to-day use).

Integrate with external window manager

From the README:

There exist plans to use a client/server architecture, delegating window management to your windowing system or favorite terminal multiplexer.

See also issue #130.

That said, there are some workarounds:

vis:command_register('xsp', function(argv)
	local file = vis.win.file
	local path = argv[1] or file.path
	if not os.getenv("DISPLAY") then
		vis:info("Error: $DISPLAY doesn't exist")
		return
	end
	local cmd = string.format('st -e vis "%s" &', path)
	os.execute(cmd)
end, "Open file in a new X11 window")
vis:command_register('tsp', function(argv)
	local file = vis.win.file
	local path = argv[1] or file.path
	local fifo = os.getenv("DVTM_CMD_FIFO")
	if not fifo then
		vis:info("Error: $DVTM_CMD_FIFO doesn't exist")
		return
	end
	local cmd = string.format([[echo 'create "vis %s"' >> %s]],
		path:gsub(" ", "\\ "), fifo)
	os.execute(cmd)
end, "Open file in a new dvtm(1) window")