Skip to content

Instantly share code, notes, and snippets.

@mooffie
mooffie / custom_f5.lua
Created June 12, 2018 14:59
mc^2: make <F5> launch your own copy command
--
-- This snippet makes the F5 key launch the external 'cp' command.
--
-- It only does this if the string "mozambique" is somewhere in the
-- folder's path. For all other folders, the builtin F5 will kick in.
--
-- *** See also the 'trash' snippet for a more robust code (it does
-- something similar for F8). ***
--
@mooffie
mooffie / fop_liveupdate.lua
Created October 21, 2016 14:08
mc^2: live-update for copy/move operations.
--[[
Live-update for copy/move operations.
This snippet updates the panel while a copy/move operation takes place.
This way you see the files unmarked as the operation proceeds.
]]
--
@mooffie
mooffie / better-mtime.lua
Last active September 19, 2016 02:06
mc^2: redefine the mtime field to show current year only.
--[[
This snippet re-defines the 'mtime' field so that dates occuring in the
current calendar year are displayed differently than older dates.
see:
https://mail.gnome.org/archives/mc/2016-September/msg00015.html
]]
@mooffie
mooffie / find_file_toggle_content.lua
Created September 5, 2016 16:24
mc^2: inject a "Toggle content" button to the Find File dialog.
--[[
This snippet adds a "Toggle content" button to the Find File dialog. This
restores the old behavior of that dialog (which had a similar checkbox
before).
This was requested by a user in:
http://www.midnight-commander.org/ticket/3680
@mooffie
mooffie / trash.lua
Created August 25, 2016 14:10
mc^2: make the <F8> key delete files using the 'trash' command.
--[[
Makes the <F8> key delete files using the 'trash' command.
You can circumvent this by pressing shift-<F8>.
]]
--
-- The command to run. You may need to modify this on your system.
--[[
This script translates, to our 'htmlize' format (same as GNOME Terminal's
configuration string), some of Wikipedia's palettes appearing in:
https://en.wikipedia.org/wiki/ANSI_escape_code
]]
local append = table.insert

How to generate hyperlinked HTML pages for C source code

Step 0: install 'global'

You can do this either by using your package manager, or by compiling from source. Caveat: Ubuntu/Debian carries an old version; see the appendix if you have to use this version.

@mooffie
mooffie / htagsfix
Created December 1, 2015 10:26
Permanent URLs for htags
#!/usr/bin/ruby
#
# Fixes htags' output so that files have fixed names. E.g., S/542.html -> D/whatever.c.h.
#
# It addresses the following problem:
#
# "Can htags create permanent addresses?"
# http://lists.gnu.org/archive/html/help-global/2015-11/msg00002.html
#
@mooffie
mooffie / menu_edit.lua
Last active August 29, 2015 14:24
Alternative "Menu edit" dialogs for MC.
--[[
This snippet demonstrated 2 possibilities for an alternative "Menu edit"
dialog which uses radio buttons instead of buttons.
]]
-- Where the three menu files are stored.
local paths = {
lcl = './.mc.menu',