about summary refs log tree commit diff stats
path: root/html/nqueens.mu.html
Commit message (Collapse)AuthorAgeFilesLines
* 4008Kartik K. Agaram2017-09-251-64/+63
| | | | | Allow list `push` operation to save result in a new list rather than mutate the existing list.
* 4007Kartik K. Agaram2017-09-251-2/+2
|
* 4006Kartik K. Agaram2017-09-241-49/+48
|
* 4005Kartik K. Agaram2017-09-241-99/+103
| | | | https://www.reddit.com/r/ProgrammingLanguages/comments/727va7/a_comparison_of_lisps/dnh2q6u
* 3830 - crosslink shape-shifting containers in htmlKartik K. Agaram2017-04-181-5/+5
|
* 3764 - better colors for cross-linksKartik K. Agaram2017-03-081-3/+4
|
* 3761Kartik K. Agaram2017-03-071-43/+44
|
* 3725Kartik K. Agaram2016-12-271-16/+16
| | | | | | More improvements to cross-linking example programs. Include their own functions as well in the tags for each program, even as you share the core .mu files everywhere.
* 3716Kartik K. Agaram2016-12-261-0/+2
| | | | Make hyperlinks less salient in the rendered html since there's so many of them.
* 3713 - cross-link calls with definitions in htmlKartik K. Agaram2016-12-261-5/+5
|
* 3710Kartik K. Agaram2016-12-261-99/+99
| | | | | Turns out we don't need to explicitly add anchors for each line. Vim's TOhtml has magic for that out of the box.
* 3709 - line numbers in htmlKartik K. Agaram2016-12-261-102/+126
| | | | | | Each line number also gets an anchor name, but I'm not hyperlinking them for now because I don't want to encourage bookmarking these links just yet. They aren't permalinks because every revision may change what's at any given line number.
* 3681Kartik K. Agaram2016-11-221-3/+4
| | | | Couple of fixes to example programs.
* 3667Kartik K. Agaram2016-11-111-6/+6
|
* 3569Kartik K. Agaram2016-10-231-35/+35
| | | | Update syntax highlighting to not color numeric locations like literals.
* 3491Kartik K. Agaram2016-10-091-10/+10
| | | | | Update the html, proving that commit 3490 worked. The only changes are from other recent commits.
* 3431Kartik K. Agaram2016-09-301-2/+2
| | | | | Improvements to syntax highlighting, particularly for Mu code in C++ files.
* 3395Kartik K. Agaram2016-09-171-20/+27
|
* 2996Kartik K. Agaram2016-05-211-0/+128
{ color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""
This is the default key configuration file of ranger.
Syntax for binding keys: map(*keys, fnc)

keys are one or more key-combinations which are either:
* a string
* an integer which represents an ascii code
* a tuple of integers

fnc is a function which is called with the CommandArgument object.

The CommandArgument object has these attributes:
arg.fm: the file manager instance
arg.wdg: the widget or ui instance
arg.n: the number typed before the key combination (if allowed)
arg.keys: the string representation of the used key combination
arg.keybuffer: the keybuffer instance

Check ranger.keyapi for more information
"""

# NOTE: The "map" object used below is a callable CommandList
# object and NOT the builtin python map function!

from ranger.api.keys import *

def _vimlike_aliases(map):
	alias = map.alias

	# the key 'k' will always do the same as KEY_UP, etc.
	alias(KEY_UP, 'k')
	alias(KEY_DOWN, 'j')
	alias(KEY_LEFT, 'h')
	alias(KEY_RIGHT, 'l')

	alias(KEY_NPAGE, ctrl('f'))
	alias(KEY_PPAGE, ctrl('b'))
	alias(KEY_HOME, 'gg')
	alias(KEY_END, 'G')

def initialize_commands(map):
	"""Initialize the commands for the main user interface"""

	# -------------------------------------------------------- movement
	_vimlike_aliases(map)
	map.alias(KEY_LEFT, KEY_BACKSPACE, DEL)

	map(KEY_DOWN, fm.move_pointer(relative=1))
	map(KEY_UP, fm.move_pointer(relative=-1))
	map(KEY_RIGHT, KEY_ENTER, ctrl('j'), fm.move_right())
	map(KEY_LEFT, KEY_BACKSPACE, DEL, fm.move_left(1))
	map(KEY_HOME, fm.move_pointer(absolute=0))
	map(KEY_END, fm.move_pointer(absolute=-1))

	map(KEY_HOME, fm.move_pointer(absolute=0))
	map(KEY_END, fm.move_pointer(absolute=-1))

	map('%', fm.move_pointer_by_percentage(absolute=50))
	map(KEY_NPAGE, ctrl('f'), fm.move_pointer_by_pages(1))
	map(KEY_PPAGE, ctrl('b'), fm.move_pointer_by_pages(-1))
	map(ctrl('d'), 'J', fm.move_pointer_by_pages(0.5))
	map(ctrl('u'), 'K', fm.move_pointer_by_pages(-0.5))

	map(']', fm.traverse())
	map('[', fm.history_go(-1))

	# --------------------------------------------------------- history
	map('H', fm.history_go(-1))
	map('L', fm.history_go(1))

	# ----------------------------------------------- tagging / marking
	map('t', fm.tag_toggle())
	map('T', fm.tag_remove())

	map(' ', fm.mark(toggle=True))
	map('v', fm.mark(all=True, toggle=True))
	map('V', fm.mark(all=True, val=False))

	# ------------------------------------------ file system operations
	map('yy', fm.copy())
	map('dd', fm.cut())
	map('pp', fm.paste())
	map('po', fm.paste(overwrite=True))
	map('pl', fm.paste_symlink())
	map('p', hint='press //p// once again to confirm pasting' \
			', or //l// to create symlinks')

	# ---------------------------------------------------- run programs
	map('s', fm.execute_command(os.environ['SHELL']))
	map('E', fm.edit_file())
	map(',term', fm.execute_command('x-terminal-emulator', flags='d'))
	map('du', fm.execute_command('du --max-depth=1 -h | less'))

	# -------------------------------------------------- toggle options
	map('b', hint="show_//h//idden //p//review_files //d//irectories_first " \
		"//c//ollapse_preview flush//i//nput")
	map('bh', fm.toggle_boolean_option('show_hidden'))
	map('bp', fm.toggle_boolean_option('preview_files'))
	map('bP', fm.toggle_boolean_option('preview_directories'))
	map('bi', fm.toggle_boolean_option('flushinput'))
	map('bd', fm.toggle_boolean_option('directories_first'))
	map('bc', fm.toggle_boolean_option('collapse_preview'))

	# ------------------------------------------------------------ sort
	map('o', 'O', hint="//s//ize //b//ase//n//ame //m//time //t//ype //r//everse")
	sort_dict = {
		's': 'size',
		'b': 'basename',
		'n': 'basename',
		'm': 'mtime',
		't': 'type',
	}

	for key, val in sort_dict.items():
		for key, is_capital in ((key, False), (key.upper(), True)):
			# reverse if any of the two letters is capital
			map('o' + key, fm.sort(func=val, reverse=is_capital))
			map('O' + key, fm.sort(func=val, reverse=True))

	map('or', 'Or', 'oR', 'OR', lambda arg: \
			arg.fm.sort(reverse=not arg.fm.settings.reverse))

	# ----------------------------------------------- console shortcuts
	@map("A")
	def append_to_filename(arg):
		command = 'rename ' + arg.fm.env.cf.basename
		arg.fm.open_console(cmode.COMMAND, command)

	map('cw', fm.open_console(cmode.COMMAND, 'rename '))
	map('cd', fm.open_console(cmode.COMMAND, 'cd '))
	map('f', fm.open_console(cmode.COMMAND_QUICK, 'find '))
	map('tf', fm.open_console(cmode.COMMAND, 'filter '))
	map('d', hint='d//u// (disk usage) d//d// (cut)')

	# --------------------------------------------- jump to directories
	map('gh', fm.cd('~'))
	map('ge', fm.cd('/etc'))
	map('gu', fm.cd('/usr'))
	map('gd', fm.cd('/dev'))
	map('gl', fm.cd('/lib'))
	map('go', fm.cd('/opt'))
	map('gv', fm.cd('/var'))
	map('gr', 'g/', fm.cd('/'))
	map('gm', fm.cd('/media'))
	map('gn', fm.cd('/mnt'))
	map('gt', fm.cd('/tmp'))
	map('gs', fm.cd('/srv'))
	map('gR', fm.cd(RANGERDIR))

	# ------------------------------------------------------- searching
	map('/', fm.open_console(cmode.SEARCH))

	map('n', fm.search())
	map('N', fm.search(forward=False))

	map(TAB, fm.search(order='tag'))
	map('cc', fm.search(order='ctime'))
	map('cm', fm.search(order='mimetype'))
	map('cs', fm.search(order='size'))
	map('c', hint='//c//time //m//imetype //s//ize')

	# ------------------------------------------------------- bookmarks
	for key in ALLOWED_BOOKMARK_KEYS:
		map("`" + key, "'" + key, fm.enter_bookmark(key))
		map("m" + key, fm.set_bookmark(key))
		map("um" + key, fm.unset_bookmark(key))
	map("`", "'", "m", "um", draw_bookmarks=True)

	# ---------------------------------------------------- change views
	map('i', fm.display_file())
	map(ctrl('p'), fm.display_log())
	map('?', KEY_F1, fm.display_help())
	map('w', lambda arg: arg.fm.ui.open_taskview())

	# ------------------------------------------------ system functions
	_system_functions(map)
	map('ZZ', 'ZQ', fm.exit())
	map(ctrl('R'), fm.reset())
	map('R', fm.reload_cwd())
	map(ctrl('C'), fm.exit())

	map(':', ';', fm.open_console(cmode.COMMAND))
	map('>', fm.open_console(cmode.COMMAND_QUICK))
	map('!', fm.open_console(cmode.OPEN))
	map('r', fm.open_console(cmode.OPEN_QUICK))

	map.rebuild_paths()


def initialize_console_commands(map):
	"""Initialize the commands for the console widget only"""

	# -------------------------------------------------------- movement
	map(KEY_UP, wdg.history_move(-1))
	map(KEY_DOWN, wdg.history_move(1))

	map(ctrl('b'), KEY_LEFT, wdg.move(relative = -1))
	map(ctrl('f'), KEY_RIGHT, wdg.move(relative = 1))
	map(ctrl('a'), KEY_HOME, wdg.move(absolute = 0))
	map(ctrl('e'), KEY_END, wdg.move(absolute = -1))

	# ----------------------------------------- deleting / pasting text
	map(ctrl('d'), KEY_DC, wdg.delete(0))
	map(ctrl('h'), KEY_BACKSPACE, DEL, wdg.delete(-1))
	map(ctrl('w'), wdg.delete_word())
	map(ctrl('k'), wdg.delete_rest(1))
	map(ctrl('u'), wdg.delete_rest(-1))
	map(ctrl('y'), wdg.paste())

	# ----------------------------------------------------- typing keys
	def type_key(arg):
		arg.wdg.type_key(arg.keys)

	for i in range(ord(' '), ord('~')+1):
		map(i, type_key)

	# ------------------------------------------------ system functions
	_system_functions(map)

	map(KEY_F1, lambda arg: arg.fm.display_command_help(arg.wdg))
	map(ctrl('c'), ESC, wdg.close())
	map(ctrl('j'), KEY_ENTER, wdg.execute())
	map(TAB, wdg.tab())
	map(KEY_BTAB, wdg.tab(-1))

	map.rebuild_paths()


def initialize_taskview_commands(map):
	"""Initialize the commands for the TaskView widget"""
	_basic_movement(map)
	_vimlike_aliases(map)
	_system_functions(map)

	# -------------------------------------------------- (re)move tasks
	map('K', wdg.task_move(0))
	map('J', wdg.task_move(-1))
	map('dd', wdg.task_remove())

	# ------------------------------------------------ system functions
	map('?', fm.display_help())
	map('w', 'q', ESC, ctrl('d'), ctrl('c'),
			lambda arg: arg.fm.ui.close_taskview())

	map.rebuild_paths()


def initialize_pager_commands(map):
	_base_pager_commands(map)
	map('q', 'i', ESC, KEY_F1, lambda arg: arg.fm.ui.close_pager())
	map.rebuild_paths()


def initialize_embedded_pager_commands(map):
	_base_pager_commands(map)
	map('q', 'i', ESC, lambda arg: arg.fm.ui.close_embedded_pager())
	map.rebuild_paths()

def _base_pager_commands(map):
	_basic_movement(map)
	_vimlike_aliases(map)
	_system_functions(map)

	# -------------------------------------------------------- movement
	map(KEY_LEFT, wdg.move_horizontal(relative=-4))
	map(KEY_RIGHT, wdg.move_horizontal(relative=4))
	map(KEY_NPAGE, ctrl('f'), wdg.move(relative=1, pages=True))
	map(KEY_PPAGE, ctrl('b'), wdg.move(relative=-1, pages=True))
	map(ctrl('d'), wdg.move(relative=0.5, pages=True))
	map(ctrl('u'), wdg.move(relative=-0.5, pages=True))
	map(' ', wdg.move(relative=0.8, pages=True))

	# ---------------------------------------------------------- others
	map('E', fm.edit_file())
	map('?', fm.display_help())

	# --------------------------------------------- less-like shortcuts
	map.alias(KEY_NPAGE, 'f')
	map.alias(KEY_PPAGE, 'b')
	map.alias(ctrl('d'), 'd')
	map.alias(ctrl('u'), 'u')


def _system_functions(map):
	# Each commandlist should have this bindings
	map(KEY_RESIZE, fm.resize())
	map(KEY_MOUSE, fm.handle_mouse())
	map('Q', fm.exit())
	map(ctrl('L'), fm.redraw_window())


def _basic_movement(map):
	map(KEY_DOWN, wdg.move(relative=1))
	map(KEY_UP, wdg.move(relative=-1))
	map(KEY_HOME, wdg.move(absolute=0))
	map(KEY_END, wdg.move(absolute=-1))